summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-22 11:38:00 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-25 20:13:17 +0200
commit2b5aa5cf373aa933255c582716408d960a025503 (patch)
tree2560b0722f324309fa3341c844a5f361587a487c /sw
parente0b82cafcea4efc91ed1f43ffa0e3aec5236e849 (diff)
Convert methods in ftnbos.hxx from Svptrarr to std::vector
Change-Id: Ia2424719aa45fecbe0d3642683bbdc581aaf78ee
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/ftnboss.hxx8
-rw-r--r--sw/source/core/layout/ftnfrm.cxx38
-rw-r--r--sw/source/core/layout/layouter.cxx16
3 files changed, 32 insertions, 30 deletions
diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx
index 2083fc02c4f6..c1b78bfe7edf 100644
--- a/sw/source/core/inc/ftnboss.hxx
+++ b/sw/source/core/inc/ftnboss.hxx
@@ -53,6 +53,8 @@ public:
#define NA_GROW_ADJUST 2
#define NA_ADJUST_GROW 3
+typedef std::vector<SwFtnFrm*> SwFtnFrms;
+
class SwFtnBossFrm: public SwLayoutFrm
{
// for private footnote operations
@@ -108,7 +110,7 @@ public:
// <_pRefFtnBossFrm> has to be referenced by an object.
static void _CollectFtns( const SwCntntFrm* _pRef,
SwFtnFrm* _pFtn,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns = sal_False,
const SwFtnBossFrm* _pRefFtnBossFrm = NULL);
// The parameter <_bCollectOnlyPreviousFtns> controls if only footnotes
@@ -116,9 +118,9 @@ public:
// collected.
void CollectFtns( const SwCntntFrm* _pRef,
SwFtnBossFrm* _pOld,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns = sal_False );
- void _MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc = sal_False );
+ void _MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc = sal_False );
void MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
SwTxtFtn *pAttr );
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index c7124fdb3798..5f78c91ee923 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1931,7 +1931,7 @@ void SwFtnBossFrm::ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *pAttr,
/// footnote boss frame <this> have to be collected.
void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
SwFtnBossFrm* _pOld,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
const sal_Bool _bCollectOnlyPreviousFtns )
{
SwFtnFrm *pFtn = _pOld->FindFirstFtn();
@@ -1989,10 +1989,10 @@ void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
|* SwFtnBossFrm::_CollectFtns()
|*
|*************************************************************************/
-inline void FtnInArr( SvPtrarr& rFtnArr, SwFtnFrm* pFtn )
+inline void FtnInArr( SwFtnFrms& rFtnArr, SwFtnFrm* pFtn )
{
- if ( USHRT_MAX == rFtnArr.GetPos( (VoidPtr)pFtn ) )
- rFtnArr.Insert( (VoidPtr)pFtn, rFtnArr.Count() );
+ if ( rFtnArr.end() == std::find( rFtnArr.begin(), rFtnArr.end(), pFtn ) )
+ rFtnArr.push_back( pFtn );
}
/// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
@@ -2003,7 +2003,7 @@ inline void FtnInArr( SvPtrarr& rFtnArr, SwFtnFrm* pFtn )
/// Adjust parameter names.
void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
SwFtnFrm* _pFtn,
- SvPtrarr& _rFtnArr,
+ SwFtnFrms& _rFtnArr,
sal_Bool _bCollectOnlyPreviousFtns,
const SwFtnBossFrm* _pRefFtnBossFrm)
{
@@ -2018,7 +2018,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
//(der Inhalt zu einem Attribut kann ueber mehrere Seiten verteilt sein)
//und ausschneiden.
- SvPtrarr aNotFtnArr( 20 ); //Zur Robustheit werden hier die nicht
+ SwFtnFrms aNotFtnArr; //Zur Robustheit werden hier die nicht
//dazugehoerigen Fussnoten eingetragen.
//Wenn eine Fussnote zweimal angefasst wird
//ists vorbei! So kommt die Funktion auch
@@ -2135,8 +2135,8 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
break;
}
if ( pNxtFtn &&
- USHRT_MAX == _rFtnArr.GetPos( (VoidPtr)pNxtFtn ) &&
- USHRT_MAX == aNotFtnArr.GetPos( (VoidPtr)pNxtFtn ) )
+ _rFtnArr.end() == std::find( _rFtnArr.begin(), _rFtnArr.end(), pNxtFtn ) &&
+ aNotFtnArr.end() == std::find( aNotFtnArr.begin(), aNotFtnArr.end(), pNxtFtn ) )
_pFtn = pNxtFtn;
else
break;
@@ -2150,7 +2150,7 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
|*************************************************************************/
-void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc )
+void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
{
//Alle Fussnoten die von pRef referenziert werden muessen von der
//aktuellen Position, die sich durch die alte Spalte/Seite ergab, auf eine
@@ -2162,9 +2162,9 @@ void SwFtnBossFrm::_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc )
// #i21478# - keep last inserted footnote in order to
// format the content of the following one.
SwFtnFrm* pLastInsertedFtn = 0L;
- for ( sal_uInt16 i = 0; i < rFtnArr.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rFtnArr.size(); ++i )
{
- SwFtnFrm *pFtn = (SwFtnFrm*)rFtnArr[i];
+ SwFtnFrm *pFtn = rFtnArr[i];
SwFtnBossFrm* pRefBoss = pFtn->GetRef()->FindFtnBossFrm( sal_True );
if( pRefBoss != this )
@@ -2377,9 +2377,9 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
OSL_ENSURE( pDestBoss, "+SwPageFrm::MoveFtns: no destination boss" );
if( pDestBoss ) // robust
{
- SvPtrarr aFtnArr( 5 );
+ SwFtnFrms aFtnArr;
pDestBoss->_CollectFtns( pDest, pFtn, aFtnArr );
- if ( aFtnArr.Count() )
+ if ( !aFtnArr.empty() )
{
pDestBoss->_MoveFtns( aFtnArr, sal_True );
SwPageFrm* pSrcPage = FindPageFrm();
@@ -2888,7 +2888,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
if( !pStart )
pStart = ContainsCntnt();
- SvPtrarr aFtnArr( 5 );
+ SwFtnFrms aFtnArr;
while ( IsAnLower( pStart ) )
{
@@ -2906,13 +2906,13 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
OSL_ENSURE( pOldBoss->IsInSct() == pNewBoss->IsInSct(),
"MoveLowerFtns: Section confusion" );
- SvPtrarr *pFtnArr;
+ SwFtnFrms *pFtnArr;
SwLayoutFrm* pNewChief = 0;
SwLayoutFrm* pOldChief = 0;
if( pStart && pOldBoss->IsInSct() && ( pOldChief = pOldBoss->FindSctFrm() )
!= ( pNewChief = pNewBoss->FindSctFrm() ) )
{
- pFtnArr = new SvPtrarr( 5 );
+ pFtnArr = new SwFtnFrms;
pOldChief = pOldBoss->FindFtnBossFrm( sal_True );
pNewChief = pNewBoss->FindFtnBossFrm( sal_True );
while( pOldChief->IsAnLower( pStart ) )
@@ -2922,7 +2922,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
(SwFtnBossFrm*)pOldBoss, *pFtnArr );
pStart = pStart->GetNextCntntFrm();
}
- if( !pFtnArr->Count() )
+ if( pFtnArr->empty() )
{
delete pFtnArr;
pFtnArr = NULL;
@@ -2931,9 +2931,9 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
else
pFtnArr = NULL;
- if ( aFtnArr.Count() || pFtnArr )
+ if ( !aFtnArr.empty() || pFtnArr )
{
- if( aFtnArr.Count() )
+ if( !aFtnArr.empty() )
pNewBoss->_MoveFtns( aFtnArr, sal_True );
if( pFtnArr )
{
diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx
index aa2ac4644b60..68264c9e899b 100644
--- a/sw/source/core/layout/layouter.cxx
+++ b/sw/source/core/layout/layouter.cxx
@@ -60,7 +60,7 @@ class SwEndnoter
{
SwLayouter* pMaster;
SwSectionFrm* pSect;
- SvPtrarr* pEndArr;
+ SwFtnFrms* pEndArr;
public:
SwEndnoter( SwLayouter* pLay )
: pMaster( pLay ), pSect( NULL ), pEndArr( NULL ) {}
@@ -69,7 +69,7 @@ public:
void CollectEndnote( SwFtnFrm* pFtn );
const SwSectionFrm* GetSect() const { return pSect; }
void InsertEndnotes();
- sal_Bool HasEndnotes() const { return pEndArr && pEndArr->Count(); }
+ sal_Bool HasEndnotes() const { return pEndArr && !pEndArr->empty(); }
};
void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
@@ -84,7 +84,7 @@ void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
{
- if( pEndArr && USHRT_MAX != pEndArr->GetPos( (VoidPtr)pFtn ) )
+ if( pEndArr && pEndArr->end() != std::find( pEndArr->begin(), pEndArr->end(), pFtn ) )
return;
if( pFtn->GetUpper() )
@@ -117,9 +117,9 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
}
else if( pEndArr )
{
- for ( sal_uInt16 i = 0; i < pEndArr->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pEndArr->size(); ++i )
{
- SwFtnFrm *pEndFtn = (SwFtnFrm*)((*pEndArr)[i]);
+ SwFtnFrm *pEndFtn = (*pEndArr)[i];
if( pEndFtn->GetAttr() == pFtn->GetAttr() )
{
delete pFtn;
@@ -128,15 +128,15 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
}
}
if( !pEndArr )
- pEndArr = new SvPtrarr( 5 ); // deleted from the SwLayouter
- pEndArr->Insert( (VoidPtr)pFtn, pEndArr->Count() );
+ pEndArr = new SwFtnFrms; // deleted from the SwLayouter
+ pEndArr->push_back( pFtn );
}
void SwEndnoter::InsertEndnotes()
{
if( !pSect )
return;
- if( !pEndArr || !pEndArr->Count() )
+ if( !pEndArr || pEndArr->empty() )
{
pSect = NULL;
return;