[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - filter/source sd/qa
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 15 06:58:54 UTC 2021
filter/source/msfilter/msdffimp.cxx | 3 +
sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt |binary
sd/qa/unit/export-tests-ooxml2.cxx | 26 +++++++++++++++++
3 files changed, 29 insertions(+)
New commits:
commit 6c411afae7f6cd9819c1b65d7b4212019a7b3cfe
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Jul 15 01:14:15 2021 +0300
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jul 15 08:58:21 2021 +0200
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 at collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118963
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e2f5b2eac0a4..d4617e652791 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3662,6 +3662,9 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj )
rOutliner.Clear();
rOutliner.SetUpdateMode( bOldUpdateMode );
pText->SetOutlinerParaObject( std::move(pNewText) );
+ // tdf#143315: restore stylesheet applied to Outliner's nodes when SdrTextObj initializes
+ // its attributes, but removed by Outliner::Init, which calls Outliner::Clear.
+ pText->SetStyleSheet(pText->GetStyleSheet(), true);
}
//static
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
Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index b80078fe7844..759fa8e203e5 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -215,6 +215,7 @@ public:
void testTextColumns_3columns();
void testTdf59323_slideFooters();
void testTdf143222_embeddedWorksheet();
+ void testTdf143315();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -342,6 +343,7 @@ public:
CPPUNIT_TEST(testTextColumns_3columns);
CPPUNIT_TEST(testTdf59323_slideFooters);
CPPUNIT_TEST(testTdf143222_embeddedWorksheet);
+ CPPUNIT_TEST(testTdf143315);
CPPUNIT_TEST_SUITE_END();
@@ -3319,6 +3321,30 @@ void SdOOXMLExportTest2::testTdf143222_embeddedWorksheet()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::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(SdOOXMLExportTest2);
More information about the Libreoffice-commits
mailing list