diff options
author | nd101 <Fong@nd.com.cn> | 2020-03-12 12:07:56 +0800 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-26 17:54:03 +0100 |
commit | f1b5e0422b421de39c9fee9a87b6fceee8e48bbd (patch) | |
tree | 9904a89ecbd38e553ed278282abb8689c127447c /filter/source | |
parent | f516c0bd3bb69bf9f18160c03bd7309774f88057 (diff) |
tdf#131269 - fix importing PPT with different notes/presentations order
Normal PPT has the order of master-presentation-note slides. But for
certain PPT document, the order is master-note-presentation.
This fix is to change the importing of page list for those documents
with different structure.
Change-Id: I2d682a30a3550a6182fcfff7f71f4993ca27a5f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90362
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 36e58f2438f1..09e69e9fcb6a 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1509,12 +1509,21 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O DffRecordHeader* pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText ); PptSlidePersistEntry* pPreviousPersist = nullptr; + DffRecordHeader* pSlideListHd = aDocRecManager.GetRecordHeader(PPT_PST_List); + sal_uLong nPSTList = 0; + if (pSlideListHd) nPSTList = pSlideListHd->GetRecBegFilePos(); + sal_uInt16 nRealPageNum = 0; + // Normal PPT document has order of Master slides - Presentation slides - Note slides + // for document with the order of Master slides - Note slides - Presentation slides + // we need to swap the later two sections + bool notePresentationSwap = false; for (sal_uInt16 nPageListNum = 0; pSlideListWithTextHd && nPageListNum < 3; ++nPageListNum) { pSlideListWithTextHd->SeekToContent( rStCtrl ); - PptSlidePersistList* pPageList = GetPageList( PptPageKind( nPageListNum ) ); + PptSlidePersistList* pPageList = nullptr; sal_uInt32 nSlideListWithTextHdEndOffset = pSlideListWithTextHd->GetRecEndFilePos(); + nRealPageNum = nPageListNum; while ( SeekToRec( rStCtrl, PPT_PST_SlidePersistAtom, nSlideListWithTextHdEndOffset ) ) { if ( pPreviousPersist ) @@ -1522,8 +1531,23 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry); ReadPptSlidePersistAtom( rStCtrl, pE2->aPersistAtom ); pE2->nSlidePersistStartOffset = rStCtrl.Tell(); - pE2->ePageKind = PptPageKind( nPageListNum ); + // Note/Presentation section swap + if (nPageListNum == 1 && pE2->nSlidePersistStartOffset < nPSTList) + { + notePresentationSwap = true; + } + if (notePresentationSwap) + { + if (nPageListNum == 1) nRealPageNum = 2; + else if (nPageListNum == 2) nRealPageNum = 1; + } + + pE2->ePageKind = PptPageKind(nRealPageNum); pPreviousPersist = pE2.get(); + if (!pPageList) + { + pPageList = GetPageList(PptPageKind(nRealPageNum)); + } pPageList->push_back(std::move(pE2)); } if ( pPreviousPersist ) |