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 {
class LinkManager;
}
// PageDescriptor-interface, Array because of inlines.
class SwPageDescs : public std::vector<SwPageDesc*>
{
public:
// the destructor will free all objects still in the vector
~SwPageDescs();
};
typedef boost::ptr_vector<SwPageDesc> SwPageDescs;
// forward declaration
void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem );
......@@ -953,9 +947,9 @@ public:
// PageDescriptor interface.
sal_uInt16 GetPageDescCnt() const { return maPageDescs.size(); }
const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return *maPageDescs[i]; }
SwPageDesc& GetPageDesc( sal_uInt16 i ) { return *maPageDescs[i]; }
SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL) const;
const SwPageDesc& GetPageDesc( const sal_uInt16 i ) const { return maPageDescs[i]; }
SwPageDesc& GetPageDesc( sal_uInt16 i ) { return maPageDescs[i]; }
SwPageDesc* FindPageDesc(const OUString& rName, sal_uInt16* pPos = NULL);
/** Copy the complete PageDesc - beyond document and "deep"!
Optionally copying of PoolFmtId, -HlpId can be prevented. */
......@@ -1680,9 +1674,9 @@ public:
private:
// 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().
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:
public:
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; }
bool GetLandscape() const { return bLandscape; }
......
This diff is collapsed.
......@@ -1236,17 +1236,6 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
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,
SwFmtsBase& rDestArr,
FNCopyFmt fnCopyFmt,
......@@ -1292,7 +1281,7 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr,
{
SwFmtPageDesc aPageDesc( *static_cast<const SwFmtPageDesc*>(pItem) );
const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
SwPageDesc* pPageDesc = ::lcl_FindPageDesc( maPageDescs, rNm );
SwPageDesc* pPageDesc = FindPageDesc( rNm );
if( !pPageDesc )
{
pPageDesc = MakePageDesc(rNm);
......@@ -1419,8 +1408,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
if( rSrcDesc.GetFollow() != &rSrcDesc )
{
SwPageDesc* pFollow = ::lcl_FindPageDesc( maPageDescs,
rSrcDesc.GetFollow()->GetName() );
SwPageDesc* pFollow = FindPageDesc( rSrcDesc.GetFollow()->GetName() );
if( !pFollow )
{
// copy
......@@ -1556,16 +1544,17 @@ void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
// 1st step: Create all formats (skip the 0th - it's the default!)
while( nCnt )
{
SwPageDesc *pSrc = rSource.maPageDescs[ --nCnt ];
if( 0 == ::lcl_FindPageDesc( maPageDescs, pSrc->GetName() ) )
MakePageDesc( pSrc->GetName() );
const SwPageDesc &rSrc = rSource.maPageDescs[ --nCnt ];
if( 0 == FindPageDesc( rSrc.GetName() ) )
MakePageDesc( rSrc.GetName() );
}
// 2nd step: Copy all attributes, set the right parents
for( nCnt = rSource.maPageDescs.size(); nCnt; )
{
SwPageDesc *pSrc = rSource.maPageDescs[ --nCnt ];
CopyPageDesc( *pSrc, *::lcl_FindPageDesc( maPageDescs, pSrc->GetName() ));
const SwPageDesc &rSrc = rSource.maPageDescs[ --nCnt ];
SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
CopyPageDesc( rSrc, *pDesc);
}
}
}
......
......@@ -517,8 +517,6 @@ SwDoc::~SwDoc()
// Destroy these only after destroying the FmtIndices, because the content
// 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.
for(SwPageDesc *pPageDesc : maPageDescs)
delete pPageDesc;
maPageDescs.clear();
// Delete content selections.
......@@ -722,10 +720,7 @@ void SwDoc::ClearDoc()
// remove the dummy pagedesc from the array and delete all the old ones
sal_uInt16 nDummyPgDsc = 0;
if (FindPageDesc(pDummyPgDsc->GetName(), &nDummyPgDsc))
maPageDescs.erase(maPageDescs.begin() + nDummyPgDsc);
for( SwPageDesc *pPageDesc : maPageDescs )
delete pPageDesc;
pDummyPgDsc = maPageDescs.release(maPageDescs.begin() + nDummyPgDsc).release();
maPageDescs.clear();
// Delete for Collections
......
......@@ -460,10 +460,4 @@ SwPageDescExt::operator SwPageDesc() const
return aResult;
}
SwPageDescs::~SwPageDescs()
{
for(const_iterator it = begin(); it != end(); ++it)
delete *it;
}
/* 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