diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx
index f247b7507ace..b968a29c8940 100644
--- a/chart2/qa/extras/xshape/chart2xshape.cxx
+++ b/chart2/qa/extras/xshape/chart2xshape.cxx
@@ -196,7 +196,7 @@ void Chart2XShapeTest::testPieChartLabels2()
if (!IsDefaultDPI())
return;
- // text wrap: wrap all text labels except one
+ // text wrap: wrap all text labels except Yellow one
loadFromFile(u"xlsx/tdf90839-2.xlsx");
compareAgainstReference(getXShapeDumpString(), u"tdf90839-2.xml");
}
@@ -208,7 +208,7 @@ void Chart2XShapeTest::testPieChartLabels3()
if (!IsDefaultDPI())
return;
- // text wrap: wrap no text label except one
+ // text wrap: wrap no text label except Yellow one
loadFromFile(u"xlsx/tdf90839-3.xlsx");
compareAgainstReference(getXShapeDumpString(), u"tdf90839-3.xml");
}
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
index 9ea3f9c16c28..5a639abb0b53 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml
@@ -14,7 +14,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -39,12 +39,12 @@
-
-
+
+
-
+
@@ -175,11 +175,11 @@
-
+
-
+
-
+
@@ -204,9 +204,9 @@
-
+
-
+
@@ -215,21 +215,21 @@
-
-
+
+
-
-
+
+
-
+
-
+
@@ -238,21 +238,21 @@
-
-
+
+
-
-
+
+
-
+
-
+
@@ -261,21 +261,21 @@
-
-
+
+
-
-
+
+
-
+
-
+
@@ -284,53 +284,51 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
index a042916da822..863778e30c0b 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml
@@ -14,7 +14,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -39,12 +39,12 @@
-
+
-
+
@@ -175,15 +175,15 @@
-
+
-
+
-
+
-
+
-
+
@@ -192,15 +192,15 @@
-
-
+
+
-
-
+
+
@@ -298,39 +298,37 @@
-
+
-
+
-
+
-
+
-
+
-
-
diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
index 83d721786149..7078cc6a26a3 100644
--- a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
+++ b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml
@@ -14,7 +14,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -39,12 +39,12 @@
-
-
+
+
-
+
@@ -175,15 +175,15 @@
-
+
-
+
-
+
-
+
-
+
@@ -192,21 +192,21 @@
-
+
-
+
-
+
-
+
@@ -215,21 +215,21 @@
-
+
-
+
-
+
-
+
@@ -238,21 +238,21 @@
-
+
-
+
-
+
-
+
@@ -261,21 +261,21 @@
-
-
+
+
-
-
+
+
-
+
-
+
@@ -284,53 +284,51 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 2d72da5f5886..ba87e8ce0cbe 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -417,12 +417,14 @@ void PieChart::createTextLabelShape(
}
else if (nLabelPlacement == css::chart::DataLabelPlacement::OUTSIDE)
{
- if ((fAngleDegree >= 67.5 && fAngleDegree <= 112.5)
- || (fAngleDegree >= 247.5 && fAngleDegree <= 292.5))
- fTextMaximumFrameWidth = m_aAvailableOuterRect.getWidth() / 3.0;
- else
- fTextMaximumFrameWidth = 0.85 * (m_aAvailableOuterRect.getWidth() / 2.0 - fPieRadius);
- }
+ const sal_Int32 nOuterX = aPieLabelInfo.aOuterPosition.getX();
+ if (fAngleDegree < 90 || fAngleDegree > 270) // label is placed on the right side
+ fTextMaximumFrameWidth = 0.8 * abs(m_aAvailableOuterRect.getWidth() - nOuterX);
+ else // label is placed on the left side
+ fTextMaximumFrameWidth = 0.8 * nOuterX;
+
+ fTextMaximumFrameWidth = std::min(fTextMaximumFrameWidth, fCompatMaxTextLen);
+ }
}
sal_Int32 nTextMaximumFrameWidth = ceil(fTextMaximumFrameWidth);
@@ -473,9 +475,9 @@ void PieChart::createTextLabelShape(
* so in that bizarre case just try the positive value of the result...
*/
const sal_Int32 nOuterX = aPieLabelInfo.aOuterPosition.getX();
- if (fAngleDegree < 90 || fAngleDegree > 270) // label is placed on the right half
+ if (fAngleDegree < 90 || fAngleDegree > 270) // label is placed on the right side
fTextMaximumFrameWidth = 0.8 * abs(m_aAvailableOuterRect.getWidth() - nOuterX);
- else // label is placed on the left half
+ else // label is placed on the left side
fTextMaximumFrameWidth = 0.8 * nOuterX;
nTextMaximumFrameWidth = ceil(std::min(fTextMaximumFrameWidth, fCompatMaxTextLen));