summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTibor Nagy <tibor.nagy.extern@allotropia.de>2024-06-19 16:07:13 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-06-21 12:50:41 +0200
commit259e743d493c3a20ae8a3cce761b77700aa09096 (patch)
tree5ccdc3836539fd49dc987364105b08720a73e63b /sd
parenteb9352112df1ed88acf10a3e3ec1db2cd9892c98 (diff)
tdf#160490 PPTX import: fix automatically resized placeholder height
See also commit Ia7f94d7452d1a1c3f004aebd73b6ed5cbfd9b43b "tdf#157285 PPTX import: fix placeholder height". Change-Id: I6203af3fe86a60e29121685ffeb435f4ff25368a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169206 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.extern@allotropia.de> (cherry picked from commit 7e13d34086d67ecfe47db5a85a4877b5ba96f874) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169143 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf160490.pptxbin0 -> 17490 bytes
-rw-r--r--sd/qa/unit/data/xml/n819614_0.xml2
-rw-r--r--sd/qa/unit/import-tests2.cxx31
-rw-r--r--sd/source/ui/unoidl/unopage.cxx8
4 files changed, 32 insertions, 9 deletions
diff --git a/sd/qa/unit/data/pptx/tdf160490.pptx b/sd/qa/unit/data/pptx/tdf160490.pptx
new file mode 100644
index 000000000000..be1b316433f9
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf160490.pptx
Binary files differ
diff --git a/sd/qa/unit/data/xml/n819614_0.xml b/sd/qa/unit/data/xml/n819614_0.xml
index 0fa127c07d9b..c889b00c343a 100644
--- a/sd/qa/unit/data/xml/n819614_0.xml
+++ b/sd/qa/unit/data/xml/n819614_0.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="1270" positionY="763" sizeX="21166" sizeY="1564" type="com.sun.star.presentation.TitleTextShape" name="Title 1" text="Test" fontHeight="44.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="AUTOFIT" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="254" textRightDistance="254" textUpperDistance="127" textLowerDistance="127" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="1" 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="1270" positionY="763" sizeX="21166" sizeY="1564" type="com.sun.star.presentation.TitleTextShape" name="Title 1" text="Test" fontHeight="44.000000" fontColor="000000" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="AUTOFIT" textHorizontalAdjust="BLOCK" textVerticalAdjust="CENTER" textLeftDistance="254" textRightDistance="254" textUpperDistance="127" textLowerDistance="127" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="3181" 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="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/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index ab66d016b665..ecae9a10c2d0 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -77,6 +77,29 @@ protected:
bool checkPattern(int nShapeNumber, std::vector<sal_uInt8>& rExpected);
};
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490)
+{
+ createSdImpressDoc("pptx/tdf160490.pptx");
+
+ uno::Reference<drawing::XShape> xShape1(getShapeFromPage(0, 0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xShape1.is());
+ sal_Int32 nHeight1 = xShape1->getSize().Height;
+
+ // Without the fix in place, this test would have failed with
+ // Expected: placeholder height: 3730
+ // Actual : placeholder height: 2627
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3730), nHeight1);
+
+ uno::Reference<drawing::XShape> xShape2(getShapeFromPage(0, 1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xShape2.is());
+ sal_Int32 nHeight2 = xShape2->getSize().Height;
+
+ // Without the fix in place, this test would have failed with
+ // Expected: placeholder height: 3366
+ // Actual : placeholder height: 2373
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3366), nHeight2);
+}
+
CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157285)
{
createSdImpressDoc("pptx/tdf157285.pptx");
@@ -86,18 +109,18 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157285)
sal_Int32 nHeight1 = xShape1->getSize().Height;
// Without the fix in place, this test would have failed with
- // Expected: placeholder height: 2541
+ // Expected: placeholder height: 2565
// Actual : placeholder height: 3435
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2541), nHeight1);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2565), nHeight1);
uno::Reference<drawing::XShape> xShape2(getShapeFromPage(1, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xShape2.is());
sal_Int32 nHeight2 = xShape2->getSize().Height;
// Without the fix in place, this test would have failed with
- // Expected: placeholder height: 1169
+ // Expected: placeholder height: 1180
// Actual : placeholder height: 11303
- CPPUNIT_ASSERT_EQUAL(sal_Int32(1169), nHeight2);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1180), nHeight2);
}
CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf152186)
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 6e0f2ad52b13..535bb2eebbc4 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -486,10 +486,10 @@ rtl::Reference<SdrObject> SdGenericDrawPage::CreateSdrObject_( const Reference<
::tools::Rectangle aRect( eObjKind == PresObjKind::Title ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect() );
- // OOXML placeholder with auto grow height
- // do not set the height here yet
- if (xShape->getSize().Height == 0)
- aRect.setHeight(0);
+ // OOXML placeholder with "TextAutoGrowHeight" use the height set on the slide
+ sal_Int32 nHeight = xShape->getSize().Height;
+ if (nHeight != 0)
+ aRect.setHeight(nHeight);
const awt::Point aPos( aRect.Left(), aRect.Top() );
xShape->setPosition( aPos );