summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-20 17:16:03 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-26 23:35:27 +0200
commitddd84d08c9bb6e00fbd9a73bd52a28688a8c1ba7 (patch)
tree6d73836125485d4d5e52080453f3ed2eb3df9043
parentf683b7fd81c058cda55fb690201f29448c44a83f (diff)
Convert SV_DECL_PTRARR_SORT_DEL(_SwRedlineTbl) to o3tl::sorted_vector
Change-Id: Ie7edc6b32b373619d4c0ac154da93650743049cf
-rw-r--r--sw/inc/docary.hxx37
-rw-r--r--sw/qa/core/swdoc-test.cxx2
-rw-r--r--sw/source/core/access/parachangetrackinginfo.cxx4
-rw-r--r--sw/source/core/crsr/swcrsr.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx6
-rw-r--r--sw/source/core/doc/docbm.cxx4
-rw-r--r--sw/source/core/doc/doccomp.cxx6
-rw-r--r--sw/source/core/doc/doccorr.cxx4
-rw-r--r--sw/source/core/doc/docedt.cxx26
-rw-r--r--sw/source/core/doc/docfmt.cxx4
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/doc/docnum.cxx10
-rw-r--r--sw/source/core/doc/docredln.cxx183
-rw-r--r--sw/source/core/doc/docsort.cxx4
-rw-r--r--sw/source/core/docnode/ndcopy.cxx10
-rw-r--r--sw/source/core/docnode/ndsect.cxx2
-rw-r--r--sw/source/core/docnode/ndtbl.cxx2
-rw-r--r--sw/source/core/edit/edlingu.cxx2
-rw-r--r--sw/source/core/edit/edredln.cxx4
-rw-r--r--sw/source/core/layout/frmtool.cxx2
-rw-r--r--sw/source/core/table/swtable.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx2
-rw-r--r--sw/source/core/text/redlnitr.cxx4
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx4
-rw-r--r--sw/source/core/txtnode/txtedt.cxx2
-rw-r--r--sw/source/core/undo/undel.cxx2
-rw-r--r--sw/source/core/undo/undobj.cxx8
-rw-r--r--sw/source/core/undo/unins.cxx8
-rw-r--r--sw/source/core/undo/unovwr.cxx2
-rw-r--r--sw/source/core/undo/unredln.cxx4
-rw-r--r--sw/source/core/undo/unsect.cxx2
-rw-r--r--sw/source/core/undo/unspnd.cxx2
-rw-r--r--sw/source/core/undo/untbl.cxx2
-rw-r--r--sw/source/core/undo/untblk.cxx2
-rw-r--r--sw/source/core/unocore/unoportenum.cxx2
-rw-r--r--sw/source/core/unocore/unoredline.cxx2
-rw-r--r--sw/source/core/unocore/unoredlines.cxx14
-rw-r--r--sw/source/core/unocore/unosect.cxx2
-rw-r--r--sw/source/core/unocore/unotbl.cxx2
-rw-r--r--sw/source/core/unocore/unotext.cxx2
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx12
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
-rw-r--r--sw/source/ui/app/docsh.cxx2
44 files changed, 214 insertions, 192 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 8cedf2ff3318..8270a742c6bc 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -32,7 +32,7 @@
#include <vector>
#include <set>
#include <algorithm>
-#include <svl/svarray.hxx>
+#include <o3tl/sorted_vector.hxx>
class SwFieldType;
class SwFmt;
@@ -139,24 +139,29 @@ public:
sal_uInt16 GetPos(const SwNumRule* pRule) const;
};
-typedef SwRedline* SwRedlinePtr;
-SV_DECL_PTRARR_SORT_DEL( _SwRedlineTbl, SwRedlinePtr, 0 )
+struct CompareSwRedlineTbl
+{
+ bool operator()(SwRedline* const &lhs, SwRedline* const &rhs) const;
+};
+class _SwRedlineTbl : public o3tl::sorted_vector<SwRedline*, CompareSwRedlineTbl> {
+public:
+ ~_SwRedlineTbl();
+};
class SwRedlineTbl : private _SwRedlineTbl
{
public:
- SwRedlineTbl( sal_uInt8 nSize = 0 )
- : _SwRedlineTbl( nSize ) {}
- ~SwRedlineTbl() {}
-
- sal_Bool SavePtrInArr( SwRedlinePtr p ) { return _SwRedlineTbl::Insert( p ); }
+ bool Contains(const SwRedline* p) const { return find(const_cast<SwRedline* const>(p)) != end(); }
+ sal_uInt16 GetPos(const SwRedline* p) const;
- sal_Bool Insert( SwRedlinePtr& p, sal_Bool bIns = sal_True );
- sal_Bool Insert( SwRedlinePtr& p, sal_uInt16& rInsPos, sal_Bool bIns = sal_True );
- sal_Bool InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsPos = 0 );
+ bool Insert( SwRedline* p, bool bIns = true );
+ bool Insert( SwRedline* p, sal_uInt16& rInsPos, bool bIns = true );
+ bool InsertWithValidRanges( SwRedline* p, sal_uInt16* pInsPos = 0 );
- void Remove( sal_uInt16 nP, sal_uInt16 nL = 1 );
- void DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL=1 );
+ void Remove( sal_uInt16 nPos );
+ bool Remove( const SwRedline* p );
+ void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
+ void DeleteAndDestroyAll();
// Search next or previous Redline with the same Seq. No.
// Search can be restricted via Lookahaed.
@@ -168,11 +173,9 @@ public:
sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
sal_uInt16 nLookahead = 20 ) const;
- using _SwRedlineTbl::Count;
+ using _SwRedlineTbl::size;
using _SwRedlineTbl::operator[];
- using _SwRedlineTbl::GetObject;
- using _SwRedlineTbl::Seek_Entry;
- using _SwRedlineTbl::GetPos;
+ using _SwRedlineTbl::empty;
};
class SwUnoCrsrTbl : public std::set<SwUnoCrsr*> {
diff --git a/sw/qa/core/swdoc-test.cxx b/sw/qa/core/swdoc-test.cxx
index e47b7d18ecd3..3e26b1f2d451 100644
--- a/sw/qa/core/swdoc-test.cxx
+++ b/sw/qa/core/swdoc-test.cxx
@@ -434,7 +434,7 @@ void SwDocTest::testSwScanner()
const SwRedlineTbl& rTbl = m_pDoc->GetRedlineTbl();
SwNodes& rNds = m_pDoc->GetNodes();
- CPPUNIT_ASSERT(rTbl.Count() == 1);
+ CPPUNIT_ASSERT(rTbl.size() == 1);
SwNodeIndex* pNodeIdx = rTbl[0]->GetContentIdx();
CPPUNIT_ASSERT(pNodeIdx);
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
index 817c40de85e9..a9c443ca979d 100644
--- a/sw/source/core/access/parachangetrackinginfo.cxx
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -65,7 +65,7 @@ namespace {
}
if ( !IDocumentRedlineAccess::IsShowChanges( pIDocChangeTrack->GetRedlineMode() ) ||
- pIDocChangeTrack->GetRedlineTbl().Count() == 0 )
+ pIDocChangeTrack->GetRedlineTbl().empty() )
{
// nothing to do --> empty change track text markup lists.
return;
@@ -88,7 +88,7 @@ namespace {
// iteration over the redlines which overlap with the text node.
const SwRedlineTbl& rRedlineTbl = pIDocChangeTrack->GetRedlineTbl();
- const sal_uInt16 nRedlineCount( rRedlineTbl.Count() );
+ const sal_uInt16 nRedlineCount( rRedlineTbl.size() );
for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTxtNode;
nActRedline < nRedlineCount;
++nActRedline)
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index ff8a90b64bbb..e99d94885b6c 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1404,7 +1404,7 @@ static String lcl_MaskDeletedRedlines( const SwTxtNode* pTxtNd )
if ( nShowChg )
{
sal_uInt16 nAct = rDoc.GetRedlinePos( *pTxtNd, USHRT_MAX );
- for ( ; nAct < rDoc.GetRedlineTbl().Count(); nAct++ )
+ for ( ; nAct < rDoc.GetRedlineTbl().size(); nAct++ )
{
const SwRedline* pRed = rDoc.GetRedlineTbl()[ nAct ];
if ( pRed->Start()->nNode > pTxtNd->GetIndex() )
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 845ae427933f..f6392318585e 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -846,7 +846,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
SwPaM aPam( rPos );
aPam.SetMark();
@@ -884,7 +884,7 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
GetIDocumentUndoRedo().AppendUndo( new SwUndoInsert( rPos.nNode ) );
}
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
SwPaM aPam( rPos );
aPam.SetMark();
@@ -976,7 +976,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
}
}
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
SwPaM aPam( rPos.nNode, aTmp.GetCntnt(),
rPos.nNode, rPos.nContent.GetIndex());
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f3befe4f1ecd..9ec2174f45e6 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1163,7 +1163,7 @@ void _DelBookmarks(
// which holds all position information as offset.
// Assignement happens after moving.
SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
- for(sal_uInt16 nCnt = 0; nCnt < rTbl.Count(); ++nCnt )
+ for(sal_uInt16 nCnt = 0; nCnt < rTbl.size(); ++nCnt )
{
// Is at position?
SwRedline* pRedl = rTbl[ nCnt ];
@@ -1276,7 +1276,7 @@ void _SaveCntntIdx(SwDoc* pDoc,
// 2. Redlines
aSave.SetTypeAndCount( 0x1000, 0 );
const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
- for( ; aSave.GetCount() < rRedlTbl.Count(); aSave.IncCount() )
+ for( ; aSave.GetCount() < rRedlTbl.size(); aSave.IncCount() )
{
const SwRedline* pRdl = rRedlTbl[ aSave.GetCount() ];
int nPointPos = lcl_RelativePosition( *pRdl->GetPoint(), nNode, nCntnt );
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 11c43f32496e..0ed56d72a2bf 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1931,7 +1931,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
--n;
const SwRedlineTbl& rRedlineTbl = pDoc->GetRedlineTbl();
- for( ; n < rRedlineTbl.Count(); ++n )
+ for( ; n < rRedlineTbl.size(); ++n )
{
SwRedline* pRedl = rRedlineTbl[ n ];
SwPosition* pRStt = pRedl->Start(),
@@ -1954,7 +1954,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
case POS_COLLIDE_END:
case POS_BEFORE:
- n = rRedlineTbl.Count();
+ n = rRedlineTbl.size();
break;
case POS_OUTSIDE:
@@ -2050,7 +2050,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
const SwRedlineTbl& rSrcRedlTbl = rSrcDoc.GetRedlineTbl();
sal_uLong nEndOfExtra = rSrcDoc.GetNodes().GetEndOfExtras().GetIndex();
sal_uLong nMyEndOfExtra = GetNodes().GetEndOfExtras().GetIndex();
- for( sal_uInt16 n = 0; n < rSrcRedlTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rSrcRedlTbl.size(); ++n )
{
const SwRedline* pRedl = rSrcRedlTbl[ n ];
sal_uLong nNd = pRedl->GetPoint()->nNode.GetIndex();
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index b81204643a8a..c7f106688ca3 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -207,7 +207,7 @@ void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset);
{ // fix redlines
SwRedlineTbl& rTbl = *pRedlineTbl;
- for (sal_uInt16 n = 0; n < rTbl.Count(); )
+ for (sal_uInt16 n = 0; n < rTbl.size(); )
{
// is on position ??
SwRedline *const pRedline( rTbl[ n ] );
@@ -326,7 +326,7 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
{ // fix the Redlines
SwRedlineTbl& rTbl = *pRedlineTbl;
SwPosition aNewPos(rNewPos);
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
// liegt auf der Position ??
lcl_PaMCorrRel1( rTbl[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset );
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 11517ca9726f..9db8837f7818 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -492,7 +492,7 @@ void lcl_SaveRedlines( const SwPaM& aPam, _SaveRedlines& rArr )
// iterate over relevant redlines and decide for each whether it should
// be saved, or split + saved
SwRedlineTbl& rRedlineTable = const_cast<SwRedlineTbl&>( pDoc->GetRedlineTbl() );
- for( ; nCurrentRedline < rRedlineTable.Count(); nCurrentRedline++ )
+ for( ; nCurrentRedline < rRedlineTable.size(); nCurrentRedline++ )
{
SwRedline* pCurrent = rRedlineTable[ nCurrentRedline ];
SwComparePosition eCompare =
@@ -562,7 +562,7 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
aSrchPos.nContent.Assign( aSrchPos.nNode.GetNode().GetCntntNode(), 0 );
if( pDoc->GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
--nRedlPos;
- else if( nRedlPos >= pDoc->GetRedlineTbl().Count() )
+ else if( nRedlPos >= pDoc->GetRedlineTbl().size() )
return ;
RedlineMode_t eOld = pDoc->GetRedlineMode();
@@ -636,7 +636,7 @@ void lcl_SaveRedlines( const SwNodeRange& rRg, _SaveRedlines& rArr )
else
break;
- } while( ++nRedlPos < pDoc->GetRedlineTbl().Count() );
+ } while( ++nRedlPos < pDoc->GetRedlineTbl().size() );
pDoc->SetRedlineMode_intern( eOld );
}
@@ -663,7 +663,7 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
{
SwNode& rNd = rInsIdx.GetNode();
SwDoc* pDest = rNd.GetDoc();
- if( pDest->GetRedlineTbl().Count() )
+ if( !pDest->GetRedlineTbl().empty() )
{
sal_uInt16 nFndPos;
const SwPosition* pEnd;
@@ -820,7 +820,7 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
}
if (!GetIDocumentUndoRedo().DoesUndo() &&
- !IsIgnoreRedline() && GetRedlineTbl().Count())
+ !IsIgnoreRedline() && !GetRedlineTbl().empty())
{
SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
DeleteRedline( aPam, true, USHRT_MAX );
@@ -879,7 +879,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// save redlines (if DOC_MOVEREDLINES is used)
_SaveRedlines aSaveRedl;
- if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
+ if( DOC_MOVEREDLINES & eMvFlags && !GetRedlineTbl().empty() )
{
lcl_SaveRedlines( rPaM, aSaveRedl );
@@ -1129,7 +1129,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
_SaveRedlines aSaveRedl;
std::vector<SwRedline*> aSavRedlInsPosArr;
- if( DOC_MOVEREDLINES & eMvFlags && GetRedlineTbl().Count() )
+ if( DOC_MOVEREDLINES & eMvFlags && !GetRedlineTbl().empty() )
{
lcl_SaveRedlines( rRange, aSaveRedl );
@@ -1147,7 +1147,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
{
aSavRedlInsPosArr.push_back( pTmp );
}
- } while( pRStt->nNode < rPos && ++nRedlPos < GetRedlineTbl().Count());
+ } while( pRStt->nNode < rPos && ++nRedlPos < GetRedlineTbl().size());
}
}
@@ -1200,7 +1200,7 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
for( sal_uInt16 n = 0; n < aSavRedlInsPosArr.size(); ++n )
{
SwRedline* pTmp = aSavRedlInsPosArr[ n ];
- if( USHRT_MAX != GetRedlineTbl().GetPos( pTmp ) )
+ if( GetRedlineTbl().Contains( pTmp ) )
{
SwPosition* pEnd = pTmp->End();
pEnd->nNode = aIdx;
@@ -1694,7 +1694,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
return true;
}
- if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if( !IsIgnoreRedline() && !GetRedlineTbl().empty() )
DeleteRedline( rPam, true, USHRT_MAX );
// Delete and move all "Flys at the paragraph", which are within the Selection
@@ -1797,7 +1797,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
} while( sal_False );
- if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if( !IsIgnoreRedline() && !GetRedlineTbl().empty() )
CompressRedlines();
SetModified();
@@ -2421,7 +2421,7 @@ SetRedlineMode( eOld );
}
else
{
- if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if( !IsIgnoreRedline() && GetRedlineTbl().size() )
DeleteRedline( aDelPam, true, USHRT_MAX );
SwUndoReplace* pUndoRpl = 0;
@@ -2722,7 +2722,7 @@ void SwDoc::checkRedlining(RedlineMode_t& _rReadlineMode)
const SwRedlineTbl& rRedlineTbl = GetRedlineTbl();
SwEditShell* pEditShell = GetEditShell();
Window* pParent = pEditShell ? pEditShell->GetWin() : NULL;
- if ( pParent && !mbReadlineChecked && rRedlineTbl.Count() > MAX_REDLINE_COUNT
+ if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT
&& !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) )
{
WarningBox aWarning( pParent,SW_RES(MSG_DISABLE_READLINE_QUESTION));
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 4c67d512c0e7..f0bc6bc25c22 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -629,7 +629,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
aTxtSet, rSt.GetIndex(), rSt.GetIndex(), nFlags ) || bRet;
if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
- && pDoc->GetRedlineTbl().Count())))
+ && !pDoc->GetRedlineTbl().empty())))
{
SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
pStt->nNode, pStt->nContent.GetIndex() );
@@ -668,7 +668,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
|| bRet;
if (bRet && (pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline()
- && pDoc->GetRedlineTbl().Count())))
+ && !pDoc->GetRedlineTbl().empty())))
{
// Was text content inserted? (RefMark/TOXMarks without an end)
sal_Bool bTxtIns = nInsCnt != rSt.GetIndex();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index f4d4128b32c2..4ddf95ed96b0 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -815,7 +815,7 @@ void SwDoc::ClearDoc()
OSL_ENSURE( !pDrawModel || !pDrawModel->GetPage(0)->GetObjCount(),
"not all DrawObjects removed from the page" );
- pRedlineTbl->DeleteAndDestroy( 0, pRedlineTbl->Count() );
+ pRedlineTbl->DeleteAndDestroyAll();
delete pACEWord;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index c3c5ad910703..fd6eb9283d9e 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1834,7 +1834,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
sal_Bool bCheckDel = sal_True;
// There is a some Redline Delete Object for the Area
- for( ; nRedlPos < GetRedlineTbl().Count(); ++nRedlPos )
+ for( ; nRedlPos < GetRedlineTbl().size(); ++nRedlPos )
{
const SwRedline* pTmp = GetRedlineTbl()[ nRedlPos ];
if( !bCheckDel || nsRedlineType_t::REDLINE_DELETE == pTmp->GetType() )
@@ -1844,7 +1844,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
{
case POS_COLLIDE_START:
case POS_BEHIND: // Pos1 comes after Pos2
- nRedlPos = GetRedlineTbl().Count();
+ nRedlPos = GetRedlineTbl().size();
break;
case POS_COLLIDE_END:
@@ -1898,7 +1898,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
: !pREnd->nContent.GetIndex() )) )
{
pOwnRedl = pTmp;
- if( nRedlPos + 1 < GetRedlineTbl().Count() )
+ if( nRedlPos + 1 < (sal_uInt16)GetRedlineTbl().size() )
{
pTmp = GetRedlineTbl()[ nRedlPos+1 ];
if( *pTmp->Start() == *pREnd )
@@ -1968,7 +1968,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
// All, that are in the to-be-deleted Node, need to be
// moved to the next Node
SwPosition* pPos;
- for( sal_uInt16 n = 0; n < GetRedlineTbl().Count(); ++n )
+ for( sal_uInt16 n = 0; n < GetRedlineTbl().size(); ++n )
{
SwRedline* pTmp = GetRedlineTbl()[ n ];
if( ( pPos = &pTmp->GetBound(sal_True))->nNode == aIdx )
@@ -2020,7 +2020,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
}
}
- if( !pOwnRedl && !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if( !pOwnRedl && !IsIgnoreRedline() && !GetRedlineTbl().empty() )
{
SwPaM aTemp(aIdx);
SplitRedline(aTemp);
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 88c3749d9c0f..cd45f8a283bf 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -99,10 +99,10 @@ TYPEINIT1(SwRedlineHint, SfxHint);
const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
// verify valid redline positions
- for( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rTbl.size(); ++i )
lcl_CheckPam( rTbl[ i ] );
- for( sal_uInt16 j = 0; j < rTbl.Count(); ++j )
+ for( sal_uInt16 j = 0; j < rTbl.size(); ++j )
{
// check for empty redlines
OSL_ENSURE( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) ||
@@ -111,7 +111,7 @@ TYPEINIT1(SwRedlineHint, SfxHint);
}
// verify proper redline sorting
- for( sal_uInt16 n = 1; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 1; n < rTbl.size(); ++n )
{
const SwRedline* pPrev = rTbl[ n-1 ];
const SwRedline* pCurrent = rTbl[ n ];
@@ -132,11 +132,11 @@ TYPEINIT1(SwRedlineHint, SfxHint);
{
static sal_uInt16 nWatch = 0;
const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
sal_uInt16 nDummy = 0;
const SwRedline* pCurrent = rTbl[ n ];
- const SwRedline* pNext = n+1 < rTbl.Count() ? rTbl[ n+1 ] : 0;
+ const SwRedline* pNext = n+1 < (sal_uInt16)rTbl.size() ? rTbl[ n+1 ] : 0;
if( pCurrent == pNext )
++nDummy;
if( n == nWatch )
@@ -154,8 +154,6 @@ TYPEINIT1(SwRedlineHint, SfxHint);
#endif
-SV_IMPL_OP_PTRARR_SORT( _SwRedlineTbl, SwRedlinePtr )
-
RedlineMode_t SwDoc::GetRedlineMode() const
{
return eRedlineMode;
@@ -195,7 +193,7 @@ void SwDoc::SetRedlineMode( RedlineMode_t eMode )
if( pFnc )
for( sal_uInt16 nLoop = 1; nLoop <= 2; ++nLoop )
- for( sal_uInt16 i = 0; i < pRedlineTbl->Count(); ++i )
+ for( sal_uInt16 i = 0; i < pRedlineTbl->size(); ++i )
((*pRedlineTbl)[ i ]->*pFnc)( nLoop );
_CHECK_REDLINE( this )
SetInXMLImport( bSaveInXMLImportFlag );
@@ -375,7 +373,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
--n;
bool bDec = false;
- for( ; pNewRedl && n < pRedlineTbl->Count(); bDec ? n : ++n )
+ for( ; pNewRedl && n < pRedlineTbl->size(); bDec ? n : ++n )
{
bDec = false;
@@ -410,7 +408,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
( POS_COLLIDE_START == eCmpPos ) ||
( POS_OVERLAP_BEHIND == eCmpPos ) ) &&
pRedl->CanCombine( *pNewRedl ) &&
- ( n+1 >= pRedlineTbl->Count() ||
+ ( n+1 >= (sal_uInt16)pRedlineTbl->size() ||
( *(*pRedlineTbl)[ n+1 ]->Start() >= *pEnd &&
*(*pRedlineTbl)[ n+1 ]->Start() != *pREnd ) ) )
{
@@ -702,9 +700,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
// Before we can merge, we make it visible!
// We insert temporarily so that pNew is
// also dealt with when moving the indices.
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
pRedl->Show();
- pRedlineTbl->Remove( pRedlineTbl->GetPos(pNewRedl ));
+ pRedlineTbl->Remove( pNewRedl );
pRStt = pRedl->Start();
pREnd = pRedl->End();
}
@@ -797,12 +795,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
// also dealt with when moving the indices.
if( bCallDelete )
{
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
DeleteAndJoin( *pRedl );
- sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
- if( USHRT_MAX != nFnd )
- pRedlineTbl->Remove( nFnd );
- else
+ if( !pRedlineTbl->Remove( pNewRedl ) )
pNewRedl = 0;
}
delete pRedl;
@@ -827,12 +822,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
{
// We insert temporarily so that pNew is
// also dealt with when moving the indices.
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
DeleteAndJoin( aPam );
- sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
- if( USHRT_MAX != nFnd )
- pRedlineTbl->Remove( nFnd );
- else
+ if( !pRedlineTbl->Remove( pNewRedl ) )
pNewRedl = 0;
n = 0; // re-initialize
}
@@ -856,12 +848,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
{
// We insert temporarily so that pNew is
// also dealt with when moving the indices.
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
DeleteAndJoin( aPam );
- sal_uInt16 nFnd = pRedlineTbl->GetPos(pNewRedl );
- if( USHRT_MAX != nFnd )
- pRedlineTbl->Remove( nFnd );
- else
+ if( !pRedlineTbl->Remove( pNewRedl ) )
pNewRedl = 0;
n = 0; // re-initialize
bDec = true;
@@ -952,10 +941,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pNewRedl->SetEnd( *pRStt, pEnd );
if( IsHideChanges( eRedlineMode ))
{
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
pRedl->Hide();
- pRedlineTbl->Remove(
- pRedlineTbl->GetPos(pNewRedl ));
+ pRedlineTbl->Remove( pNewRedl );
}
}
else
@@ -981,10 +969,9 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pNewRedl->SetStart( *pREnd, pStt );
if( IsHideChanges( eRedlineMode ))
{
- pRedlineTbl->SavePtrInArr( pNewRedl );
+ pRedlineTbl->Insert( pNewRedl );
pRedl->Hide();
- pRedlineTbl->Remove(
- pRedlineTbl->GetPos(pNewRedl ));
+ pRedlineTbl->Remove( pNewRedl );
}
}
else
@@ -1199,7 +1186,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
case POS_COLLIDE_START:
if( pRedl->IsOwnRedline( *pNewRedl ) &&
pRedl->CanCombine( *pNewRedl ) &&
- n+1 < pRedlineTbl->Count() &&
+ n+1 < (sal_uInt16)pRedlineTbl->size() &&
*(*pRedlineTbl)[ n+1 ]->Start() < *pEnd )
{
// If that's the case we can merge it, meaning
@@ -1277,7 +1264,7 @@ void SwDoc::CompressRedlines()
}
// Try to merge identical ones
- for( sal_uInt16 n = 1; n < pRedlineTbl->Count(); ++n )
+ for( sal_uInt16 n = 1; n < pRedlineTbl->size(); ++n )
{
SwRedline* pPrev = (*pRedlineTbl)[ n-1 ],
* pCur = (*pRedlineTbl)[ n ];
@@ -1314,7 +1301,7 @@ bool SwDoc::SplitRedline( const SwPaM& rRange )
* pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
: rRange.GetPoint();
GetRedline( *pStt, &n );
- for( ; n < pRedlineTbl->Count() ; ++n )
+ for( ; n < pRedlineTbl->size() ; ++n )
{
SwRedline* pTmp = (*pRedlineTbl)[ n ];
SwPosition* pTStt = pTmp->Start(),
@@ -1393,7 +1380,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
: rRange.GetPoint();
sal_uInt16 n = 0;
GetRedline( *pStt, &n );
- for( ; n < pRedlineTbl->Count() ; ++n )
+ for( ; n < pRedlineTbl->size() ; ++n )
{
SwRedline* pRedl = (*pRedlineTbl)[ n ];
if( USHRT_MAX != nDelType && nDelType != pRedl->GetType() )
@@ -1458,7 +1445,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
if( !pRedl->HasValidRange() )
{
// re-insert
- pRedlineTbl->Remove( pRedlineTbl->GetPos( pRedl ));
+ pRedlineTbl->Remove( pRedl );
pRedlineTbl->Insert( pRedl );
--n;
}
@@ -1470,7 +1457,7 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
case POS_COLLIDE_END:
case POS_BEFORE:
- n = pRedlineTbl->Count();
+ n = pRedlineTbl->size();
break;
default:
break;
@@ -1493,7 +1480,7 @@ bool SwDoc::DeleteRedline( const SwStartNode& rNode, bool bSaveInUndo,
sal_uInt16 SwDoc::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const
{
const sal_uLong nNdIdx = rNd.GetIndex();
- for( sal_uInt16 n = 0; n < pRedlineTbl->Count() ; ++n )
+ for( sal_uInt16 n = 0; n < pRedlineTbl->size() ; ++n )
{
const SwRedline* pTmp = (*pRedlineTbl)[ n ];
sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
@@ -1513,7 +1500,7 @@ sal_uInt16 SwDoc::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const
const SwRedline* SwDoc::GetRedline( const SwPosition& rPos,
sal_uInt16* pFndPos ) const
{
- sal_uInt16 nO = pRedlineTbl->Count(), nM, nU = 0;
+ sal_uInt16 nO = pRedlineTbl->size(), nM, nU = 0;
if( nO > 0 )
{
nO--;
@@ -1648,7 +1635,7 @@ sal_Bool lcl_AcceptRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
{
// re-insert
- rArr.Remove( rArr.GetPos( pRedl ));
+ rArr.Remove( pRedl );
rArr.Insert( pRedl );
}
}
@@ -1925,7 +1912,7 @@ sal_Bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
if( bReplace || ( bCheck && !pRedl->HasValidRange() ))
{
// re-insert
- rArr.Remove( rArr.GetPos( pRedl ));
+ rArr.Remove( pRedl );
rArr.Insert( pRedl );
}
}
@@ -1953,7 +1940,7 @@ const SwRedline* lcl_FindCurrRedline( const SwPosition& rSttPos,
{
const SwRedline* pFnd = 0;
const SwRedlineTbl& rArr = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl();
- for( ; rPos < rArr.Count() ; ++rPos )
+ for( ; rPos < rArr.size() ; ++rPos )
{
const SwRedline* pTmp = rArr[ rPos ];
if( pTmp->HasMark() && pTmp->IsVisible() )
@@ -1996,7 +1983,7 @@ int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
++n;
}
- for( ; n < rArr.Count(); ++n )
+ for( ; n < rArr.size(); ++n )
{
SwRedline* pTmp = rArr[ n ];
if( pTmp->HasMark() && pTmp->IsVisible() )
@@ -2310,7 +2297,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
do {
bRestart = sal_False;
- for( ; !pFnd && n < pRedlineTbl->Count(); ++n )
+ for( ; !pFnd && n < pRedlineTbl->size(); ++n )
{
pFnd = (*pRedlineTbl)[ n ];
if( pFnd->HasMark() && pFnd->IsVisible() )
@@ -2328,7 +2315,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
// Merge all of the same type and author that are
// consecutive into one Selection.
const SwPosition* pPrevEnd = pFnd->End();
- while( ++n < pRedlineTbl->Count() )
+ while( ++n < pRedlineTbl->size() )
{
const SwRedline* pTmp = (*pRedlineTbl)[ n ];
if( pTmp->HasMark() && pTmp->IsVisible() )
@@ -2378,7 +2365,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
if( !pFnd || *rPam.GetMark() == *rPam.GetPoint() )
{
- if( n < pRedlineTbl->Count() )
+ if( n < pRedlineTbl->size() )
{
bRestart = sal_True;
*rPam.GetPoint() = *pSaveFnd->End();
@@ -2525,7 +2512,7 @@ bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const String& rS )
sal_uInt16 n = 0;
if( lcl_FindCurrRedline( *pStt, n, sal_True ) )
{
- for( ; n < pRedlineTbl->Count(); ++n )
+ for( ; n < pRedlineTbl->size(); ++n )
{
bRet = sal_True;
SwRedline* pTmp = (*pRedlineTbl)[ n ];
@@ -2558,7 +2545,7 @@ sal_uInt16 SwDoc::InsertRedlineAuthor( const String& rNew )
void SwDoc::UpdateRedlineAttr()
{
const SwRedlineTbl& rTbl = GetRedlineTbl();
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
SwRedline* pRedl = rTbl[ n ];
if( pRedl->IsVisible() )
@@ -2594,12 +2581,12 @@ void SwDoc::SetRedlinePassword(
}
-sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_Bool bIns )
+bool SwRedlineTbl::Insert( SwRedline* p, bool bIns )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
if( p->HasValidRange() )
{
- bRet = _SwRedlineTbl::Insert( p );
+ bRet = insert( p ).second;
p->CallDisplayFunc();
}
else if( bIns )
@@ -2611,12 +2598,14 @@ sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_Bool bIns )
return bRet;
}
-sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_uInt16& rP, sal_Bool bIns )
+bool SwRedlineTbl::Insert( SwRedline* p, sal_uInt16& rP, bool bIns )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
if( p->HasValidRange() )
{
- bRet = _SwRedlineTbl::Insert( p, rP );
+ std::pair<_SwRedlineTbl::const_iterator, bool> rv = insert( p );
+ rP = rv.first - begin();
+ bRet = rv.second;
p->CallDisplayFunc();
}
else if( bIns )
@@ -2628,10 +2617,10 @@ sal_Bool SwRedlineTbl::Insert( SwRedlinePtr& p, sal_uInt16& rP, sal_Bool bIns )
return bRet;
}
-sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsPos )
+bool SwRedlineTbl::InsertWithValidRanges( SwRedline* p, sal_uInt16* pInsPos )
{
// Create valid "sub-ranges" from the Selection
- sal_Bool bAnyIns = sal_False;
+ bool bAnyIns = false;
SwPosition* pStt = p->Start(),
* pEnd = pStt == p->GetPoint() ? p->GetMark() : p->GetPoint();
SwPosition aNewStt( *pStt );
@@ -2715,10 +2704,10 @@ sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsP
CheckPosition( pNew->GetPoint(), pNew->GetMark() );
#endif
if( *pNew->GetPoint() != *pNew->GetMark() &&
- _SwRedlineTbl::Insert( pNew, nInsPos ) )
+ Insert( pNew, nInsPos ) )
{
pNew->CallDisplayFunc();
- bAnyIns = sal_True;
+ bAnyIns = true;
pNew = 0;
if( pInsPos && *pInsPos < nInsPos )
*pInsPos = nInsPos;
@@ -2737,13 +2726,39 @@ sal_Bool SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, sal_uInt16* pInsP
return bAnyIns;
}
-void SwRedlineTbl::Remove( sal_uInt16 nP, sal_uInt16 nL )
+bool CompareSwRedlineTbl::operator()(SwRedline* const &lhs, SwRedline* const &rhs) const
+{
+ return *lhs < *rhs;
+}
+
+_SwRedlineTbl::~_SwRedlineTbl()
+{
+ DeleteAndDestroyAll();
+}
+
+sal_uInt16 SwRedlineTbl::GetPos(const SwRedline* p) const
+{
+ const_iterator it = find(const_cast<SwRedline* const>(p));
+ if( it == end() )
+ return USHRT_MAX;
+ return it - begin();
+}
+
+bool SwRedlineTbl::Remove( const SwRedline* p )
+{
+ sal_uInt16 nPos = GetPos(p);
+ if (nPos != USHRT_MAX)
+ Remove(nPos);
+ return nPos != USHRT_MAX;
+}
+
+void SwRedlineTbl::Remove( sal_uInt16 nP )
{
SwDoc* pDoc = 0;
- if( !nP && nL && nL == _SwRedlineTbl::Count() )
- pDoc = _SwRedlineTbl::GetObject( 0 )->GetDoc();
+ if( !nP && 1 == size() )
+ pDoc = front()->GetDoc();
- _SwRedlineTbl::Remove( nP, nL );
+ erase( begin() + nP );
ViewShell* pSh;
if( pDoc && !pDoc->IsInDtor() &&
@@ -2751,13 +2766,20 @@ void SwRedlineTbl::Remove( sal_uInt16 nP, sal_uInt16 nL )
pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) );
}
+void SwRedlineTbl::DeleteAndDestroyAll()
+{
+ DeleteAndDestroy(0, size());
+}
+
void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
{
SwDoc* pDoc = 0;
- if( !nP && nL && nL == _SwRedlineTbl::Count() )
- pDoc = _SwRedlineTbl::GetObject( 0 )->GetDoc();
+ if( !nP && nL && nL == size() )
+ pDoc = front()->GetDoc();
- _SwRedlineTbl::DeleteAndDestroy( nP, nL );
+ for( const_iterator it = begin() + nP; it != begin() + nP + nL; ++it )
+ delete *it;
+ erase( begin() + nP, begin() + nP + nL );
ViewShell* pSh;
if( pDoc && !pDoc->IsInDtor() &&
@@ -2770,17 +2792,14 @@ void SwRedlineTbl::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL )
// 0 or USHRT_MAX searches the whole array.
sal_uInt16 SwRedlineTbl::FindNextOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const
{
- return nSttPos + 1 < _SwRedlineTbl::Count()
- ? FindNextSeqNo( _SwRedlineTbl::GetObject( nSttPos )
- ->GetSeqNo(), nSttPos+1, nLookahead )
+ return nSttPos + 1 < (sal_uInt16)size()
+ ? FindNextSeqNo( operator[]( nSttPos )->GetSeqNo(), nSttPos+1, nLookahead )
: USHRT_MAX;
}
sal_uInt16 SwRedlineTbl::FindPrevOfSeqNo( sal_uInt16 nSttPos, sal_uInt16 nLookahead ) const
{
- return nSttPos ? FindPrevSeqNo( _SwRedlineTbl::GetObject(
- nSttPos )->GetSeqNo(),
- nSttPos-1, nLookahead )
+ return nSttPos ? FindPrevSeqNo( operator[]( nSttPos )->GetSeqNo(), nSttPos-1, nLookahead )
: USHRT_MAX;
}
@@ -2788,15 +2807,15 @@ sal_uInt16 SwRedlineTbl::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
sal_uInt16 nLookahead ) const
{
sal_uInt16 nRet = USHRT_MAX, nEnd;
- if( nSeqNo && nSttPos < _SwRedlineTbl::Count() )
+ if( nSeqNo && nSttPos < size() )
{
- nEnd = _SwRedlineTbl::Count();
+ nEnd = size();
if( nLookahead && USHRT_MAX != nLookahead &&
- nSttPos + nLookahead < _SwRedlineTbl::Count() )
+ nSttPos + nLookahead < size() )
nEnd = nSttPos + nLookahead;
for( ; nSttPos < nEnd; ++nSttPos )
- if( nSeqNo == _SwRedlineTbl::GetObject( nSttPos )->GetSeqNo() )
+ if( nSeqNo == operator[]( nSttPos )->GetSeqNo() )
{
nRet = nSttPos;
break;
@@ -2809,7 +2828,7 @@ sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
sal_uInt16 nLookahead ) const
{
sal_uInt16 nRet = USHRT_MAX, nEnd;
- if( nSeqNo && nSttPos < _SwRedlineTbl::Count() )
+ if( nSeqNo && nSttPos < size() )
{
nEnd = 0;
if( nLookahead && USHRT_MAX != nLookahead && nSttPos > nLookahead )
@@ -2817,7 +2836,7 @@ sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
++nSttPos;
while( nSttPos > nEnd )
- if( nSeqNo == _SwRedlineTbl::GetObject( --nSttPos )->GetSeqNo() )
+ if( nSeqNo == operator[]( --nSttPos )->GetSeqNo() )
{
nRet = nSttPos;
break;
@@ -3315,7 +3334,7 @@ void SwRedline::MoveToSection()
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
SwRedline* pRedl = rTbl[ n ];
if( pRedl->GetBound(sal_True) == *pStt )
@@ -3468,7 +3487,7 @@ void SwRedline::DelCopyOfSection()
// In order to not move other Redlines' indices, we set them
// to the end (is exclusive)
const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
- for( sal_uInt16 n = 0; n < rTbl.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rTbl.size(); ++n )
{
SwRedline* pRedl = rTbl[ n ];
if( pRedl->GetBound(sal_True) == *pStt )
@@ -3551,7 +3570,7 @@ void SwRedline::MoveFromSection()
sal_Bool bBreak = sal_False;
sal_uInt16 n;
- for( n = nMyPos+1; !bBreak && n < rTbl.Count(); ++n )
+ for( n = nMyPos+1; !bBreak && n < rTbl.size(); ++n )
{
bBreak = sal_True;
if( rTbl[ n ]->GetBound(sal_True) == *GetPoint() )
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index fea5026f5028..bb78bd45a41b 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -343,7 +343,7 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
SwUndoRedlineSort* pRedlUndo = 0;
SwUndoSort* pUndoSort = 0;
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
pRedlPam = new SwPaM( pStart->nNode, pEnd->nNode, -1, 1 );
SwCntntNode* pCNd = pRedlPam->GetCntntNode( sal_False );
@@ -508,7 +508,7 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
if(aFndBox.GetLines().empty())
return sal_False;
- if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if( !IsIgnoreRedline() && !GetRedlineTbl().empty() )
DeleteRedline( *pTblNd, true, USHRT_MAX );
sal_uInt16 nStart = 0;
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index a701f8e4d065..fb4903063f0a 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -581,7 +581,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
{
const SwDoc* pSrcDoc = rPam.GetDoc();
const SwRedlineTbl& rTbl = pSrcDoc->GetRedlineTbl();
- if( rTbl.Count() )
+ if( !rTbl.empty() )
{
SwDoc* pDestDoc = rCpyPam.GetDoc();
SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
@@ -593,7 +593,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
sal_uInt16 n = 0;
pSrcDoc->GetRedline( *pStt, &n );
- for( ; n < rTbl.Count(); ++n )
+ for( ; n < rTbl.size(); ++n )
{
const SwRedline* pRedl = rTbl[ n ];
if( nsRedlineType_t::REDLINE_DELETE == pRedl->GetType() && pRedl->IsVisible() )
@@ -609,7 +609,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
case POS_COLLIDE_START:
case POS_BEHIND: // Pos1 liegt hinter Pos2
- n = rTbl.Count();
+ n = rTbl.size();
break;
default:
@@ -659,7 +659,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg )
{
SwDoc* pSrcDoc = rRg.aStart.GetNode().GetDoc();
- if( pSrcDoc->GetRedlineTbl().Count() )
+ if( !pSrcDoc->GetRedlineTbl().empty() )
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( rCpyRg.aStart, rCpyRg.aEnd );
@@ -703,7 +703,7 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const
SwPaM* pRedlineRange = 0;
if( pDoc->IsRedlineOn() ||
- (!pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) )
+ (!pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() ) )
pRedlineRange = new SwPaM( rPos );
RedlineMode_t eOld = pDoc->GetRedlineMode();
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 7f0be84cc48d..8dd40236b76d 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -327,7 +327,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
SetRedlineMode_intern( eOld );
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
if( IsRedlineOn() )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 5a09a63462e7..f89ff9c73377 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -551,7 +551,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
GetNodes().GoNext( &aNdIdx ); // zum naechsten ContentNode
pTblNd->MakeFrms( &aNdIdx );
- if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+ if( IsRedlineOn() || (!IsIgnoreRedline() && !pRedlineTbl->empty() ))
{
SwPaM aPam( *pTblNd->EndOfSectionNode(), *pTblNd, 1 );
if( IsRedlineOn() )
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index c002d56a5dca..e0c30ecf6e2d 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1439,7 +1439,7 @@ SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell* pSh)
sal_uInt16 nAct = pDoc->GetRedlinePos( *pTxtNode, USHRT_MAX );
const xub_StrLen nStartIndex = pStartPos->nContent.GetIndex();
- for ( ; nAct < pDoc->GetRedlineTbl().Count(); nAct++ )
+ for ( ; nAct < pDoc->GetRedlineTbl().size(); nAct++ )
{
const SwRedline* pRed = pDoc->GetRedlineTbl()[ nAct ];
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index 49063fb145af..19e9c0664a22 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -50,7 +50,7 @@ sal_Bool SwEditShell::IsRedlineOn() const
sal_uInt16 SwEditShell::GetRedlineCount() const
{
- return GetDoc()->GetRedlineTbl().Count();
+ return GetDoc()->GetRedlineTbl().size();
}
const SwRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const
@@ -128,7 +128,7 @@ sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
{
const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
- for( sal_uInt16 i = 0, nCnt = rTbl.Count(); i < nCnt; ++i )
+ for( sal_uInt16 i = 0, nCnt = rTbl.size(); i < nCnt; ++i )
if( &rTbl[ i ]->GetRedlineData() == &rData )
return i;
return USHRT_MAX;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 23405104287f..b300ba0a8e69 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3452,7 +3452,7 @@ sal_Bool IsExtraData( const SwDoc *pDoc )
return rInf.IsPaintLineNumbers() ||
rInf.IsCountInFlys() ||
((sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE &&
- pDoc->GetRedlineTbl().Count());
+ !pDoc->GetRedlineTbl().empty());
}
// OD 22.09.2003 #110978#
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 7501aca37f9e..200c5a69df13 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2108,7 +2108,7 @@ void ChgTextToNum( SwTableBox& rBox, const String& rTxt, const Color* pCol,
pTNd->DontExpandFmt( aResetIdx, sal_False, sal_False );
}
- if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() )
+ if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
{
SwPaM aTemp(*pTNd, 0, *pTNd, rOrig.Len());
pDoc->DeleteRedline(aTemp, true, USHRT_MAX);
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index c464d2452581..e1305f0794dd 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2239,7 +2239,7 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi
{
sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX );
- for ( ; nAct < rIDRA.GetRedlineTbl().Count(); nAct++ )
+ for ( ; nAct < rIDRA.GetRedlineTbl().size(); nAct++ )
{
const SwRedline* pRed = rIDRA.GetRedlineTbl()[ nAct ];
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 621930e151c6..0e63f7616cf3 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -239,7 +239,7 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
nStart = STRING_LEN;
nEnd = STRING_LEN;
- for( ; nAct < rDoc.GetRedlineTbl().Count() ; ++nAct )
+ for( ; nAct < rDoc.GetRedlineTbl().size() ; ++nAct )
{
rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
@@ -398,7 +398,7 @@ sal_Bool SwRedlineItr::CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd )
xub_StrLen nOldAct = nAct;
sal_Bool bRet = sal_False;
- for( nAct = nFirst; nAct < rDoc.GetRedlineTbl().Count() ; ++nAct )
+ for( nAct = nFirst; nAct < rDoc.GetRedlineTbl().size() ; ++nAct )
{
rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
if( nChkEnd < nStart )
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 3a26191da9d6..90e9a2b6f26c 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -988,7 +988,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
if ( !bNegative && !bDelete )
{
const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
- for ( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rTbl.size(); ++i )
{
SwRedline *const pRedl = rTbl[ i ];
if ( pRedl->HasMark() )
@@ -3155,7 +3155,7 @@ XubString SwTxtNode::GetRedlineTxt( xub_StrLen nIdx, xub_StrLen nLen,
{
// es existiert fuer den Node irgendein Redline-Delete-Object
const sal_uLong nNdIdx = GetIndex();
- for( ; nRedlPos < pDoc->GetRedlineTbl().Count() ; ++nRedlPos )
+ for( ; nRedlPos < pDoc->GetRedlineTbl().size() ; ++nRedlPos )
{
const SwRedline* pTmp = pDoc->GetRedlineTbl()[ nRedlPos ];
if( nsRedlineType_t::REDLINE_DELETE == pTmp->GetType() )
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 0e4e44778928..bde558876bec 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -118,7 +118,7 @@ sal_uInt16 lcl_MaskRedlines( const SwTxtNode& rNode, XubString& rText,
const SwDoc& rDoc = *rNode.GetDoc();
sal_uInt16 nAct = rDoc.GetRedlinePos( rNode, USHRT_MAX );
- for ( ; nAct < rDoc.GetRedlineTbl().Count(); nAct++ )
+ for ( ; nAct < rDoc.GetRedlineTbl().size(); nAct++ )
{
const SwRedline* pRed = rDoc.GetRedlineTbl()[ nAct ];
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 1cfa0a792aaa..604921e8b21d 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -117,7 +117,7 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, sal_Bool bFullPara, sal_Bool bCalledByT
SwDoc * pDoc = rPam.GetDoc();
- if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() )
+ if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
{
pRedlSaveData = new SwRedlineSaveDatas;
if( !FillSaveData( rPam, *pRedlSaveData ))
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index ea1995d1e3d7..5207a61d30a4 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -988,7 +988,7 @@ SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos,
}
#if OSL_DEBUG_LEVEL > 0
- nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl().Count();
+ nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl().size();
#endif
}
@@ -1037,7 +1037,7 @@ sal_Bool SwUndo::FillSaveData( const SwPaM& rRange, SwRedlineSaveDatas& rSData,
const SwRedlineTbl& rTbl = rRange.GetDoc()->GetRedlineTbl();
sal_uInt16 n = 0;
rRange.GetDoc()->GetRedline( *pStt, &n );
- for( ; n < rTbl.Count(); ++n )
+ for( ; n < rTbl.size(); ++n )
{
SwRedline* pRedl = rTbl[ n ];
const SwPosition *pRStt = pRedl->Start(), *pREnd = pRedl->End();
@@ -1065,7 +1065,7 @@ sal_Bool SwUndo::FillSaveDataForFmt( const SwPaM& rRange, SwRedlineSaveDatas& rS
const SwRedlineTbl& rTbl = rRange.GetDoc()->GetRedlineTbl();
sal_uInt16 n = 0;
rRange.GetDoc()->GetRedline( *pStt, &n );
- for( ; n < rTbl.Count(); ++n )
+ for( ; n < rTbl.size(); ++n )
{
SwRedline* pRedl = rTbl[ n ];
if( nsRedlineType_t::REDLINE_FORMAT == pRedl->GetType() )
@@ -1099,7 +1099,7 @@ void SwUndo::SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData )
#if OSL_DEBUG_LEVEL > 0
// check redline count against count saved in RedlineSaveData object
assert(rSData.empty() ||
- (rSData[0]->nRedlineCount == rDoc.GetRedlineTbl().Count()));
+ (rSData[0]->nRedlineCount == rDoc.GetRedlineTbl().size()));
// "redline count not restored properly"
#endif
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 03f50b6f00eb..fcbb4acd86ce 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -166,12 +166,12 @@ sal_Bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
// Check if there is another Redline at the InsPosition. If the
// same exists only once, it can be combined.
const SwRedlineTbl& rTbl = rDoc.GetRedlineTbl();
- if( rTbl.Count() )
+ if( !rTbl.empty() )
{
SwRedlineData aRData( nsRedlineType_t::REDLINE_INSERT, rDoc.GetRedlineAuthor() );
const SwIndexReg* pIReg = rPos.nContent.GetIdxReg();
SwIndex* pIdx;
- for( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
+ for( sal_uInt16 i = 0; i < rTbl.size(); ++i )
{
SwRedline* pRedl = rTbl[ i ];
if( pIReg == (pIdx = &pRedl->End()->nContent)->GetIdxReg() &&
@@ -315,7 +315,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
pTmpDoc->SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- pTmpDoc->GetRedlineTbl().Count() )
+ !pTmpDoc->GetRedlineTbl().empty() )
pTmpDoc->SplitRedline( *pPam );
pPam->DeleteMark();
@@ -361,7 +361,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
pTmpDoc->SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- pTmpDoc->GetRedlineTbl().Count() )
+ !pTmpDoc->GetRedlineTbl().empty() )
pTmpDoc->SplitRedline(*pPam);
}
}
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index bba2d1e87c23..c76b5b02482c 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -53,7 +53,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos,
: SwUndo(UNDO_OVERWRITE),
pRedlSaveData( 0 ), bGroup( sal_False )
{
- if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() )
+ if( !pDoc->IsIgnoreRedline() && !pDoc->GetRedlineTbl().empty() )
{
SwPaM aPam( rPos.nNode, rPos.nContent.GetIndex(),
rPos.nNode, rPos.nContent.GetIndex()+1 );
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 6938d91e5724..2cd6a25df241 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -251,7 +251,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
sal_uInt16 nFnd = rDoc.GetRedlinePos(
*rDoc.GetNodes()[ nSttNode + 1 ],
nsRedlineType_t::REDLINE_INSERT );
- OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(),
+ OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < (sal_uInt16)rDoc.GetRedlineTbl().size(),
"could not find an Insert object" );
++nFnd;
rDoc.GetRedlineTbl()[nFnd]->Show( 1 );
@@ -483,7 +483,7 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
pTmp->InvalidateRange();
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- pDoc->GetRedlineTbl().Count() )
+ !pDoc->GetRedlineTbl().empty() )
pDoc->SplitRedline( *pPam );
}
else
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 11a7701563b4..448660ed8104 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -202,7 +202,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext)
rDoc.SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- rDoc.GetRedlineTbl().Count() )
+ !rDoc.GetRedlineTbl().empty() )
{
SwPaM aPam( *pSectNd->EndOfSectionNode(), *pSectNd, 1 );
rDoc.SplitRedline( aPam );
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index 3922c3c6b5a6..5fb481478a57 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -173,7 +173,7 @@ void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
if( ( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) ||
( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- pDoc->GetRedlineTbl().Count() ))
+ !pDoc->GetRedlineTbl().empty() ))
{
rPam.SetMark();
if( rPam.Move( fnMoveBackward ))
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index f508d4111a7c..10fa4ed3e8ab 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -330,7 +330,7 @@ void SwUndoInsTbl::RedoImpl(::sw::UndoRedoContext & rContext)
if( (pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) ||
( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- rDoc.GetRedlineTbl().Count() ))
+ !rDoc.GetRedlineTbl().empty() ))
{
SwPaM aPam( *pTblNode->EndOfSectionNode(), *pTblNode, 1 );
SwCntntNode* pCNd = aPam.GetCntntNode( sal_False );
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index f02764514f7c..bebaeb21737f 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -323,7 +323,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
pDoc->SetRedlineMode_intern( eOld );
}
else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
- pDoc->GetRedlineTbl().Count() )
+ !pDoc->GetRedlineTbl().empty() )
pDoc->SplitRedline( *pPam );
}
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index ed9ef38515c7..5bbe006cb26e 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -935,7 +935,7 @@ lcl_FillRedlineArray(SwDoc const & rDoc, SwUnoCrsr const & rUnoCrsr,
SwXRedlinePortion_ImplList& rRedArr )
{
const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
- sal_uInt16 nRedTblCount = rRedTbl.Count();
+ sal_uInt16 nRedTblCount = rRedTbl.size();
if ( nRedTblCount > 0 )
{
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 977730e83641..8f399b235214 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -294,7 +294,7 @@ void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
SwDoc* pDoc = pUnoCrsr->GetDoc();
const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
sal_Bool bFound = sal_False;
- for(sal_uInt16 nRed = 0; nRed < rRedTbl.Count() && !bFound; nRed++)
+ for(sal_uInt16 nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
bFound = pRedline == rRedTbl[nRed];
if(!bFound)
throw uno::RuntimeException();
diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx
index 26fedc52594c..82dd78e806f5 100644
--- a/sw/source/core/unocore/unoredlines.cxx
+++ b/sw/source/core/unocore/unoredlines.cxx
@@ -60,7 +60,7 @@ sal_Int32 SwXRedlines::getCount( ) throw(uno::RuntimeException)
if(!IsValid())
throw uno::RuntimeException();
const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
- return rRedTbl.Count();
+ return rRedTbl.size();
}
uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
@@ -71,9 +71,9 @@ uno::Any SwXRedlines::getByIndex(sal_Int32 nIndex)
throw uno::RuntimeException();
const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
uno::Any aRet;
- if(rRedTbl.Count() > nIndex && nIndex >= 0)
+ if(!rRedTbl.empty() > nIndex && nIndex >= 0)
{
- uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject((sal_uInt16)nIndex), *GetDoc() );
+ uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl[nIndex], *GetDoc() );
aRet <<= xRet;
}
else
@@ -101,7 +101,7 @@ sal_Bool SwXRedlines::hasElements( ) throw(uno::RuntimeException)
if(!IsValid())
throw uno::RuntimeException();
const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
- return rRedTbl.Count() > 0;
+ return rRedTbl.size() > 0;
}
OUString SwXRedlines::getImplementationName(void) throw( uno::RuntimeException )
@@ -154,7 +154,7 @@ sal_Bool SwXRedlineEnumeration::hasMoreElements(void) throw( uno::RuntimeExcepti
{
if(!pDoc)
throw uno::RuntimeException();
- return pDoc->GetRedlineTbl().Count() > nCurrentIndex;
+ return pDoc->GetRedlineTbl().size() > nCurrentIndex;
}
uno::Any SwXRedlineEnumeration::nextElement(void)
@@ -163,9 +163,9 @@ uno::Any SwXRedlineEnumeration::nextElement(void)
if(!pDoc)
throw uno::RuntimeException();
const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
- if(!(rRedTbl.Count() > nCurrentIndex))
+ if( rRedTbl.size() <= nCurrentIndex )
throw container::NoSuchElementException();
- uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject(nCurrentIndex++), *pDoc );
+ uno::Reference <beans::XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl[nCurrentIndex++], *pDoc );
uno::Any aRet;
aRet <<= xRet;
return aRet;
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 7ba330534936..c51a601549a1 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1165,7 +1165,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
}
const SwRedlineTbl& rRedTbl =
pFmt->GetDoc()->GetRedlineTbl();
- for (sal_uInt16 nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ for (sal_uInt16 nRed = 0; nRed < rRedTbl.size(); nRed++)
{
const SwRedline* pRedline = rRedTbl[nRed];
SwNode const*const pRedPointNode = pRedline->GetNode(sal_True);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index bd6a44b36911..a49db0de0fce 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -305,7 +305,7 @@ uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry
if(FN_UNO_REDLINE_NODE_END == pEntry->nWID)
pTblNode = pTblNode->EndOfSectionNode();
const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
- for(sal_uInt16 nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ for(sal_uInt16 nRed = 0; nRed < rRedTbl.size(); nRed++)
{
const SwRedline* pRedline = rRedTbl[nRed];
const SwNode* pRedPointNode = pRedline->GetNode(sal_True);
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 4a8f1ef4d19d..315990ac14e7 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1169,7 +1169,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
case FN_UNO_REDLINE_NODE_END:
{
const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
- const sal_uInt16 nRedTblCount = rRedTbl.Count();
+ const sal_uInt16 nRedTblCount = rRedTbl.size();
if (nRedTblCount > 0)
{
SwStartNode const*const pStartNode = GetStartNode();
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 2876a5281f54..c14c5aabdc28 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -249,7 +249,7 @@ void RtfExport::WriteRevTab()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC);
- int nRevAuthors = pDoc->GetRedlineTbl().Count();
+ int nRevAuthors = pDoc->GetRedlineTbl().size();
if (nRevAuthors < 1)
return;
@@ -258,7 +258,7 @@ void RtfExport::WriteRevTab()
String sUnknown(RTL_CONSTASCII_USTRINGPARAM("Unknown"));
GetRedline(sUnknown);
- for( sal_uInt16 i = 0; i < pDoc->GetRedlineTbl().Count(); ++i )
+ for( sal_uInt16 i = 0; i < pDoc->GetRedlineTbl().size(); ++i )
{
const SwRedline* pRedl = pDoc->GetRedlineTbl()[ i ];
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 498f65aa714b..09969f54c3ad 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -225,7 +225,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
maFlyIter = maFlyFrms.begin();
- if ( m_rExport.pDoc->GetRedlineTbl().Count() )
+ if ( !m_rExport.pDoc->GetRedlineTbl().empty() )
{
SwPosition aPosition( rNd, SwIndex( (SwTxtNode*)&rNd ) );
pCurRedline = m_rExport.pDoc->GetRedline( aPosition, &nCurRedlinePos );
@@ -277,14 +277,14 @@ xub_StrLen SwWW8AttrIter::SearchNext( xub_StrLen nStartPos )
nMinPos = i;
}
- if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().Count() )
+ if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size() )
{
// nCurRedlinePos point to the next redline
nPos = nCurRedlinePos;
if( pCurRedline )
++nPos;
- for ( ; nPos < m_rExport.pDoc->GetRedlineTbl().Count(); ++nPos )
+ for ( ; nPos < m_rExport.pDoc->GetRedlineTbl().size(); ++nPos )
{
const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nPos ];
@@ -1196,7 +1196,7 @@ bool SwWW8AttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
bool bRet = false;
// search next Redline
for( sal_uInt16 nPos = nCurRedlinePos;
- nPos < m_rExport.pDoc->GetRedlineTbl().Count(); ++nPos )
+ nPos < m_rExport.pDoc->GetRedlineTbl().size(); ++nPos )
{
const SwPosition* pEnd = m_rExport.pDoc->GetRedlineTbl()[ nPos ]->End();
if( pEnd->nNode == rNd )
@@ -1234,7 +1234,7 @@ const SwRedlineData* SwWW8AttrIter::GetRedline( xub_StrLen nPos )
if( !pCurRedline )
{
// search next Redline
- for( ; nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().Count();
+ for( ; nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size();
++nCurRedlinePos )
{
const SwRedline* pRedl = m_rExport.pDoc->GetRedlineTbl()[ nCurRedlinePos ];
@@ -1474,7 +1474,7 @@ String SwWW8AttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
static SwTxtFmtColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTxtNode* pTxtNode )
{
sal_uInt16 nPos = 0;
- sal_uInt16 nMax = rExport.pDoc->GetRedlineTbl().Count();
+ sal_uInt16 nMax = rExport.pDoc->GetRedlineTbl().size();
while( nPos < nMax )
{
const SwRedline* pRedl = rExport.pDoc->GetRedlineTbl()[ nPos++ ];
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 80ec3bcc8707..634fe20af61d 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2846,7 +2846,7 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam );
mnRedlineMode = pDoc->GetRedlineMode();
- if ( pDoc->GetRedlineTbl().Count() )
+ if ( !pDoc->GetRedlineTbl().empty() )
{
pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
nsRedlineMode_t::REDLINE_SHOW_INSERT) );
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 21f125e210ae..ec2bcca0f613 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -921,7 +921,7 @@ sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates )
if ( nStates & HIDDENINFORMATION_RECORDEDCHANGES )
{
- if ( GetDoc()->GetRedlineTbl().Count() )
+ if ( !GetDoc()->GetRedlineTbl().empty() )
nState |= HIDDENINFORMATION_RECORDEDCHANGES;
}
if ( nStates & HIDDENINFORMATION_NOTES )