tdf#142537 PPTX export: fix placeholder style export
Regression from: b6b02e0b4c9d739836e1f61a886ea45b01e6696e
(tdf#111903 tdf#137152 PPTX export: fix placeholders)
Placeholders lost the formatting, which has been fixed.
(fill, effects, and outline)
Change-Id: I2b9300b85cf3641d89d748a03377f950e668a2af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116113
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sd/qa/unit/data/pptx/LostPlaceholderFill.odp b/sd/qa/unit/data/pptx/LostPlaceholderFill.odp
new file mode 100644
index 0000000..d2ea8da
--- /dev/null
+++ b/sd/qa/unit/data/pptx/LostPlaceholderFill.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 08504c8..b5222c4 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -115,6 +115,7 @@ public:
void testNarrationMimeType();
void testTdf140865Wordart3D();
void testTdf124457();
void testPlaceholderFillAndOutlineExport();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
@@ -172,6 +173,7 @@ public:
CPPUNIT_TEST(testNarrationMimeType);
CPPUNIT_TEST(testTdf140865Wordart3D);
CPPUNIT_TEST(testTdf124457);
CPPUNIT_TEST(testPlaceholderFillAndOutlineExport);
CPPUNIT_TEST_SUITE_END();
@@ -442,6 +444,57 @@ void SdOOXMLExportTest1::testLostPlaceholders()
xDocShRef->DoClose();
}
void SdOOXMLExportTest1::testPlaceholderFillAndOutlineExport()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/LostPlaceholderFill.odp"), ODP);
uno::Any aFillStyle;
uno::Any aFillColor;
uno::Any aLineStyle;
uno::Any aLineColor;
for (int i = 1; i <= 2; i++)
{
CPPUNIT_ASSERT(xDocShRef.is());
auto pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT(pDoc);
auto pPage = pDoc->GetPage(1);
CPPUNIT_ASSERT(pPage);
auto pObj = pPage->GetObj(1);
CPPUNIT_ASSERT(pObj);
uno::Reference<drawing::XShape> xShp(pObj->getUnoShape(), uno::UNO_QUERY);
CPPUNIT_ASSERT(xShp);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong ShapeType!", OUString(u"com.sun.star.presentation.OutlinerShape"), xShp->getShapeType());
uno::Reference<beans::XPropertySet> xShpProps(xShp, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL_MESSAGE("It must be a placeholder!", true, xShpProps->getPropertyValue("IsPresentationObject").get<bool>());
if (i == 1)
{
aFillStyle = xShpProps->getPropertyValue("FillStyle");
aFillColor = xShpProps->getPropertyValue("FillColor");
aLineStyle = xShpProps->getPropertyValue("LineStyle");
aLineColor = xShpProps->getPropertyValue("LineColor");
xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
continue;
}
else
{
CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder fillstyle has not been exported!", aFillStyle, xShpProps->getPropertyValue("FillStyle"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder fillcolor has not been exported!", aFillColor, xShpProps->getPropertyValue("FillColor"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder linestyle has not been exported!", aLineStyle, xShpProps->getPropertyValue("LineStyle"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("The Placeholder linecolor has not been exported!", aLineColor, xShpProps->getPropertyValue("LineColor"));
break;
}
}
xDocShRef->DoClose();
}
void SdOOXMLExportTest1::testFdo71961()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/fdo71961.odp"), ODP);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 089e3bb..a1a6dd6 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1534,7 +1534,25 @@ ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShap
WritePresetShape("rect");
Reference< XPropertySet > xProps(xShape, UNO_QUERY);
if (xProps.is())
{
WriteBlipFill(xProps, "Graphic");
// Do not forget to export the visible properties.
WriteFill( xProps );
WriteOutline( xProps );
WriteShapeEffects( xProps );
bool bHas3DEffectinShape = false;
uno::Sequence<beans::PropertyValue> grabBag;
if (xProps->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
xProps->getPropertyValue("InteropGrabBag") >>= grabBag;
for (auto const& it : std::as_const(grabBag))
if (it.Name == "3DEffectProperties")
bHas3DEffectinShape = true;
if( bHas3DEffectinShape)
WriteShape3DEffects( xProps );
}
mpFS->endElementNS(XML_p, XML_spPr);
WriteTextBox(xShape, XML_p);