diff options
author | Noel Grandin <noel@peralex.com> | 2012-07-19 14:07:52 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-26 14:30:09 +0200 |
commit | a236f8318a0e05caeec53ccbee8b134f44a98008 (patch) | |
tree | e8e25865b99cd8f89c1077ceda74e1c4867ee571 /sw | |
parent | db9274645596be84d449fdc6e224ddd0959b8ea4 (diff) |
Convert SV_DECL_PTRARR_SORT(_SwFtnIdxs) to o3tl::sorted_vector
Change-Id: I84c4cd5686ea0649ad9ca6c879d51bffe6d693c2
Diffstat (limited to 'sw')
29 files changed, 98 insertions, 127 deletions
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx index 81174e12ddbf..0cc2efa53979 100644 --- a/sw/inc/ftnidx.hxx +++ b/sw/inc/ftnidx.hxx @@ -28,8 +28,9 @@ #ifndef _FTNIDX_HXX #define _FTNIDX_HXX -#include <svl/svarray.hxx> #include <vector> +#include <sal/types.h> +#include <o3tl/sorted_vector.hxx> class SwTxtFtn; class SwNodeIndex; @@ -41,10 +42,12 @@ class SwSectionNode; #define _SwTxtFtn_GetIndex( pFIdx ) (pFIdx->GetTxtNode().GetIndex()) -typedef SwTxtFtn* SwTxtFtnPtr; -SV_DECL_PTRARR_SORT( _SwFtnIdxs, SwTxtFtnPtr, 0 ) +struct CompareSwFtnIdxs +{ + bool operator()(SwTxtFtn* const& lhs, SwTxtFtn* const& rhs) const; +}; -class SwFtnIdxs : public _SwFtnIdxs +class SwFtnIdxs : public o3tl::sorted_vector<SwTxtFtn*> { public: SwFtnIdxs() {} diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 0baf7f24c8ed..c81fd6aedc83 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -131,7 +131,7 @@ sal_Bool SwCursor::GotoFtnAnchor() // search in all footnotes in document for this StartIndex const SwTxtFtn* pTxtFtn; const SwFtnIdxs& rFtnArr = pSttNd->GetDoc()->GetFtnIdxs(); - for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n ) if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() && pSttNd == &pTxtFtn->GetStartNode()->GetNode() ) { @@ -184,7 +184,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor() if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos )) { // there is a footnote with this index, so search also for the next one - if( nPos < rFtnArr.Count() ) + if( nPos < rFtnArr.size() ) { sal_uLong nNdPos = GetPoint()->nNode.GetIndex(); xub_StrLen nCntPos = GetPoint()->nContent.GetIndex(); @@ -194,7 +194,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor() if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) ) { pTxtFtn = 0; - for( ++nPos; nPos < rFtnArr.Count(); ++nPos ) + for( ++nPos; nPos < rFtnArr.size(); ++nPos ) { pTxtFtn = rFtnArr[ nPos ]; if( !CmpLE( *pTxtFtn, nNdPos, nCntPos ) ) @@ -218,7 +218,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor() } } } - else if( nPos < rFtnArr.Count() ) + else if( nPos < rFtnArr.size() ) pTxtFtn = rFtnArr[ nPos ]; sal_Bool bRet = 0 != pTxtFtn; @@ -250,7 +250,7 @@ sal_Bool SwCursor::GotoPrevFtnAnchor() // search forwards if( CmpL( *pTxtFtn, nNdPos, nCntPos )) { - for( ++nPos; nPos < rFtnArr.Count(); ++nPos ) + for( ++nPos; nPos < rFtnArr.size(); ++nPos ) { pTxtFtn = rFtnArr[ nPos ]; if( !CmpL( *pTxtFtn, nNdPos, nCntPos ) ) diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 737f92bc47da..62691a1b3b3f 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -323,7 +323,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged ) // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts // that refer to a changed page, so we invalidate foot notes. SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index f1dedb3f463a..d33c9dca8256 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -368,7 +368,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, rSttNd.GetIndex() >= rNds.GetEndOfAutotext().GetIndex(); const bool bSaveFtn = !bDelFtn && rInsPos.GetIndex() >= rNds.GetEndOfExtras().GetIndex(); - if( rFtnArr.Count() ) + if( !rFtnArr.empty() ) { sal_uInt16 nPos; @@ -377,7 +377,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, const SwNode* pFtnNd; // Delete/save all that come after it - while( nPos < rFtnArr.Count() && ( pFtnNd = + while( nPos < rFtnArr.size() && ( pFtnNd = &( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex() <= rEndNd.GetIndex() ) { @@ -403,9 +403,9 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, else { pSrch->DelFrms(0); - rFtnArr.Remove( nPos ); + rFtnArr.erase( rFtnArr.begin() + nPos ); if( bSaveFtn ) - rSaveArr.Insert( pSrch ); + rSaveArr.insert( pSrch ); } bUpdateFtn = sal_True; } @@ -431,9 +431,9 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, else { pSrch->DelFrms(0); - rFtnArr.Remove( nPos ); + rFtnArr.erase( rFtnArr.begin() + nPos ); if( bSaveFtn ) - rSaveArr.Insert( pSrch ); + rSaveArr.insert( pSrch ); } bUpdateFtn = sal_True; } @@ -461,7 +461,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, SwTxtAttr *pAttr = pHints->GetTextHint( i ); if ( pAttr->Which() == RES_TXTATR_FTN ) { - rSaveArr.Insert( static_cast<SwTxtFtn*>(pAttr) ); + rSaveArr.insert( static_cast<SwTxtFtn*>(pAttr) ); } } } @@ -1089,10 +1089,10 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) if( bUpdateFtn ) { - if( aTmpFntIdx.Count() ) + if( !aTmpFntIdx.empty() ) { - GetFtnIdxs().Insert( &aTmpFntIdx ); - aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() ); + GetFtnIdxs().insert( aTmpFntIdx ); + aTmpFntIdx.clear(); } GetFtnIdxs().UpdateAllFtn(); @@ -1222,10 +1222,10 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, if( bUpdateFtn ) { - if( aTmpFntIdx.Count() ) + if( !aTmpFntIdx.empty() ) { - GetFtnIdxs().Insert( &aTmpFntIdx ); - aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() ); + GetFtnIdxs().insert( aTmpFntIdx ); + aTmpFntIdx.clear(); } GetFtnIdxs().UpdateAllFtn(); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 4ed6145b0ca2..353ddeefe389 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -206,7 +206,7 @@ void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) else pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc(); SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs(); - for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -307,7 +307,7 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) // For messages regarding ErgoSum etc. we save the extra code and use the // available methods. SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -377,7 +377,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) // For messages regarding ErgoSum etc. we save the extra code and use the // available methods. SwFtnIdxs& rFtnIdxs = GetFtnIdxs(); - for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos ) { SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -432,7 +432,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, sal_Bool bChg = sal_False; sal_Bool bTypeChgd = sal_False; sal_uInt16 n = nPos; // save - while( nPos < rFtnArr.Count() && + while( nPos < rFtnArr.size() && (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] ))) < nEndNd || ( nIdx == nEndNd && nEndCnt >= *pTxtFtn->GetStart() )) ) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index d6193e260d57..5f6e55feee31 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -2125,7 +2125,7 @@ void SwDoc::SetAllUniqueFlyNames() } aArr.clear(); - if( GetFtnIdxs().Count() ) + if( !GetFtnIdxs().empty() ) { SwTxtFtn::SetUniqueSeqRefNo( *this ); // #i52775# Chapter footnotes did not get updated correctly. diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 7a2e26135c7b..f4d4128b32c2 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -562,7 +562,7 @@ SwDoc::~SwDoc() SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() ); rUndoNodes.pOutlineNds->clear(); - pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() ); + pFtnIdxs->clear(); // indices could be registered in attributes m_pUndoManager->DelAllUndoObj(); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 70a5fad77aa4..c3c5ad910703 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -146,7 +146,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule ) UpdateNumRule(); // update if we have foot notes && chapter-wise numbering - if( GetFtnIdxs().Count() && FTNNUM_CHAPTER == GetFtnInfo().eNum ) + if( !GetFtnIdxs().empty() && FTNNUM_CHAPTER == GetFtnInfo().eNum ) GetFtnIdxs().UpdateAllFtn(); UpdateExpFlds(NULL, true); diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index 4ad477b3c7b7..c47a4f9028c2 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -38,48 +38,17 @@ #include <rootfrm.hxx> -_SV_IMPL_SORTAR_ALG( _SwFtnIdxs, SwTxtFtnPtr ) -sal_Bool _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, sal_uInt16* pFndPos ) const -{ - sal_uLong nIdx = _SwTxtFtn_GetIndex( rSrch ); - xub_StrLen nCntIdx = *rSrch->GetStart(); - sal_uInt16 nO = Count(), nM, nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - sal_uLong nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] ); - if( nFndIdx == nIdx && *(*this)[ nM ]->GetStart() == nCntIdx ) - { - if( pFndPos ) - *pFndPos = nM; - return sal_True; - } - else if( nFndIdx < nIdx || - (nFndIdx == nIdx && *(*this)[ nM ]->GetStart() < nCntIdx )) - nU = nM + 1; - else if( nM == 0 ) - { - if( pFndPos ) - *pFndPos = nU; - return sal_False; - } - else - nO = nM - 1; - } - } - if( pFndPos ) - *pFndPos = nU; - return sal_False; +bool CompareSwFtnIdxs::operator()(SwTxtFtn* const& lhs, SwTxtFtn* const& rhs) const +{ + sal_uLong nIdxLHS = _SwTxtFtn_GetIndex( lhs ); + sal_uLong nIdxRHS = _SwTxtFtn_GetIndex( rhs ); + return ( nIdxLHS == nIdxRHS && lhs->GetStart() < rhs->GetStart() ) || nIdxLHS < nIdxRHS; } - void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) { - if( !Count() ) + if( empty() ) return; // Get the NodesArray using the first foot note's StartIndex @@ -129,13 +98,13 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) ++nPos; } - if( nPos == Count() ) // nothing found + if( nPos == size() ) // nothing found return; if( rOutlNds.empty() ) nFtnNo = nPos+1; - for( ; nPos < Count(); ++nPos ) + for( ; nPos < size(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; if( pTxtFtn->GetTxtNode().GetIndex() >= nCapEnd ) @@ -156,7 +125,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) sal_uInt16 nPos, nFtnNo = 1, nEndNo = 1; sal_uLong nUpdNdIdx = rStt.GetIndex(); - for( nPos = 0; nPos < Count(); ++nPos ) + for( nPos = 0; nPos < size(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; if( nUpdNdIdx <= pTxtFtn->GetTxtNode().GetIndex() ) @@ -176,7 +145,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) } // Set the array number for all footnotes starting from nPos - for( ; nPos < Count(); ++nPos ) + for( ; nPos < size(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -199,7 +168,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) void SwFtnIdxs::UpdateAllFtn() { - if( !Count() ) + if( empty() ) return; // Get the NodesArray via the StartIndex of the first Footnote @@ -224,7 +193,7 @@ void SwFtnIdxs::UpdateAllFtn() if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { sal_uLong nCapStt = rOutlNds[ n ]->GetIndex(); // Start of a new chapter - for( ; nFtnIdx < Count(); ++nFtnIdx ) + for( ; nFtnIdx < size(); ++nFtnIdx ) { pTxtFtn = (*this)[ nFtnIdx ]; if( pTxtFtn->GetTxtNode().GetIndex() >= nCapStt ) @@ -237,13 +206,13 @@ void SwFtnIdxs::UpdateAllFtn() pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++, &rFtn.GetNumStr() ); } - if( nFtnIdx >= Count() ) + if( nFtnIdx >= size() ) break; // ok, everything is updated nNo = 1; } } - for( nNo = 1; nFtnIdx < Count(); ++nFtnIdx ) + for( nNo = 1; nFtnIdx < size(); ++nFtnIdx ) { // Endnotes are per-document pTxtFtn = (*this)[ nFtnIdx ]; @@ -259,7 +228,7 @@ void SwFtnIdxs::UpdateAllFtn() // We use sal_Bool here, so that we also iterate through the Endnotes with a chapter setting. const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum; sal_uInt16 nFtnNo = 0, nEndNo = 0; - for( sal_uInt16 nPos = 0; nPos < Count(); ++nPos ) + for( sal_uInt16 nPos = 0; nPos < size(); ++nPos ) { pTxtFtn = (*this)[ nPos ]; const SwFmtFtn &rFtn = pTxtFtn->GetFtn(); @@ -286,7 +255,7 @@ SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, sal_uInt16* pFndPos ) c { sal_uLong nIdx = rPos.GetIndex(); - sal_uInt16 nO = Count(), nM, nU = 0; + sal_uInt16 nO = size(), nM, nU = 0; if( nO > 0 ) { nO--; diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 4f5e709770e6..7f0be84cc48d 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -354,7 +354,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } sal_Bool bUpdateFtn = sal_False; - if( GetFtnIdxs().Count() && pAttr ) + if( GetFtnIdxs().size() && pAttr ) { sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get( RES_FTN_AT_TXTEND )).GetValue(); @@ -769,14 +769,14 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd ) { SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs(); - if( rFtnArr.Count() ) + if( rFtnArr.size() ) { sal_uInt16 nPos; rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos ); SwTxtFtn* pSrch; // loesche erstmal alle, die dahinter stehen - while( nPos < rFtnArr.Count() && + while( nPos < rFtnArr.size() && _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) <= nEnd ) { // Werden die Nodes nicht geloescht mussen sie bei den Seiten diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 3f4f5aa9367e..93a0aed2aa33 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -684,7 +684,7 @@ const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay, // der Anker kann nur im Bodytext sein const SwTxtFtn* pTxtFtn; const SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs(); - for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n ) if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() && (SwNode*)pSttNd == &pTxtFtn->GetStartNode()->GetNode() ) @@ -1806,7 +1806,7 @@ sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const const SwTxtFtn* pTxtFtn; const SwNode* pSrchNd = pSttNd; - for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n ) + for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n ) if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() && pSrchNd == &pTxtFtn->GetStartNode()->GetNode() ) { diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 8d78f072c39e..b1dcfe22d413 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -325,7 +325,7 @@ bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn ) bool SwEditShell::HasFtns( bool bEndNotes ) const { const SwFtnIdxs &rIdxs = pDoc->GetFtnIdxs(); - for ( sal_uInt16 i = 0; i < rIdxs.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rIdxs.size(); ++i ) { const SwFmtFtn &rFtn = rIdxs[i]->GetFtn(); if ( bEndNotes == rFtn.IsEndNote() ) @@ -340,7 +340,7 @@ sal_uInt16 SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes ) { rList.Clear(); - sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().size(); SwTxtFtn* pTxtFtn; for( n = 0; n < nFtnCnt; ++n ) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 420a4456f392..5b8094f67f96 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -389,7 +389,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) case REF_FOOTNOTE: case REF_ENDNOTE: // die Nummer oder den NumString besorgen - for( unsigned i = 0; i < pDoc->GetFtnIdxs().Count(); ++i ) + for( unsigned i = 0; i < pDoc->GetFtnIdxs().size(); ++i ) { SwTxtFtn* const pFtnIdx = pDoc->GetFtnIdxs()[i]; if( nSeqNo == pFtnIdx->GetSeqRefNo() ) @@ -912,7 +912,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, case REF_FOOTNOTE: case REF_ENDNOTE: { - sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().size(); SwTxtFtn* pFtnIdx; for( n = 0; n < nFtnCnt; ++n ) if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() ) @@ -986,7 +986,7 @@ void _RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds) /// @param[in,out] rIds The list of IDs found in the document. void _RefIdsMap::GetNoteIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds) { - for( sal_uInt16 n = rDoc.GetFtnIdxs().Count(); n; ) + for( sal_uInt16 n = rDoc.GetFtnIdxs().size(); n; ) rIds.insert( rDoc.GetFtnIdxs()[ --n ]->GetSeqRefNo() ); } @@ -1087,7 +1087,7 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld, if( !bField ) { SwTxtFtn* pFtnIdx; - for( sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().Count(); i < nCnt; ++i ) + for( sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().size(); i < nCnt; ++i ) if( nSeqNo == (pFtnIdx = rDoc.GetFtnIdxs()[ i ])->GetSeqRefNo() ) { pFtnIdx->SetSeqNo( n ); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index d469bd46947b..3565c2a460be 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -65,10 +65,11 @@ sal_uLong lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) { const SwFtnIdxs &rFtnIdxs = pDoc->GetFtnIdxs(); - sal_uInt16 nRet; - SwTxtFtnPtr pBla = (SwTxtFtn*)pAttr; - if ( rFtnIdxs.Seek_Entry( pBla, &nRet ) ) + SwTxtFtn* pBla = (SwTxtFtn*)pAttr; + SwFtnIdxs::const_iterator it = rFtnIdxs.find( pBla ); + if ( it != rFtnIdxs.end() ) { + sal_uInt16 nRet = it - rFtnIdxs.begin(); if( pAttr->GetFtn().IsEndNote() ) return sal_uLong(nRet) + ENDNOTE; return nRet; @@ -1132,7 +1133,7 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont() SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( sal_Bool bDontLeave ) { SwFtnContFrm *pCont = 0; - if ( GetFmt()->GetDoc()->GetFtnIdxs().Count() ) + if ( !GetFmt()->GetDoc()->GetFtnIdxs().empty() ) { pCont = FindFtnCont(); if ( !pCont ) @@ -2873,7 +2874,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, SwFtnBossFrm *pNewBoss, const sal_Bool bFtnNums ) { SwDoc *pDoc = GetFmt()->GetDoc(); - if ( !pDoc->GetFtnIdxs().Count() ) + if ( pDoc->GetFtnIdxs().empty() ) return sal_False; if( pDoc->GetFtnInfo().ePos == FTNPOS_CHAPTER && ( !IsInSct() || !FindSctFrm()->IsFtnAtEnd() ) ) diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 9b6ac9bb64fb..123f4cbd7578 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -496,7 +496,7 @@ SwPageFrm* SwLayAction::CheckFirstVisPage( SwPageFrm *pPage ) pPage = pCnt->FindPageFrm(); } - if ( pPage->GetFmt()->GetDoc()->GetFtnIdxs().Count() ) + if ( !pPage->GetFmt()->GetDoc()->GetFtnIdxs().empty() ) { SwFtnContFrm *pCont = pPage->FindFtnCont(); if ( pCont ) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 42f361ef1335..cf1d64b6bca8 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -169,8 +169,8 @@ void SwBodyFrm::Format( const SwBorderAttrs * ) nBorder /= 2; // #i21774# Footnotes and centering the grid does not work together: - const bool bAdjust = 0 == ((SwPageFrm*)GetUpper())->GetFmt()->GetDoc()-> - GetFtnIdxs().Count(); + const bool bAdjust = ((SwPageFrm*)GetUpper())->GetFmt()->GetDoc()-> + GetFtnIdxs().empty(); (Prt().*fnRect->fnSetPosY)( bAdjust ? nBorder : 0 ); (Prt().*fnRect->fnSetHeight)( nSize ); @@ -1093,7 +1093,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields ) SwRootFrm *pRoot = (SwRootFrm*)pStart->GetUpper(); SwDoc* pDoc = pStart->GetFmt()->GetDoc(); - const sal_Bool bFtns = 0 != pDoc->GetFtnIdxs().Count(); + const bool bFtns = !pDoc->GetFtnIdxs().empty(); SwPageFrm *pPage = pStart; if( pPage->GetPrev() && ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage() ) @@ -1341,7 +1341,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) { SwPageFrm *pDel = pSibling; pSibling = (SwPageFrm*)pSibling->GetNext(); - if ( pDoc->GetFtnIdxs().Count() ) + if ( !pDoc->GetFtnIdxs().empty() ) pRoot->RemoveFtns( pDel, sal_True ); pDel->Cut(); delete pDel; @@ -1364,7 +1364,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn ) { SwPageFrm *pDel = pSibling; pSibling = (SwPageFrm*)pSibling->GetNext(); - if ( pDoc->GetFtnIdxs().Count() ) + if ( !pDoc->GetFtnIdxs().empty() ) pRoot->RemoveFtns( pDel, sal_True ); pDel->Cut(); delete pDel; @@ -1535,7 +1535,7 @@ void SwRootFrm::RemoveSuperfluous() { SwPageFrm *pEmpty = pPage; pPage = (SwPageFrm*)pPage->GetPrev(); - if ( GetFmt()->GetDoc()->GetFtnIdxs().Count() ) + if ( !GetFmt()->GetDoc()->GetFtnIdxs().empty() ) RemoveFtns( pEmpty, sal_True ); pEmpty->Cut(); delete pEmpty; @@ -1617,7 +1617,7 @@ void SwRootFrm::AssertFlyPages() } //Jetzt koennen die Endnotenseiten natuerlich wieder krumm sein; //in diesem Fall werden sie vernichtet. - if ( pDoc->GetFtnIdxs().Count() ) + if ( !pDoc->GetFtnIdxs().empty() ) { pPage = (SwPageFrm*)Lower(); while ( pPage && !pPage->IsFtnPage() ) diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 848c921b2c30..177cd4d4b620 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -482,14 +482,14 @@ SwCntntFrm::~SwCntntFrm() sal_uLong nIndex = pCNd->GetIndex(); rFtnIdxs.SeekEntry( *pTxtNd, &nPos ); SwTxtFtn* pTxtFtn; - if( nPos < rFtnIdxs.Count() ) + if( nPos < rFtnIdxs.size() ) { while( nPos && pTxtNd == &(rFtnIdxs[ nPos ]->GetTxtNode()) ) --nPos; if( nPos || pTxtNd != &(rFtnIdxs[ nPos ]->GetTxtNode()) ) ++nPos; } - while( nPos < rFtnIdxs.Count() ) + while( nPos < rFtnIdxs.size() ) { pTxtFtn = rFtnIdxs[ nPos ]; if( pTxtFtn->GetTxtNode().GetIndex() > nIndex ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 6d2456583e6f..fa1e75a85df8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -475,7 +475,7 @@ void lcl_MoveRowContent( SwRowFrm& rSourceLine, SwRowFrm& rDestLine ) // void lcl_MoveFootnotes( SwTabFrm& rSource, SwTabFrm& rDest, SwLayoutFrm& rRowFrm ) { - if ( 0 != rSource.GetFmt()->GetDoc()->GetFtnIdxs().Count() ) + if ( !rSource.GetFmt()->GetDoc()->GetFtnIdxs().empty() ) { SwFtnBossFrm* pOldBoss = rSource.FindFtnBossFrm( sal_True ); SwFtnBossFrm* pNewBoss = rDest.FindFtnBossFrm( sal_True ); @@ -1866,7 +1866,7 @@ void SwTabFrm::MakeAll() bool bMovedFwd = false; // gets set to true when the Frm is split bool bSplit = false; - const sal_Bool bFtnsInDoc = 0 != GetFmt()->GetDoc()->GetFtnIdxs().Count(); + const bool bFtnsInDoc = !GetFmt()->GetDoc()->GetFtnIdxs().empty(); sal_Bool bMoveable; const sal_Bool bFly = IsInFly(); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index c04b03db57cd..d9b3def8e04a 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1930,7 +1930,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // // FOOTNOTES // - const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().Count(); + const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().size(); for ( sal_uInt16 nIdx = 0; nIdx < nFtnCount; ++nIdx ) { // Set cursor to text node that contains the footnote: diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 3755a1622422..6000271685f8 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -52,16 +52,14 @@ namespace { SwTxtFtn *pExclude, std::vector<SwTxtFtn*> &rInvalid) { - int n; std::set<sal_uInt16> aArr; SwFtnIdxs& ftnIdxs = rDoc.GetFtnIdxs(); - SwTxtFtn* pTxtFtn; rInvalid.clear(); - for( n = 0; n < ftnIdxs.Count(); ++n ) + for( sal_uInt16 n = 0; n < ftnIdxs.size(); ++n ) { - pTxtFtn = ftnIdxs[ n ]; + SwTxtFtn* pTxtFtn = ftnIdxs[ n ]; if ( pTxtFtn != pExclude ) { if ( USHRT_MAX == pTxtFtn->GetSeqRefNo() ) @@ -314,12 +312,12 @@ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, sal_Bool bDelNode ) DELETEZ( m_pStartNode ); // loesche die Fussnote noch aus dem Array am Dokument - for( sal_uInt16 n = 0; n < pDoc->GetFtnIdxs().Count(); ++n ) + for( sal_uInt16 n = 0; n < pDoc->GetFtnIdxs().size(); ++n ) if( this == pDoc->GetFtnIdxs()[n] ) { - pDoc->GetFtnIdxs().Remove( n ); + pDoc->GetFtnIdxs().erase( pDoc->GetFtnIdxs().begin() + n ); // gibt noch weitere Fussnoten - if( !pDoc->IsInDtor() && n < pDoc->GetFtnIdxs().Count() ) + if( !pDoc->IsInDtor() && n < pDoc->GetFtnIdxs().size() ) { SwNodeIndex aTmp( pDoc->GetFtnIdxs()[n]->GetTxtNode() ); pDoc->GetFtnIdxs().UpdateFtn( aTmp ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 0e3c6d696e9b..b9664806b867 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1088,7 +1088,7 @@ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl, SwNodes& rNds = GetNodes(); // Update beim Level 0 noch die Fussnoten !! - if( ( !nNewLevel || !nOldLevel) && pDoc->GetFtnIdxs().Count() && + if( ( !nNewLevel || !nOldLevel) && !pDoc->GetFtnIdxs().empty() && FTNNUM_CHAPTER == pDoc->GetFtnInfo().eNum && rNds.IsDocNodes() ) { diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index a1afcde4cfa0..367884ac9113 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1389,13 +1389,13 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) if( !bNewFtn ) { // eine alte Ftn wird umgehaengt (z.B. SplitNode) - for( sal_uInt16 n = 0; n < pDoc->GetFtnIdxs().Count(); ++n ) + for( sal_uInt16 n = 0; n < pDoc->GetFtnIdxs().size(); ++n ) if( pAttr == pDoc->GetFtnIdxs()[n] ) { // neuen Index zuweisen, dafuer aus dem SortArray // loeschen und neu eintragen pTxtFtn = pDoc->GetFtnIdxs()[n]; - pDoc->GetFtnIdxs().Remove( n ); + pDoc->GetFtnIdxs().erase( pDoc->GetFtnIdxs().begin() + n ); break; } // wenn ueber Undo der StartNode gesetzt wurde, kann @@ -1411,7 +1411,7 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // FussNote im Redline-Bereich NICHT ins FtnArray einfuegen! if( StartOfSectionIndex() > rNodes.GetEndOfRedlines().GetIndex() ) { - const bool bSuccess = pDoc->GetFtnIdxs().Insert(pTxtFtn); + const bool bSuccess = pDoc->GetFtnIdxs().insert(pTxtFtn).second; OSL_ENSURE( bSuccess, "FtnIdx not inserted." ); (void) bSuccess; // unused in non-debug } diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index a67586bf5b72..ea1995d1e3d7 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -540,7 +540,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, if( nsDelCntntType::DELCNT_FTN & nDelCntntType ) { SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs(); - if( rFtnArr.Count() ) + if( !rFtnArr.empty() ) { const SwNode* pFtnNd; sal_uInt16 nPos; @@ -548,7 +548,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, SwTxtFtn* pSrch; // for now delete all that come afterwards - while( nPos < rFtnArr.Count() && ( pFtnNd = + while( nPos < rFtnArr.size() && ( pFtnNd = &( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex() <= pEnd->nNode.GetIndex() ) { diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index b24524176824..ba6570c0d132 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1811,7 +1811,7 @@ sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException ) if(!IsValid()) throw uno::RuntimeException(); sal_Int32 nCount = 0; - sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size(); SwTxtFtn* pTxtFtn; for( n = 0; n < nFtnCnt; ++n ) { @@ -1832,7 +1832,7 @@ uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex) sal_Int32 nCount = 0; if(IsValid()) { - sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count(); + sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size(); SwTxtFtn* pTxtFtn; uno::Reference< XFootnote > xRef; for( n = 0; n < nFtnCnt; ++n ) @@ -1868,7 +1868,7 @@ sal_Bool SwXFootnotes::hasElements(void) throw( uno::RuntimeException ) SolarMutexGuard aGuard; if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->GetFtnIdxs().Count() > 0; + return !GetDoc()->GetFtnIdxs().empty(); } Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt ) diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 09e63bd08e8d..304bed62167a 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -361,7 +361,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) // force creation of sequence id - is used for references if (pNewDoc->IsInReading()) { - pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().Count()); + pTxtAttr->SetSeqNo(pNewDoc->GetFtnIdxs().size()); } else { diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index b2b1d56ff253..a1359bd80e50 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1263,7 +1263,7 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos) break; case SwFootnoteStartNode: { - const sal_uInt16 nFtnCnt = rDoc.GetFtnIdxs().Count(); + const sal_uInt16 nFtnCnt = rDoc.GetFtnIdxs().size(); uno::Reference< text::XFootnote > xRef; for (sal_uInt16 n = 0; n < nFtnCnt; ++n ) { diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index c8c504c2373c..03584cd28a6d 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -664,7 +664,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, sal_Bool bUsed ) } const SwFtnIdxs& rIdxs = pDoc->GetFtnIdxs(); - nArrLen = rIdxs.Count(); + nArrLen = rIdxs.size(); sal_uInt16 nEnd = 0, nFtn = 0; for( i=0; i < nArrLen; i++ ) { diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 2a1d4bbdbdf5..54cc347dd9da 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -139,7 +139,7 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport ) { // if exist any Foot-/End-Notes then get from the EndNoteInfo struct // the CharFormats. They will create it! - if ( m_rExport.pDoc->GetFtnIdxs().Count() ) + if ( !m_rExport.pDoc->GetFtnIdxs().empty() ) { m_rExport.pDoc->GetEndNoteInfo().GetAnchorCharFmt( *m_rExport.pDoc ); m_rExport.pDoc->GetEndNoteInfo().GetCharFmt( *m_rExport.pDoc ); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 2eb6cd75decf..0e3b08a87670 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -382,7 +382,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() const SwNodeIndex* pSttIdx = ((SwTxtFtn*)pFN)->GetStartNode(); OSL_ENSURE(pSttIdx, "Probleme beim Anlegen des Fussnoten-Textes"); - ((SwTxtFtn*)pFN)->SetSeqNo( rDoc.GetFtnIdxs().Count() ); + ((SwTxtFtn*)pFN)->SetSeqNo( rDoc.GetFtnIdxs().size() ); bool bOld = bFtnEdn; bFtnEdn = true; |