diff options
-rw-r--r-- | oox/qa/unit/data/testTdf157019_objPlaceholderCustomShape.pptx | bin | 0 -> 33050 bytes | |||
-rw-r--r-- | oox/qa/unit/drawingml.cxx | 17 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 19 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 11 | ||||
-rw-r--r-- | sd/qa/unit/import-tests2.cxx | 12 |
5 files changed, 36 insertions, 23 deletions
diff --git a/oox/qa/unit/data/testTdf157019_objPlaceholderCustomShape.pptx b/oox/qa/unit/data/testTdf157019_objPlaceholderCustomShape.pptx Binary files differnew file mode 100644 index 000000000000..125494d5f376 --- /dev/null +++ b/oox/qa/unit/data/testTdf157019_objPlaceholderCustomShape.pptx diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 35cb7528452e..f2f06509cdf3 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -464,6 +464,23 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf132557_footerCustomShapes) CPPUNIT_ASSERT_EQUAL(u"com.sun.star.drawing.CustomShape"_ustr, xShapeSlideNum->getShapeType()); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf132557_objPlaceholderCustomShape) +{ + // slide with object placeholder with custom shape + loadFromFile(u"testTdf157019_objPlaceholderCustomShape.pptx"); + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + // Test if we were able to import the outliner shape with CustomShape service. + // Without the fix in place, this test would have failed with + // Expected: shape type: "com.sun.star.drawing.CustomShape" + // Actual : shape type: "com.sun.star.presentation.OutlinerShape" + uno::Reference<drawing::XShape> xObjShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"com.sun.star.drawing.CustomShape"_ustr, xObjShape->getShapeType()); +} + CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeColorTint_Table) { // Given a document with a table style, using theme color with tinting in the A2 cell: diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 9727688b25fe..5adf4a8eb15b 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1293,30 +1293,21 @@ Reference< XShape > const & Shape::createAndInsert( ppt::PowerPointImport* pPPT = dynamic_cast<ppt::PowerPointImport*>(&rFilterBase); if (!pPPT->getActualSlidePersist()->isMasterPage()) { - // There is no support for change the shape of the drawing in LO, but we check, - // if the placeholder changes its shape, top and bottom margins won't be used. - bool bIsChangePlaceholderShape - = !mpCustomShapePropertiesPtr->getAdjustmentGuideList().empty(); - sal_Int32 nUpper = 0; sal_Int32 nLower = 0; sal_Int32 nHeight = maSize.Height / 360; - if (getTextBody()->getTextProperties().moInsets[1].value() != 0 - && getTextBody()->getTextProperties().moInsets[3].value() != 0) + if (getTextBody()->getTextProperties().moInsets[1].has_value() + && getTextBody()->getTextProperties().moInsets[3].has_value()) { - if (!bIsChangePlaceholderShape) - { - nUpper = *getTextBody()->getTextProperties().moInsets[1]; - nLower = *getTextBody()->getTextProperties().moInsets[3]; - nHeight -= (nUpper + nLower); - } + nUpper = *getTextBody()->getTextProperties().moInsets[1]; + nLower = *getTextBody()->getTextProperties().moInsets[3]; } else { maDefaultShapeProperties.getProperty(PROP_TextUpperDistance) >>= nUpper; maDefaultShapeProperties.getProperty(PROP_TextLowerDistance) >>= nLower; - nHeight += (nUpper + nLower); } + nHeight -= (nUpper + nLower); mxShape->setSize(awt::Size(0, nHeight)); } } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index c443e3bd5e52..6ee8b660a1b9 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -335,9 +335,14 @@ void PPTShape::addShape( // Since it is not possible to represent custom shaped placeholders in Impress // Need to use service name css.drawing.CustomShape if they have a non default shape. // This workaround has the drawback of them not really being processed as placeholders - // so it is only done for slide footers... - bool convertInSlideMode = meShapeLocation == Slide && - (mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == XML_ftr || mnSubType == XML_body); + // so it is done for slide footers and obj placeholder + bool convertInSlideMode + = meShapeLocation == Slide + && (mnSubType == XML_sldNum || mnSubType == XML_dt || mnSubType == XML_ftr + || mnSubType == XML_body + || (mnSubType == XML_obj + && sServiceName != "com.sun.star.drawing.GraphicObjectShape")); + bool convertInLayoutMode = meShapeLocation == Layout && (mnSubType == XML_body); if ((convertInSlideMode || convertInLayoutMode) && !mpCustomShapePropertiesPtr->representsDefaultShape()) { diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index c01ae0b8747a..3f01a678ca5b 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -111,18 +111,18 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf160490) 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); + // Expected: placeholder height: 2627 + // Actual : placeholder height: 3476 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2627), 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); + // Expected: placeholder height: 2373 + // Actual : placeholder height: 3116 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2373), nHeight2); } CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf157285) |