Kaydet (Commit) 2b5aa5cf authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Convert methods in ftnbos.hxx from Svptrarr to std::vector

Change-Id: Ia2424719aa45fecbe0d3642683bbdc581aaf78ee
üst e0b82caf
......@@ -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 );
......
......@@ -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 )
{
......
......@@ -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;
......
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