summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2024-12-12 09:23:48 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2024-12-13 12:56:00 +0100
commit9948c2ed03d227e178b9002dabc6edf34c32a5af (patch)
tree73fdf641f80ba1aa22d09a5494f8297bb8d8dca5 /oox
parente7763739ae04193190a29e5127f047de2f5f35af (diff)
tdf#150789 - FILEOPEN PPTX: fix text in SmartArt vertically off
Calculate correctly the textbox area of upArrowCallout and downArrowCallout shapes in group shapes. In grouped list text area does not cover the whole shape but just a part of it at the top. In case of upArrowCallout and downArrowCallout the arrow size of the shape is not included in the textbox area of the full shape. Change-Id: If732305747c20da55bbd2896522c0b9c05cc4b4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178343 Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/transform2dcontext.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 656cb41a4b7f..63d197abb81b 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -135,6 +135,39 @@ bool ConstructPresetTextRectangle(Shape& rShape, awt::Rectangle& rRect)
rRect.Height = rShape.getSize().Height;
return true;
}
+ case XML_upArrowCallout:
+ case XML_downArrowCallout:
+ {
+ // The identifiers here reflect the guides name value in presetShapeDefinitions.xml
+ sal_Int32 nWidth = rShape.getSize().Width;
+ sal_Int32 nHeight = rShape.getSize().Height;
+ if (nWidth == 0 || nHeight == 0)
+ return false;
+ // double adj1 = 25000.0;
+ // double adj2 = 25000.0;
+ double adj3 = 25000.0; // height of arrow head
+ double adj4 = 64977.0; // height of arrow shaft
+ const auto& aAdjGdList = rShape.getCustomShapeProperties()->getAdjustmentGuideList();
+ if (aAdjGdList.size() == 4)
+ {
+ // adj1 = aAdjGdList[0].maFormula.toDouble();
+ // adj2 = aAdjGdList[1].maFormula.toDouble();
+ adj3 = aAdjGdList[2].maFormula.toDouble();
+ adj4 = aAdjGdList[3].maFormula.toDouble();
+ }
+
+ double maxAdj3 = 100000.0 * nHeight / std::min(nWidth, nHeight);
+ adj3 = std::clamp<double>(adj3, 0, maxAdj3);
+ double q2 = adj3 * std::min(nWidth, nHeight) / nHeight;
+ double maxAdj4 = 100000.0 - q2;
+ adj4 = std::clamp<double>(adj4, 0, maxAdj4);
+
+ rRect.X = rShape.getPosition().X;
+ rRect.Y = rShape.getPosition().Y;
+ rRect.Width = rShape.getSize().Width;
+ rRect.Height = nHeight * adj4 / 100000.0;
+ return true;
+ }
case XML_gear6:
{
// The identifiers here reflect the guides name value in presetShapeDefinitions.xml