oox/source/ppt/presentationfragmenthandler.cxx |    7 -
 sd/qa/unit/export-tests-ooxml2.cxx             |    6 -
 sd/qa/unit/export-tests-ooxml3.cxx             |    4 
 sd/source/filter/eppt/epptooxml.hxx            |    4 
 sd/source/filter/eppt/pptx-epptooxml.cxx       |  128 +------------------------
 sd/source/ui/inc/unopage.hxx                   |    1 
 sd/source/ui/unoidl/unopage.cxx                |   13 --
 7 files changed, 17 insertions(+), 146 deletions(-)

New commits:
commit 6c6ed62a98ee180236b60047f21c4584a323c931
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Sun Dec 10 10:44:23 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Dec 11 15:54:51 2023 +0100

    tdf#158513: Revert "tdf#155512: sd: filter: eppt: add "SlideLayout"
    
    This reverts commit c8d8d3bffec73e965ca3b9b30c4d74515e2d0d4e.
    
    https://bugs.documentfoundation.org/show_bug.cgi?id=158513
    
    1. Open example PPTX in Impress
    2. Save from Impress.
    3. Open just saved version in Impress again.
    4. Observe how the background is gone.
    
    Unit test adjustment:
    
    SdOOXMLExportTest2::testAccentColor()
    Now all slide masters are imported, so when saves and reload same
    document, the reference theme has changed.
    
    Change-Id: I9cdcb585b1143c2c76feea10fee71d6b83f698df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160569
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Henry Castro <hcas...@collabora.com>

diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 91824210e239..1586a8a26174 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -212,11 +212,11 @@ void PresentationFragmentHandler::importMasterSlide(const 
Reference<frame::XMode
 
     for (const auto& rEntry : *xMasterRelations)
     {
+        aLayoutFragmentPath = 
xMasterRelations->getFragmentPathFromRelation(rEntry.second);
+
         if (!rEntry.second.maType.endsWith("relationships/slideLayout"))
             continue;
 
-        aLayoutFragmentPath = 
xMasterRelations->getFragmentPathFromRelation(rEntry.second);
-
         sal_Int32 nIndex;
         if( rFilter.getMasterPages().empty() )
         {
@@ -271,9 +271,6 @@ void PresentationFragmentHandler::importMasterSlide(const 
Reference<frame::XMode
         pMasterPersistPtr->createBackground( rFilter );
         pMasterPersistPtr->createXShapes( rFilter );
 
-        uno::Reference< beans::XPropertySet > 
xSet(pMasterPersistPtr->getPage(), uno::UNO_QUERY_THROW);
-        xSet->setPropertyValue("SlideLayout", 
Any(pMasterPersistPtr->getLayoutFromValueToken()));
-
         oox::drawingml::ThemePtr pTheme = pMasterPersistPtr->getTheme();
         if (pTheme)
         {
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 47efaea2fe55..9d572a8ee10c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1462,7 +1462,7 @@ void SdOOXMLExportTest2::testTdf106867()
                 
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
                 
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
                 "p:cBhvr/p:tgtEl/p:spTgt",
-                "spid", "42");
+                "spid", "455");
 }
 
 void SdOOXMLExportTest2::testTdf112280()
@@ -1841,7 +1841,7 @@ void SdOOXMLExportTest2::testAccentColor()
     xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
     assertXPath(pXmlDocTheme1, 
"/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
                 "70ad47");
-    xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
+    xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme24.xml");
     assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val",
                 "deb340");
 
@@ -1858,7 +1858,7 @@ void SdOOXMLExportTest2::testThemeColors()
     createSdImpressDoc("pptx/tdf84205.pptx");
     save("Impress Office Open XML");
 
-    xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme1.xml");
+    xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
     assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
                 "44546a");
     assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:accent3/a:srgbClr", "val",
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 0c9ab10203e0..dd0945bd4c40 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -288,6 +288,10 @@ void SdOOXMLExportTest3::testTdf114848()
     xmlDocUniquePtr pXmlDocTheme1 = parseExport("ppt/theme/theme1.xml");
     assertXPath(pXmlDocTheme1, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
                 "1f497d");
+    xmlDocUniquePtr pXmlDocTheme2 = parseExport("ppt/theme/theme2.xml");
+
+    assertXPath(pXmlDocTheme2, 
"/a:theme/a:themeElements/a:clrScheme/a:dk2/a:srgbClr", "val",
+                "1f497d");
 }
 
 void SdOOXMLExportTest3::testTdf147586()
diff --git a/sd/source/filter/eppt/epptooxml.hxx 
b/sd/source/filter/eppt/epptooxml.hxx
index 6d804c80cf1f..0c7644c72b3d 100644
--- a/sd/source/filter/eppt/epptooxml.hxx
+++ b/sd/source/filter/eppt/epptooxml.hxx
@@ -131,8 +131,6 @@ private:
     css::uno::Reference<css::drawing::XShape> 
GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) 
const;
     void WritePlaceholderReferenceShapes(PowerPointShapeExport& rDML, PageType 
ePageType);
 
-    long FindEquivalentMasterPage(SdrPage* pMasterPage) const;
-
     /// Should we export as .pptm, ie. do we contain macros?
     bool mbPptm;
 
@@ -142,14 +140,12 @@ private:
     ::sax_fastparser::FSHelperPtr mPresentationFS;
 
     LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
-    std::vector<std::pair<SdrPage*, size_t>> mpSlidesMaster;
     std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
     sal_Int32 mnLayoutFileIdMax;
 
     sal_uInt32 mnSlideIdMax;
     sal_uInt32 mnSlideMasterIdMax;
     sal_uInt32 mnAnimationNodeIdMax;
-    sal_uInt32 mnThemeIdMax;
 
     sal_uInt32 mnDiagramId;
 
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 1e7b70501870..437434c201fe 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -25,8 +25,6 @@
 #include <oox/ole/vbaproject.hxx>
 #include "epptooxml.hxx"
 #include <oox/export/shapes.hxx>
-#include <svx/svdlayer.hxx>
-#include <unokywds.hxx>
 
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/storagehelper.hxx>
@@ -42,8 +40,6 @@
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/XDrawPages.hpp>
 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
-#include <com/sun/star/drawing/XMasterPageTarget.hpp>
-#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/geometry/RealPoint2D.hpp>
 #include <com/sun/star/office/XAnnotationEnumeration.hpp>
@@ -392,7 +388,6 @@ PowerPointExport::PowerPointExport(const Reference< 
XComponentContext >& rContex
     , mnSlideIdMax(1 << 8)
     , mnSlideMasterIdMax(1U << 31)
     , mnAnimationNodeIdMax(1)
-    , mnThemeIdMax(0)
     , mnDiagramId(1)
     , mbCreateNotes(false)
     , mnPlaceholderIndexMax(1)
@@ -1494,111 +1489,8 @@ void PowerPointExport::AddLayoutIdAndRelation(const 
FSHelperPtr& pFS, sal_Int32
                          FSNS(XML_r, XML_id), sRelId);
 }
 
-static bool lcl_ContainsEquivalentObject(SdrPage* pPage, SdrObject* pObj)
-{
-    bool bFound = false;
-    SdrObject* pObjNext;
-
-    if (!pPage || !pObj)
-        return bFound;
-
-    for (size_t nObj = 0; nObj < pPage->GetObjCount(); ++nObj)
-    {
-        pObjNext = pPage->GetObj(nObj);
-        if (pObjNext && pObjNext->GetMergedItemSet().Equals(
-                pObj->GetMergedItemSet(), false))
-        {
-            bFound = true;
-            break;
-        }
-    }
-
-    return bFound;
-}
-
-static bool lcl_ComparePageObjects(SdrPage* pMasterPage, SdrPage* pMasterNext)
-{
-    if (!pMasterPage || !pMasterNext)
-        return false;
-
-    bool bFound = true;
-    SdrObject* pObjNext;
-    SdrLayerID aLayer =
-        
pMasterNext->GetLayerAdmin().GetLayerID(sUNO_LayerName_background_objects);
-
-    for (size_t nObj = 0; nObj < pMasterPage->GetObjCount(); ++nObj)
-    {
-        pObjNext = pMasterPage->GetObj(nObj);
-        if (!pObjNext || pObjNext->GetLayer() == aLayer)
-            continue;
-
-        if (!lcl_ContainsEquivalentObject(pMasterNext, pObjNext))
-        {
-            bFound = false;
-            break;
-        }
-    }
-
-    return bFound;
-}
-
-long PowerPointExport::FindEquivalentMasterPage(SdrPage* pMasterPage) const
-{
-    SdrPage* pMasterNext;
-    long nFound = -1;
-
-    if (!pMasterPage)
-        return nFound;
-
-    for (size_t nMaster = 0; nMaster < mpSlidesMaster.size(); ++nMaster)
-    {
-        pMasterNext = mpSlidesMaster[nMaster].first;
-        if (!pMasterNext)
-            continue;
-
-        if (pMasterNext->getSdrPageProperties().GetItemSet().Equals(
-                pMasterPage->getSdrPageProperties().GetItemSet(), false) &&
-            lcl_ComparePageObjects(pMasterPage, pMasterNext))
-        {
-            nFound = nMaster;
-            break;
-        }
-    }
-
-    return nFound;
-}
-
 void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< 
XPropertySet > const& aXBackgroundPropSet)
 {
-    SdrPage* pMasterPage = SdPage::getImplementation(mXDrawPage);
-    if (!pMasterPage)
-        return;
-
-    uno::Reference<beans::XPropertySet> xPropSet(mXDrawPage, 
uno::UNO_QUERY_THROW);
-    if (!xPropSet.is())
-        return;
-
-    sal_Int32 nLayout;
-    Any aLayout = xPropSet->getPropertyValue("SlideLayout");
-    long nFound = FindEquivalentMasterPage(pMasterPage);
-    if (aLayout.hasValue() && nFound != -1)
-    {
-        aLayout >>= nLayout;
-        size_t nOffset = GetPPTXLayoutId(nLayout);
-
-        if (mLayoutInfo[nOffset].mnFileIdArray.size() < mnMasterPages)
-        {
-            mLayoutInfo[nOffset].mnFileIdArray.resize(mnMasterPages);
-        }
-
-        mLayoutInfo[nOffset].mnFileIdArray[nPageNum] = 
mpSlidesMaster[nFound].second;
-
-        if (nPageNum == mnMasterPages - 1)
-            mPresentationFS->endElementNS(XML_p, XML_sldMasterIdLst);
-
-        return;
-    }
-
     SAL_INFO("sd.eppt", "write master slide: " << nPageNum << 
"\n--------------");
 
     // slides list
@@ -1621,7 +1513,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
                                           OUString::number(nPageNum + 1) + 
".xml",
                                          
"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml");
 
-
+    SdrPage* pMasterPage = SdPage::getImplementation(mXDrawPage);
     model::Theme* pTheme = nullptr;
     if (pMasterPage)
     {
@@ -1629,12 +1521,12 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
     }
 
     // write theme per master
-    WriteTheme(mnThemeIdMax, pTheme);
+    WriteTheme(nPageNum, pTheme);
 
     // add implicit relation to the presentation theme
     addRelation(pFS->getOutputStream(),
                 oox::getRelationship(Relationship::THEME),
-                Concat2View("../theme/theme" + 
OUString::number(++mnThemeIdMax) + ".xml"));
+                Concat2View("../theme/theme" + OUString::number(nPageNum + 1) 
+ ".xml"));
 
     pFS->startElementNS(XML_p, XML_sldMaster, PNMSS);
 
@@ -1678,13 +1570,6 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
         }
     }
 
-    if (aLayout.hasValue())
-    {
-        aLayout >>= nLayout;
-        mpSlidesMaster.push_back(std::make_pair(pMasterPage,
-                                                
GetLayoutFileId(GetPPTXLayoutId(nLayout), nPageNum)));
-    }
-
     pFS->endElementNS(XML_p, XML_sldLayoutIdLst);
 
     pFS->endElementNS(XML_p, XML_sldMaster);
@@ -2383,11 +2268,10 @@ Reference<XShape> 
PowerPointExport::GetReferencedPlaceholderXShape(const Placeho
         }
         else
         {
-            SdrPage* pPage = 
&SdPage::getImplementation(mXDrawPage)->TRG_GetMasterPage();
-            long nFound = FindEquivalentMasterPage(pPage);
-            pMasterPage = dynamic_cast<SdPage*>(nFound != -1 ? 
mpSlidesMaster[nFound].first : pPage);
+            pMasterPage
+                = 
&static_cast<SdPage&>(SdPage::getImplementation(mXDrawPage)->TRG_GetMasterPage());
         }
-        if (SdrObject* pMasterFooter = (pMasterPage ? 
pMasterPage->GetPresObj(ePresObjKind) : nullptr))
+        if (SdrObject* pMasterFooter = pMasterPage->GetPresObj(ePresObjKind))
             return GetXShapeForSdrObject(pMasterFooter);
     }
     return nullptr;
diff --git a/sd/source/ui/inc/unopage.hxx b/sd/source/ui/inc/unopage.hxx
index f2d646817536..1eb3cb6d83b1 100644
--- a/sd/source/ui/inc/unopage.hxx
+++ b/sd/source/ui/inc/unopage.hxx
@@ -56,7 +56,6 @@ private:
     SdrModel* mpSdrModel;
     bool      mbIsImpressDocument;
     sal_Int16 mnTempPageNumber; // for printing handouts
-    css::uno::Any  mSlideLayout;  // import slide layout pptx
     const SvxItemPropertySet*   mpPropSet;
 
     void UpdateModel();
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index cc52acf448a3..d23ba1ad2e0e 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -103,8 +103,7 @@ enum WID_PAGE
     WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, 
WID_PAGE_DATETIMEFIXED,
     WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, 
WID_TRANSITION_SUBTYPE,
     WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, 
WID_TRANSITION_DURATION, WID_LOOP_SOUND,
-    WID_NAVORDER, WID_PAGE_PREVIEWMETAFILE, WID_PAGE_THEME, 
WID_PAGE_THEME_UNO_REPRESENTATION,
-    WID_PAGE_SLIDE_LAYOUT
+    WID_NAVORDER, WID_PAGE_PREVIEWMETAFILE, WID_PAGE_THEME, 
WID_PAGE_THEME_UNO_REPRESENTATION
 };
 
 }
@@ -285,8 +284,7 @@ static const SvxItemPropertySet* 
ImplGetMasterPagePropertySet( PageKind ePageKin
         { u"IsBackgroundDark",             WID_PAGE_ISDARK,    
cppu::UnoType<bool>::get(),                        
beans::PropertyAttribute::READONLY, 0},
         { u"Theme", WID_PAGE_THEME, cppu::UnoType<util::XTheme>::get(), 0,  0},
         // backwards compatible view of the theme for use in tests
-        { u"ThemeUnoRepresentation", WID_PAGE_THEME_UNO_REPRESENTATION, 
cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get(), 0,  0},
-        { u"SlideLayout",            WID_PAGE_SLIDE_LAYOUT,    
::cppu::UnoType<sal_Int16>::get(),            0,  0}
+        { u"ThemeUnoRepresentation", WID_PAGE_THEME_UNO_REPRESENTATION, 
cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get(), 0,  0}
     };
 
     static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
@@ -593,7 +591,6 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const 
OUString& aPropertyName
         case WID_PAGE_TOP:
         case WID_PAGE_BOTTOM:
         case WID_PAGE_LAYOUT:
-        case WID_PAGE_SLIDE_LAYOUT:
         case WID_PAGE_DURATION:
         case WID_PAGE_CHANGE:
         {
@@ -621,9 +618,6 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const 
OUString& aPropertyName
             case WID_PAGE_LAYOUT:
                 GetPage()->SetAutoLayout( static_cast<AutoLayout>(nValue), 
true );
                 break;
-            case WID_PAGE_SLIDE_LAYOUT:
-                mSlideLayout <<= nValue;
-                break;
             case WID_PAGE_DURATION:
                 GetPage()->SetTime(nValue);
                 break;
@@ -1063,9 +1057,6 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const 
OUString& PropertyName )
     case WID_PAGE_LAYOUT:
         aAny <<= static_cast<sal_Int16>( GetPage()->GetAutoLayout() );
         break;
-    case WID_PAGE_SLIDE_LAYOUT:
-        aAny = mSlideLayout;
-        break;
     case WID_PAGE_NUMBER:
         {
             const sal_uInt16 nPageNumber(GetPage()->GetPageNum());

Reply via email to