summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-07-15 01:14:15 +0300
committerMiklos Vajna <vmiklos@collabora.com>2021-07-15 09:03:31 +0200
commitb3d2abf4c113741a386b7eb840e22b872f29c7c3 (patch)
treeea28e6fc9c8193a8d9357a67ec82aaecc118ffa9 /sd
parentac1817a2fb9fde32f40c5afe96bab174621de892 (diff)
tdf#143315: restore the stylesheet after clearing outliner object
Prior to commit c4f615b359be56e88e4fbf9aaaf30affb29d57e2, pObj passed to SvxMSDffManager::ReadObjText was not initializing its properties (no call to AttributeProperties::GetObjectItemSet() happened) until call to CreateParaObject in the end of the function. Then it finally initialized, and called applyDefaultStyleSheetFromSdrModel, which applied the obtained stylesheet to the nodes of the outliner object, and resulted in OutlinerParaObject having correct style name in its ContentInfo structures, which then went into pObj. The mentioned commit added calls to SdrTextObj::GetTextColumns* in SdrOutliner::SetTextObj, called by SdrTextObj::ImpGetDrawOutliner indirectly. These calls initialize the object properties, and the stylesheet gets applied to the SdrOutliner and its empty node early. Then the call to Outliner::Init and Outliner::Clear resulted in the node being destroyed and re-created without stylesheet info. Then in AttributeProperties::GetObjectItemSet called from CreateParaObject, re-initialization does not happen, because the item set exists. When exporting to OOXML, the missing stylesheet required to use pool default value, which led to bullet being exported. The previous behavior relied on fragile and unspecified assumption. Instead, now we call SetStyleSheet after all operations, to make sure that the stylesheet information is present in the final data. Change-Id: I14de9017e4af92a2eaf12b3a0e090b0db7fcc759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118961 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118964 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.pptbin0 -> 68608 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml3.cxx27
2 files changed, 27 insertions, 0 deletions
diff --git a/sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt b/sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt
new file mode 100644
index 000000000000..54111bb28a7a
--- /dev/null
+++ b/sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx
index 6632934e430e..f842e4b97717 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -117,6 +117,7 @@ public:
void testTdf125560_textInflateTop();
void testTdf96061_textHighlight();
void testTdf142235_TestPlaceholderTextAlignment();
+ void testTdf143315();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
@@ -186,6 +187,7 @@ public:
CPPUNIT_TEST(testTdf125560_textInflateTop);
CPPUNIT_TEST(testTdf96061_textHighlight);
CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment);
+ CPPUNIT_TEST(testTdf143315);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -1743,6 +1745,31 @@ void SdOOXMLExportTest3::testTdf96061_textHighlight()
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor);
}
+void SdOOXMLExportTest3::testTdf143315()
+{
+ auto xDocShRef = loadURL(
+ m_directories.getURLFromSrc(u"sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt"),
+ PPT);
+
+ utl::TempFile tmpfile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile);
+ xDocShRef->DoClose();
+
+ xmlDocUniquePtr pXml = parseExport(tmpfile, "ppt/slides/slide1.xml");
+
+ // Without the fix in place, whis would have failed with
+ // - Expected:
+ // - Actual : 216000
+ // - In <file:///tmp/lu161922zcvd.tmp>, XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr' unexpected 'marL' attribute
+
+ assertXPathNoAttribute(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "marL");
+ assertXPathNoAttribute(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr", "indent");
+ assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buClr", 0);
+ assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buSzPct", 0);
+ assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buFont", 0);
+ assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3);
CPPUNIT_PLUGIN_IMPLEMENT();