summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-19 13:12:17 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-25 14:13:45 +0200
commit63f792d9b1482c518f37b4d0681082ea49957a1e (patch)
tree20a971bd0aff47a6bfea9bba60ff189dba75829c
parent9532d9bc22b411f20d8203b9495aea2eae158e72 (diff)
Convert SV_DECL_PTRARR_SORT(SwOutlineNodes) to o3tl::sorted_vector
Change-Id: I17c40bda4ab401bde42b64d090fd7e3259e79026
-rw-r--r--sw/inc/ndarr.hxx13
-rw-r--r--sw/source/core/crsr/crstrvl.cxx12
-rwxr-xr-xsw/source/core/doc/dbgoutsw.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx8
-rw-r--r--sw/source/core/doc/docdde.cxx4
-rw-r--r--sw/source/core/doc/docglbl.cxx26
-rw-r--r--sw/source/core/doc/docnew.cxx4
-rw-r--r--sw/source/core/doc/docnum.cxx18
-rw-r--r--sw/source/core/doc/doctxm.cxx2
-rw-r--r--sw/source/core/doc/ftnidx.cxx10
-rw-r--r--sw/source/core/docnode/ndnum.cxx63
-rw-r--r--sw/source/core/docnode/node.cxx6
-rw-r--r--sw/source/core/docnode/nodes.cxx22
-rw-r--r--sw/source/core/edit/ednumber.cxx2
-rw-r--r--sw/source/filter/basflt/fltini.cxx4
-rw-r--r--sw/source/ui/app/docsh.cxx2
-rw-r--r--sw/source/ui/app/docsh2.cxx4
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx6
18 files changed, 90 insertions, 118 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 0faba74af165..051476856231 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -35,11 +35,11 @@
#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <svl/svarray.hxx>
#include <svtools/embedhlp.hxx>
#include <bparr.hxx>
#include <ndtyp.hxx>
+#include <o3tl/sorted_vector.hxx>
class Graphic;
class GraphicObject;
@@ -82,7 +82,16 @@ typedef SwNode * SwNodePtr;
typedef sal_Bool (*FnForEach_SwNodes)( const SwNodePtr&, void* pArgs );
typedef struct _xmlTextWriter *xmlTextWriterPtr;
-SV_DECL_PTRARR_SORT( SwOutlineNodes, SwNodePtr, 0 )
+struct CompareSwOutlineNodes
+{
+ bool operator()( SwNode* const& lhs, SwNode* const& rhs) const;
+};
+
+class SwOutlineNodes : public o3tl::sorted_vector<SwNode*, CompareSwOutlineNodes>
+{
+public:
+ bool Seek_Entry(SwNode* const &rP, sal_uInt16* pnPos) const;
+};
class SW_DLLPUBLIC SwNodes
: private BigPtrArray
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index dbe766bab966..6509f8f144c1 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -826,7 +826,7 @@ sal_Bool SwCrsrShell::GotoNextOutline()
if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
++nPos;
- if( nPos == rNds.GetOutLineNds().Count() )
+ if( nPos == rNds.GetOutLineNds().size() )
return sal_False;
pNd = rNds.GetOutLineNds()[ nPos ];
@@ -903,7 +903,7 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
{
const SwNodes& rNds = GetDoc()->GetNodes();
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
- if( !rOutlNds.Count() )
+ if( rOutlNds.empty() )
return sal_False;
SET_CURR_SHELL( this );
@@ -923,7 +923,7 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
if( bWithChildren )
{
const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
- for( ++nEndPos; nEndPos < rOutlNds.Count(); ++nEndPos )
+ for( ++nEndPos; nEndPos < rOutlNds.size(); ++nEndPos )
{
pEndNd = rOutlNds[ nEndPos ];
const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;
@@ -932,10 +932,10 @@ sal_Bool SwCrsrShell::MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos,
}
}
// if without children then set onto next one
- else if( ++nEndPos < rOutlNds.Count() )
+ else if( ++nEndPos < rOutlNds.size() )
pEndNd = rOutlNds[ nEndPos ];
- if( nEndPos == rOutlNds.Count() ) // no end found
+ if( nEndPos == rOutlNds.size() ) // no end found
pEndNd = &rNds.GetEndOfContent();
KillPams();
@@ -1020,7 +1020,7 @@ sal_Bool SwCrsrShell::GetContentAtPos( const Point& rPt,
const SwNodes& rNds = GetDoc()->GetNodes();
if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
- && rNds.GetOutLineNds().Count() )
+ && !rNds.GetOutLineNds().empty() )
{
const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
if( pONd )
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index aa6c9e855e90..6854be4f53ad 100755
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -828,7 +828,7 @@ String lcl_dbg_out(SwOutlineNodes & rNodes)
{
String aStr("[\n", RTL_TEXTENCODING_ASCII_US);
- for (sal_uInt16 i = 0; i < rNodes.Count(); i++)
+ for (sal_uInt16 i = 0; i < rNodes.size(); i++)
{
aStr += lcl_dbg_out(*rNodes[i]);
aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 33a6af27170b..845ae427933f 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2066,12 +2066,12 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const String& rName ) const
void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool bImpress )
{
const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds();
- if( pExtDoc && rOutNds.Count() )
+ if( pExtDoc && !rOutNds.empty() )
{
sal_uInt16 i;
- ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.Count(), GetDocShell() );
+ ::StartProgress( STR_STATSTR_SUMMARY, 0, rOutNds.size(), GetDocShell() );
SwNodeIndex aEndOfDoc( pExtDoc->GetNodes().GetEndOfContent(), -1 );
- for( i = 0; i < rOutNds.Count(); ++i )
+ for( i = 0; i < rOutNds.size(); ++i )
{
::SetProgressState( i, GetDocShell() );
const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
@@ -2081,7 +2081,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool
continue;
sal_uInt16 nEndOfs = 1;
sal_uInt8 nWish = nPara;
- sal_uLong nNextOutNd = i + 1 < rOutNds.Count() ?
+ sal_uLong nNextOutNd = i + 1 < (sal_uInt16)rOutNds.size() ?
rOutNds[ i + 1 ]->GetIndex() : GetNodes().Count();
sal_Bool bKeep = sal_False;
while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index edc6c87598bb..7023c8d77f4c 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -370,14 +370,14 @@ sal_Bool SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
// look for the section's end, now
for( ++nTmpPos;
- nTmpPos < rOutlNds.Count() &&
+ nTmpPos < rOutlNds.size() &&
nLvl < rOutlNds[ nTmpPos ]->GetTxtNode()->
//GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei
GetAttrOutlineLevel()-1;//<-end,zhaojianwei
++nTmpPos )
; // there is no block
- if( nTmpPos < rOutlNds.Count() )
+ if( nTmpPos < rOutlNds.size() )
rpRange->aEnd = *rOutlNds[ nTmpPos ];
else
rpRange->aEnd = GetNodes().GetEndOfContent();
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 60dbf890cad0..dd38654fdc32 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -91,8 +91,8 @@ SwNodePtr GetStartNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16*
{
SwNodePtr pNd;
- for( ; *nOutl < pOutlNds->Count(); ++(*nOutl) )
- if( ( pNd = pOutlNds->GetObject( *nOutl ))->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel && !pNd->FindTableNode() )
+ for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
+ if( ( pNd = (*pOutlNds)[ *nOutl ])->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel && !pNd->FindTableNode() )
{
return pNd;
}
@@ -104,9 +104,9 @@ SwNodePtr GetEndNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* n
{
SwNodePtr pNd;
- for( ++(*nOutl); (*nOutl) < pOutlNds->Count(); ++(*nOutl) )
+ for( ++(*nOutl); (*nOutl) < pOutlNds->size(); ++(*nOutl) )
{
- pNd = pOutlNds->GetObject( *nOutl );
+ pNd = (*pOutlNds)[ *nOutl ];
const int nLevel = pNd->GetTxtNode()->GetAttrOutlineLevel();
@@ -123,8 +123,8 @@ SwNodePtr GetEndNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* n
SwNodePtr GetStartNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplitColl, sal_uInt16* nOutl )
{
SwNodePtr pNd;
- for( ; *nOutl < pOutlNds->Count(); ++(*nOutl) )
- if( ( pNd = pOutlNds->GetObject( *nOutl ))->GetTxtNode()->
+ for( ; *nOutl < pOutlNds->size(); ++(*nOutl) )
+ if( ( pNd = (*pOutlNds)[ *nOutl ])->GetTxtNode()->
GetTxtColl() == pSplitColl &&
!pNd->FindTableNode() )
{
@@ -137,9 +137,9 @@ SwNodePtr GetEndNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplit
{
SwNodePtr pNd;
- for( ++(*nOutl); *nOutl < pOutlNds->Count(); ++(*nOutl) )
+ for( ++(*nOutl); *nOutl < pOutlNds->size(); ++(*nOutl) )
{
- pNd = pOutlNds->GetObject( *nOutl );
+ pNd = (*pOutlNds)[ *nOutl ];
SwTxtFmtColl* pTColl = pNd->GetTxtNode()->GetTxtColl();
if( ( pTColl == pSplitColl ||
@@ -174,13 +174,13 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
// If it isn't a OutlineNumbering, then use an own array and collect the Nodes.
if( pSplitColl->GetAttrOutlineLevel() == 0 )//<-end,zhaojianwei, 0814
{
- pOutlNds = new SwOutlineNodes( 8 );
+ pOutlNds = new SwOutlineNodes;
SwIterator<SwTxtNode,SwFmtColl> aIter( *pSplitColl );
for( SwTxtNode* pTNd = aIter.First(); pTNd; pTNd = aIter.Next() )
if( pTNd->GetNodes().IsDocNodes() )
- pOutlNds->Insert( pTNd );
+ pOutlNds->insert( pTNd );
- if( !pOutlNds->Count() )
+ if( pOutlNds->empty() )
{
delete pOutlNds;
return false;
@@ -244,8 +244,8 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
// Skip all invalid ones
- while( nOutl < pOutlNds->Count() &&
- pOutlNds->GetObject( nOutl )->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+ while( nOutl < pOutlNds->size() &&
+ (*pOutlNds)[ nOutl ]->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
++nOutl;
do {
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5b14784d034f..7a2e26135c7b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -558,9 +558,9 @@ SwDoc::~SwDoc()
// The ChapterNumbers/Numbers need to be deleted before the Templates
// or we update all the time!
- m_pNodes->pOutlineNds->Remove(sal_uInt16(0), m_pNodes->pOutlineNds->Count());
+ m_pNodes->pOutlineNds->clear();
SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
- rUndoNodes.pOutlineNds->Remove(sal_uInt16(0), rUndoNodes.pOutlineNds->Count());
+ rUndoNodes.pOutlineNds->clear();
pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() );
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index a264f7bd9b11..70a5fad77aa4 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -184,7 +184,7 @@ void SwDoc::PropagateOutlineRule()
// Increase/Decrease
sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
{
- if( !GetNodes().GetOutLineNds().Count() || !nOffset )
+ if( GetNodes().GetOutLineNds().empty() || !nOffset )
return sal_False;
// calculate the area
@@ -431,7 +431,7 @@ sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
const SwPosition& rStt = *rPam.Start(),
& rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark()
: *rPam.GetPoint();
- if( !GetNodes().GetOutLineNds().Count() || !nOffset ||
+ if( GetNodes().GetOutLineNds().empty() || !nOffset ||
(rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) ||
(rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()))
{
@@ -471,7 +471,7 @@ sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
++nTmpPos; // For sub outlines only!
}
- aEndRg = nTmpPos < GetNodes().GetOutLineNds().Count()
+ aEndRg = nTmpPos < GetNodes().GetOutLineNds().size()
? *GetNodes().GetOutLineNds()[ nTmpPos ]
: GetNodes().GetEndOfContent();
if( nOffset >= 0 )
@@ -513,7 +513,7 @@ sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
// calculation of the new position
if( nOffset < 0 && nAktPos < sal_uInt16(-nOffset) )
pNd = GetNodes().GetEndOfContent().StartOfSectionNode();
- else if( nAktPos + nOffset >= GetNodes().GetOutLineNds().Count() )
+ else if( nAktPos + nOffset >= (sal_uInt16)GetNodes().GetOutLineNds().size() )
pNd = &GetNodes().GetEndOfContent();
else
pNd = GetNodes().GetOutLineNds()[ nAktPos + nOffset ];
@@ -579,7 +579,7 @@ sal_uInt16 lcl_FindOutlineName( const SwNodes& rNds, const String& rName,
{
sal_uInt16 nSavePos = USHRT_MAX;
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
- for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rOutlNds.size(); ++n )
{
SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
String sTxt( pTxtNd->GetExpandTxt() );
@@ -646,12 +646,12 @@ sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, String& rName )
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
// Without OutlineNodes searching doesn't pay off
// and we save a crash
- if(!rOutlNds.Count())
+ if( rOutlNds.empty() )
return USHRT_MAX;
SwTxtNode* pNd;
nPos = 0;
// search in the existing outline nodes for the required outline num array
- for( ; nPos < rOutlNds.Count(); ++nPos )
+ for( ; nPos < rOutlNds.size(); ++nPos )
{
pNd = rOutlNds[ nPos ]->GetTxtNode();
const int nLvl = pNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei
@@ -687,7 +687,7 @@ sal_uInt16 lcl_FindOutlineNum( const SwNodes& rNds, String& rName )
}
}
}
- if( nPos >= rOutlNds.Count() )
+ if( nPos >= rOutlNds.size() )
nPos = USHRT_MAX;
return nPos;
}
@@ -2417,7 +2417,7 @@ void SwDoc::getNumItems( tSortedNodeNumList& orNodeNumList ) const
// implementation for interface <IDocumentOutlineNodes>
sal_Int32 SwDoc::getOutlineNodesCount() const
{
- return GetNodes().GetOutLineNds().Count();
+ return GetNodes().GetOutLineNds().size();
}
int SwDoc::getOutlineLevel( const sal_Int32 nIdx ) const
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 2a2b3d41155d..82a86fe0ed23 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1214,7 +1214,7 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode )
SwNodes& rNds = pDoc->GetNodes();
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
- for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rOutlNds.size(); ++n )
{
::SetProgressState( 0, pDoc->GetDocShell() );
SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode();
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index 1b6393cee092..4ad477b3c7b7 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -98,19 +98,19 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras();
sal_uLong nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
- if( rOutlNds.Count() )
+ if( !rOutlNds.empty() )
{
// Find the Chapter's start, which contains rStt
sal_uInt16 n;
- for( n = 0; n < rOutlNds.Count(); ++n )
+ for( n = 0; n < rOutlNds.size(); ++n )
if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() )
break; // found it!
//else if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) //#outline level,zhaojianwei
else if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 ) //<-end,zhaojianwei
pCapStt = rOutlNds[ n ]; // Beginning of a new Chapter
// now find the end of the range
- for( ; n < rOutlNds.Count(); ++n )
+ for( ; n < rOutlNds.size(); ++n )
//if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei
if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
{
@@ -132,7 +132,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
if( nPos == Count() ) // nothing found
return;
- if( !rOutlNds.Count() )
+ if( rOutlNds.empty() )
nFtnNo = nPos+1;
for( ; nPos < Count(); ++nPos )
@@ -219,7 +219,7 @@ void SwFtnIdxs::UpdateAllFtn()
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
sal_uInt16 nNo = 1, // Number for the Footnotes
nFtnIdx = 0; // Index into theFtnIdx array
- for( sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rOutlNds.size(); ++n )
{
if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
{
diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx
index 71552dde9c46..257400101ed0 100644
--- a/sw/source/core/docnode/ndnum.cxx
+++ b/sw/source/core/docnode/ndnum.cxx
@@ -33,53 +33,16 @@
#include <fldbas.hxx> // UpdateFlds der KapitelNummerierung
#include <docary.hxx>
-_SV_IMPL_SORTAR_ALG( SwOutlineNodes, SwNodePtr )
-sal_Bool SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, sal_uInt16* pFndPos ) const
+bool CompareSwOutlineNodes::operator()( SwNode* const& lhs, SwNode* const& rhs) const
{
- sal_uLong nIdx = rSrch->GetIndex();
-
- sal_uInt16 nO = Count(), nM, nU = 0;
- if( nO > 0 )
- {
-//JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo
-// Nodes aus dem falschen NodesArray im OutlineArray standen,
-// jetzt mal einen Check eingebaut.
-#if OSL_DEBUG_LEVEL > 0
- {
- for( sal_uInt16 n = 1; n < nO; ++n )
- if( &(*this)[ n-1 ]->GetNodes() !=
- &(*this)[ n ]->GetNodes() )
- {
- OSL_ENSURE( !this, "Node im falschen Outline-Array" );
- }
- }
-#endif
+ return lhs->GetIndex() < rhs->GetIndex();
+}
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- if( (*this)[ nM ] == rSrch )
- {
- if( pFndPos )
- *pFndPos = nM;
- return sal_True;
- }
- else if( (*this)[ nM ]->GetIndex() < nIdx )
- 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 SwOutlineNodes::Seek_Entry(SwNode* const &rP, sal_uInt16* pnPos) const
+{
+ const_iterator it = lower_bound(rP);
+ *pnPos = it - begin();
+ return it != end() && rP->GetIndex() == (*it)->GetIndex();
}
void SwNodes::UpdateOutlineNode(SwNode & rNd)
@@ -88,7 +51,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd)
if (pTxtNd && pTxtNd->IsOutlineStateChanged())
{
- sal_Bool bFound = pOutlineNds->Seek_Entry(pTxtNd);
+ sal_Bool bFound = pOutlineNds->find(pTxtNd) != pOutlineNds->end();
if (pTxtNd->IsOutline())
{
@@ -97,7 +60,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd)
// assure that text is in the correct nodes array
if ( &(pTxtNd->GetNodes()) == this )
{
- pOutlineNds->Insert(pTxtNd);
+ pOutlineNds->insert(pTxtNd);
}
else
{
@@ -108,7 +71,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd)
else
{
if (bFound)
- pOutlineNds->Remove(pTxtNd);
+ pOutlineNds->erase(pTxtNd);
}
pTxtNd->UpdateOutlineState();
@@ -120,13 +83,13 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd)
void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
{
- if( !pOutlineNds->Count() ) // keine OutlineNodes vorhanden ?
+ if( pOutlineNds->empty() ) // keine OutlineNodes vorhanden ?
return;
const SwNodePtr pSrch = (SwNodePtr)&rNd;
sal_uInt16 nPos;
pOutlineNds->Seek_Entry( pSrch, &nPos );
- if( nPos == pOutlineNds->Count() ) // keine zum Updaten vorhanden ?
+ if( nPos == pOutlineNds->size() ) // keine zum Updaten vorhanden ?
return;
if( nPos )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index fc519c0c47e2..3f4f5aa9367e 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -805,7 +805,7 @@ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
{
const SwTxtNode* pRet = 0;
const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
- if( MAXLEVEL > nLvl && rONds.Count() )
+ if( MAXLEVEL > nLvl && !rONds.empty() )
{
sal_uInt16 nPos;
SwNode* pNd = (SwNode*)this;
@@ -1836,11 +1836,11 @@ sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
{
sal_uInt16 nPos;
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
- if( rOutlNds.Count() )
+ if( !rOutlNds.empty() )
{
if( !rOutlNds.Seek_Entry( (SwCntntNode*)this, &nPos ) && nPos )
--nPos;
- if( nPos < rOutlNds.Count() &&
+ if( nPos < rOutlNds.size() &&
rOutlNds[ nPos ]->GetIndex() < GetIndex() )
{
SwTxtNode* pOutlNd = rOutlNds[ nPos ]->GetTxtNode();
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index ca189e9e652f..d8d53e514ec6 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -176,7 +176,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
if (pTxtNode->IsOutline())
{
const SwNodePtr pSrch = (SwNodePtr)&rNd;
- pOutlineNds->Remove( pSrch );
+ pOutlineNds->erase( pSrch );
}
}
@@ -191,7 +191,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
if (bInsOutlineIdx && rTxtNd.IsOutline())
{
const SwNodePtr pSrch = (SwNodePtr)&rNd;
- pOutlineNds->Insert( pSrch );
+ pOutlineNds->insert( pSrch );
}
rTxtNd.InvalidateNumRule();
@@ -234,7 +234,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
// remove outline index from old nodes array
if (pTxtNd->IsOutline())
{
- pOutlineNds->Remove( pNd );
+ pOutlineNds->erase( pNd );
}
// muss die Rule kopiere werden?
@@ -272,7 +272,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
// OultineNodes set the new nodes in the array
if (bInsOutlineIdx && pTxtNd->IsOutline())
{
- rNds.pOutlineNds->Insert( pTxtNd );
+ rNds.pOutlineNds->insert( pTxtNd );
}
pTxtNd->AddToList();
@@ -541,7 +541,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
if (pCNd->IsTxtNode() &&
static_cast<SwTxtNode*>(pCNd)->IsOutline())
{
- pOutlineNds->Remove( pCNd );
+ pOutlineNds->erase( pCNd );
}
else
pCNd = 0;
@@ -550,7 +550,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
BigPtrArray::Move( aMvIdx.GetIndex(), aIdx.GetIndex() );
if( bInsOutlineIdx && pCNd )
- pOutlineNds->Insert( pCNd );
+ pOutlineNds->insert( pCNd );
if( pTmpNd->IsTxtNode() )
((SwTxtNode*)pTmpNd)->AddToList();
}
@@ -576,7 +576,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
// loesche die Gliederungs-Indizies aus
// dem alten Nodes-Array
if( bOutlNd )
- pOutlineNds->Remove( pNd );
+ pOutlineNds->erase( pNd );
RemoveNode( aMvIdx.GetIndex(), 1, sal_False );
pNd->pStartOfSection = pSttNode;
@@ -585,7 +585,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
// setze bei Start/EndNodes die richtigen Indizies
if( bInsOutlineIdx && bOutlNd )
// und setze sie im neuen Nodes-Array
- rNodes.pOutlineNds->Insert( pNd );
+ rNodes.pOutlineNds->insert( pNd );
else if( pNd->IsStartNode() )
pSttNode = (SwStartNode*)pNd;
else if( pNd->IsEndNode() )
@@ -1226,7 +1226,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
{
// loesche die Gliederungs-Indizies.
- pOutlineNds->Remove( nIdxPos );
+ pOutlineNds->erase( pOutlineNds->begin() + nIdxPos );
bUpdateOutline = sal_True;
}
pTxtNode->InvalidateNumRule();
@@ -1288,7 +1288,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
{
if( pTxtNd->IsOutline())
{ // loesche die Gliederungs-Indizies.
- pOutlineNds->Remove( pTxtNd );
+ pOutlineNds->erase( pTxtNd );
bUpdateOutline = sal_True;
}
pTxtNd->InvalidateNumRule();
@@ -1528,7 +1528,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
sal_uInt16 nIdxPos;
if( pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
{
- pOutlineNds->Remove( nIdxPos );
+ pOutlineNds->erase( pOutlineNds->begin() + nIdxPos );
bUpdateNum = 1;
}
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 4a0b614371b5..36a74b0b0361 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -536,7 +536,7 @@ sal_Bool SwEditShell::IsProtectedOutlinePara() const
if( !rOutlNd.Seek_Entry( pNd, &nPos ) && nPos )
--nPos;
- for( ; nPos < rOutlNd.Count(); ++nPos )
+ for( ; nPos < rOutlNd.size(); ++nPos )
{
SwNodePtr pTmpNd = rOutlNd[ nPos ];
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 3808519ba943..c39f80b5d5a2 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -403,11 +403,11 @@ void SwRelNumRuleSpaces::SetOultineRelSpaces( const SwNodeIndex& rStt,
{
SwDoc* pDoc = rStt.GetNode().GetDoc();
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
- if( rOutlNds.Count() )
+ if( !rOutlNds.empty() )
{
sal_uInt16 nPos;
rOutlNds.Seek_Entry( &rStt.GetNode(), &nPos );
- for( ; nPos < rOutlNds.Count() &&
+ for( ; nPos < rOutlNds.size() &&
rOutlNds[ nPos ]->GetIndex() < rEnd.GetIndex(); ++nPos )
{
SwTxtNode* pNd = rOutlNds[ nPos ]->GetTxtNode();
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 9d51d7e6edaa..21f125e210ae 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1010,7 +1010,7 @@ void SwDocShell::GetState(SfxItemSet& rSet)
case FN_ABSTRACT_NEWDOC:
case FN_OUTLINE_TO_CLIPBOARD:
{
- if ( !GetDoc()->GetNodes().GetOutLineNds().Count() )
+ if ( GetDoc()->GetNodes().GetOutLineNds().empty() )
rSet.DisableItem( nWhich );
}
break;
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index d2d6013a2928..32ee54712484 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -1256,10 +1256,10 @@ void SwDocShell::Execute(SfxRequest& rReq)
bool bOutline[MAXLEVEL] = {false};
const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
- if( rOutlNds.Count() )
+ if( !rOutlNds.empty() )
{
int nLevel;
- for(sal_uInt16 n = 0; n < rOutlNds.Count(); ++n )
+ for(sal_uInt16 n = 0; n < rOutlNds.size(); ++n )
if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 &&
! bOutline[nLevel-1] )
{
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index d62ef84e32be..09b5beccfab2 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -3452,7 +3452,7 @@ Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
if(!pxDoc->GetDocShell())
throw RuntimeException();
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
- sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count();
+ sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();
for (sal_uInt16 i = 0; i < nOutlineCount && !bFound; ++i)
{
@@ -3495,7 +3495,7 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames(void)
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
- sal_uInt16 nOutlineCount = rOutlineNodes.Count();
+ sal_uInt16 nOutlineCount = rOutlineNodes.size();
aRet.realloc(nOutlineCount);
OUString* pResArr = aRet.getArray();
String sSuffix = rtl::OUString('|');
@@ -3539,7 +3539,7 @@ sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName)
if(!pxDoc->GetDocShell())
throw RuntimeException();
SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
- sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count();
+ sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().size();
for (sal_uInt16 i = 0; i < nOutlineCount && !bRet; ++i)
{