diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/tdf159666.odg | bin | 0 -> 20613 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml4.cxx | 45 | ||||
-rw-r--r-- | sd/qa/unit/uiimpress.cxx | 21 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 38 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 8 |
5 files changed, 102 insertions, 10 deletions
diff --git a/sd/qa/unit/data/tdf159666.odg b/sd/qa/unit/data/tdf159666.odg Binary files differnew file mode 100644 index 0000000000..6b407597f7 --- /dev/null +++ b/sd/qa/unit/data/tdf159666.odg diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index c4c061c50d..06cc2805d6 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1095,6 +1095,51 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf157740_slideMasters) assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId"_ostr, 1); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf159931_slideLayouts) +{ + createSdImpressDoc("odp/repeatBitmapMode.odp"); + save("Impress Office Open XML"); + + xmlDocUniquePtr pXmlDocRels1 = parseExport("ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels2 = parseExport("ppt/slides/_rels/slide2.xml.rels"); + + assertXPath( + pXmlDocRels1, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); + + // the relative target e.g. "../slideLayouts/slideLayout2.xml" + OUString sRelativeLayoutPath1 = getXPathContent( + pXmlDocRels1, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); + + assertXPath( + pXmlDocRels2, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); + + // the relative target e.g. "../slideLayouts/slideLayout1.xml" + OUString sRelativeLayoutPath2 = getXPathContent( + pXmlDocRels2, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); + + uno::Reference<packages::zip::XZipFileAccess2> xNameAccess + = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + + // Check that the referenced slideLayout files exist + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 1 + // - Actual : 0 + // i.e. the referenced slideLayout file was missing on export. + OUString sSlideLayoutName1 = sRelativeLayoutPath1.getToken(2, '/'); + OUString sSlideLayoutName2 = sRelativeLayoutPath2.getToken(2, '/'); + + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName1))); + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName2))); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 41c685feef..d03e85dab6 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -288,6 +288,27 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf124708) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(16), pActualPage->GetObjCount()); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf159666) +{ + createSdDrawDoc("tdf159666.odg"); + + auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), pActualPage->GetObjCount()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Delete", {}); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pActualPage->GetObjCount()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), pActualPage->GetObjCount()); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf143412) { createSdImpressDoc(); diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 2148653dcd..96f135ecf5 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -63,6 +63,7 @@ #include "../ppt/pptanimations.hxx" #include <i18nlangtag/languagetag.hxx> +#include <svx/sdrmasterpagedescriptor.hxx> #include <svx/svdpage.hxx> #include <svx/unoapi.hxx> #include <svx/svdogrp.hxx> @@ -1515,23 +1516,48 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro // use master's id type as they have same range, mso does that as well pFS->startElementNS(XML_p, XML_sldLayoutIdLst); - sal_Int32 nLayout = 0; - OUString aSlideName; - css::uno::Reference< css::beans::XPropertySet >xPagePropSet; + auto getLayoutsUsedForMaster = [](SdrPage* pMaster) -> std::unordered_set<sal_Int32> + { + if (!pMaster) + return {}; + + std::unordered_set<sal_Int32> aUsedLayouts{}; + for (const auto* pPageUser : pMaster->GetPageUsers()) + { + const auto* pMasterPageDescriptor + = dynamic_cast<const sdr::MasterPageDescriptor*>(pPageUser); + + if (!pMasterPageDescriptor) + continue; + + AutoLayout eLayout + = static_cast<SdPage&>(pMasterPageDescriptor->GetOwnerPage()).GetAutoLayout(); + aUsedLayouts.insert(eLayout); + } + return aUsedLayouts; + }; + + std::unordered_set<sal_Int32> aLayouts = getLayoutsUsedForMaster(pMasterPage); + + css::uno::Reference< css::beans::XPropertySet > xPagePropSet; xPagePropSet.set(mXDrawPage, UNO_QUERY); if (xPagePropSet.is()) { uno::Any aAny; if (GetPropertyValue(aAny, xPagePropSet, "SlideLayout")) - aAny >>= nLayout; + aLayouts.insert(aAny.get<sal_Int32>()); } + OUString aSlideName; Reference< XNamed > xNamed(mXDrawPage, UNO_QUERY); if (xNamed.is()) aSlideName = xNamed->getName(); - ImplWritePPTXLayout(nLayout, nPageNum, aSlideName); - AddLayoutIdAndRelation(pFS, GetLayoutFileId(nLayout, nPageNum)); + for (auto nLayout : aLayouts) + { + ImplWritePPTXLayout(nLayout, nPageNum, aSlideName); + AddLayoutIdAndRelation(pFS, GetLayoutFileId(nLayout, nPageNum)); + } pFS->endElementNS(XML_p, XML_sldLayoutIdLst); diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 39b3d488d2..bb08f33c44 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -310,12 +310,10 @@ void CustomAnimationListEntryItem::PaintTrigger(vcl::RenderContext& rRenderConte ::tools::Rectangle aOutRect(rRect); - // fill the background - Color aColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor()); - rRenderContext.Push(); - rRenderContext.SetFillColor(aColor); + rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogColor()); rRenderContext.SetLineColor(); + // fill the background with the dialog bg color rRenderContext.DrawRect(aOutRect); // Erase the four corner pixels to make the rectangle appear rounded. @@ -335,6 +333,8 @@ void CustomAnimationListEntryItem::PaintTrigger(vcl::RenderContext& rRenderConte aOutRect.AdjustTop( nVertBorder ); aOutRect.AdjustBottom( -nVertBorder ); + // Draw the text with the dialog text color + rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetDialogTextColor()); rRenderContext.DrawText(aOutRect, rRenderContext.GetEllipsisString(msDescription, aOutRect.GetWidth())); rRenderContext.Pop(); } |