sd/source/filter/eppt/eppt.cxx | 10 +++++++++- sd/source/filter/eppt/epptbase.hxx | 2 ++ sd/source/filter/eppt/pptx-epptbase.cxx | 13 +++++++++++++ sd/source/filter/eppt/pptx-epptooxml.cxx | 6 +++++- 4 files changed, 29 insertions(+), 2 deletions(-)
New commits: commit d0dbf0153f34d57c839acca8fbaca0118b3a6048 Author: Mohit Marathe <[email protected]> AuthorDate: Fri Nov 28 21:17:23 2025 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Tue Dec 2 11:48:19 2025 +0100 sd: do not export canvas page to pptx Signed-off-by: Mohit Marathe <[email protected]> Change-Id: I82c078bda9bb2b7cb6ac634d4296031beeb59f71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194880 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 1d7d564de8f6..be5a99cd02a7 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -100,7 +100,7 @@ void PPTWriter::exportPPTPre( const std::vector< css::beans::PropertyValue >& rM if ( mXStatusIndicator.is() ) { mbStatusIndicator = true; - mnStatMaxValue = ( mnPages + mnMasterPages ) * 5; + mnStatMaxValue = ( mnPages + mnMasterPages - (2 * static_cast<int>(mbHasCanvasPage)) ) * 5; mXStatusIndicator->start( u"PowerPoint Export"_ustr, mnStatMaxValue + ( mnStatMaxValue >> 3 ) ); } @@ -709,6 +709,8 @@ bool PPTWriter::ImplCreateDocument() for ( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom ); mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() ); mpStrm->WriteUInt32( 0 ) // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY ) @@ -734,6 +736,8 @@ bool PPTWriter::ImplCreateDocument() mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // animation information for the notes for( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom ); mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() ); mpStrm->WriteUInt32( 0 ) @@ -1323,6 +1327,8 @@ void PPTWriter::ImplWriteAtomEnding() // write slide persists -> we have to write a valid value into EPP_SlidePersistAtome too for ( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i ); if ( nOfs ) { @@ -1333,6 +1339,8 @@ void PPTWriter::ImplWriteAtomEnding() // write Notes persists for ( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i ); if ( nOfs ) { diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx index 70bcd3a4b6ce..0c06e55c275c 100644 --- a/sd/source/filter/eppt/epptbase.hxx +++ b/sd/source/filter/eppt/epptbase.hxx @@ -342,6 +342,8 @@ protected: bool mbIsBackgroundDark; sal_Int32 mnAngle; + bool mbHasCanvasPage; + sal_uInt32 mnPages; ///< number of Slides ( w/o master pages & notes & handout ) sal_uInt32 mnMasterPages; diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx index 0b3205eb38cb..8bea54bd1124 100644 --- a/sd/source/filter/eppt/pptx-epptbase.cxx +++ b/sd/source/filter/eppt/pptx-epptbase.cxx @@ -204,6 +204,8 @@ void PPTWriterBase::exportPPT( const std::vector< css::beans::PropertyValue >& r for ( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; SAL_INFO("sd.eppt", "call ImplCreateSlide( " << i << " )"); if ( !CreateSlide( i ) ) return; @@ -211,6 +213,8 @@ void PPTWriterBase::exportPPT( const std::vector< css::beans::PropertyValue >& r for ( i = 0; i < mnPages; i++ ) { + if (mbHasCanvasPage && i == 0) + continue; if ( !CreateNotes( i ) ) return; } @@ -241,6 +245,15 @@ bool PPTWriterBase::InitSOIface() if ( !GetPageByIndex( 0, NORMAL ) ) break; + SdXImpressDocument* pModel = comphelper::getFromUnoTunnel<SdXImpressDocument>(mXModel); + if (pModel) + { + SdDrawDocument* pDoc = pModel->GetDoc(); + if (pDoc && pDoc->HasCanvasPage()) + mbHasCanvasPage = true; + else + mbHasCanvasPage = false; + } return true; } return false; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index e5f701f9b626..2b8f81d12b22 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1721,7 +1721,9 @@ void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum SAL_INFO("sd.eppt", "write slide: " << nPageNum << " ----------------"); // slides list - if (nPageNum == 0) + if (!mbHasCanvasPage && nPageNum == 0) + mPresentationFS->startElementNS(XML_p, XML_sldIdLst); + else if (mbHasCanvasPage && nPageNum == 1) mPresentationFS->startElementNS(XML_p, XML_sldIdLst); // add explicit relation of presentation to this slide @@ -2716,6 +2718,8 @@ bool PowerPointExport::ImplCreateDocument() for (sal_uInt32 i = 0; i < mnPages; i++) { + if (mbHasCanvasPage && i == 0) + continue; if (!GetPageByIndex(i, NOTICE)) return false;
