[Libreoffice-commits] core.git: filter/source include/filter

Caolán McNamara caolanm at redhat.com
Thu Jan 4 21:06:03 UTC 2018


 filter/source/msfilter/svdfppt.cxx  |   34 ++++++++++++++--------------------
 include/filter/msfilter/svdfppt.hxx |    4 ++--
 2 files changed, 16 insertions(+), 22 deletions(-)

New commits:
commit 85cbefac5bb6631927e29aac9e27fbf07a280a4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 4 09:56:10 2018 +0000

    migrate to std::unique_ptr
    
    Change-Id: I4986d3e2893554bc875e64a1f27f9203814f4d55
    Reviewed-on: https://gerrit.libreoffice.org/47374
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 7f5e7a024e36..bc1ccb59f2dd 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -499,8 +499,6 @@ SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom )
 }
 
 PptSlidePersistEntry::PptSlidePersistEntry() :
-    pStyleSheet             ( nullptr ),
-    pSolverContainer        ( nullptr ),
     nSlidePersistStartOffset( 0 ),
     nSlidePersistEndOffset  ( 0 ),
     nBackgroundOffset       ( 0 ),
@@ -515,12 +513,9 @@ PptSlidePersistEntry::PptSlidePersistEntry() :
     HeaderFooterOfs[ 0 ] =  HeaderFooterOfs[ 1 ] = HeaderFooterOfs[ 2 ] = HeaderFooterOfs[ 3 ] = 0;
 }
 
-
 PptSlidePersistEntry::~PptSlidePersistEntry()
 {
-    delete pStyleSheet;
-    delete pSolverContainer;
-};
+}
 
 SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString& rBaseURL ) :
     SvxMSDffManager         ( rParam.rDocStream, rBaseURL ),
@@ -1242,9 +1237,9 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
         {
             pRet->NbcSetSnapRect( tools::Rectangle( Point(), rData.pPage.page->GetSize() ) );   // set size
         }
-        if ( rPersistEntry.pSolverContainer )
+        if (rPersistEntry.xSolverContainer)
         {
-            for (SvxMSDffConnectorRule* pPtr : rPersistEntry.pSolverContainer->aCList)
+            for (SvxMSDffConnectorRule* pPtr : rPersistEntry.xSolverContainer->aCList)
             {
                 if ( rObjData.nShapeId == pPtr->nShapeC )
                     pPtr->pCObj = pRet;
@@ -1587,8 +1582,8 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
                                     }
                                     if ( SeekToRec( rStCtrl, DFF_msofbtSolverContainer, aPPTDgContainer.GetRecEndFilePos() ) )
                                     {
-                                        rE2.pSolverContainer = new SvxMSDffSolverContainer;
-                                        ReadSvxMSDffSolverContainer( rStCtrl, *( rE2.pSolverContainer ) );
+                                        rE2.xSolverContainer.reset(new SvxMSDffSolverContainer);
+                                        ReadSvxMSDffSolverContainer(rStCtrl, *rE2.xSolverContainer);
                                     }
                                     aPPTDgContainer.SeekToBegOfRecord( rStCtrl );
                                     SetDgContainer( rStCtrl );  // set this, so that the escherimport is knowing of our drawings
@@ -1601,8 +1596,8 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
                                 if ( aTxSIStyle.bValid && !aTxSIStyle.aList.empty() )
                                     aTxSI = *( aTxSIStyle.aList[ 0 ] );
 
-                                rE2.pStyleSheet = new PPTStyleSheet( aSlideHd, rStCtrl, *this, aTxPFStyle, aTxSI );
-                                pDefaultSheet = rE2.pStyleSheet;
+                                rE2.xStyleSheet.reset(new PPTStyleSheet(aSlideHd, rStCtrl, *this, aTxPFStyle, aTxSI));
+                                pDefaultSheet = rE2.xStyleSheet.get();
                             }
                             if ( SeekToRec( rStCtrl, PPT_PST_ColorSchemeAtom, aSlideHd.GetRecEndFilePos() ) )
                                 ReadPptColorSchemeAtom( rStCtrl, rE2.aColorScheme );
@@ -2216,7 +2211,6 @@ SdrObject* SdrPowerPointImport::ReadObjText( PPTTextObj* pTextObj, SdrObject* pS
     return pSdrObj;
 }
 
-
 SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pSdrText, SdPageCapsule /*pPage*/,
                                                 SfxStyleSheet* pSheet, SfxStyleSheet** ppStyleSheetAry ) const
 {
@@ -2479,13 +2473,13 @@ void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind )
         if ( pPageList && nMasterIndex < pPageList->size() )
         {
             PptSlidePersistEntry* pMasterPersist = &(*pPageList)[ nMasterIndex ];
-            if ( ( pMasterPersist->pStyleSheet == nullptr ) && pMasterPersist->aSlideAtom.nMasterId )
+            if (!pMasterPersist->xStyleSheet && pMasterPersist->aSlideAtom.nMasterId)
             {
                 nMasterIndex = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
                 if ( nMasterIndex != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
                     pMasterPersist = &(*pPageList)[ nMasterIndex ];
             }
-            pPPTStyleSheet = pMasterPersist->pStyleSheet;
+            pPPTStyleSheet = pMasterPersist->xStyleSheet.get();
          }
     }
     if ( !pPPTStyleSheet )
@@ -2878,7 +2872,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
                                                 if ( pObj )
                                                 {
                                                     if ( aProcessData.pTableRowProperties )
-                                                        pObj = CreateTable( pObj, aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.pSolverContainer );
+                                                        pObj = CreateTable(pObj, aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.xSolverContainer.get());
 
                                                     pRet->NbcInsertObject( pObj );
 
@@ -2927,9 +2921,9 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
                             // to the Page and delete it.
                             pRet->getSdrPageProperties().ClearItem();
                             pRet->getSdrPageProperties().PutItemSet(rSlidePersist.pBObj->GetMergedItemSet());
-                            if (rSlidePersist.pSolverContainer)
+                            if (rSlidePersist.xSolverContainer)
                             {
-                                for (SvxMSDffConnectorRule* pPtr : rSlidePersist.pSolverContainer->aCList)
+                                for (SvxMSDffConnectorRule* pPtr : rSlidePersist.xSolverContainer->aCList)
                                 {
                                     // check connections to the group object
                                     if (pPtr->pAObj == rSlidePersist.pBObj)
@@ -2949,8 +2943,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
             if (!aHd.SeekToEndOfRecord(rStCtrl))
                 break;
         }
-        if ( rSlidePersist.pSolverContainer )
-            SolveSolver( *rSlidePersist.pSolverContainer );
+        if (rSlidePersist.xSolverContainer)
+            SolveSolver(*rSlidePersist.xSolverContainer);
     }
     rStCtrl.Seek( nMerk );
 }
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index acf4a707d111..eece8dd5df1f 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -356,11 +356,11 @@ struct PptSlidePersistEntry
     PptSlideAtom        aSlideAtom;
     PptNotesAtom        aNotesAtom;
     PptColorSchemeAtom  aColorScheme;           // each slide includes this colorscheme atom
-    PPTStyleSheet*      pStyleSheet;            // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
+    std::unique_ptr<PPTStyleSheet> xStyleSheet; // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
 
     sal_uInt32          HeaderFooterOfs[ 4 ];   // containing the ofs to the placeholder (only masterpage)
     std::unique_ptr<HeaderFooterEntry> xHeaderFooterEntry;
-    SvxMSDffSolverContainer* pSolverContainer;
+    std::unique_ptr<SvxMSDffSolverContainer> xSolverContainer;
     sal_uInt32          nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
     sal_uInt32          nSlidePersistEndOffset;
     sal_uInt32          nBackgroundOffset;      // fileoffset


More information about the Libreoffice-commits mailing list