[Libreoffice-commits] .: 4 commits - sw/inc sw/qa sw/source
Michael Stahl
mst at kemper.freedesktop.org
Thu Jul 26 14:37:15 PDT 2012
sw/inc/docary.hxx | 37 ++--
sw/qa/core/swdoc-test.cxx | 2
sw/source/core/access/parachangetrackinginfo.cxx | 4
sw/source/core/crsr/swcrsr.cxx | 2
sw/source/core/doc/doc.cxx | 6
sw/source/core/doc/docbm.cxx | 4
sw/source/core/doc/doccomp.cxx | 6
sw/source/core/doc/doccorr.cxx | 4
sw/source/core/doc/docedt.cxx | 26 +--
sw/source/core/doc/docfmt.cxx | 4
sw/source/core/doc/docnew.cxx | 2
sw/source/core/doc/docnum.cxx | 10 -
sw/source/core/doc/docredln.cxx | 183 ++++++++++++-----------
sw/source/core/doc/docsort.cxx | 4
sw/source/core/doc/tblrwcl.cxx | 43 +++--
sw/source/core/docnode/ndcopy.cxx | 10 -
sw/source/core/docnode/ndsect.cxx | 2
sw/source/core/docnode/ndtbl.cxx | 2
sw/source/core/edit/edlingu.cxx | 2
sw/source/core/edit/edredln.cxx | 4
sw/source/core/frmedt/tblsel.cxx | 25 +--
sw/source/core/inc/swblocks.hxx | 8 -
sw/source/core/layout/frmtool.cxx | 2
sw/source/core/swg/SwXMLTextBlocks.cxx | 18 +-
sw/source/core/swg/SwXMLTextBlocks1.cxx | 14 -
sw/source/core/swg/swblocks.cxx | 44 +++--
sw/source/core/table/swtable.cxx | 2
sw/source/core/text/porlay.cxx | 2
sw/source/core/text/redlnitr.cxx | 4
sw/source/core/txtnode/ndtxt.cxx | 4
sw/source/core/txtnode/txtedt.cxx | 2
sw/source/core/undo/undel.cxx | 2
sw/source/core/undo/undobj.cxx | 8 -
sw/source/core/undo/unins.cxx | 8 -
sw/source/core/undo/unovwr.cxx | 2
sw/source/core/undo/unredln.cxx | 4
sw/source/core/undo/unsect.cxx | 2
sw/source/core/undo/unspnd.cxx | 2
sw/source/core/undo/untbl.cxx | 2
sw/source/core/undo/untblk.cxx | 2
sw/source/core/unocore/unoportenum.cxx | 2
sw/source/core/unocore/unoredline.cxx | 2
sw/source/core/unocore/unoredlines.cxx | 14 -
sw/source/core/unocore/unosect.cxx | 2
sw/source/core/unocore/unotbl.cxx | 2
sw/source/core/unocore/unotext.cxx | 2
sw/source/filter/ww8/rtfexport.cxx | 4
sw/source/filter/ww8/wrtw8nds.cxx | 12 -
sw/source/filter/ww8/wrtww8.cxx | 2
sw/source/ui/app/docsh.cxx | 2
50 files changed, 297 insertions(+), 261 deletions(-)
New commits:
commit ddd84d08c9bb6e00fbd9a73bd52a28688a8c1ba7
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 17:16:03 2012 +0200
Convert SV_DECL_PTRARR_SORT_DEL(_SwRedlineTbl) to o3tl::sorted_vector
Change-Id: Ie7edc6b32b373619d4c0ac154da93650743049cf
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 8cedf2f..8270a74 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 e47b7d1..3e26b1f 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 817c40d..a9c443c 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 ff8a90b..e99d948 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 845ae42..f639231 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 f3befe4..9ec2174 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 11c43f3..0ed56d7 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 b812046..c7f1066 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 11517ca..9db8837 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 4c67d51..f0bc6bc 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 f4d4128..4ddf95e 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 c3c5ad9..fd6eb92 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 88c3749..cd45f8a 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 fea5026..bb78bd4 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 a701f8e..fb49030 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 7f0be84..8dd4023 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 5a09a63..f89ff9c 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 c002d56..e0c30ec 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 49063fb..19e9c06 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 2340510..b300ba0 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 7501aca..200c5a6 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 c464d24..e1305f0 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 621930e..0e63f76 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 3a26191..90e9a2b 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 0e4e447..bde5588 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 1cfa0a7..604921e 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 ea1995d..5207a61 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 03f50b6..fcbb4ac 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 bba2d1e..c76b5b0 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 6938d91..2cd6a25 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 11a7701..448660e 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 3922c3c..5fb4814 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 f508d41..10fa4ed 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 f027645..bebaeb2 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 ed9ef38..5bbe006 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 977730e..8f399b2 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 26fedc5..82dd78e 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 7ba3305..c51a601 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 bd6a44b..a49db0d 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 4a8f1ef..315990a 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 2876a52..c14c5aa 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 498f65a..09969f5 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 80ec3bc..634fe20 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 21f125e..ec2bcca 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 )
commit f683b7fd81c058cda55fb690201f29448c44a83f
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 15:34:14 2012 +0200
Convert SV_DECL_PTRARR_SORT(SwBlockNames) to o3tl::sorted_vector
Change-Id: I85ceda4df9f495bc514e2f37c73097b268822e1e
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index 4663e8a..bf89e6e 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -31,7 +31,7 @@
#include <tools/string.hxx>
#include <tools/datetime.hxx>
-#include <svl/svarray.hxx>
+#include <o3tl/sorted_vector.hxx>
class SwPaM;
@@ -58,11 +58,11 @@ public:
SwBlockName( const String& rShort, const String& rLong, const String& rPackageName );
// fuer das Einsortieren in das Array
- int operator==( const SwBlockName& r ) { return aShort == r.aShort; }
- int operator< ( const SwBlockName& r ) { return aShort < r.aShort; }
+ bool operator==( const SwBlockName& r ) const { return aShort == r.aShort; }
+ bool operator< ( const SwBlockName& r ) const { return aShort < r.aShort; }
};
-SV_DECL_PTRARR_SORT( SwBlockNames, SwBlockName*, 10 )
+class SwBlockNames : public o3tl::sorted_vector<SwBlockName*, o3tl::less_ptr_to<SwBlockName> > {};
class SwImpBlocks
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 17d3b5f..d3ca9b5 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -155,14 +155,17 @@ void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong, sal_Bo
sal_uInt16 nIdx = GetIndex( rShort );
SwBlockName* pNew = NULL;
if( nIdx != (sal_uInt16) -1 )
- aNames.DeleteAndDestroy( nIdx );
+ {
+ delete aNames[nIdx];
+ aNames.erase( aNames.begin() + nIdx );
+ }
aPackageName = GeneratePackageName( rShort );
pNew = new SwBlockName( rShort, rLong, aPackageName );
pNew->bIsOnlyTxtFlagInit = sal_True;
pNew->bIsOnlyTxt = bOnlyTxt;
- aNames.C40_PTR_INSERT( SwBlockName, pNew );
+ aNames.insert( pNew );
bInfoChanged = sal_True;
}
void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong,
@@ -170,17 +173,20 @@ void SwXMLTextBlocks::AddName( const String& rShort, const String& rLong,
{
sal_uInt16 nIdx = GetIndex( rShort );
if( nIdx != (sal_uInt16) -1 )
- aNames.DeleteAndDestroy( nIdx );
+ {
+ delete aNames[nIdx];
+ aNames.erase( aNames.begin() + nIdx );
+ }
SwBlockName* pNew = new SwBlockName( rShort, rLong, rPackageName );
pNew->bIsOnlyTxtFlagInit = sal_True;
pNew->bIsOnlyTxt = bOnlyTxt;
- aNames.C40_PTR_INSERT( SwBlockName, pNew );
+ aNames.insert( pNew );
bInfoChanged = sal_True;
}
sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n )
{
- String aPckName (aNames[ n ]->aPackageName);
+ String aPckName (aNames[n]->aPackageName);
uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY );
if ( xAccess.is() &&
xAccess->hasByName( aPckName ) && xBlkRoot->isStreamElement( aPckName ) )
@@ -206,7 +212,7 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con
OSL_ENSURE( xBlkRoot.is(), "No storage set" );
if(!xBlkRoot.is())
return 0;
- rtl::OUString aOldName (aNames[ nIdx ]->aPackageName);
+ rtl::OUString aOldName (aNames[nIdx]->aPackageName);
aShort = rNewShort;
aPackageName = GeneratePackageName( aShort );
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index f8feb96..646439b 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -114,7 +114,7 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx )
}
xml::sax::InputSource aParserInput;
- aParserInput.sSystemId = aNames [ nIdx ] ->aPackageName;
+ aParserInput.sSystemId = aNames[nIdx]->aPackageName;
aParserInput.aInputStream = xStream->getInputStream();
@@ -182,9 +182,9 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
{
// set current auto text
- aShort = aNames[ nIdx ]->aShort;
- aLong = aNames[ nIdx ]->aLong;
- aPackageName = aNames[ nIdx ]->aPackageName;
+ aShort = aNames[nIdx]->aShort;
+ aLong = aNames[nIdx]->aLong;
+ aPackageName = aNames[nIdx]->aPackageName;
sal_uLong nRet = 0;
@@ -603,9 +603,9 @@ sal_uLong SwXMLTextBlocks::SetMacroTable(
sal_Bool bFileAlreadyOpen )
{
// set current autotext
- aShort = aNames[ nIdx ]->aShort;
- aLong = aNames[ nIdx ]->aLong;
- aPackageName = aNames[ nIdx ]->aPackageName;
+ aShort = aNames[nIdx]->aShort;
+ aLong = aNames[nIdx]->aLong;
+ aPackageName = aNames[nIdx]->aPackageName;
// start XML autotext event export
sal_uLong nRes = 0;
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx
index 463456a..cb938d2 100644
--- a/sw/source/core/swg/swblocks.cxx
+++ b/sw/source/core/swg/swblocks.cxx
@@ -47,8 +47,6 @@
#include <statstr.hrc>
#include <swerror.h>
-SV_IMPL_OP_PTRARR_SORT( SwBlockNames, SwBlockName* );
-
//////////////////////////////////////////////////////////////////////////
// Hash-Code errechnen (muss nicht eindeutig sein)
@@ -115,7 +113,7 @@ SwImpBlocks::SwImpBlocks( const String& rFile, sal_Bool )
SwImpBlocks::~SwImpBlocks()
{
- aNames.DeleteAndDestroy( 0, aNames.Count() );
+ aNames.DeleteAndDestroyAll();
}
// Loeschen des Inhaltes des Dokuments
@@ -143,7 +141,7 @@ SwPaM* SwImpBlocks::MakePaM()
sal_uInt16 SwImpBlocks::GetCount() const
{
- return aNames.Count();
+ return aNames.size();
}
// Case Insensitive
@@ -151,9 +149,9 @@ sal_uInt16 SwImpBlocks::GetIndex( const String& rShort ) const
{
String s( GetAppCharClass().uppercase( rShort ) );
sal_uInt16 nHash = Hash( s );
- for( sal_uInt16 i = 0; i < aNames.Count(); i++ )
+ for( sal_uInt16 i = 0; i < aNames.size(); i++ )
{
- SwBlockName* pName = aNames[ i ];
+ const SwBlockName* pName = aNames[ i ];
if( pName->nHashS == nHash
&& pName->aShort == s )
return i;
@@ -165,9 +163,9 @@ sal_uInt16 SwImpBlocks::GetIndex( const String& rShort ) const
sal_uInt16 SwImpBlocks::GetLongIndex( const String& rLong ) const
{
sal_uInt16 nHash = Hash( rLong );
- for( sal_uInt16 i = 0; i < aNames.Count(); i++ )
+ for( sal_uInt16 i = 0; i < aNames.size(); i++ )
{
- SwBlockName* pName = aNames[ i ];
+ const SwBlockName* pName = aNames[ i ];
if( pName->nHashL == nHash
&& pName->aLong == rLong )
return i;
@@ -178,23 +176,23 @@ sal_uInt16 SwImpBlocks::GetLongIndex( const String& rLong ) const
const String& SwImpBlocks::GetShortName( sal_uInt16 n ) const
{
- if( n < aNames.Count() )
- return aNames[ n ]->aShort;
+ if( n < aNames.size() )
+ return aNames[n]->aShort;
return aEmptyStr;
}
const String& SwImpBlocks::GetLongName( sal_uInt16 n ) const
{
- if( n < aNames.Count() )
- return aNames[ n ]->aLong;
+ if( n < aNames.size() )
+ return aNames[n]->aLong;
return aEmptyStr;
}
rtl::OUString SwImpBlocks::GetPackageName( sal_uInt16 n ) const
{
- if( n < aNames.Count() )
- return aNames[ n ]->aPackageName;
+ if( n < aNames.size() )
+ return aNames[n]->aPackageName;
return rtl::OUString();
}
@@ -203,11 +201,14 @@ void SwImpBlocks::AddName( const String& rShort, const String& rLong,
{
sal_uInt16 nIdx = GetIndex( rShort );
if( nIdx != (sal_uInt16) -1 )
- aNames.DeleteAndDestroy( nIdx );
+ {
+ delete aNames[nIdx];
+ aNames.erase( aNames.begin() + nIdx );
+ }
SwBlockName* pNew = new SwBlockName( rShort, rLong, 0L );
pNew->bIsOnlyTxtFlagInit = sal_True;
pNew->bIsOnlyTxt = bOnlyTxt;
- aNames.C40_PTR_INSERT( SwBlockName, pNew );
+ aNames.insert( pNew );
}
@@ -341,7 +342,10 @@ sal_Bool SwTextBlocks::Delete( sal_uInt16 n )
{
nErr = pImp->Delete( n );
if( !nErr )
- pImp->aNames.DeleteAndDestroy( n );
+ {
+ delete pImp->aNames[n];
+ pImp->aNames.erase( pImp->aNames.begin() + n );
+ }
if( n == pImp->nCur )
pImp->nCur = (sal_uInt16) -1;
if( !nErr )
@@ -383,7 +387,8 @@ sal_uInt16 SwTextBlocks::Rename( sal_uInt16 n, const String* s, const String* l
if( !nErr )
{
sal_Bool bOnlyTxt = pImp->aNames[ n ]->bIsOnlyTxt;
- pImp->aNames.DeleteAndDestroy( n );
+ delete pImp->aNames[n];
+ pImp->aNames.erase( pImp->aNames.begin() + n );
pImp->AddName( aNew, aLong, bOnlyTxt );
nErr = pImp->MakeBlockList();
}
@@ -578,7 +583,7 @@ sal_Bool SwTextBlocks::IsOnlyTextBlock( sal_uInt16 nIdx ) const
sal_Bool bRet = sal_False;
if( pImp && !pImp->bInPutMuchBlocks )
{
- SwBlockName* pBlkNm = pImp->aNames[ nIdx ];
+ SwBlockName* pBlkNm = const_cast<SwBlockName*>( pImp->aNames[ nIdx ] );
if( !pBlkNm->bIsOnlyTxtFlagInit &&
!pImp->IsFileChanged() && !pImp->OpenFile( sal_True ) )
{
@@ -650,5 +655,4 @@ void SwTextBlocks::SetBaseURL( const String& rURL )
pImp->SetBaseURL(rURL);
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4162724112a7d7233e22b2f14ed745a765b80eff
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 13:20:49 2012 +0200
Convert SV_DECL_VARARR_SORT(_MergePos) to o3tl::sorted_vector
Change-Id: I164cbdb72d76a04a567e82d6dcb217139d451059
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 529d0ba..00e1b48 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -83,10 +83,10 @@ struct _CmpLPt
_CmpLPt( const Point& rPt, const SwTableBox* pBox, sal_Bool bVertical );
- sal_Bool operator==( const _CmpLPt& rCmp ) const
+ bool operator==( const _CmpLPt& rCmp ) const
{ return X() == rCmp.X() && Y() == rCmp.Y() ? sal_True : sal_False; }
- sal_Bool operator<( const _CmpLPt& rCmp ) const
+ bool operator<( const _CmpLPt& rCmp ) const
{
if ( bVert )
return X() > rCmp.X() || ( X() == rCmp.X() && Y() < rCmp.Y() )
@@ -101,8 +101,7 @@ struct _CmpLPt
};
-SV_DECL_VARARR_SORT( _MergePos, _CmpLPt, 0 )
-SV_IMPL_VARARR_SORT( _MergePos, _CmpLPt )
+typedef o3tl::sorted_vector<_CmpLPt> _MergePos;
struct _Sort_CellFrm
@@ -1002,7 +1001,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// this box is selected
pLastBox = pBox;
rBoxes.insert( pBox );
- aPosArr.Insert(
+ aPosArr.insert(
_CmpLPt( (pCell->Frm().*fnRect->fnGetPos)(),
pBox, bVert ) );
@@ -1022,7 +1021,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
#if OSL_DEBUG_LEVEL > 1
Point aInsPoint( (pCell->Frm().*fnRect->fnGetPos)() );
#endif
- aPosArr.Insert(
+ aPosArr.insert(
_CmpLPt( (pCell->Frm().*fnRect->fnGetPos)(),
pBox, bVert ) );
}
@@ -1070,7 +1069,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// this box is selected
pLastBox = pBox;
rBoxes.insert( pBox );
- aPosArr.Insert(
+ aPosArr.insert(
_CmpLPt( (pCell->Frm().*fnRect->fnGetPos)(),
pBox, bVert ) );
@@ -1112,7 +1111,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
pLastBox = pBox;
rBoxes.insert( pBox );
- aPosArr.Insert( _CmpLPt( Point( rUnion.Left(),
+ aPosArr.insert( _CmpLPt( Point( rUnion.Left(),
pCell->Frm().Top()), pBox, bVert ));
if( pUndo )
@@ -1290,13 +1289,13 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
// DEL_ALL_EMPTY_BOXES
nWidth = 0;
- long nY = aPosArr.Count() ?
+ long nY = !aPosArr.empty() ?
( bVert ?
aPosArr[ 0 ].X() :
aPosArr[ 0 ].Y() ) :
0;
- for( sal_uInt16 n = 0; n < aPosArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < aPosArr.size(); ++n )
{
const _CmpLPt& rPt = aPosArr[ n ];
if( bCalcWidth )
@@ -1312,7 +1311,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
if( pUndo )
pUndo->SaveCollection( *rPt.pSelBox );
- aPosArr.Remove( n, 1 );
+ aPosArr.erase( aPosArr.begin() + n );
--n;
}
}
@@ -1346,7 +1345,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
}
//Block to delete SwPaM, SwPosition from stack
- if( aPosArr.Count() )
+ if( !aPosArr.empty() )
{
SwTxtNode* pTxtNd = 0;
SwPosition aInsPos( *(*ppMergeBox)->GetSttNd() );
@@ -1354,7 +1353,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwPaM aPam( aInsPos );
- for( sal_uInt16 n = 0; n < aPosArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < aPosArr.size(); ++n )
{
const _CmpLPt& rPt = aPosArr[ n ];
aPam.GetPoint()->nNode.Assign( *rPt.pSelBox->GetSttNd()->
commit 64e88f1f7f4d0187b50b751d9519dcc70fc1a8ca
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 13:16:14 2012 +0200
Convert SV_DECL_VARARR_SORT(_CpyTabFrms) to o3tl::sorted_vector
Change-Id: I9f1aced563e3ab8e9dc86f70f18ad8058cfa3fab
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 37e6183..c043f7b 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -270,8 +270,7 @@ _CpyTabFrm& _CpyTabFrm::operator=( const _CpyTabFrm& rCpyTabFrm )
return *this;
}
-SV_DECL_VARARR_SORT( _CpyTabFrms, _CpyTabFrm, 0 )
-SV_IMPL_VARARR_SORT( _CpyTabFrms, _CpyTabFrm )
+typedef o3tl::sorted_vector<_CpyTabFrm> _CpyTabFrms;
struct _CpyPara
{
@@ -327,7 +326,9 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara)
sal_uInt16 nFndPos;
if( pCpyPara->nCpyCnt )
{
- if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ _CpyTabFrms::const_iterator itFind = pCpyPara->rTabFrmArr.lower_bound( aFindFrm );
+ nFndPos = itFind - pCpyPara->rTabFrmArr.begin();
+ if( itFind == pCpyPara->rTabFrmArr.end() || !(*itFind == aFindFrm) )
{
// For nested copying, also save the new Format as an old one.
SwTableBoxFmt* pNewFmt = (SwTableBoxFmt*)pBox->ClaimFrmFmt();
@@ -371,9 +372,9 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara)
pNewFmt->SetFmtAttr( aFrmSz );
aFindFrm.pNewFrmFmt = pNewFmt;
- pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ pCpyPara->rTabFrmArr.insert( aFindFrm );
aFindFrm.Value.pFrmFmt = pNewFmt;
- pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ pCpyPara->rTabFrmArr.insert( aFindFrm );
}
}
else
@@ -384,9 +385,10 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara)
}
else
{
+ _CpyTabFrms::const_iterator itFind = pCpyPara->rTabFrmArr.find( aFindFrm );
if( pCpyPara->nDelBorderFlag &&
- pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
- aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ];
+ itFind != pCpyPara->rTabFrmArr.end() )
+ aFindFrm = *itFind;
else
aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
}
@@ -440,7 +442,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara)
pBox->ClaimFrmFmt()->SetFmtAttr( aNew );
if( !pCpyPara->nCpyCnt )
- pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ pCpyPara->rTabFrmArr.insert( aFindFrm );
}
}
}
@@ -1322,7 +1324,9 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
// Find the Frame Format in the Frame Format Array
SwTableBoxFmt* pLastBoxFmt;
_CpyTabFrm aFindFrm( (SwTableBoxFmt*)pSelBox->GetFrmFmt() );
- if( !aFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ _CpyTabFrms::const_iterator itFind = aFrmArr.lower_bound( aFindFrm );
+ nFndPos = itFind - aFrmArr.begin();
+ if( itFind == aFrmArr.end() || !(*itFind == aFindFrm) )
{
// Change the FrmFmt
aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pSelBox->ClaimFrmFmt();
@@ -1330,7 +1334,7 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 );
aFindFrm.pNewFrmFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE,
nNewBoxSz, 0 ) );
- aFrmArr.Insert( aFindFrm );
+ aFrmArr.insert( aFindFrm );
pLastBoxFmt = aFindFrm.pNewFrmFmt;
if( nBoxSz != ( nNewBoxSz * (nCnt + 1)))
@@ -1369,13 +1373,13 @@ sal_Bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nC
aFindFrm.pNewFrmFmt->SetFmtAttr( aTmp );
// Remove the Format from the "cache"
- for( sal_uInt16 i = aFrmArr.Count(); i; )
+ for( sal_uInt16 i = aFrmArr.size(); i; )
{
const _CpyTabFrm& rCTF = aFrmArr[ --i ];
if( rCTF.pNewFrmFmt == aFindFrm.pNewFrmFmt ||
rCTF.Value.pFrmFmt == aFindFrm.pNewFrmFmt )
{
- aFrmArr.Remove( i );
+ aFrmArr.erase( aFrmArr.begin() + i );
aLastBoxArr.erase( aLastBoxArr.begin() + i );
}
}
@@ -2020,8 +2024,9 @@ static void lcl_CopyBoxToDoc(_FndBox const& rFndBox, _CpyPara *const pCpyPara)
_CpyTabFrm aFindFrm(static_cast<SwTableBoxFmt*>(rFndBox.GetBox()->GetFrmFmt()));
SwFmtFrmSize aFrmSz;
- sal_uInt16 nFndPos;
- if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ) ||
+ _CpyTabFrms::const_iterator itFind = pCpyPara->rTabFrmArr.lower_bound( aFindFrm );
+ sal_uInt16 nFndPos = itFind - pCpyPara->rTabFrmArr.begin();
+ if( itFind == pCpyPara->rTabFrmArr.end() || !(*itFind == aFindFrm) ||
( aFrmSz = ( aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ]).pNewFrmFmt->
GetFrmSize()).GetWidth() != (SwTwips)nSize )
{
@@ -2032,7 +2037,7 @@ static void lcl_CopyBoxToDoc(_FndBox const& rFndBox, _CpyPara *const pCpyPara)
aFindFrm.pNewFrmFmt->ResetFmtAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
aFrmSz.SetWidth( nSize );
aFindFrm.pNewFrmFmt->SetFmtAttr( aFrmSz );
- pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ pCpyPara->rTabFrmArr.insert( aFindFrm );
}
SwTableBox* pBox;
@@ -2113,16 +2118,16 @@ lcl_CopyLineToDoc(const _FndLine& rFndLine, _CpyPara *const pCpyPara)
{
// Find the Frame Format in the list of all Frame Formats
_CpyTabFrm aFindFrm( (SwTableBoxFmt*)rFndLine.GetLine()->GetFrmFmt() );
- sal_uInt16 nFndPos;
- if( !pCpyPara->rTabFrmArr.Seek_Entry( aFindFrm, &nFndPos ))
+ _CpyTabFrms::const_iterator itFind = pCpyPara->rTabFrmArr.find( aFindFrm );
+ if( itFind == pCpyPara->rTabFrmArr.end() )
{
// It doesn't exist yet, so copy it
aFindFrm.pNewFrmFmt = (SwTableBoxFmt*)pCpyPara->pDoc->MakeTableLineFmt();
aFindFrm.pNewFrmFmt->CopyAttrs( *rFndLine.GetLine()->GetFrmFmt() );
- pCpyPara->rTabFrmArr.Insert( aFindFrm );
+ pCpyPara->rTabFrmArr.insert( aFindFrm );
}
else
- aFindFrm = pCpyPara->rTabFrmArr[ nFndPos ];
+ aFindFrm = *itFind;
SwTableLine* pNewLine = new SwTableLine( (SwTableLineFmt*)aFindFrm.pNewFrmFmt,
rFndLine.GetBoxes().size(), pCpyPara->pInsBox );
More information about the Libreoffice-commits
mailing list