diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 97116c2dd5f8..99ec6d476e11 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -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 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"); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 9843f5ed8785..4a7152993130 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -3330,12 +3330,12 @@ void PowerPointExport::WriteNotesMaster() auto pTheme = std::make_shared("Office Theme"); pTheme->setColorSet(std::make_shared(*pDefaultColorSet)); - WriteTheme(mnMasterPages - static_cast(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(mbHasCanvasPage)) + ".xml")); + Concat2View("../theme/theme" + OUString::number(++mnThemeIdMax) + ".xml")); } pFS->startElementNS(XML_p, XML_notesMaster, presentationNamespaces(*this));