sd: adjust theme ids when exporting notes to PPTX
Previous numbering was from before the
deduplication in commit
9205b4eb09.
Deduplication collapses themes for the same master
to a single XML, and the theme for notes master
didn't follow in numbering, causing a big gap,
eg. theme1.xml being followed by theme13.xml.
Use mnThemeIdMax introduced there.
Change-Id: I5e9ddb11716543bc816d47f5aac03bb2f182dc62
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13448
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit a1f3059174fa5ff51d258b5a2125884cb1b4e23b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211513
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
@@ -1456,6 +1456,38 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf157740_slideMasters)
|
||||
assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId", 7);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testNotesMasterThemeNoAfterDeduplicatedMasters)
|
||||
{
|
||||
createSdImpressDoc("n759180.pptx");
|
||||
save(TestFilter::PPTX);
|
||||
|
||||
xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/presentation.xml"_ustr);
|
||||
assertXPath(pXmlDocContent, "/p:presentation/p:sldMasterIdLst/p:sldMasterId", 1);
|
||||
|
||||
xmlDocUniquePtr pXmlDocRels = parseExport(u"ppt/slideMasters/_rels/slideMaster1.xml.rels"_ustr);
|
||||
assertXPath(pXmlDocRels,
|
||||
"/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/"
|
||||
"officeDocument/2006/relationships/theme']",
|
||||
"Target", u"../theme/theme1.xml");
|
||||
|
||||
// The one slide master of this document has 12 layouts, which are imported as 12 master pages
|
||||
// and written back as one slide master. The notes master theme takes the number after the slide
|
||||
// master theme, as in the original file, without a gap for the master pages that were merged.
|
||||
// Without the change in place, this test would have failed with:
|
||||
// - Expected: ../theme/theme2.xml
|
||||
// - Actual : ../theme/theme13.xml
|
||||
pXmlDocRels = parseExport(u"ppt/notesMasters/_rels/notesMaster1.xml.rels"_ustr);
|
||||
assertXPath(pXmlDocRels,
|
||||
"/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/"
|
||||
"officeDocument/2006/relationships/theme']",
|
||||
"Target", u"../theme/theme2.xml");
|
||||
|
||||
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
|
||||
= packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
|
||||
maTempFile.GetURL());
|
||||
CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName(u"ppt/theme/theme2.xml"_ustr)));
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf159931_slideLayouts)
|
||||
{
|
||||
createSdImpressDoc("odp/repeatBitmapMode.odp");
|
||||
|
||||
@@ -3330,12 +3330,12 @@ void PowerPointExport::WriteNotesMaster()
|
||||
auto pTheme = std::make_shared<model::Theme>("Office Theme");
|
||||
pTheme->setColorSet(std::make_shared<model::ColorSet>(*pDefaultColorSet));
|
||||
|
||||
WriteTheme(mnMasterPages - static_cast<int>(mbHasCanvasPage), pTheme.get());
|
||||
WriteTheme(mnThemeIdMax, pTheme.get());
|
||||
|
||||
// add implicit relation to the presentation theme
|
||||
addRelation(pFS->getOutputStream(),
|
||||
oox::getRelationship(Relationship::THEME),
|
||||
Concat2View("../theme/theme" + OUString::number(mnMasterPages + 1 - static_cast<int>(mbHasCanvasPage)) + ".xml"));
|
||||
Concat2View("../theme/theme" + OUString::number(++mnThemeIdMax) + ".xml"));
|
||||
}
|
||||
|
||||
pFS->startElementNS(XML_p, XML_notesMaster, presentationNamespaces(*this));
|
||||
|
||||
Reference in New Issue
Block a user