summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2025-02-18 10:31:06 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2025-02-18 22:21:43 +0100
commitf9b9bf030618f66eccf9168413f1935ac521f161 (patch)
tree291ddfe30535f27f963faa2c8c717ff2dc305fef
parent6d978385b1d34fe0703ca9cc841c7ea67abd47cc (diff)
tdf#165261 - PPTX import: fix text in shape is left-aligned
instead of being centered regression from: 1d9ce0a67a71e51569cd33c26270eeece587a354 (tdf#162571 - sd: Text box expands or shrinks on left or right or...) Change-Id: Ieed39426dc5aec7a34d15bbb0a4faaeba04ba50f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181822 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
-rw-r--r--oox/source/drawingml/shape.cxx14
-rw-r--r--sd/qa/unit/data/pptx/tdf165261.pptxbin0 -> 9021 bytes
-rw-r--r--sd/qa/unit/data/xml/n762695_1.xml4
-rw-r--r--sd/qa/unit/data/xml/n820786_0.xml4
-rw-r--r--sd/qa/unit/data/xml/tdf90338_0.xml2
-rw-r--r--sd/qa/unit/data/xml/tdf92001_0.xml2
-rw-r--r--sd/qa/unit/export-tests-ooxml4.cxx28
7 files changed, 39 insertions, 15 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 409b67b58ba2..cd2903179949 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1531,16 +1531,12 @@ Reference< XShape > const & Shape::createAndInsert(
std::optional<css::style::ParagraphAdjust>& oParaAdjust
= mpTextBody->getParagraphs()[0]->getProperties().getParaAdjust();
- bool bAutoHeight = false;
- Reference< XPropertySetInfo > xSetInfo(xSet->getPropertySetInfo());
- const OUString& rPropName = PropertyMap::getPropertyName(PROP_TextAutoGrowHeight);
- if (xSetInfo.is() && xSetInfo->hasPropertyByName(rPropName))
- {
- uno::Any aTextAutoGrowHeight = xSet->getPropertyValue(u"TextAutoGrowHeight"_ustr);
- aTextAutoGrowHeight >>= bAutoHeight;
- }
+ bool bAutoGrowHeight = getTextBody()
+ ->getTextProperties()
+ .maPropertyMap.getProperty(PROP_TextAutoGrowHeight)
+ .get<bool>();
- if (bAutoHeight && nShapeRotateInclCamera == 0)
+ if (bAutoGrowHeight && nShapeRotateInclCamera == 0)
{
mpTextBody->getTextProperties().maPropertyMap.setProperty(
PROP_TextHorizontalAdjust, lcl_convertTextAdjust(
diff --git a/sd/qa/unit/data/pptx/tdf165261.pptx b/sd/qa/unit/data/pptx/tdf165261.pptx
new file mode 100644
index 000000000000..1f0ae1706401
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf165261.pptx
Binary files differ
diff --git a/sd/qa/unit/data/xml/n762695_1.xml b/sd/qa/unit/data/xml/n762695_1.xml
index 8cd404c575be..02d3b735da86 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="3175" positionY="7197" sizeX="17991" sizeY="7619" type="com.sun.star.drawing.CustomShape" name="Freeform 15" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="3175" positionY="7197" sizeX="17991" sizeY="7619" type="com.sun.star.drawing.CustomShape" name="Freeform 15" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" 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="3465a4" 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"/>
@@ -85,7 +85,7 @@
</PropertyValue>
</CustomShapeGeometry>
</XShape>
- <XShape positionX="3387" positionY="4229" sizeX="17682" sizeY="9528" type="com.sun.star.drawing.CustomShape" name="Freeform 16" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="3387" positionY="4229" sizeX="17682" sizeY="9528" type="com.sun.star.drawing.CustomShape" name="Freeform 16" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="729fcf" 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="3465a4" 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/sd/qa/unit/data/xml/n820786_0.xml b/sd/qa/unit/data/xml/n820786_0.xml
index fee4d9667e52..4b2e06b3f347 100644
--- a/sd/qa/unit/data/xml/n820786_0.xml
+++ b/sd/qa/unit/data/xml/n820786_0.xml
@@ -64,7 +64,7 @@
</XShape>
<XShape positionX="20904" positionY="11701" sizeX="846" sizeY="1057" type="com.sun.star.drawing.GroupShape" name="Group 43">
<XShapes>
- <XShape positionX="21750" positionY="12758" sizeX="846" sizeY="1057" type="com.sun.star.drawing.CustomShape" name="Oval 44" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="HATCH" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="21750" positionY="12758" sizeX="846" sizeY="1057" type="com.sun.star.drawing.CustomShape" name="Oval 44" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="HATCH" 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="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="DOUBLE" color="000000" distance="175" angle="450"/>
@@ -148,7 +148,7 @@
</PropertyValue>
</CustomShapeGeometry>
</XShape>
- <XShape positionX="21750" positionY="12758" sizeX="211" sizeY="1057" type="com.sun.star.drawing.CustomShape" name="Oval 45" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="HATCH" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="21750" positionY="12758" sizeX="211" sizeY="1057" type="com.sun.star.drawing.CustomShape" name="Oval 45" fontHeight="24.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="HATCH" 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="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="DOUBLE" color="000000" distance="175" angle="450"/>
diff --git a/sd/qa/unit/data/xml/tdf90338_0.xml b/sd/qa/unit/data/xml/tdf90338_0.xml
index 792eca6f4cf1..741d6ca08071 100644
--- a/sd/qa/unit/data/xml/tdf90338_0.xml
+++ b/sd/qa/unit/data/xml/tdf90338_0.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="5498" positionY="2715" sizeX="11630" sizeY="8623" type="com.sun.star.drawing.CustomShape" name="Freeform 3" fontHeight="11.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="e7e6e6" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="5498" positionY="2715" sizeX="11630" sizeY="8623" type="com.sun.star.drawing.CustomShape" name="Freeform 3" fontHeight="11.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="e7e6e6" 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="3465a4" 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/sd/qa/unit/data/xml/tdf92001_0.xml b/sd/qa/unit/data/xml/tdf92001_0.xml
index d5c59dd7ff0e..d67952eb1fe5 100644
--- a/sd/qa/unit/data/xml/tdf92001_0.xml
+++ b/sd/qa/unit/data/xml/tdf92001_0.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="4826" positionY="4826" sizeX="19557" sizeY="12953" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="325" textRightDistance="325" textUpperDistance="200" textLowerDistance="200" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="729fcf" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="4826" positionY="4826" sizeX="19557" sizeY="12953" type="com.sun.star.drawing.CustomShape" fontHeight="18.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="325" textRightDistance="325" textUpperDistance="200" textLowerDistance="200" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="729fcf" 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="3465a4" 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/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx
index 4cf8e852267b..d9bea30c1334 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
@@ -1346,6 +1347,33 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testConvertWithMasterDeduplication)
}
}
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf162571HorzAnchor)
+{
+ createSdImpressDoc("pptx/tdf165261.pptx");
+ saveAndReload(u"Impress Office Open XML"_ustr);
+
+ uno::Reference<drawing::XShape> xShape(getShapeFromPage(1, 0), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xProp(xShape, uno::UNO_QUERY);
+
+ drawing::TextHorizontalAdjust eHori;
+ CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori);
+ CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT, eHori);
+}
+
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf165261HorzAnchor)
+{
+ createSdImpressDoc("pptx/tdf165261.pptx");
+ saveAndReload(u"Impress Office Open XML"_ustr);
+
+ uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
+
+ uno::Reference<beans::XPropertySet> xProp(xShape, uno::UNO_QUERY);
+ drawing::TextHorizontalAdjust eHori;
+ CPPUNIT_ASSERT(xProp->getPropertyValue(u"TextHorizontalAdjust"_ustr) >>= eHori);
+ CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER, eHori);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */