summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAttila Bakos (NISZ) <bakos.attilakaroly@nisz.hu>2021-05-25 16:48:51 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-31 11:43:02 +0200
commit8acc6bc43e0334157b97b36f570987a49c5febdd (patch)
tree19d4ff422e26d0318c28589bc310d758ffa8d6bc /sd
parent936af331ba6f5073aeaa0f10f5f2af1def1d74c6 (diff)
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>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/LostPlaceholderFill.odpbin0 -> 15000 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx53
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx18
3 files changed, 71 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/LostPlaceholderFill.odp b/sd/qa/unit/data/pptx/LostPlaceholderFill.odp
new file mode 100644
index 000000000000..d2ea8dab6d4a
--- /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 08504c8286a6..b5222c40f913 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 089e3bbdffa5..a1a6dd6cad5d 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);