summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-07-23 23:02:50 +0200
committerMichael Stahl <mstahl@redhat.com>2015-07-24 10:58:55 +0200
commit9c959736caaaab5a757b0a0ff0abb121062483ab (patch)
treecf969b4da92178ce615de210b98637860fdffe55
parentfilter: replace boost::ptr_vector with std::vector<std::unique_ptr> (diff)
downloadcore-9c959736caaaab5a757b0a0ff0abb121062483ab.tar.gz
core-9c959736caaaab5a757b0a0ff0abb121062483ab.zip
filter: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I87f903c6a81b271847f072fa0608fae4669ac307
-rw-r--r--filter/source/msfilter/svdfppt.cxx66
-rw-r--r--include/filter/msfilter/svdfppt.hxx30
-rw-r--r--sd/source/filter/ppt/pptin.cxx6
3 files changed, 53 insertions, 49 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index e11dc4325c70..fa0670309fd4 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -206,7 +206,7 @@ sal_uInt16 PptSlidePersistList::FindPage(sal_uInt32 nId) const
{
for ( size_t i=0; i < mvEntries.size(); i++ )
{
- if (mvEntries[ i ].GetSlideId()==nId) return i;
+ if (mvEntries[ i ]->GetSlideId() == nId) return i;
}
return PPTSLIDEPERSIST_ENTRY_NOTFOUND;
}
@@ -1289,9 +1289,9 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
pPersistPtr ( NULL ),
nPersistPtrAnz ( 0 ),
pDefaultSheet ( NULL ),
- pMasterPages ( NULL ),
- pSlidePages ( NULL ),
- pNotePages ( NULL ),
+ m_pMasterPages ( nullptr ),
+ m_pSlidePages ( nullptr ),
+ m_pNotePages ( nullptr ),
nAktPageNum ( 0 ),
nDocStreamPos ( 0 ),
nPageColorsNum ( 0xFFFF ),
@@ -1478,17 +1478,17 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
// TODO:: PPT_PST_TxPFStyleAtom
// read SlidePersists
- pMasterPages=new PptSlidePersistList;
- pSlidePages =new PptSlidePersistList;
- pNotePages =new PptSlidePersistList;
+ m_pMasterPages = new PptSlidePersistList;
+ m_pSlidePages = new PptSlidePersistList;
+ m_pNotePages = new PptSlidePersistList;
// now always creating the handout page, it will be the first in our masterpage list
- PptSlidePersistEntry* pE = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE(new PptSlidePersistEntry);
pE->aPersistAtom.nPsrReference = aDocAtom.nHandoutMasterPersist;
pE->bHandoutMaster = true;
if ( !aDocAtom.nHandoutMasterPersist )
pE->bStarDrawFiller = true; // this is a dummy master page
- pMasterPages->insert( pMasterPages->begin(), pE );
+ m_pMasterPages->insert(m_pMasterPages->begin(), std::move(pE));
sal_uInt16 nPageListNum = 0;
DffRecordHeader* pSlideListWithTextHd = aDocRecManager.GetRecordHeader( PPT_PST_SlideListWithText );
@@ -1502,12 +1502,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
{
if ( pPreviousPersist )
pPreviousPersist->nSlidePersistEndOffset = rStCtrl.Tell();
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
ReadPptSlidePersistAtom( rStCtrl, pE2->aPersistAtom );
pE2->nSlidePersistStartOffset = rStCtrl.Tell();
pE2->ePageKind = PptPageKind( nPageListNum );
- pPageList->push_back( pE2 );
- pPreviousPersist = pE2;
+ pPreviousPersist = pE2.get();
+ pPageList->push_back(std::move(pE2));
}
if ( pPreviousPersist )
pPreviousPersist->nSlidePersistEndOffset = nSlideListWithTextHdEndOffset;
@@ -1516,19 +1516,19 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
}
// we will ensure that there is at least one master page
- if ( pMasterPages->size() == 1 ) // -> there is only a handout page available
+ if (m_pMasterPages->size() == 1) // -> there is only a handout page available
{
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
pE2->bStarDrawFiller = true; // this is a dummy master page
- pMasterPages->insert( pMasterPages->begin() + 1, pE2 );
+ m_pMasterPages->insert(m_pMasterPages->begin() + 1, std::move(pE2));
}
// now we will insert at least one notes master for each master page
sal_uInt16 nMasterPage;
- sal_uInt16 nMasterPages = pMasterPages->size() - 1;
+ sal_uInt16 nMasterPages = m_pMasterPages->size() - 1;
for ( nMasterPage = 0; nMasterPage < nMasterPages; nMasterPage++ )
{
- PptSlidePersistEntry* pE2 = new PptSlidePersistEntry;
+ std::unique_ptr<PptSlidePersistEntry> pE2(new PptSlidePersistEntry);
pE2->bNotesMaster = true;
pE2->bStarDrawFiller = true; // this is a dummy master page
if ( !nMasterPage && aDocAtom.nNotesMasterPersist )
@@ -1536,7 +1536,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
pE2->aPersistAtom.nPsrReference = aDocAtom.nNotesMasterPersist;
pE2->bStarDrawFiller = false; // this is a dummy master page
}
- pMasterPages->insert( pMasterPages->begin() + (( nMasterPage + 1 ) << 1), pE2 );
+ m_pMasterPages->insert(m_pMasterPages->begin() + ((nMasterPage + 1) << 1), std::move(pE2));
}
// read for each page the SlideAtom respectively the NotesAtom if it exists
@@ -1619,12 +1619,12 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
else if ( pHeadersFootersHd->nRecInstance == 4 ) // notes master
ImportHeaderFooterContainer( *pHeadersFootersHd, aNotesMaster );
}
- for ( size_t i = 0; i < pMasterPages->size(); i++ )
+ for (size_t i = 0; i < m_pMasterPages->size(); i++)
{
- if ( (*pMasterPages)[ i ].bNotesMaster )
- (*pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
+ if ((*m_pMasterPages)[ i ].bNotesMaster)
+ (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
else
- (*pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
+ (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
}
}
}
@@ -1641,9 +1641,9 @@ SdrPowerPointImport::~SdrPowerPointImport()
delete aHyperList[ i ];
}
aHyperList.clear();
- delete pMasterPages;
- delete pSlidePages;
- delete pNotePages;
+ delete m_pMasterPages;
+ delete m_pSlidePages;
+ delete m_pNotePages;
delete[] pPersistPtr;
}
@@ -2171,11 +2171,11 @@ bool SdrPowerPointImport::ReadFontCollection()
PptSlidePersistList* SdrPowerPointImport::GetPageList(PptPageKind ePageKind) const
{
if ( ePageKind == PPT_MASTERPAGE )
- return pMasterPages;
+ return m_pMasterPages;
if ( ePageKind == PPT_SLIDEPAGE )
- return pSlidePages;
+ return m_pSlidePages;
if ( ePageKind == PPT_NOTEPAGE )
- return pNotePages;
+ return m_pNotePages;
return NULL;
}
@@ -2462,7 +2462,7 @@ void SdrPowerPointImport::SetPageNum( sal_uInt16 nPageNum, PptPageKind eKind )
PptSlidePersistEntry* pMasterPersist = &(*pPageList)[ nMasterIndex ];
if ( ( pMasterPersist->pStyleSheet == NULL ) && pMasterPersist->aSlideAtom.nMasterId )
{
- nMasterIndex = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ nMasterIndex = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
if ( nMasterIndex != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
pMasterPersist = &(*pPageList)[ nMasterIndex ];
}
@@ -2539,7 +2539,7 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor )
while( ( pMasterPersist && pMasterPersist->aSlideAtom.nFlags & 2 ) // it is possible that a masterpage
&& pMasterPersist->aSlideAtom.nMasterId ) // itself is following a master colorscheme
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -2772,7 +2772,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
PptSlidePersistEntry* pE = &(*pPageList)[ nMasterNum ];
while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -2931,9 +2931,9 @@ sal_uInt16 SdrPowerPointImport::GetMasterPageIndex( sal_uInt16 nPageNum, PptPage
if ( ePageKind == PPT_NOTEPAGE )
return 2;
sal_uInt32 nId = GetMasterPageId( nPageNum, ePageKind );
- if ( nId && pMasterPages )
+ if (nId && m_pMasterPages)
{
- nIdx = pMasterPages->FindPage( nId );
+ nIdx = m_pMasterPages->FindPage( nId );
if ( nIdx == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
nIdx = 0;
}
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index dd4cfcfb27b9..e355d6537c27 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -36,9 +36,9 @@
#include <filter/msfilter/msfilterdllapi.h>
#include <vcl/font.hxx>
#include <vector>
+#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
-#include <boost/ptr_container/ptr_vector.hpp>
class SdrModel;
class SdPage;
@@ -354,23 +354,27 @@ public:
class MSFILTER_DLLPUBLIC PptSlidePersistList: private boost::noncopyable
{
private:
- boost::ptr_vector<PptSlidePersistEntry> mvEntries;
+ typedef std::vector<std::unique_ptr<PptSlidePersistEntry>> Entries_t;
+ Entries_t mvEntries;
public:
PptSlidePersistList();
~PptSlidePersistList();
size_t size() const { return mvEntries.size(); }
- bool is_null( size_t nIdx ) const { return mvEntries.is_null( nIdx ); }
- const PptSlidePersistEntry& operator[]( size_t nIdx ) const { return mvEntries[ nIdx ]; }
- PptSlidePersistEntry& operator[]( size_t nIdx ) { return mvEntries[ nIdx ]; }
- boost::ptr_vector<PptSlidePersistEntry>::iterator begin() { return mvEntries.begin(); }
- void insert( boost::ptr_vector<PptSlidePersistEntry>::iterator it,
- PptSlidePersistEntry* pEntry )
+ bool is_null( size_t nIdx ) const { return mvEntries[ nIdx ] == nullptr; }
+ const PptSlidePersistEntry& operator[](size_t nIdx) const { return *mvEntries[ nIdx ]; }
+ PptSlidePersistEntry& operator[](size_t nIdx) { return *mvEntries[ nIdx ]; }
+ Entries_t::iterator begin() { return mvEntries.begin(); }
+ void insert( Entries_t::iterator it,
+ std::unique_ptr<PptSlidePersistEntry> pEntry )
{
- mvEntries.insert(it, pEntry);
+ mvEntries.insert(it, std::move(pEntry));
+ }
+ void push_back(std::unique_ptr<PptSlidePersistEntry> pEntry)
+ {
+ mvEntries.push_back(std::move(pEntry));
}
- void push_back( PptSlidePersistEntry* pEntry ) { mvEntries.push_back(pEntry); }
sal_uInt16 FindPage( sal_uInt32 nId ) const;
};
@@ -545,9 +549,9 @@ protected:
const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet;
const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
// never happen just preventing a crash
- PptSlidePersistList* pMasterPages;
- PptSlidePersistList* pSlidePages;
- PptSlidePersistList* pNotePages;
+ PptSlidePersistList* m_pMasterPages;
+ PptSlidePersistList* m_pSlidePages;
+ PptSlidePersistList* m_pNotePages;
sal_uInt16 nAktPageNum;
sal_uLong nDocStreamPos;
sal_uInt16 nPageColorsNum;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index ca300f156b95..68f80f303e2d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -541,7 +541,7 @@ bool ImplSdPPTImport::Import()
// create master pages:
SfxProgress* pStbMgr = new SfxProgress( pDocShell, SD_RESSTR( STR_POWERPOINT_IMPORT ),
- pMasterPages->size() + pSlidePages->size() + pNotePages->size() );
+ m_pMasterPages->size() + m_pSlidePages->size() + m_pNotePages->size() );
sal_uInt32 nImportedPages = 0;
{
@@ -726,7 +726,7 @@ bool ImplSdPPTImport::Import()
PptSlidePersistEntry* pE = pPersist;
while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ sal_uInt16 nNextMaster = m_pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
@@ -952,7 +952,7 @@ bool ImplSdPPTImport::Import()
if ( nNotesPageId )
{
nImportedPages++;
- sal_uInt16 nNotesPageIndex = pNotePages->FindPage( nNotesPageId );
+ sal_uInt16 nNotesPageIndex = m_pNotePages->FindPage( nNotesPageId );
if ( nNotesPageIndex == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
nNotesPageIndex = 0;
SetPageNum( nNotesPageIndex, PPT_NOTEPAGE );