chart2/qa/extras/chart2import.cxx                     |    8 ++---
 chart2/qa/extras/xshape/data/reference/tdf90839-2.xml |   12 +++-----
 chart2/qa/extras/xshape/data/reference/tdf90839-3.xml |    6 +---
 chart2/qa/extras/xshape/data/reference/tdf90839-4.xml |   10 +++----
 chart2/source/view/charttypes/PieChart.cxx            |   25 +++++++-----------
 sw/qa/extras/layout/data/outside_long_data_label.docx |binary
 sw/qa/extras/layout/layout2.cxx                       |   18 ++++++++++++
 7 files changed, 44 insertions(+), 35 deletions(-)

New commits:
commit b0068342398786ca50304260434a18880dddf74d
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Fri Dec 11 09:13:46 2020 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Dec 16 18:26:26 2020 +0100

    tdf#138777 pie chart: improve long data label width
    
    to avoid chart distortion.
    
    Reduce the maximum text width of data point label shape based,
    because in some cases the long data label flowed out of the chart.
    
    Change-Id: I045c81ecc6ce579e1f472d7ea67e04315ce9c60b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107585
    Tested-by: Jenkins
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index e4742405d967..9bb042fb6867 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -2581,8 +2581,8 @@ void Chart2ImportTest::testTdf133376()
     CPPUNIT_ASSERT(xDataPointLabel.is());
     // Check the position of the 3rd data point label, which is out from the 
pie slice
     awt::Point aLabelPosition = xDataPointLabel->getPosition();
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(458, aLabelPosition.X, 30);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(5114, aLabelPosition.Y, 30);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1082, aLabelPosition.X, 30);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(5462, aLabelPosition.Y, 30);
 }
 
 void Chart2ImportTest::testTdf134225()
@@ -2652,8 +2652,8 @@ void Chart2ImportTest::testTdf136105()
         CPPUNIT_ASSERT(xDataPointLabel.is());
         // Check the position of the 1st data point label, which is out from 
the pie slice
         awt::Point aLabelPosition = xDataPointLabel->getPosition();
-        CPPUNIT_ASSERT_DOUBLES_EQUAL(8610, aLabelPosition.X, 500);
-        CPPUNIT_ASSERT_DOUBLES_EQUAL(1684, aLabelPosition.Y, 500);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(7978, aLabelPosition.X, 500);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(1048, aLabelPosition.Y, 500);
     }
 }
 
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml 
b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
index c8afb487a4ae..d7e5c4a364f9 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
@@ -206,7 +206,7 @@
            </XShape>
            <XShape positionX="3974" positionY="12784" sizeX="6220" sizeY="849" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=1">
             <XShapes>
-             <XShape positionX="3974" positionY="12784" sizeX="6220" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Black - The color of 
night and coffee&#10;28%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="10279" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="3974" positionY="12784" sizeX="6220" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Black - The color of 
night and coffee&#10;28%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="7129" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -229,7 +229,7 @@
            </XShape>
            <XShape positionX="1910" positionY="7819" sizeX="6167" sizeY="849" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=2">
             <XShapes>
-             <XShape positionX="1910" positionY="7819" sizeX="6167" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Green - The color of 
grass and hope&#10;6%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="CENTER" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8225" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="1910" positionY="7819" sizeX="6167" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Green - The color of 
grass and hope&#10;6%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="CENTER" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="7129" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -252,7 +252,7 @@
            </XShape>
            <XShape positionX="3813" positionY="3994" sizeX="6035" sizeY="849" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=3">
             <XShapes>
-             <XShape positionX="3813" positionY="3994" sizeX="6035" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Red - The color of rose 
and passion&#10;19%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="9943" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="3813" positionY="3994" sizeX="6035" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Red - The color of rose 
and passion&#10;19%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="7129" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -275,7 +275,7 @@
            </XShape>
            <XShape positionX="14780" positionY="3124" sizeX="6140" sizeY="849" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=4">
             <XShapes>
-             <XShape positionX="14780" positionY="3124" sizeX="6140" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="White - The color of 
milk and purity&#10;14%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="26494" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="14780" positionY="3124" sizeX="6140" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="White - The color of 
milk and purity&#10;14%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8832" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -331,6 +331,4 @@
    <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
   </Transformation>
  </XShape>
-</XShapes>
-
-
+</XShapes>
\ No newline at end of file
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml 
b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
index 7b67bd226da6..77a1ac06f80a 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
@@ -183,7 +183,7 @@
           <XShapes>
            <XShape positionX="17907" positionY="9977" sizeX="6114" sizeY="849" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0">
             <XShapes>
-             <XShape positionX="17907" positionY="9977" sizeX="6114" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Yellow - The color of 
sun and honey&#10;33%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8732" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="17907" positionY="9977" sizeX="6114" 
sizeY="849" type="com.sun.star.drawing.TextShape" text="Yellow - The color of 
sun and honey&#10;33%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="7129" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -331,6 +331,4 @@
    <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
   </Transformation>
  </XShape>
-</XShapes>
-
-
+</XShapes>
\ No newline at end of file
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml 
b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
index 7fabc697c751..6b182821f1c9 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
@@ -183,7 +183,7 @@
           <XShapes>
            <XShape positionX="17590" positionY="9958" sizeX="6114" 
sizeY="1273" type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0">
             <XShapes>
-             <XShape positionX="17590" positionY="9958" sizeX="6114" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Yellow - The color of 
sun and honey&#10;120&#10;33%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8546" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="17590" positionY="9958" sizeX="6114" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Yellow - The color of 
sun and honey&#10;120&#10;33%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="6977" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -206,7 +206,7 @@
            </XShape>
            <XShape positionX="3770" positionY="12725" sizeX="6220" 
sizeY="1273" type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=1">
             <XShapes>
-             <XShape positionX="3770" positionY="12725" sizeX="6220" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Black - The color of 
night and coffee&#10;100&#10;28%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="10075" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="3770" positionY="12725" sizeX="6220" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Black - The color of 
night and coffee&#10;100&#10;28%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="TOP" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="6977" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -229,7 +229,7 @@
            </XShape>
            <XShape positionX="1737" positionY="7614" sizeX="6167" sizeY="1273" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=2">
             <XShapes>
-             <XShape positionX="1737" positionY="7614" sizeX="6167" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Green - The color of 
grass and hope&#10;20&#10;6%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="CENTER" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8052" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="1737" positionY="7614" sizeX="6167" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Green - The color of 
grass and hope&#10;20&#10;6%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="CENTER" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="6977" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -252,7 +252,7 @@
            </XShape>
            <XShape positionX="3614" positionY="3626" sizeX="6035" sizeY="1273" 
type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=3">
             <XShapes>
-             <XShape positionX="3614" positionY="3626" sizeX="6035" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Red - The color of 
rose and passion&#10;70&#10;19%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="9744" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="3614" positionY="3626" sizeX="6035" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="Red - The color of 
rose and passion&#10;70&#10;19%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="RIGHT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="6977" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
@@ -275,7 +275,7 @@
            </XShape>
            <XShape positionX="14509" positionY="2768" sizeX="6140" 
sizeY="1273" type="com.sun.star.drawing.GroupShape" 
name="CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=4">
             <XShapes>
-             <XShape positionX="14509" positionY="2768" sizeX="6140" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="White - The color of 
milk and purity&#10;50&#10;14%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="25991" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+             <XShape positionX="14509" positionY="2768" sizeX="6140" 
sizeY="1273" type="com.sun.star.drawing.TextShape" text="White - The color of 
milk and purity&#10;50&#10;14%" fontHeight="12.000000" fontColor="595959" 
textAutoGrowHeight="true" textAutoGrowWidth="true" textContourFrame="false" 
textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="BOTTOM" 
textLeftDistance="0" textRightDistance="0" textUpperDistance="0" 
textLowerDistance="0" textMaximumFrameHeight="0" textMaximumFrameWidth="8664" 
textMinimumFrameHeight="1" textMinimumFrameWidth="1" textAnimationAmount="0" 
textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" 
textAnimationKind="NONE" textAnimationStartInside="false" 
textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" 
fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
               <FillTransparenceGradient style="LINEAR" startColor="000000" 
endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillGradient style="LINEAR" startColor="000000" 
endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" 
startIntensity="100" endIntensity="100" stepCount="0"/>
               <FillHatch style="SINGLE" color="3465a4" distance="20" 
angle="0"/>
diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index 7bf2eaa2a89b..3b61cb9c46e3 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -386,14 +386,14 @@ void PieChart::createTextLabelShape(
 
     // set the maximum text width to be used when text wrapping is enabled
     double fTextMaximumFrameWidth = 0.8 * fPieRadius;
-    if( nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE && 
m_aAvailableOuterRect.getWidth() )
+    if (nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE
+        && m_aAvailableOuterRect.getWidth())
     {
-        if (fAngleDegree < 67.5 || fAngleDegree >= 292.5)
-            fTextMaximumFrameWidth = m_aAvailableOuterRect.getMaxX() - 
aPieLabelInfo.aFirstPosition.getX();
-        else if (fAngleDegree < 112.5 || fAngleDegree >= 247.5)
-            fTextMaximumFrameWidth = m_aAvailableOuterRect.getWidth();
+        if ((fAngleDegree >= 67.5 && fAngleDegree <= 112.5)
+            || (fAngleDegree >= 247.5 && fAngleDegree <= 292.5))
+            fTextMaximumFrameWidth = m_aAvailableOuterRect.getWidth() / 3.0;
         else
-            fTextMaximumFrameWidth = aPieLabelInfo.aFirstPosition.getX() - 
m_aAvailableOuterRect.getMinX();
+            fTextMaximumFrameWidth = 0.85 * (m_aAvailableOuterRect.getWidth() 
/ 2.0 - fPieRadius);
     }
     sal_Int32 nTextMaximumFrameWidth = ceil(fTextMaximumFrameWidth);
 
@@ -424,17 +424,12 @@ void PieChart::createTextLabelShape(
         {
             if (m_aAvailableOuterRect.getWidth())
             {
-                if (fAngleDegree < 67.5 || fAngleDegree >= 292.5)
-                    fTextMaximumFrameWidth
-                        = 0.8
-                          * (m_aAvailableOuterRect.getMaxX() - 
aPieLabelInfo.aFirstPosition.getX());
-                else if (fAngleDegree < 112.5 || fAngleDegree >= 247.5)
-                    fTextMaximumFrameWidth = 0.8 * 
m_aAvailableOuterRect.getWidth();
+                if ((fAngleDegree >= 67.5 && fAngleDegree <= 112.5)
+                    || (fAngleDegree >= 247.5 && fAngleDegree <= 292.5))
+                    fTextMaximumFrameWidth = m_aAvailableOuterRect.getWidth() 
/ 3.0;
                 else
                     fTextMaximumFrameWidth
-                        = 0.8
-                          * (aPieLabelInfo.aFirstPosition.getX() - 
m_aAvailableOuterRect.getMinX());
-
+                        = 0.85 * (m_aAvailableOuterRect.getWidth() / 2.0 - 
fPieRadius);
                 nTextMaximumFrameWidth = ceil(fTextMaximumFrameWidth);
             }
 
diff --git a/sw/qa/extras/layout/data/outside_long_data_label.docx 
b/sw/qa/extras/layout/data/outside_long_data_label.docx
new file mode 100644
index 000000000000..fb5110a43eaa
Binary files /dev/null and 
b/sw/qa/extras/layout/data/outside_long_data_label.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index b52ff9ecdb6c..0c2d2c47d3f6 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -856,6 +856,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137154)
     CPPUNIT_ASSERT_DOUBLES_EQUAL(nX4, nX1, 50);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138777)
+{
+    SwDoc* pDoc = createDoc("outside_long_data_label.docx");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    const sal_Int32 nFirstLabelLines
+        = getXPathContent(pXmlDoc, 
"count(//text[contains(text(),\"really\")])").toInt32();
+
+    // This failed, if the first data label didn't break to multiple lines.
+    CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(1), nFirstLabelLines);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf130031)
 {
     SwDoc* pDoc = createDoc("tdf130031.docx");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to