summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2023-10-09 07:34:02 -0400
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-29 21:47:19 +0100
commitd23176dc22ab3ef7291757aca779f80f0cf0576b (patch)
tree0a991263b9995a1198b7b1b09912d409d58322eb /oox
parentc8d8d3bffec73e965ca3b9b30c4d74515e2d0d4e (diff)
tdf#155512: oox: ppt: fix import master slides, follow up
Import all master slides. Signed-off-by: Henry Castro <hcastro@collabora.com> Change-Id: Ieac68bacf15c75e4c23ec692aadcb16033cdd092 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157701 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx37
1 files changed, 20 insertions, 17 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 80fb6c6689a7..91824210e239 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -199,13 +199,12 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>&
}
}
-SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference<frame::XModel>& xModel,
- PowerPointImport& rFilter,
- const OUString& rLayoutFragmentPath,
- const OUString& rMasterFragmentPath)
+void PresentationFragmentHandler::importMasterSlide(const Reference<frame::XModel>& xModel,
+ PowerPointImport& rFilter,
+ const OUString& rMasterFragmentPath)
{
OUString aLayoutFragmentPath;
- SlidePersistPtr pMasterPersistPtr, pMasterPtr;
+ SlidePersistPtr pMasterPersistPtr;
Reference< drawing::XDrawPage > xMasterPage;
Reference< drawing::XMasterPagesSupplier > xMPS( xModel, uno::UNO_QUERY_THROW );
Reference< drawing::XDrawPages > xMasterPages( xMPS->getMasterPages(), uno::UNO_SET_THROW );
@@ -280,14 +279,7 @@ SlidePersistPtr PresentationFragmentHandler::importMasterSlide(const Reference<f
{
pTheme->addTheme(pMasterPersistPtr->getPage());
}
-
- if (pMasterPersistPtr->getLayoutPath() == rLayoutFragmentPath)
- {
- pMasterPtr = pMasterPersistPtr;
- }
}
-
- return pMasterPtr;
}
void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr,
@@ -356,6 +348,19 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme
}
}
+void PresentationFragmentHandler::importMasterSlides()
+{
+ OUString aMasterFragmentPath;
+ PowerPointImport& rFilter = dynamic_cast<PowerPointImport&>(getFilter());
+ Reference<frame::XModel> xModel(rFilter.getModel());
+
+ for (sal_uInt32 nMaster = 0; nMaster < maSlideMasterVector.size(); ++nMaster)
+ {
+ aMasterFragmentPath = getFragmentPathFromRelId(maSlideMasterVector[nMaster]);
+ importMasterSlide(xModel, rFilter, aMasterFragmentPath);
+ }
+}
+
void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage, bool bImportNotesPage)
{
PowerPointImport& rFilter = dynamic_cast< PowerPointImport& >( getFilter() );
@@ -370,7 +375,10 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
try {
if( bFirstPage )
+ {
xDrawPages->getByIndex( 0 ) >>= xSlide;
+ importMasterSlides();
+ }
else
xSlide = xDrawPages->insertNewByIndex( xDrawPages->getCount() );
@@ -403,11 +411,6 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
break;
}
}
-
- if ( !pMasterPersistPtr )
- { // masterpersist not found, we have to load it
- pMasterPersistPtr = importMasterSlide(xModel, rFilter, aLayoutFragmentPath, aMasterFragmentPath);
- }
}
}