Kaydet (Commit) 28b61d7a authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Caolán McNamara

fdo#75757 remove inheritance to std::vector

Conflicts:
	sw/source/core/doc/docnew.cxx

Change-Id: I4ba20e689b77e75bea75e5a60f50ff40577183e8
üst 2021275f
...@@ -237,13 +237,7 @@ namespace sfx2 { ...@@ -237,13 +237,7 @@ namespace sfx2 {
class LinkManager; class LinkManager;
} }
// PageDescriptor-interface, Array because of inlines. typedef boost::ptr_vector<SwPageDesc> SwPageDescs;
class SwPageDescs : public std::vector<SwPageDesc*>
{
public:
// the destructor will free all objects still in the vector
~SwPageDescs();
};
// forward declaration // forward declaration
void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ); void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
...@@ -953,9 +947,9 @@ public: ...@@ -953,9 +947,9 @@ public:
// PageDescriptor interface. // PageDescriptor interface.
sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); } sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); }
const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *maPageDescs[i]; } const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return maPageDescs[i]; }
SwPageDesc& GetPageDesc( sal_uInt16 i ) { return *maPageDescs[i]; } SwPageDesc& GetPageDesc( sal_uInt16 i ) { return maPageDescs[i]; }
SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL) const; SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL);
/** Copy the complete PageDesc - beyond document and "deep"! /** Copy the complete PageDesc - beyond document and "deep"!
Optionally copying of PoolFmtId, -HlpId can be prevented. */ Optionally copying of PoolFmtId, -HlpId can be prevented. */
...@@ -1680,9 +1674,9 @@ public: ...@@ -1680,9 +1674,9 @@ public:
private: private:
// Copies master header to left / first one, if necessary - used by ChgPageDesc(). // Copies master header to left / first one, if necessary - used by ChgPageDesc().
void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft, bool bFirst); void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst);
// Copies master footer to left / first one, if necessary - used by ChgPageDesc(). // Copies master footer to left / first one, if necessary - used by ChgPageDesc().
void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc *pDesc, bool bLeft, bool bFirst); void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst);
}; };
......
...@@ -162,7 +162,7 @@ protected: ...@@ -162,7 +162,7 @@ protected:
public: public:
OUString GetName() const { return aDescName; } OUString GetName() const { return aDescName; }
bool HasName( const OUString& rThisName ) { return aDescName == rThisName; } bool HasName( const OUString& rThisName ) const { return aDescName == rThisName; }
void SetName( const OUString& rNewName ) { aDescName = rNewName; } void SetName( const OUString& rNewName ) { aDescName = rNewName; }
bool GetLandscape() const { return bLandscape; } bool GetLandscape() const { return bLandscape; }
......
This diff is collapsed.
...@@ -1236,17 +1236,6 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) ...@@ -1236,17 +1236,6 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
return pNewColl; return pNewColl;
} }
static SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const OUString& rName )
{
for( sal_uInt16 n = rArr.size(); n; )
{
SwPageDesc* pDesc = rArr[ --n ];
if( pDesc->GetName() == rName )
return pDesc;
}
return 0;
}
void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr,
SwFmtsBase& rDestArr, SwFmtsBase& rDestArr,
FNCopyFmt fnCopyFmt, FNCopyFmt fnCopyFmt,
...@@ -1292,7 +1281,7 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, ...@@ -1292,7 +1281,7 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr,
{ {
SwFmtPageDesc aPageDesc( *static_cast<const SwFmtPageDesc*>(pItem) ); SwFmtPageDesc aPageDesc( *static_cast<const SwFmtPageDesc*>(pItem) );
const OUString& rNm = aPageDesc.GetPageDesc()->GetName(); const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
SwPageDesc* pPageDesc = ::lcl_FindPageDesc( maPageDescs, rNm ); SwPageDesc* pPageDesc = FindPageDesc( rNm );
if( !pPageDesc ) if( !pPageDesc )
{ {
pPageDesc = MakePageDesc(rNm); pPageDesc = MakePageDesc(rNm);
...@@ -1419,8 +1408,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, ...@@ -1419,8 +1408,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
if( rSrcDesc.GetFollow() != &rSrcDesc ) if( rSrcDesc.GetFollow() != &rSrcDesc )
{ {
SwPageDesc* pFollow = ::lcl_FindPageDesc( maPageDescs, SwPageDesc* pFollow = FindPageDesc( rSrcDesc.GetFollow()->GetName() );
rSrcDesc.GetFollow()->GetName() );
if( !pFollow ) if( !pFollow )
{ {
// copy // copy
...@@ -1556,16 +1544,17 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles ) ...@@ -1556,16 +1544,17 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
// 1st step: Create all formats (skip the 0th - it's the default!) // 1st step: Create all formats (skip the 0th - it's the default!)
while( nCnt ) while( nCnt )
{ {
SwPageDesc *pSrc = rSource.maPageDescs[ --nCnt ]; const SwPageDesc &rSrc = rSource.maPageDescs[ --nCnt ];
if( 0 == ::lcl_FindPageDesc( maPageDescs, pSrc->GetName() ) ) if( 0 == FindPageDesc( rSrc.GetName() ) )
MakePageDesc( pSrc->GetName() ); MakePageDesc( rSrc.GetName() );
} }
// 2nd step: Copy all attributes, set the right parents // 2nd step: Copy all attributes, set the right parents
for( nCnt = rSource.maPageDescs.size(); nCnt; ) for( nCnt = rSource.maPageDescs.size(); nCnt; )
{ {
SwPageDesc *pSrc = rSource.maPageDescs[ --nCnt ]; const SwPageDesc &rSrc = rSource.maPageDescs[ --nCnt ];
CopyPageDesc( *pSrc, *::lcl_FindPageDesc( maPageDescs, pSrc->GetName() )); SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
CopyPageDesc( rSrc, *pDesc);
} }
} }
} }
......
...@@ -517,8 +517,6 @@ SwDoc::~SwDoc() ...@@ -517,8 +517,6 @@ SwDoc::~SwDoc()
// Destroy these only after destroying the FmtIndices, because the content // Destroy these only after destroying the FmtIndices, because the content
// of headers/footers has to be deleted as well. If in the headers/footers // of headers/footers has to be deleted as well. If in the headers/footers
// there are still Flys registered at that point, we have a problem. // there are still Flys registered at that point, we have a problem.
for(SwPageDesc *pPageDesc : maPageDescs)
delete pPageDesc;
maPageDescs.clear(); maPageDescs.clear();
// Delete content selections. // Delete content selections.
...@@ -722,10 +720,7 @@ void SwDoc::ClearDoc() ...@@ -722,10 +720,7 @@ void SwDoc::ClearDoc()
// remove the dummy pagedesc from the array and delete all the old ones // remove the dummy pagedesc from the array and delete all the old ones
sal_uInt16 nDummyPgDsc = 0; sal_uInt16 nDummyPgDsc = 0;
if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc)) if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
maPageDescs.erase(maPageDescs.begin() + nDummyPgDsc); pDummyPgDsc = maPageDescs.release(maPageDescs.begin() + nDummyPgDsc).release();
for( SwPageDesc *pPageDesc : maPageDescs )
delete pPageDesc;
maPageDescs.clear(); maPageDescs.clear();
// Delete for Collections // Delete for Collections
......
...@@ -460,10 +460,4 @@ SwPageDescExt::operator SwPageDesc() const ...@@ -460,10 +460,4 @@ SwPageDescExt::operator SwPageDesc() const
return aResult; return aResult;
} }
SwPageDescs::~SwPageDescs()
{
for(const_iterator it = begin(); it != end(); ++it)
delete *it;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment