[Libreoffice-commits] .: 12 commits - editeng/inc editeng/source sc/source svx/inc svx/source sw/inc sw/source
Michael Stahl
mst at kemper.freedesktop.org
Thu Jul 26 05:33:54 PDT 2012
editeng/inc/editeng/tstpitem.hxx | 32 +++------
editeng/source/items/paraitem.cxx | 45 ++++++-------
sc/source/filter/html/htmlpars.cxx | 60 ++++++++----------
sc/source/filter/inc/htmlpars.hxx | 3
sc/source/filter/inc/rtfparse.hxx | 3
sc/source/filter/rtf/rtfparse.cxx | 14 +---
svx/inc/svx/srchdlg.hxx | 16 ++--
svx/source/dialog/srchdlg.cxx | 47 +++++---------
sw/inc/edimp.hxx | 14 ++--
sw/inc/ftnidx.hxx | 11 ++-
sw/inc/swcrsr.hxx | 4 -
sw/inc/swregion.hxx | 8 +-
sw/inc/tblsel.hxx | 13 +++-
sw/source/core/access/acccell.cxx | 2
sw/source/core/access/acctable.cxx | 6 -
sw/source/core/bastyp/swregion.cxx | 78 +++++++++---------------
sw/source/core/crsr/crsrsh.cxx | 12 +--
sw/source/core/crsr/swcrsr.cxx | 28 ++++----
sw/source/core/crsr/trvlfnfl.cxx | 10 +--
sw/source/core/crsr/trvltbl.cxx | 12 +--
sw/source/core/crsr/unocrsr.cxx | 2
sw/source/core/crsr/viscrs.cxx | 57 +++++++----------
sw/source/core/doc/docdesc.cxx | 2
sw/source/core/doc/docedt.cxx | 26 ++++----
sw/source/core/doc/docfmt.cxx | 7 --
sw/source/core/doc/docftn.cxx | 8 +-
sw/source/core/doc/doclay.cxx | 6 -
sw/source/core/doc/docnew.cxx | 2
sw/source/core/doc/docnum.cxx | 2
sw/source/core/doc/docsort.cxx | 4 -
sw/source/core/doc/ftnidx.cxx | 63 ++++---------------
sw/source/core/doc/notxtfrm.cxx | 6 -
sw/source/core/doc/tblcpy.cxx | 18 ++---
sw/source/core/doc/tblrwcl.cxx | 71 ++++++++++-----------
sw/source/core/docnode/ndcopy.cxx | 27 ++++----
sw/source/core/docnode/ndsect.cxx | 6 -
sw/source/core/docnode/ndtbl.cxx | 48 +++++++-------
sw/source/core/docnode/ndtbl1.cxx | 12 +--
sw/source/core/docnode/node.cxx | 4 -
sw/source/core/edit/edattr.cxx | 4 -
sw/source/core/edit/edglss.cxx | 4 -
sw/source/core/edit/ednumber.cxx | 55 ++++++++--------
sw/source/core/edit/edtab.cxx | 8 +-
sw/source/core/fields/cellfml.cxx | 15 ++--
sw/source/core/fields/reffld.cxx | 8 +-
sw/source/core/frmedt/fecopy.cxx | 6 -
sw/source/core/frmedt/fefly1.cxx | 2
sw/source/core/frmedt/fetab.cxx | 55 ++++++++--------
sw/source/core/frmedt/tblsel.cxx | 73 +++++-----------------
sw/source/core/inc/tblrwcl.hxx | 8 +-
sw/source/core/layout/ftnfrm.cxx | 11 +--
sw/source/core/layout/layact.cxx | 17 ++---
sw/source/core/layout/pagechg.cxx | 14 ++--
sw/source/core/layout/paintfrm.cxx | 50 +++++++--------
sw/source/core/layout/ssfrm.cxx | 4 -
sw/source/core/layout/tabfrm.cxx | 4 -
sw/source/core/layout/trvlfrm.cxx | 9 +-
sw/source/core/table/swnewtable.cxx | 72 ++++++++++------------
sw/source/core/text/EnhancedPDFExportHelper.cxx | 18 ++---
sw/source/core/text/frmcrsr.cxx | 2
sw/source/core/text/txtfly.cxx | 6 -
sw/source/core/text/txttab.cxx | 2
sw/source/core/txtnode/atrftn.cxx | 12 +--
sw/source/core/txtnode/ndtxt.cxx | 2
sw/source/core/txtnode/thints.cxx | 6 -
sw/source/core/undo/undobj.cxx | 4 -
sw/source/core/undo/untbl.cxx | 16 ++--
sw/source/core/unocore/unochart.cxx | 6 -
sw/source/core/unocore/unocoll.cxx | 6 -
sw/source/core/unocore/unoftn.cxx | 2
sw/source/core/unocore/unoobj2.cxx | 2
sw/source/core/unocore/unotbl.cxx | 10 +--
sw/source/core/view/viewsh.cxx | 26 ++++----
sw/source/filter/html/css1atr.cxx | 2
sw/source/filter/rtf/swparrtf.cxx | 9 +-
sw/source/filter/ww1/fltshell.cxx | 7 +-
sw/source/filter/ww8/wrtw8sty.cxx | 2
sw/source/filter/ww8/ww8par2.cxx | 16 ++--
78 files changed, 621 insertions(+), 743 deletions(-)
New commits:
commit 8d832481e1f7f817821eb3202c58b2cd132bac82
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 26 14:21:59 2012 +0200
fix non-const accesses in previous commit:
Probably using const_cast is "good enough" here for the exising use
cases of modifying elements in a sorted_vector; not exposing non-const
accessors in sorted_vector should deter adding these in the future.
Change-Id: I613d7d40041b01109fd1d54f51c105acf56ae34a
diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx
index 62923aa..6174f1e 100644
--- a/editeng/inc/editeng/tstpitem.hxx
+++ b/editeng/inc/editeng/tstpitem.hxx
@@ -150,8 +150,6 @@ public:
const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
{ return maTabStops[nPos]; }
- SvxTabStop& operator[]( const sal_uInt16 nPos )
- { return maTabStops[nPos]; }
// "pure virtual Methods" from SfxPoolItem
virtual int operator==( const SfxPoolItem& ) const;
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index d611a09..84a3f28 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -967,8 +967,7 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
{
- maTabStops.clear();
- maTabStops.insert( rTSI.maTabStops );
+ maTabStops = rTSI.maTabStops;
return *this;
}
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 7f6f48e..105ef75 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -472,14 +472,14 @@ void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, sal_uInt16& nOl
{
do
{
- (*pOffset)[nPos] += nDiff;
+ const_cast<sal_uLong&>((*pOffset)[nPos]) += nDiff;
} while ( nPos-- );
}
else
{
do
{
- (*pOffset)[nPos] += nDiff;
+ const_cast<sal_uLong&>((*pOffset)[nPos]) += nDiff;
} while ( ++nPos < (sal_uInt16)pOffset->size() );
}
}
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 3498cab..db71783 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -3797,7 +3797,9 @@ void SwRTFParser::SetSwgValues( SfxItemSet& rSet )
// Tabs anpassen !!
for( sal_uInt16 n = 0; n < aTStop.Count(); ++n)
if( SVX_TAB_ADJUST_DEFAULT != aTStop[n].GetAdjustment() )
- aTStop[n].GetTabPos() -= nOffset;
+ {
+ const_cast<SvxTabStop&>(aTStop[n]).GetTabPos() -= nOffset;
+ }
// negativer Einzug, dann auf 0 Pos einen Tab setzen
if( rLR.GetTxtFirstLineOfst() < 0 )
commit ef3990b07b1a9b05b135807765f9dd2732ee085b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 14:26:38 2012 +0200
Convert SV_DECL_VARARR_SORT_VISIBILITY(SvxTabStopArr) o3tl::sorted_vector
And convert it from a private superclass to a member. The code
is cleaner and easier to read as a consequence.
Change-Id: I35501a208c96615ce5797ad06d34d3b7efc2c4db
diff --git a/editeng/inc/editeng/tstpitem.hxx b/editeng/inc/editeng/tstpitem.hxx
index 90052bf..62923aa 100644
--- a/editeng/inc/editeng/tstpitem.hxx
+++ b/editeng/inc/editeng/tstpitem.hxx
@@ -33,6 +33,7 @@
#include <svl/poolitem.hxx>
#include <editeng/svxenum.hxx>
#include <editeng/editengdllapi.h>
+#include <o3tl/sorted_vector.hxx>
// class SvxTabStop ------------------------------------------------------
@@ -103,16 +104,16 @@ public:
// class SvxTabStopItem --------------------------------------------------
-SV_DECL_VARARR_SORT_VISIBILITY( SvxTabStopArr, SvxTabStop, SVX_TAB_DEFCOUNT, EDITENG_DLLPUBLIC )
+typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr;
/* [Description]
This item describes a list of TabStops.
*/
-class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem, private SvxTabStopArr
+class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem
{
-//friend class SvxTabStopObject_Impl;
+ SvxTabStopArr maTabStops;
public:
TYPEINFO();
@@ -131,14 +132,14 @@ public:
sal_uInt16 GetPos( const sal_Int32 nPos ) const;
// unprivatized:
- sal_uInt16 Count() const { return SvxTabStopArr::Count(); }
- sal_Bool Insert( const SvxTabStop& rTab );
- void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
+ sal_uInt16 Count() const { return maTabStops.size(); }
+ bool Insert( const SvxTabStop& rTab );
+ void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
sal_uInt16 nEnd = USHRT_MAX );
- void Remove( SvxTabStop& rTab )
- { SvxTabStopArr::Remove( rTab ); }
- void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
- { SvxTabStopArr::Remove( nPos, nLen ); }
+ void Remove( SvxTabStop& rTab )
+ { maTabStops.erase( rTab ); }
+ void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
+ { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
// Assignment operator, equality operator (caution: expensive!)
SvxTabStopItem& operator=( const SvxTabStopItem& rTSI );
@@ -147,15 +148,10 @@ public:
//int operator!=( const SvxTabStopItem& rTSI ) const
// { return !( operator==( rTSI ) ); }
- // SortedArrays returns only Stackobjects!
const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
- {
- DBG_ASSERT( GetStart() &&
- nPos < Count(), "op[]" );
- return *( GetStart() + nPos );
- }
- const SvxTabStop* GetStart() const
- { return SvxTabStopArr::GetData(); }
+ { return maTabStops[nPos]; }
+ SvxTabStop& operator[]( const sal_uInt16 nPos )
+ { return maTabStops[nPos]; }
// "pure virtual Methods" from SfxPoolItem
virtual int operator==( const SfxPoolItem& ) const;
@@ -171,8 +167,6 @@ public:
virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
- using SvxTabStopArr::Insert;
- using SvxTabStopArr::Remove;
};
#endif
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 4549274..d611a09 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -93,8 +93,6 @@ TYPEINIT1_FACTORY(SvxForbiddenRuleItem, SfxBoolItem, new SvxForbiddenRuleItem(sa
TYPEINIT1_FACTORY(SvxParaVertAlignItem, SfxUInt16Item, new SvxParaVertAlignItem(0, 0));
TYPEINIT1_FACTORY(SvxParaGridItem, SfxBoolItem, new SvxParaGridItem(sal_True, 0));
-SV_IMPL_VARARR_SORT( SvxTabStopArr, SvxTabStop )
-
// -----------------------------------------------------------------------
SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight, const sal_uInt16 nId )
@@ -913,7 +911,7 @@ XubString SvxTabStop::GetValueString() const
SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
- SvxTabStopArr( sal_Int8(SVX_TAB_DEFCOUNT) )
+ maTabStops()
{
const sal_uInt16 nTabs = SVX_TAB_DEFCOUNT, nDist = SVX_TAB_DEFDIST;
const SvxTabAdjust eAdjst= SVX_TAB_ADJUST_DEFAULT;
@@ -921,7 +919,7 @@ SvxTabStopItem::SvxTabStopItem( sal_uInt16 _nWhich ) :
for (sal_uInt16 i = 0; i < nTabs; ++i)
{
SvxTabStop aTab( (i + 1) * nDist, eAdjst );
- SvxTabStopArr::Insert( aTab );
+ maTabStops.insert( aTab );
}
}
@@ -932,12 +930,12 @@ SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs,
const SvxTabAdjust eAdjst,
sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
- SvxTabStopArr( sal_Int8(nTabs) )
+ maTabStops()
{
for ( sal_uInt16 i = 0; i < nTabs; ++i )
{
SvxTabStop aTab( (i + 1) * nDist, eAdjst );
- SvxTabStopArr::Insert( aTab );
+ maTabStops.insert( aTab );
}
}
@@ -945,33 +943,32 @@ SvxTabStopItem::SvxTabStopItem( const sal_uInt16 nTabs,
SvxTabStopItem::SvxTabStopItem( const SvxTabStopItem& rTSI ) :
SfxPoolItem( rTSI.Which() ),
- SvxTabStopArr( (sal_Int8)rTSI.Count() )
+ maTabStops( rTSI.maTabStops )
{
- SvxTabStopArr::Insert( &rTSI );
}
// -----------------------------------------------------------------------
sal_uInt16 SvxTabStopItem::GetPos( const SvxTabStop& rTab ) const
{
- sal_uInt16 nFound;
- return Seek_Entry( rTab, &nFound ) ? nFound : SVX_TAB_NOTFOUND;
+ SvxTabStopArr::const_iterator it = maTabStops.find( rTab );
+ return it != maTabStops.end() ? it - maTabStops.begin() : SVX_TAB_NOTFOUND;
}
// -----------------------------------------------------------------------
sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
{
- sal_uInt16 nFound;
- return Seek_Entry( SvxTabStop( nPos ), &nFound ) ? nFound : SVX_TAB_NOTFOUND;
+ SvxTabStopArr::const_iterator it = maTabStops.find( SvxTabStop( nPos ) );
+ return it != maTabStops.end() ? it - maTabStops.begin() : SVX_TAB_NOTFOUND;
}
// -----------------------------------------------------------------------
SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
{
- Remove( 0, Count() );
- SvxTabStopArr::Insert( &rTSI );
+ maTabStops.clear();
+ maTabStops.insert( rTSI.maTabStops );
return *this;
}
@@ -988,7 +985,7 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
style::TabStop* pArr = aSeq.getArray();
for(sal_uInt16 i = 0; i < nCount; i++)
{
- const SvxTabStop& rTab = *(GetStart() + i);
+ const SvxTabStop& rTab = (*this)[i];
pArr[i].Position = bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos();
switch(rTab.GetAdjustment())
{
@@ -1008,7 +1005,7 @@ bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
}
case MID_STD_TAB:
{
- const SvxTabStop &rTab = *(GetStart());
+ const SvxTabStop &rTab = maTabStops.front();
rVal <<= (static_cast<sal_Int32>(bConvert ? TWIP_TO_MM100(rTab.GetTabPos()) : rTab.GetTabPos()));
break;
}
@@ -1068,7 +1065,7 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
}
- SvxTabStopArr::Remove( 0, Count() );
+ maTabStops.clear();
const style::TabStop* pArr = aSeq.getConstArray();
const sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
for(sal_uInt16 i = 0; i < nCount ; i++)
@@ -1101,9 +1098,9 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
nNewPos = MM100_TO_TWIP ( nNewPos );
if (nNewPos <= 0)
return sal_False;
- const SvxTabStop& rTab = *(GetStart());
+ const SvxTabStop& rTab = maTabStops.front();
SvxTabStop aNewTab ( nNewPos, rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
- Remove ( 0 );
+ Remove( 0 );
Insert( aNewTab );
break;
}
@@ -1210,7 +1207,7 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
{
const SvxTabStopItem& rDefTab = (const SvxTabStopItem &)
pPool->GetDefaultItem( pPool->GetWhich( SID_ATTR_TABSTOP, sal_False ) );
- nDefDist = sal_uInt16( rDefTab.GetStart()->GetTabPos() );
+ nDefDist = sal_uInt16( rDefTab.maTabStops.front().GetTabPos() );
const sal_Int32 nPos = nTabs > 0 ? (*this)[nTabs-1].GetTabPos() : 0;
nCount = (sal_uInt16)(nPos / nDefDist);
nNew = (nCount + 1) * nDefDist;
@@ -1247,12 +1244,12 @@ SvStream& SvxTabStopItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ )
}
// -----------------------------------------------------------------------
-sal_Bool SvxTabStopItem::Insert( const SvxTabStop& rTab )
+bool SvxTabStopItem::Insert( const SvxTabStop& rTab )
{
sal_uInt16 nTabPos = GetPos(rTab);
if(SVX_TAB_NOTFOUND != nTabPos )
Remove(nTabPos);
- return SvxTabStopArr::Insert( rTab );
+ return maTabStops.insert( rTab ).second;
}
// -----------------------------------------------------------------------
void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart,
@@ -1265,7 +1262,10 @@ void SvxTabStopItem::Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart,
if(SVX_TAB_NOTFOUND != nTabPos)
Remove(nTabPos);
}
- SvxTabStopArr::Insert( pTabs, nStart, nEnd );
+ for( sal_uInt16 i = nStart; i < nEnd && i < pTabs->Count(); i++ )
+ {
+ maTabStops.insert( (*pTabs)[i] );
+ }
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 2dfc3df..4c67d51 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1136,12 +1136,9 @@ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
return sal_False;
// Find the default's beginning
- SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart())
- + (nOldCnt-1);
sal_uInt16 n;
-
- for( n = nOldCnt; n ; --n, --pTabs )
- if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() )
+ for( n = nOldCnt; n ; --n )
+ if( SVX_TAB_ADJUST_DEFAULT != rChgTabStop[n - 1].GetAdjustment() )
break;
++n;
if( n < nOldCnt ) // delete the DefTabStops
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 1855406..3210de6 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -1590,7 +1590,7 @@ static sal_Char const sDoubleSpace[] = " ";
const SvxTabStopItem& rTab =
(const SvxTabStopItem &)pSet->
GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
- MSHORT nDefTabDist = (MSHORT)rTab.GetStart()->GetTabPos();
+ MSHORT nDefTabDist = (MSHORT)rTab[0].GetTabPos();
nRightTab = nLeftTab - nTxtLeft;
nRightTab /= nDefTabDist;
nRightTab = nRightTab * nDefTabDist + nTxtLeft;
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 137da97..a53cce9 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -183,7 +183,7 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
(const SvxTabStopItem &)pFrm->GetAttrSet()->
GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
if( rTab.Count() )
- nDefTabDist = (KSHORT)rTab.GetStart()->GetTabPos();
+ nDefTabDist = (KSHORT)rTab[0].GetTabPos();
else
nDefTabDist = SVX_TAB_DEFDIST;
aLineInf.SetDefTabStop( nDefTabDist );
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index c210149..3498cab 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -3795,10 +3795,9 @@ void SwRTFParser::SetSwgValues( SfxItemSet& rSet )
if( nOffset )
{
// Tabs anpassen !!
- SvxTabStop* pTabs = (SvxTabStop*)aTStop.GetStart();
- for( sal_uInt16 n = aTStop.Count(); n; --n, ++pTabs)
- if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() )
- pTabs->GetTabPos() -= nOffset;
+ for( sal_uInt16 n = 0; n < aTStop.Count(); ++n)
+ if( SVX_TAB_ADJUST_DEFAULT != aTStop[n].GetAdjustment() )
+ aTStop[n].GetTabPos() -= nOffset;
// negativer Einzug, dann auf 0 Pos einen Tab setzen
if( rLR.GetTxtFirstLineOfst() < 0 )
commit f7f99968f2014c9e7f1f216c6ef0d2d31630087d
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 15:18:22 2012 +0200
Convert SV_DECL_VARARR_SORT(ScHTMLColOffset) to o3tl::sorted_vector
Change-Id: I583eeccc2cdb0c3fd0dc60f9e222e026c6b0ead2
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index d913865..7f6f48e 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -190,9 +190,6 @@ void ScHTMLStyles::insertProp(
pProps->insert(PropsType::value_type(aProp, aValue));
}
-SV_IMPL_VARARR_SORT( ScHTMLColOffset, sal_uLong );
-
-
// ============================================================================
// BASE class for HTML parser classes
// ============================================================================
@@ -323,16 +320,15 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const String& rBaseURL )
// Spaltenbreiten erzeugen
Adjust();
OutputDevice* pDefaultDev = Application::GetDefaultDevice();
- sal_uInt16 nCount = pColOffset->Count();
- const sal_uLong* pOff = (const sal_uLong*) pColOffset->GetData();
- sal_uLong nOff = *pOff++;
+ sal_uInt16 nCount = pColOffset->size();
+ sal_uLong nOff = (*pColOffset)[0];
Size aSize;
- for ( sal_uInt16 j = 1; j < nCount; j++, pOff++ )
+ for ( sal_uInt16 j = 1; j < nCount; j++ )
{
- aSize.Width() = *pOff - nOff;
+ aSize.Width() = (*pColOffset)[j] - nOff;
aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
maColWidths[ j-1 ] = aSize.Width();
- nOff = *pOff;
+ nOff = (*pColOffset)[j];
}
return nErr;
}
@@ -393,12 +389,13 @@ bool ScHTMLLayoutParser::SeekOffset( ScHTMLColOffset* pOffset, sal_uInt16 nOffse
SCCOL* pCol, sal_uInt16 nOffsetTol )
{
OSL_ENSURE( pOffset, "ScHTMLLayoutParser::SeekOffset - illegal call" );
- sal_uInt16 nPos;
- bool bFound = pOffset->Seek_Entry( nOffset, &nPos );
+ ScHTMLColOffset::const_iterator it = pOffset->find( nOffset );
+ bool bFound = it != pOffset->end();
+ sal_uInt16 nPos = it - pOffset->end();
*pCol = static_cast<SCCOL>(nPos);
if ( bFound )
return true;
- sal_uInt16 nCount = pOffset->Count();
+ sal_uInt16 nCount = pOffset->size();
if ( !nCount )
return false;
// nPos ist Einfuegeposition, da liegt der Naechsthoehere (oder auch nicht)
@@ -422,13 +419,13 @@ void ScHTMLLayoutParser::MakeCol( ScHTMLColOffset* pOffset, sal_uInt16& nOffset,
if ( SeekOffset( pOffset, nOffset, &nPos, nOffsetTol ) )
nOffset = (sal_uInt16)(*pOffset)[nPos];
else
- pOffset->Insert( nOffset );
+ pOffset->insert( nOffset );
if ( nWidth )
{
if ( SeekOffset( pOffset, nOffset + nWidth, &nPos, nWidthTol ) )
nWidth = (sal_uInt16)(*pOffset)[nPos] - nOffset;
else
- pOffset->Insert( nOffset + nWidth );
+ pOffset->insert( nOffset + nWidth );
}
}
@@ -441,11 +438,11 @@ void ScHTMLLayoutParser::MakeColNoRef( ScHTMLColOffset* pOffset, sal_uInt16 nOff
if ( SeekOffset( pOffset, nOffset, &nPos, nOffsetTol ) )
nOffset = (sal_uInt16)(*pOffset)[nPos];
else
- pOffset->Insert( nOffset );
+ pOffset->insert( nOffset );
if ( nWidth )
{
if ( !SeekOffset( pOffset, nOffset + nWidth, &nPos, nWidthTol ) )
- pOffset->Insert( nOffset + nWidth );
+ pOffset->insert( nOffset + nWidth );
}
}
@@ -460,7 +457,7 @@ void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, sal_uInt16& nOl
if ( SeekOffset( pOffset, nNewOffset, &nPos, nOffsetTol ) )
nNewOffset = (sal_uInt16)(*pOffset)[nPos];
else
- pOffset->Insert( nNewOffset );
+ pOffset->insert( nNewOffset );
return ;
}
nOldOffset = (sal_uInt16)(*pOffset)[nPos];
@@ -470,23 +467,20 @@ void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, sal_uInt16& nOl
nNewOffset = (sal_uInt16)(*pOffset)[nPos2];
return ;
}
- sal_uLong* pData = ((sal_uLong*) pOffset->GetData()) + nPos; //! QAD
long nDiff = nNewOffset - nOldOffset;
if ( nDiff < 0 )
{
- const sal_uLong* pStop = pOffset->GetData();
do
{
- *pData += nDiff;
- } while ( pStop < pData-- );
+ (*pOffset)[nPos] += nDiff;
+ } while ( nPos-- );
}
else
{
- const sal_uLong* pStop = pOffset->GetData() + pOffset->Count();
do
{
- *pData += nDiff;
- } while ( ++pData < pStop );
+ (*pOffset)[nPos] += nDiff;
+ } while ( ++nPos < (sal_uInt16)pOffset->size() );
}
}
@@ -642,7 +636,7 @@ void ScHTMLLayoutParser::Adjust()
SkipLocked( pE, false );
if ( pE->nCol != nColBeforeSkip )
{
- SCCOL nCount = (SCCOL)pColOffset->Count();
+ SCCOL nCount = (SCCOL)pColOffset->size();
if ( nCount <= pE->nCol )
{
pE->nOffset = (sal_uInt16) (*pColOffset)[nCount-1];
@@ -685,7 +679,7 @@ sal_uInt16 ScHTMLLayoutParser::GetWidth( ScEEParseEntry* pE )
return pE->nWidth;
sal_Int32 nTmp = ::std::min( static_cast<sal_Int32>( pE->nCol -
nColCntStart + pE->nColOverlap),
- static_cast<sal_Int32>( pLocalColOffset->Count() - 1));
+ static_cast<sal_Int32>( pLocalColOffset->size() - 1));
SCCOL nPos = (nTmp < 0 ? 0 : static_cast<SCCOL>(nTmp));
sal_uInt16 nOff2 = (sal_uInt16) (*pLocalColOffset)[nPos];
if ( pE->nOffset < nOff2 )
@@ -703,16 +697,16 @@ void ScHTMLLayoutParser::SetWidths()
SCCOL nColsPerRow = nMaxCol - nColCntStart;
if ( nColsPerRow <= 0 )
nColsPerRow = 1;
- if ( pLocalColOffset->Count() <= 2 )
+ if ( pLocalColOffset->size() <= 2 )
{ // nur PageSize, es gab keine Width-Angabe
sal_uInt16 nWidth = nTableWidth / static_cast<sal_uInt16>(nColsPerRow);
sal_uInt16 nOff = nColOffsetStart;
- pLocalColOffset->Remove( (sal_uInt16)0, pLocalColOffset->Count() );
+ pLocalColOffset->clear();
for ( nCol = 0; nCol <= nColsPerRow; ++nCol, nOff = nOff + nWidth )
{
MakeColNoRef( pLocalColOffset, nOff, 0, 0, 0 );
}
- nTableWidth = (sal_uInt16)((*pLocalColOffset)[pLocalColOffset->Count() -1 ] - (*pLocalColOffset)[0]);
+ nTableWidth = (sal_uInt16)(pLocalColOffset->back() - pLocalColOffset->front());
for ( size_t i = nFirstTableCell, nListSize = maList.size(); i < nListSize; ++i )
{
pE = maList[ i ];
@@ -797,7 +791,7 @@ void ScHTMLLayoutParser::SetWidths()
{
pOffsets[nCol] = pOffsets[nCol-1] + pWidths[nCol-1];
}
- pLocalColOffset->Remove( (sal_uInt16)0, pLocalColOffset->Count() );
+ pLocalColOffset->clear();
for ( nCol = 0; nCol <= nColsPerRow; nCol++ )
{
MakeColNoRef( pLocalColOffset, pOffsets[nCol], 0, 0, 0 );
@@ -826,9 +820,9 @@ void ScHTMLLayoutParser::SetWidths()
delete [] pOffsets;
}
}
- if ( pLocalColOffset->Count() )
+ if ( !pLocalColOffset->empty() )
{
- sal_uInt16 nMax = (sal_uInt16) (*pLocalColOffset)[pLocalColOffset->Count() - 1];
+ sal_uInt16 nMax = (sal_uInt16) pLocalColOffset->back();
if ( aPageSize.Width() < nMax )
aPageSize.Width() = nMax;
}
@@ -860,7 +854,7 @@ void ScHTMLLayoutParser::Colonize( ScEEParseEntry* pE )
if ( nCol < pE->nCol )
{ // verdraengt
nCol = pE->nCol - nColCntStart;
- SCCOL nCount = static_cast<SCCOL>(pLocalColOffset->Count());
+ SCCOL nCount = static_cast<SCCOL>(pLocalColOffset->size());
if ( nCol < nCount )
nColOffset = (sal_uInt16) (*pLocalColOffset)[nCol];
else
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 30f72c9..fbae497 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -34,6 +34,7 @@
#include <vector>
#include <list>
#include <map>
+#include <o3tl/sorted_vector.hxx>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/unordered_map.hpp>
@@ -108,7 +109,7 @@ public:
// ============================================================================
-SV_DECL_VARARR_SORT( ScHTMLColOffset, sal_uLong, 16 )
+typedef o3tl::sorted_vector<sal_uLong> ScHTMLColOffset;
struct ScHTMLTableStackEntry
{
commit e0e006ccb03e0af1826d30ed6a784dc185321cfe
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 12:49:18 2012 +0200
Convert SV_DECL_VARARR( _MapTblFrmFmts) to std::vector
Change-Id: I96db7b86a5739a396522cf2e5c3dbaae48963859
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 2d55541..a701f8e 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -235,8 +235,7 @@ struct _MapTblFrmFmt
{}
};
-SV_DECL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt, 0 )
-SV_IMPL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt );
+typedef std::vector<_MapTblFrmFmt> _MapTblFrmFmts;
SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
{
@@ -299,12 +298,12 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
}
-sal_Bool lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara )
+static bool lcl_SrchNew( const _MapTblFrmFmt& rMap, const SwFrmFmt** pPara )
{
- if( rMap.pOld != *(const SwFrmFmt**)pPara )
- return sal_True;
- *((const SwFrmFmt**)pPara) = rMap.pNew;
- return sal_False; // abbrechen, Pointer gefunden
+ if( rMap.pOld != *pPara )
+ return true;
+ *pPara = rMap.pNew;
+ return false; // abbrechen, Pointer gefunden
}
@@ -330,7 +329,9 @@ static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT );
static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT )
{
SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
- pCT->rMapArr.ForEach( lcl_SrchNew, &pBoxFmt );
+ for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it )
+ if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pBoxFmt ) )
+ break;
if( pBoxFmt == pBox->GetFrmFmt() ) // ein neues anlegen ??
{
const SfxPoolItem* pItem;
@@ -357,8 +358,7 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT )
}
}
- pCT->rMapArr.Insert( _MapTblFrmFmt( pBox->GetFrmFmt(), pBoxFmt ),
- pCT->rMapArr.Count() );
+ pCT->rMapArr.push_back( _MapTblFrmFmt( pBox->GetFrmFmt(), pBoxFmt ) );
}
sal_uInt16 nLines = pBox->GetTabLines().size();
@@ -391,13 +391,14 @@ static void lcl_CopyTblBox( SwTableBox* pBox, _CopyTable* pCT )
static void lcl_CopyTblLine( const SwTableLine* pLine, _CopyTable* pCT )
{
SwTableLineFmt* pLineFmt = (SwTableLineFmt*)pLine->GetFrmFmt();
- pCT->rMapArr.ForEach( lcl_SrchNew, &pLineFmt );
+ for( _MapTblFrmFmts::const_iterator it = pCT->rMapArr.begin(); it != pCT->rMapArr.end(); ++it )
+ if ( !lcl_SrchNew( *it, (const SwFrmFmt**)&pLineFmt ) )
+ break;
if( pLineFmt == pLine->GetFrmFmt() ) // ein neues anlegen ??
{
pLineFmt = pCT->pDoc->MakeTableLineFmt();
pLineFmt->CopyAttrs( *pLine->GetFrmFmt() );
- pCT->rMapArr.Insert( _MapTblFrmFmt( pLine->GetFrmFmt(), pLineFmt ),
- pCT->rMapArr.Count());
+ pCT->rMapArr.push_back( _MapTblFrmFmt( pLine->GetFrmFmt(), pLineFmt ) );
}
SwTableLine* pNewLine = new SwTableLine( pLineFmt,
pLine->GetTabBoxes().size(), pCT->pInsBox );
commit e7cda38616c967bcc8c07f94d32342ccd1b629c5
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 20 12:08:29 2012 +0200
Convert SV_DECL_VARARR(SwRects) to std::vector
Change-Id: I7fa9380fad92d6667ccd9a635b2d26f700aa780e
diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx
index b0f63f8..b4c18fa 100644
--- a/sw/inc/swregion.hxx
+++ b/sw/inc/swregion.hxx
@@ -28,17 +28,17 @@
#ifndef _SWREGION_HXX
#define _SWREGION_HXX
-#include <svl/svarray.hxx>
+#include <vector>
#include "swrect.hxx"
-SV_DECL_VARARR( SwRects, SwRect, 20 )
+typedef std::vector<SwRect> SwRects;
class SwRegionRects : public SwRects
{
SwRect aOrigin; // Copy of StartRect.
- inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, sal_Bool &rDel);
+ inline void InsertRect( const SwRect &rRect, const sal_uInt16 nPos, bool &rDel);
public:
SwRegionRects( const SwRect& rStartRect, sal_uInt16 nInit = 20 );
@@ -50,7 +50,7 @@ public:
void Invert();
// Combine adjacent rectangles.
- void Compress( sal_Bool bFuzzy = sal_True );
+ void Compress( bool bFuzzy = true );
inline const SwRect &GetOrigin() const { return aOrigin; }
inline void ChangeOrigin( const SwRect &rRect ) { aOrigin = rRect; }
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
index 06206b8..f745f4b 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -30,29 +30,27 @@
#include "swregion.hxx"
#include "swtypes.hxx"
-SV_IMPL_VARARR( SwRects, SwRect );
-
SwRegionRects::SwRegionRects( const SwRect &rStartRect, sal_uInt16 nInit ) :
- SwRects( (sal_uInt8)nInit ),
+ SwRects(),
aOrigin( rStartRect )
{
- Insert( aOrigin, 0 );
+ reserve(nInit);
+ push_back( aOrigin );
}
// If <rDel> is sal_True then this Rect will be overwritten by <rRect> at
// position <nPos>. Otherwise <rRect> is attached at the end.
inline void SwRegionRects::InsertRect( const SwRect &rRect,
- const sal_uInt16 nPos, sal_Bool &rDel )
+ const sal_uInt16 nPos, bool &rDel )
{
if( rDel )
{
- pData = (SwRect*)pData; // looks weird but seems to help gcc ->i78417
- *(pData+nPos) = rRect;
- rDel = sal_False;
+ (*this)[nPos] = rRect;
+ rDel = false;
}
else
{
- Insert( rRect, Count() );
+ push_back( rRect );
}
}
@@ -64,18 +62,18 @@ inline void SwRegionRects::InsertRect( const SwRect &rRect,
*/
void SwRegionRects::operator-=( const SwRect &rRect )
{
- sal_uInt16 nMax = Count();
+ sal_uInt16 nMax = size();
for ( sal_uInt16 i = 0; i < nMax; ++i )
{
- if ( rRect.IsOver( *(pData+i) ) )
+ if ( rRect.IsOver( (*this)[i] ) )
{
- SwRect aTmp( *(pData+i) );
+ SwRect aTmp( (*this)[i] );
SwRect aInter( aTmp );
aInter._Intersection( rRect );
// The first Rect that should be inserted takes position of i.
// This avoids one Delete() call.
- sal_Bool bDel = sal_True;
+ bool bDel = true;
// now split; only those rectangles should be left over that are in
// the "old" but not in the "new" area; hence, not in intersection.
@@ -108,7 +106,7 @@ void SwRegionRects::operator-=( const SwRect &rRect )
if( bDel )
{
- Remove( i );
+ erase( begin() + i );
--i; // so that we don't forget any
--nMax; // so that we don't check too much
}
@@ -132,24 +130,12 @@ void SwRegionRects::Invert()
// To avoid unnecessary memory requirements, create a "useful" initial size:
// Number of rectangles in this area * 2 + 2 for the special case of a
// single hole (so four Rects in the inverse case).
- SwRegionRects aInvRegion( aOrigin, Count()*2+2 );
- const SwRect *pDat = GetData();
- for( sal_uInt16 i = 0; i < Count(); ++pDat, ++i )
- aInvRegion -= *pDat;
+ SwRegionRects aInvRegion( aOrigin, size()*2+2 );
+ for( const_iterator it = begin(); it != end(); ++it )
+ aInvRegion -= *it;
- sal_uInt16 nCpy = Count(), nDel = 0;
- if( aInvRegion.Count() < Count() )
- {
- nDel = Count() - aInvRegion.Count();
- nCpy = aInvRegion.Count();
- }
// overwrite all existing
- memcpy( pData, aInvRegion.GetData(), nCpy * sizeof( SwRect ));
-
- if( nCpy < aInvRegion.Count() )
- Insert( &aInvRegion, nCpy, nCpy );
- else if( nDel )
- Remove( nCpy, nDel );
+ swap( aInvRegion );
}
inline SwTwips CalcArea( const SwRect &rRect )
@@ -158,23 +144,23 @@ inline SwTwips CalcArea( const SwRect &rRect )
}
// combine all adjacent rectangles
-void SwRegionRects::Compress( sal_Bool bFuzzy )
+void SwRegionRects::Compress( bool bFuzzy )
{
- for ( int i = 0; i < Count(); ++i )
+ for ( size_type i = 0; i < size(); ++i )
{
- for ( int j = i+1; j < Count(); ++j )
+ for ( size_type j = i+1; j < size(); ++j )
{
// If one rectangle contains a second completely than the latter
// does not need to be stored and can be deleted
- if ( (*(pData + i)).IsInside( *(pData + j) ) )
+ if ( (*this)[i].IsInside( (*this)[j] ) )
{
- Remove( static_cast<sal_uInt16>(j), 1 );
+ erase( begin() + j );
--j;
}
- else if ( (*(pData + j)).IsInside( *(pData + i) ) )
+ else if ( (*this)[j].IsInside( (*this)[i] ) )
{
- *(pData + i) = *(pData + j);
- Remove( static_cast<sal_uInt16>(j), 1 );
+ (*this)[i] = (*this)[j];
+ erase( begin() + j );
i = -1;
break;
}
@@ -187,16 +173,16 @@ void SwRegionRects::Compress( sal_Bool bFuzzy )
// ( 9622 * 141.5 = 1361513 ~= a quarter (1/4) centimeter wider
// than the width of a A4 page
const long nFuzzy = bFuzzy ? 1361513 : 0;
- SwRect aUnion( *(pData + i) );
- aUnion.Union( *(pData + j) );
- SwRect aInter( *(pData + i) );
- aInter.Intersection( *(pData + j));
- if ( (::CalcArea( *(pData + i) ) +
- ::CalcArea( *(pData + j) ) + nFuzzy) >=
+ SwRect aUnion( (*this)[i] );
+ aUnion.Union( (*this)[j] );
+ SwRect aInter( (*this)[i] );
+ aInter.Intersection( (*this)[j] );
+ if ( (::CalcArea( (*this)[i] ) +
+ ::CalcArea( (*this)[j] ) + nFuzzy) >=
(::CalcArea( aUnion ) - CalcArea( aInter )) )
{
- *(pData + i) = aUnion;
- Remove( static_cast<sal_uInt16>(j), 1 );
+ (*this)[i] = aUnion;
+ erase( begin() + j );
i = -1;
break;
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 31bd6da..78544a8 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1851,8 +1851,8 @@ void SwCrsrShell::RefreshBlockCursor()
--pPam;
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
- pNew->Insert( pCurCrsr, 0 );
- pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pNew->insert( pNew->begin(), pCurCrsr->begin(), pCurCrsr->end());
+ pCurCrsr->clear();
pCurCrsr->DeleteMark();
*pCurCrsr->GetPoint() = *(*pPam)->GetPoint(); // n-2, n-3, .., 2, 1
@@ -1868,8 +1868,8 @@ void SwCrsrShell::RefreshBlockCursor()
}
{
SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
- pNew->Insert( pCurCrsr, 0 );
- pCurCrsr->Remove( 0, pCurCrsr->Count() );
+ pNew->insert( pNew->begin(), pCurCrsr->begin(), pCurCrsr->end() );
+ pCurCrsr->clear();
pCurCrsr->DeleteMark();
}
pPam = aSelList.getEnd();
@@ -1937,8 +1937,8 @@ sal_Bool SwCrsrShell::Pop( sal_Bool bOldCrsr )
pOldStk->GetPtPos() == pCurCrsr->GetMkPos() )
{
// move "Selections Rectangles"
- pCurCrsr->Insert( pOldStk, 0 );
- pOldStk->Remove( 0, pOldStk->Count() );
+ pCurCrsr->insert( pCurCrsr->begin(), pOldStk->begin(), pOldStk->end() );
+ pOldStk->clear();
}
if( pOldStk->HasMark() )
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 139461c..22a4b7c 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -265,7 +265,7 @@ void SwVisCrsr::_SetPosAndShow()
SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh )
-: SwRects( 0 ),
+: SwRects(),
pCShell( &rCSh ),
mpCursorOverlay(0)
{
@@ -278,14 +278,7 @@ SwSelPaintRects::~SwSelPaintRects()
void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap)
{
- SwRects aTempRects;
- aTempRects.Insert(this, 0);
-
- Remove(0, Count());
- Insert(&rSwap, 0);
-
- rSwap.Remove(0, rSwap.Count());
- rSwap.Insert(&aTempRects, 0);
+ SwRects::swap(rSwap);
// #i75172# also swap mpCursorOverlay
sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay();
@@ -301,7 +294,7 @@ void SwSelPaintRects::Hide()
mpCursorOverlay = 0;
}
- SwRects::Remove( 0, Count() );
+ SwRects::clear();
}
void SwSelPaintRects::Show()
@@ -311,13 +304,13 @@ void SwSelPaintRects::Show()
if(pView && pView->PaintWindowCount())
{
// reset rects
- SwRects::Remove( 0, SwRects::Count() );
+ SwRects::clear();
FillRects();
// get new rects
std::vector< basegfx::B2DRange > aNewRanges;
- for(sal_uInt16 a(0); a < Count(); a++)
+ for(sal_uInt16 a(0); a < size(); a++)
{
const SwRect aNextRect((*this)[a]);
const Rectangle aPntRect(aNextRect.SVRect());
@@ -339,7 +332,7 @@ void SwSelPaintRects::Show()
mpCursorOverlay = 0;
}
}
- else if(Count())
+ else if(!empty())
{
SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
@@ -382,31 +375,31 @@ void SwSelPaintRects::Show()
void SwSelPaintRects::Invalidate( const SwRect& rRect )
{
- sal_uInt16 nSz = Count();
+ sal_uInt16 nSz = size();
if( !nSz )
return;
SwRegionRects aReg( GetShell()->VisArea() );
- aReg.Remove( 0, aReg.Count() );
- aReg.Insert( this, 0 );
+ aReg.assign( begin(), end() );
aReg -= rRect;
- SwRects::Remove( 0, nSz );
- SwRects::Insert( &aReg, 0 );
+ SwRects::erase( begin(), begin() + nSz );
+ SwRects::insert( begin(), aReg.begin(), aReg.end() );
// If the selection is to the right or at the bottom, outside the
// visible area, it is never aligned on one pixel at the right/bottom.
// This has to be determined here and if that is the case the
// rectangle has to be expanded.
- if( GetShell()->bVisPortChgd && 0 != ( nSz = Count()) )
+ if( GetShell()->bVisPortChgd && 0 != ( nSz = size()) )
{
SwSelPaintRects::Get1PixelInLogic( *GetShell() );
- SwRect* pRect = (SwRect*)GetData();
- for( ; nSz--; ++pRect )
+ iterator it = begin();
+ for( ; nSz--; ++it )
{
- if( pRect->Right() == GetShell()->aOldRBPos.X() )
- pRect->Right( pRect->Right() + nPixPtX );
- if( pRect->Bottom() == GetShell()->aOldRBPos.Y() )
- pRect->Bottom( pRect->Bottom() + nPixPtY );
+ SwRect& rRectIt = *it;
+ if( rRectIt.Right() == GetShell()->aOldRBPos.X() )
+ rRectIt.Right( rRectIt.Right() + nPixPtX );
+ if( rRectIt.Bottom() == GetShell()->aOldRBPos.Y() )
+ rRectIt.Bottom( rRectIt.Bottom() + nPixPtY );
}
}
}
@@ -680,7 +673,7 @@ void SwShellTableCrsr::FillRects()
}
}
aReg.Invert();
- Insert( &aReg, 0 );
+ insert( begin(), aReg.begin(), aReg.end() );
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e9e7ab8..a04eaae 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -210,18 +210,18 @@ void lcl_ClearArea( const SwFrm &rFrm,
SwRegionRects aRegion( rPtArea, 4 );
aRegion -= rGrfArea;
- if ( aRegion.Count() )
+ if ( !aRegion.empty() )
{
const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
else
{
rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
rOut.SetLineColor();
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
rOut.DrawRect( aRegion[i].SVRect() );
rOut.Pop();
}
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 123f4cb..adeda9d 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -210,7 +210,7 @@ sal_Bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwCntntFrm *p
const SwFlyFrm *pSelfFly = pCnt->FindFlyFrm();
sal_uInt16 i;
- for ( i = 0; i < rObjs.Count() && aTmp.Count(); ++i )
+ for ( i = 0; i < rObjs.Count() && !aTmp.empty(); ++i )
{
SdrObject *pO = rObjs[i]->DrawObj();
if ( !pO->ISA(SwVirtFlyDrawObj) )
@@ -279,9 +279,8 @@ sal_Bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwCntntFrm *p
}
sal_Bool bRetPaint = sal_False;
- const SwRect *pData = aTmp.GetData();
- for ( i = 0; i < aTmp.Count(); ++pData, ++i )
- bRetPaint |= pImp->GetShell()->AddPaintRect( *pData );
+ for ( SwRects::const_iterator it = aTmp.begin(); it != aTmp.end(); ++it )
+ bRetPaint |= pImp->GetShell()->AddPaintRect( *it );
return bRetPaint;
}
@@ -1421,13 +1420,13 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
SwRegionRects aRegion( aOldRect );
aRegion -= aPaint;
- for ( i = 0; i < aRegion.Count(); ++i )
+ for ( i = 0; i < aRegion.size(); ++i )
pImp->GetShell()->AddPaintRect( aRegion[i] );
aRegion.ChangeOrigin( aPaint );
- aRegion.Remove( 0, aRegion.Count() );
- aRegion.Insert( aPaint, 0 );
+ aRegion.clear();
+ aRegion.push_back( aPaint );
aRegion -= aOldRect;
- for ( i = 0; i < aRegion.Count(); ++i )
+ for ( i = 0; i < aRegion.size(); ++i )
pImp->GetShell()->AddPaintRect( aRegion[i] );
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ba91302..e2995ab 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1494,7 +1494,7 @@ void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
if ( !pRetoucheFly )
pRetoucheFly = pRetoucheFly2;
- for ( sal_uInt16 j = 0; (j < rObjs.Count()) && rRegion.Count(); ++j )
+ for ( sal_uInt16 j = 0; (j < rObjs.Count()) && !rRegion.empty(); ++j )
{
const SwAnchoredObject* pAnchoredObj = rObjs[j];
const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
@@ -2104,7 +2104,7 @@ void DrawGraphic( const SvxBrushItem *pBrush,
else
bGrfBackgrdAlreadyDrawn = true;
/// loop rectangles of background region, which has to be drawn
- for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
pOutDev->DrawRect( aRegion[i].SVRect() );
}
@@ -4035,12 +4035,12 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
pOut->SetClipRegion( aPoly );
}
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
pOut->Pop();
}
else
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
}
@@ -4232,21 +4232,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Top( aOut.Top() + nHeight );
aOut.Left( aOut.Left() + nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Top ( aOut.Bottom() - nHeight );
aOut.Left( aOut.Left() + nWidth );
if ( bBottom )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Left( aOut.Right() - nWidth );
aOut.Top ( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
if ( bCnt && (!bTop || !bBottom) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Right ( rOutRect.Right() - nWidth );
@@ -4260,21 +4260,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Bottom( aOut.Bottom() - nHeight );
aOut.Right( aOut.Right() - nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Bottom( aOut.Top() + nHeight );
aOut.Right ( aOut.Right() - nWidth );
if ( bTop )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Right ( aOut.Left() + nWidth );
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
if ( bCnt && (!bBottom || !bTop) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
@@ -4288,21 +4288,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Bottom( aOut.Bottom() - nHeight);
aOut.Left( aOut.Left() + nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Bottom( aOut.Top() + nHeight );
aOut.Left ( aOut.Left()+ nWidth );
if ( bTop )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Left ( aOut.Right() - nWidth );
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
if ( bCnt && (!bBottom || bTop) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Right( rOutRect.Right() - nWidth );
@@ -4316,21 +4316,21 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
/// OD 06.08.2002 #99657# - draw full shadow rectangle
aOut.Top( aOut.Top() + nHeight );
aOut.Right( aOut.Right() - nWidth );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
else
{
aOut.Top ( aOut.Bottom()- nHeight );
aOut.Right( aOut.Right() - nWidth );
if ( bBottom )
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
aOut.Right( aOut.Left() + nWidth );
aOut.Top( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
if ( bCnt && (!bTop || !bBottom) )
::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
- aRegion.Insert( aOut, aRegion.Count() );
+ aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
@@ -4346,7 +4346,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
sal_uLong nOldDrawMode = pOut->GetDrawMode();
Color aShadowColor( rShadow.GetColor() );
- if( aRegion.Count() && pGlobalShell->GetWin() &&
+ if( !aRegion.empty() && pGlobalShell->GetWin() &&
Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{
// Is heigh contrast mode, the output device has already set the
@@ -4362,7 +4362,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
pOut->SetDrawMode( nOldDrawMode );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
SwRect &rOut = aRegion[i];
aOut = rOut;
@@ -4415,7 +4415,7 @@ void SwFrm::PaintBorderLine( const SwRect& rRect,
{
SwRegionRects aRegion( aOut, 4 );
::lcl_SubtractFlys( this, pPage, aOut, aRegion );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
pLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol );
}
else
@@ -5583,14 +5583,14 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this);
if ( pPage->GetSortedObjs() )
::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion );
- if ( aPgRegion.Count() )
+ if ( !aPgRegion.empty() )
{
OutputDevice *pOut = _pViewShell->GetOut();
if ( pOut->GetFillColor() != aGlobalRetoucheColor )
pOut->SetFillColor( aGlobalRetoucheColor );
- for ( sal_uInt16 i = 0; i < aPgRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aPgRegion.size(); ++i )
{
- if ( 1 < aPgRegion.Count() )
+ if ( 1 < aPgRegion.size() )
{
::SwAlignRect( aPgRegion[i], pGlobalShell );
if( !aPgRegion[i].HasArea() )
@@ -6142,9 +6142,9 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
/// --> Status Quo: background transparency have to be
/// considered for fly frames
const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
- if ( 1 < aRegion.Count() )
+ if ( 1 < aRegion.size() )
{
::SwAlignRect( aRegion[i], pGlobalShell );
if( !aRegion[i].HasArea() )
@@ -6898,7 +6898,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
// #i16816# tagged pdf support
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
SwRect &rRetouche = aRegion[i];
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index e32f8ac..3f7cc79 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2097,8 +2097,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
SwRect aTmp( pCell->Prt() );
aTmp.Pos() += pCell->Frm().Pos();
aRegion.ChangeOrigin( aTmp );
- aRegion.Remove( 0, aRegion.Count() );
- aRegion.Insert( aTmp, 0 );
+ aRegion.clear();
+ aRegion.push_back( aTmp);
}
else
{
@@ -2675,8 +2675,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
Sub( aRegion, aDropRect );
}
- rCrsr.Remove( 0, rCrsr.Count() );
- rCrsr.Insert( &aRegion, 0 );
+ rCrsr.assign( aRegion.begin(), aRegion.end() );
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index d9b3def..3d1e6d9 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1703,8 +1703,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Note: We make a copy of the rectangles, because they may
// be deleted again in JumpToSwMark.
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
// Create the destination for internal links:
sal_Int32 nDestId = -1;
@@ -1732,7 +1732,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles:
- const sal_uInt16 nNumOfRects = aTmp.Count();
+ const sal_uInt16 nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
{
// Link Rectangle
@@ -1865,8 +1865,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link Rectangles
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
mrSh.SwCrsrShell::ClearMark();
@@ -1890,7 +1890,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
// Create links for all selected rectangles:
- const sal_uInt16 nNumOfRects = aTmp.Count();
+ const sal_uInt16 nNumOfRects = aTmp.size();
for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
{
// Link rectangle
@@ -1954,8 +1954,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
// Link Rectangle
SwRects aTmp;
- aTmp.Insert( mrSh.SwCrsrShell::_GetCrsr(), 0 );
- OSL_ENSURE( aTmp.Count() > 0, "Enhanced pdf export - rectangles are missing" );
+ aTmp.insert( aTmp.begin(), mrSh.SwCrsrShell::_GetCrsr()->begin(), mrSh.SwCrsrShell::_GetCrsr()->end() );
+ OSL_ENSURE( !aTmp.empty(), "Enhanced pdf export - rectangles are missing" );
const SwRect aLinkRect( aTmp[ 0 ] );
mrSh._GetCrsr()->RestoreSavePos();
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index f8ed3b5..adbdff3 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -589,11 +589,11 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
rInf.SetPos( rOld );
return sal_False;
}
- else if( aRegion.Count() )
+ else if( !aRegion.empty() )
{
// What a huge effort ...
SwSaveClip aClipVout( rInf.GetpOut() );
- for( MSHORT i = 0; i < aRegion.Count(); ++i )
+ for( MSHORT i = 0; i < aRegion.size(); ++i )
{
SwRect &rRect = aRegion[i];
if( rRect != aRegion.GetOrigin() )
@@ -659,7 +659,7 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect,
}
}
- for( MSHORT i = 0; i < aRegion.Count(); ++i )
+ for( MSHORT i = 0; i < aRegion.size(); ++i )
{
if ( bNoGraphic )
pOut->DrawRect( aRegion[i].SVRect() );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 60b7bc3..fb9de45 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -294,10 +294,10 @@ void ViewShell::ImplEndAction( const sal_Bool bIdleEnd )
pRegion->Compress();
VirtualDevice *pVout = 0;
- while ( pRegion->Count() )
+ while ( !pRegion->empty() )
{
- SwRect aRect( (*pRegion)[ pRegion->Count() - 1 ] );
- pRegion->Remove( pRegion->Count() - 1 );
+ SwRect aRect( pRegion->back() );
+ pRegion->pop_back();
sal_Bool bPaint = sal_True;
if ( IsEndActionByVirDev() )
@@ -1501,18 +1501,18 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
}
pPage = pPage->GetNext();
}
- aRegion.Remove( 0, aRegion.Count() );
+ aRegion.clear();
if ( aLeft.HasArea() )
- aRegion.Insert( aLeft, 0 );
+ aRegion.push_back( aLeft );
if ( aRight.HasArea() )
- aRegion.Insert( aRight, 1 );
+ aRegion.push_back( aRight );
}
else
{
const SwFrm *pPage = Imp()->GetFirstVisPage();
const SwTwips nBottom = rRect.Bottom();
//const SwTwips nRight = rRect.Right();
- while ( pPage && aRegion.Count() &&
+ while ( pPage && !aRegion.empty() &&
(pPage->Frm().Top() <= nBottom) ) // PAGES01 && (pPage->Frm().Left() <= nRight))
{
SwRect aPageRect( pPage->Frm() );
@@ -1533,7 +1533,7 @@ void ViewShell::PaintDesktop( const SwRect &rRect )
pPage = pPage->GetNext();
}
}
- if ( aRegion.Count() )
+ if ( !aRegion.empty() )
_PaintDesktop( aRegion );
}
@@ -1545,7 +1545,7 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
GetOut()->SetLineColor();
- for ( sal_uInt16 i = 0; i < rRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rRegion.size(); ++i )
{
const Rectangle aRectangle(rRegion[i].SVRect());
@@ -1634,7 +1634,7 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
//Nur dann interessant, wenn sich im sichtbaren Bereich etwas
//veraendert hat.
sal_Bool bStop = sal_True;
- for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
{
const SwRect &rTmp = (*pRegion)[i];
if ( sal_False == (bStop = rTmp.IsOver( VisArea() )) )
@@ -1653,10 +1653,10 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
pRegion->Invert();
pRegion->Compress();
bRet = sal_False;
- if ( pRegion->Count() )
+ if ( !pRegion->empty() )
{
SwRegionRects aRegion( rRect );
- for ( sal_uInt16 i = 0; i < pRegion->Count(); ++i )
+ for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
{ const SwRect &rTmp = (*pRegion)[i];
if ( !rRect.IsInside( rTmp ) )
{
@@ -1669,7 +1669,7 @@ sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
}
if ( bRet )
{
- for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
GetWin()->Invalidate( aRegion[i].SVRect() );
if ( rRect != VisArea() )
commit 74fdac012e33d84f24080381103e63bb0466ade7
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 26 12:45:50 2012 +0200
fix previous STL conversion commit:
Change-Id: I05427b6753cb9eb13cf3d3e085aa22346eed4977
SwPamRanges::Insert needs to check for it != end() before comparing it.
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 6be3bcf..8ede603 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -52,53 +52,53 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
if( aRg.nEnd < aRg.nStart )
{ aRg.nStart = aRg.nEnd; aRg.nEnd = rIdx1.GetIndex(); }
- _SwPamRanges::iterator it = lower_bound( aRg );
+ _SwPamRanges::const_iterator it = lower_bound(aRg); //search Insert Position
sal_uInt16 nPos = it - begin();
- if( !empty() && (*it) == aRg) // suche Insert Position
+ if (!empty() && (it != end()) && (*it) == aRg)
{
- // ist der im Array stehende kleiner ??
- SwPamRange& rTmp = _SwPamRanges::operator[](nPos);
+ // is the one in the Array smaller?
+ SwPamRange const& rTmp = _SwPamRanges::operator[](nPos);
if( rTmp.nEnd < aRg.nEnd )
{
aRg.nEnd = rTmp.nEnd;
- erase( begin() + nPos ); // zusammenfassen
+ erase(begin() + nPos); // combine
}
else
- return; // ende, weil schon alle zusammengefasst waren
+ return; // done, because by precondition everything is combined
}
sal_Bool bEnde;
do {
bEnde = sal_True;
- // mit dem Vorgaenger zusammenfassen ??
+ // combine with predecessor?
if( nPos > 0 )
{
- SwPamRange& rTmp = _SwPamRanges::operator[](nPos-1);
+ SwPamRange const& rTmp = _SwPamRanges::operator[](nPos-1);
if( rTmp.nEnd == aRg.nStart
|| rTmp.nEnd+1 == aRg.nStart )
{
aRg.nStart = rTmp.nStart;
bEnde = sal_False;
- erase( begin() + --nPos ); // zusammenfassen
+ erase( begin() + --nPos ); // combine
}
- // SSelection im Bereich ??
+ // range contained in rTmp?
else if( rTmp.nStart <= aRg.nStart && aRg.nEnd <= rTmp.nEnd )
return;
}
- // mit dem Nachfolger zusammenfassen ??
+ // combine with successor?
if( nPos < size() )
{
- SwPamRange& rTmp = _SwPamRanges::operator[](nPos);
+ SwPamRange const& rTmp = _SwPamRanges::operator[](nPos);
if( rTmp.nStart == aRg.nEnd ||
rTmp.nStart == aRg.nEnd+1 )
{
aRg.nEnd = rTmp.nEnd;
bEnde = sal_False;
- erase( begin() + nPos ); // zusammenfassen
+ erase( begin() + nPos ); // combine
}
- // SSelection im Bereich ??
+ // range contained in rTmp?
else if( rTmp.nStart <= aRg.nStart && aRg.nEnd <= rTmp.nEnd )
return;
}
commit c10159f3ed4b474736711fc6f15b85454da2669f
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 16:19:24 2012 +0200
Convert SV_DECL_VARARR_SORT(_SwPamRanges) to o3tl::sorted_vector
Change-Id: I6f3fa6b4940ba17e21e9fc47bcdd61c9761ba477
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index 18c2106..915ed9f 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -30,7 +30,7 @@
#define _EDIMP_HXX
#include <tools/solar.h>
-#include <svl/svarray.hxx>
+#include <o3tl/sorted_vector.hxx>
class SwPaM;
class SwNodeIndex;
@@ -56,13 +56,13 @@ struct SwPamRange
SwPamRange() : nStart( 0 ), nEnd( 0 ) {}
SwPamRange( sal_uLong nS, sal_uLong nE ) : nStart( nS ), nEnd( nE ) {}
- sal_Bool operator==( const SwPamRange& rRg )
- { return nStart == rRg.nStart ? sal_True : sal_False; }
- sal_Bool operator<( const SwPamRange& rRg )
- { return nStart < rRg.nStart ? sal_True : sal_False; }
+ bool operator==( const SwPamRange& rRg ) const
+ { return nStart == rRg.nStart ? true : false; }
+ bool operator<( const SwPamRange& rRg ) const
+ { return nStart < rRg.nStart ? true : false; }
};
-SV_DECL_VARARR_SORT( _SwPamRanges, SwPamRange, 0 )
+class _SwPamRanges : public o3tl::sorted_vector<SwPamRange> {};
class SwPamRanges : private _SwPamRanges
{
@@ -73,7 +73,7 @@ public:
SwPaM& SetPam( sal_uInt16 nArrPos, SwPaM& rPam );
sal_uInt16 Count() const
- { return _SwPamRanges::Count(); }
+ { return _SwPamRanges::size(); }
SwPamRange operator[]( sal_uInt16 nPos ) const
{ return _SwPamRanges::operator[](nPos); }
};
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 36a74b0..6be3bcf 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -36,8 +36,6 @@
#include <swundo.hxx>
#include <numrule.hxx>
-SV_IMPL_VARARR_SORT( _SwPamRanges, SwPamRange )
-
SwPamRanges::SwPamRanges( const SwPaM& rRing )
{
@@ -54,15 +52,16 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
if( aRg.nEnd < aRg.nStart )
{ aRg.nStart = aRg.nEnd; aRg.nEnd = rIdx1.GetIndex(); }
- sal_uInt16 nPos = 0;
- const SwPamRange* pTmp;
- if( Count() && Seek_Entry( aRg, &nPos )) // suche Insert Position
+ _SwPamRanges::iterator it = lower_bound( aRg );
+ sal_uInt16 nPos = it - begin();
+ if( !empty() && (*it) == aRg) // suche Insert Position
{
// ist der im Array stehende kleiner ??
- if( ( pTmp = GetData()+ nPos )->nEnd < aRg.nEnd )
+ SwPamRange& rTmp = _SwPamRanges::operator[](nPos);
+ if( rTmp.nEnd < aRg.nEnd )
{
- aRg.nEnd = pTmp->nEnd;
- Remove( nPos, 1 ); // zusammenfassen
+ aRg.nEnd = rTmp.nEnd;
+ erase( begin() + nPos ); // zusammenfassen
}
else
return; // ende, weil schon alle zusammengefasst waren
@@ -75,35 +74,37 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
// mit dem Vorgaenger zusammenfassen ??
if( nPos > 0 )
{
- if( ( pTmp = GetData()+( nPos-1 ))->nEnd == aRg.nStart
- || pTmp->nEnd+1 == aRg.nStart )
+ SwPamRange& rTmp = _SwPamRanges::operator[](nPos-1);
+ if( rTmp.nEnd == aRg.nStart
+ || rTmp.nEnd+1 == aRg.nStart )
{
- aRg.nStart = pTmp->nStart;
+ aRg.nStart = rTmp.nStart;
bEnde = sal_False;
- Remove( --nPos, 1 ); // zusammenfassen
+ erase( begin() + --nPos ); // zusammenfassen
}
// SSelection im Bereich ??
- else if( pTmp->nStart <= aRg.nStart && aRg.nEnd <= pTmp->nEnd )
+ else if( rTmp.nStart <= aRg.nStart && aRg.nEnd <= rTmp.nEnd )
return;
}
// mit dem Nachfolger zusammenfassen ??
- if( nPos < Count() )
+ if( nPos < size() )
{
- if( ( pTmp = GetData() + nPos )->nStart == aRg.nEnd ||
- pTmp->nStart == aRg.nEnd+1 )
+ SwPamRange& rTmp = _SwPamRanges::operator[](nPos);
+ if( rTmp.nStart == aRg.nEnd ||
+ rTmp.nStart == aRg.nEnd+1 )
{
- aRg.nEnd = pTmp->nEnd;
+ aRg.nEnd = rTmp.nEnd;
bEnde = sal_False;
- Remove( nPos, 1 ); // zusammenfassen
+ erase( begin() + nPos ); // zusammenfassen
}
// SSelection im Bereich ??
- else if( pTmp->nStart <= aRg.nStart && aRg.nEnd <= pTmp->nEnd )
+ else if( rTmp.nStart <= aRg.nStart && aRg.nEnd <= rTmp.nEnd )
return;
}
} while( !bEnde );
- _SwPamRanges::Insert( aRg );
+ _SwPamRanges::insert( aRg );
}
@@ -111,7 +112,7 @@ void SwPamRanges::Insert( const SwNodeIndex& rIdx1, const SwNodeIndex& rIdx2 )
SwPaM& SwPamRanges::SetPam( sal_uInt16 nArrPos, SwPaM& rPam )
{
OSL_ASSERT( nArrPos < Count() );
- const SwPamRange& rTmp = *(GetData() + nArrPos );
+ const SwPamRange& rTmp = (*this)[ nArrPos ];
rPam.GetPoint()->nNode = rTmp.nStart;
rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), 0 );
rPam.SetMark();
commit 6376dd83fb436f73cb891bc11b502014e66a74da
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 15:51:39 2012 +0200
Convert SV_DECL_VARARR_VISIBILITY(SrchAttrItemList) to std::vector
Change-Id: Ib6d6bb62613004ba0a8ee603f7047fb017570e89
diff --git a/svx/inc/svx/srchdlg.hxx b/svx/inc/svx/srchdlg.hxx
index 7f0fa67..6d032e6 100644
--- a/svx/inc/svx/srchdlg.hxx
+++ b/svx/inc/svx/srchdlg.hxx
@@ -38,10 +38,10 @@
#include <vcl/dialog.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/basedlgs.hxx>
-#include <svl/svarray.hxx>
#include <svtools/svmedit.hxx>
#include <svl/srchdefs.hxx>
#include "svx/svxdllapi.h"
+#include <vector>
class SvxSearchItem;
class MoreButton;
@@ -63,7 +63,7 @@ struct SearchAttrItem
// class SearchAttrItemList ----------------------------------------------
-SV_DECL_VARARR_VISIBILITY(SrchAttrItemList, SearchAttrItem, 8, SVX_DLLPUBLIC)
+typedef std::vector<SearchAttrItem> SrchAttrItemList;
class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
{
@@ -75,15 +75,15 @@ public:
void Put( const SfxItemSet& rSet );
SfxItemSet& Get( SfxItemSet& rSet );
void Clear();
- sal_uInt16 Count() const { return SrchAttrItemList::Count(); }
- SearchAttrItem& operator[](sal_uInt16 nPos) const
+ sal_uInt16 Count() const { return SrchAttrItemList::size(); }
+ SearchAttrItem& operator[](sal_uInt16 nPos)
+ { return SrchAttrItemList::operator[]( nPos ); }
+ SearchAttrItem& GetObject( sal_uInt16 nPos )
{ return SrchAttrItemList::operator[]( nPos ); }
- SearchAttrItem& GetObject( sal_uInt16 nPos ) const
- { return SrchAttrItemList::GetObject( nPos ); }
- // the pointer to the item is not being copierd, so don't delete
+ // the pointer to the item is not being copied, so don't delete
void Insert( const SearchAttrItem& rItem )
- { SrchAttrItemList::Insert( rItem, SrchAttrItemList::Count() ); }
+ { SrchAttrItemList::push_back( rItem ); }
// deletes the pointer to the items
void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
};
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index eb7eb10..70af258 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -98,8 +98,6 @@ using namespace comphelper;
#define MODIFY_ALLTABLES 0x00004000
#define MODIFY_NOTES 0x00008000
-SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
-
#define GetCheckBoxValue( rBox ) \
rBox.IsEnabled() ? rBox.IsChecked() : sal_False
@@ -170,16 +168,11 @@ void StrArrToList_Impl( sal_uInt16 nId, const std::vector<rtl::OUString>& rStrLs
// class SearchAttrItemList ----------------------------------------------
SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) :
-
- SrchAttrItemList( (sal_uInt8)rList.Count() )
-
+ SrchAttrItemList(rList)
{
- SrchAttrItemList::Insert( &rList, 0 );
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
-
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- _pData->pItem = _pData->pItem->Clone();
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ (*this)[i].pItem = (*this)[i].pItem->Clone();
}
// -----------------------------------------------------------------------
@@ -230,13 +223,12 @@ void SearchAttrItemList::Put( const SfxItemSet& rSet )
SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
{
SfxItemPool* pPool = rSet.GetPool();
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( IsInvalidItem( _pData->pItem ) )
- rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) );
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( IsInvalidItem( (*this)[i].pItem ) )
+ rSet.InvalidateItem( pPool->GetWhich( (*this)[i].nSlot ) );
else
- rSet.Put( *_pData->pItem );
+ rSet.Put( *(*this)[i].pItem );
return rSet;
}
@@ -244,12 +236,10 @@ SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
void SearchAttrItemList::Clear()
{
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
-
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- delete _pData->pItem;
- SrchAttrItemList::Remove( 0, Count() );
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ delete (*this)[i].pItem;
+ SrchAttrItemList::clear();
}
// -----------------------------------------------------------------------
@@ -257,15 +247,14 @@ void SearchAttrItemList::Clear()
// Deletes the pointer to the items
void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen )
{
- if ( nPos + nLen > Count() )
- nLen = Count() - nPos;
- SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos;
+ if ( nPos + nLen > size() )
+ nLen = size() - nPos;
- for ( sal_uInt16 n = nLen; n; --n, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- delete _pData->pItem;
+ for ( sal_uInt16 i = nPos; i < nPos + nLen; ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ delete (*this)[i].pItem;
- SrchAttrItemList::Remove( nPos, nLen );
+ SrchAttrItemList::erase( begin() + nPos, begin() + nPos + nLen );
}
#undef INI_LIST
commit ed24564ce11683731b820c29d5a46e073ab7a2a7
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 15:22:31 2012 +0200
SV_DECL_VARARR_SORT(ScRTFColTwips) o3tl::sorted_vector
Change-Id: I6d048af2b32ad02952cfe91d155ca17f5067ecee
diff --git a/sc/source/filter/inc/rtfparse.hxx b/sc/source/filter/inc/rtfparse.hxx
index 3b43648..c381378 100644
--- a/sc/source/filter/inc/rtfparse.hxx
+++ b/sc/source/filter/inc/rtfparse.hxx
@@ -33,6 +33,7 @@
#ifdef SC_RTFPARSE_CXX
#include <boost/ptr_container/ptr_vector.hpp>
+#include <o3tl/sorted_vector.hxx>
struct ScRTFCellDefault
{
@@ -46,7 +47,7 @@ struct ScRTFCellDefault
};
// deswegen ULONG, typedef bringt's auch nicht :-(
-SV_DECL_VARARR_SORT( ScRTFColTwips, sal_uLong, 16 )
+class ScRTFColTwips : public o3tl::sorted_vector<sal_uLong> {};
#else // SC_RTFPARSE_CXX
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index 40e848f..511d905 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -46,9 +46,6 @@
-SV_IMPL_VARARR_SORT( ScRTFColTwips, sal_uLong );
-
-
ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
ScEEParser( pEditP ),
@@ -126,12 +123,13 @@ inline void ScRTFParser::NextRow()
sal_Bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol )
{
- sal_uInt16 nPos;
- sal_Bool bFound = pColTwips->Seek_Entry( nTwips, &nPos );
+ ScRTFColTwips::const_iterator it = pColTwips->find( nTwips );
+ sal_Bool bFound = it != pColTwips->end();
+ sal_uInt16 nPos = it - pColTwips->end();
*pCol = static_cast<SCCOL>(nPos);
if ( bFound )
return sal_True;
- sal_uInt16 nCount = pColTwips->Count();
+ sal_uInt16 nCount = pColTwips->size();
if ( !nCount )
return false;
SCCOL nCol = *pCol;
@@ -173,7 +171,7 @@ void ScRTFParser::ColAdjust()
nColMax = nCol;
}
nStartAdjust = (sal_uLong)~0;
- pColTwips->Remove( (sal_uInt16)0, pColTwips->Count() );
+ pColTwips->clear();
}
}
@@ -252,7 +250,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
const ScRTFCellDefault& rD = maDefaultList[i];
SCCOL nCol;
if ( !SeekTwips(rD.nTwips, &nCol) )
- pColTwips->Insert( rD.nTwips );
+ pColTwips->insert( rD.nTwips );
}
}
pDefMerge = NULL;
commit a236f8318a0e05caeec53ccbee8b134f44a98008
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 19 14:07:52 2012 +0200
Convert SV_DECL_PTRARR_SORT(_SwFtnIdxs) to o3tl::sorted_vector
Change-Id: I84c4cd5686ea0649ad9ca6c879d51bffe6d693c2
diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx
index 81174e1..0cc2efa 100644
--- a/sw/inc/ftnidx.hxx
+++ b/sw/inc/ftnidx.hxx
@@ -28,8 +28,9 @@
#ifndef _FTNIDX_HXX
#define _FTNIDX_HXX
-#include <svl/svarray.hxx>
#include <vector>
+#include <sal/types.h>
+#include <o3tl/sorted_vector.hxx>
class SwTxtFtn;
class SwNodeIndex;
@@ -41,10 +42,12 @@ class SwSectionNode;
#define _SwTxtFtn_GetIndex( pFIdx ) (pFIdx->GetTxtNode().GetIndex())
-typedef SwTxtFtn* SwTxtFtnPtr;
-SV_DECL_PTRARR_SORT( _SwFtnIdxs, SwTxtFtnPtr, 0 )
+struct CompareSwFtnIdxs
+{
+ bool operator()(SwTxtFtn* const& lhs, SwTxtFtn* const& rhs) const;
+};
-class SwFtnIdxs : public _SwFtnIdxs
+class SwFtnIdxs : public o3tl::sorted_vector<SwTxtFtn*>
{
public:
SwFtnIdxs() {}
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index 0baf7f2..c81fd6a 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -131,7 +131,7 @@ sal_Bool SwCursor::GotoFtnAnchor()
// search in all footnotes in document for this StartIndex
const SwTxtFtn* pTxtFtn;
const SwFtnIdxs& rFtnArr = pSttNd->GetDoc()->GetFtnIdxs();
- for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n )
if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
pSttNd == &pTxtFtn->GetStartNode()->GetNode() )
{
@@ -184,7 +184,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor()
if( rFtnArr.SeekEntry( GetPoint()->nNode, &nPos ))
{
// there is a footnote with this index, so search also for the next one
- if( nPos < rFtnArr.Count() )
+ if( nPos < rFtnArr.size() )
{
sal_uLong nNdPos = GetPoint()->nNode.GetIndex();
xub_StrLen nCntPos = GetPoint()->nContent.GetIndex();
@@ -194,7 +194,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor()
if( CmpLE( *pTxtFtn, nNdPos, nCntPos ) )
{
pTxtFtn = 0;
- for( ++nPos; nPos < rFtnArr.Count(); ++nPos )
+ for( ++nPos; nPos < rFtnArr.size(); ++nPos )
{
pTxtFtn = rFtnArr[ nPos ];
if( !CmpLE( *pTxtFtn, nNdPos, nCntPos ) )
@@ -218,7 +218,7 @@ sal_Bool SwCursor::GotoNextFtnAnchor()
}
}
}
- else if( nPos < rFtnArr.Count() )
+ else if( nPos < rFtnArr.size() )
pTxtFtn = rFtnArr[ nPos ];
sal_Bool bRet = 0 != pTxtFtn;
@@ -250,7 +250,7 @@ sal_Bool SwCursor::GotoPrevFtnAnchor()
// search forwards
if( CmpL( *pTxtFtn, nNdPos, nCntPos ))
{
- for( ++nPos; nPos < rFtnArr.Count(); ++nPos )
+ for( ++nPos; nPos < rFtnArr.size(); ++nPos )
{
pTxtFtn = rFtnArr[ nPos ];
if( !CmpL( *pTxtFtn, nNdPos, nCntPos ) )
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 737f92b..62691a1 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -323,7 +323,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
// If the numbering scheme has changed we could have QuoVadis/ErgoSum texts
// that refer to a changed page, so we invalidate foot notes.
SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
- for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
{
SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index f1dedb3..d33c9dc 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -368,7 +368,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
rSttNd.GetIndex() >= rNds.GetEndOfAutotext().GetIndex();
const bool bSaveFtn = !bDelFtn &&
rInsPos.GetIndex() >= rNds.GetEndOfExtras().GetIndex();
- if( rFtnArr.Count() )
+ if( !rFtnArr.empty() )
{
sal_uInt16 nPos;
@@ -377,7 +377,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
const SwNode* pFtnNd;
// Delete/save all that come after it
- while( nPos < rFtnArr.Count() && ( pFtnNd =
+ while( nPos < rFtnArr.size() && ( pFtnNd =
&( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex()
<= rEndNd.GetIndex() )
{
@@ -403,9 +403,9 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
else
{
pSrch->DelFrms(0);
- rFtnArr.Remove( nPos );
+ rFtnArr.erase( rFtnArr.begin() + nPos );
if( bSaveFtn )
- rSaveArr.Insert( pSrch );
+ rSaveArr.insert( pSrch );
}
bUpdateFtn = sal_True;
}
@@ -431,9 +431,9 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
else
{
pSrch->DelFrms(0);
- rFtnArr.Remove( nPos );
+ rFtnArr.erase( rFtnArr.begin() + nPos );
if( bSaveFtn )
- rSaveArr.Insert( pSrch );
+ rSaveArr.insert( pSrch );
}
bUpdateFtn = sal_True;
}
@@ -461,7 +461,7 @@ bool lcl_SaveFtn( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd,
SwTxtAttr *pAttr = pHints->GetTextHint( i );
if ( pAttr->Which() == RES_TXTATR_FTN )
{
- rSaveArr.Insert( static_cast<SwTxtFtn*>(pAttr) );
+ rSaveArr.insert( static_cast<SwTxtFtn*>(pAttr) );
}
}
}
@@ -1089,10 +1089,10 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
if( bUpdateFtn )
{
- if( aTmpFntIdx.Count() )
+ if( !aTmpFntIdx.empty() )
{
- GetFtnIdxs().Insert( &aTmpFntIdx );
- aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() );
+ GetFtnIdxs().insert( aTmpFntIdx );
+ aTmpFntIdx.clear();
}
GetFtnIdxs().UpdateAllFtn();
@@ -1222,10 +1222,10 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
if( bUpdateFtn )
{
- if( aTmpFntIdx.Count() )
+ if( !aTmpFntIdx.empty() )
{
- GetFtnIdxs().Insert( &aTmpFntIdx );
- aTmpFntIdx.Remove( sal_uInt16( 0 ), aTmpFntIdx.Count() );
+ GetFtnIdxs().insert( aTmpFntIdx );
+ aTmpFntIdx.clear();
}
GetFtnIdxs().UpdateAllFtn();
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 4ed6145..353ddee 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -206,7 +206,7 @@ void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
else
pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
- for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
{
SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
@@ -307,7 +307,7 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
// For messages regarding ErgoSum etc. we save the extra code and use the
// available methods.
SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
- for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
{
SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
@@ -377,7 +377,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
// For messages regarding ErgoSum etc. we save the extra code and use the
// available methods.
SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
- for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < rFtnIdxs.size(); ++nPos )
{
SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
@@ -432,7 +432,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
sal_Bool bChg = sal_False;
sal_Bool bTypeChgd = sal_False;
sal_uInt16 n = nPos; // save
- while( nPos < rFtnArr.Count() &&
+ while( nPos < rFtnArr.size() &&
(( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
< nEndNd || ( nIdx == nEndNd &&
nEndCnt >= *pTxtFtn->GetStart() )) )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index d6193e2..5f6e55f 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -2125,7 +2125,7 @@ void SwDoc::SetAllUniqueFlyNames()
}
aArr.clear();
- if( GetFtnIdxs().Count() )
+ if( !GetFtnIdxs().empty() )
{
SwTxtFtn::SetUniqueSeqRefNo( *this );
// #i52775# Chapter footnotes did not get updated correctly.
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 7a2e261..f4d4128 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -562,7 +562,7 @@ SwDoc::~SwDoc()
SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
rUndoNodes.pOutlineNds->clear();
- pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() );
+ pFtnIdxs->clear();
// indices could be registered in attributes
m_pUndoManager->DelAllUndoObj();
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 70a5fad..c3c5ad9 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -146,7 +146,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
UpdateNumRule();
// update if we have foot notes && chapter-wise numbering
- if( GetFtnIdxs().Count() && FTNNUM_CHAPTER == GetFtnInfo().eNum )
+ if( !GetFtnIdxs().empty() && FTNNUM_CHAPTER == GetFtnInfo().eNum )
GetFtnIdxs().UpdateAllFtn();
UpdateExpFlds(NULL, true);
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index 4ad477b..c47a4f9 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -38,48 +38,17 @@
#include <rootfrm.hxx>
-_SV_IMPL_SORTAR_ALG( _SwFtnIdxs, SwTxtFtnPtr )
-sal_Bool _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, sal_uInt16* pFndPos ) const
-{
- sal_uLong nIdx = _SwTxtFtn_GetIndex( rSrch );
- xub_StrLen nCntIdx = *rSrch->GetStart();
- sal_uInt16 nO = Count(), nM, nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- sal_uLong nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] );
- if( nFndIdx == nIdx && *(*this)[ nM ]->GetStart() == nCntIdx )
- {
- if( pFndPos )
- *pFndPos = nM;
- return sal_True;
- }
- else if( nFndIdx < nIdx ||
- (nFndIdx == nIdx && *(*this)[ nM ]->GetStart() < nCntIdx ))
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pFndPos )
- *pFndPos = nU;
- return sal_False;
- }
- else
- nO = nM - 1;
- }
- }
- if( pFndPos )
- *pFndPos = nU;
- return sal_False;
+bool CompareSwFtnIdxs::operator()(SwTxtFtn* const& lhs, SwTxtFtn* const& rhs) const
+{
+ sal_uLong nIdxLHS = _SwTxtFtn_GetIndex( lhs );
+ sal_uLong nIdxRHS = _SwTxtFtn_GetIndex( rhs );
+ return ( nIdxLHS == nIdxRHS && lhs->GetStart() < rhs->GetStart() ) || nIdxLHS < nIdxRHS;
}
-
void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
{
- if( !Count() )
+ if( empty() )
return;
// Get the NodesArray using the first foot note's StartIndex
@@ -129,13 +98,13 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
++nPos;
}
- if( nPos == Count() ) // nothing found
+ if( nPos == size() ) // nothing found
return;
if( rOutlNds.empty() )
nFtnNo = nPos+1;
- for( ; nPos < Count(); ++nPos )
+ for( ; nPos < size(); ++nPos )
{
pTxtFtn = (*this)[ nPos ];
if( pTxtFtn->GetTxtNode().GetIndex() >= nCapEnd )
@@ -156,7 +125,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
sal_uInt16 nPos, nFtnNo = 1, nEndNo = 1;
sal_uLong nUpdNdIdx = rStt.GetIndex();
- for( nPos = 0; nPos < Count(); ++nPos )
+ for( nPos = 0; nPos < size(); ++nPos )
{
pTxtFtn = (*this)[ nPos ];
if( nUpdNdIdx <= pTxtFtn->GetTxtNode().GetIndex() )
@@ -176,7 +145,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
}
// Set the array number for all footnotes starting from nPos
- for( ; nPos < Count(); ++nPos )
+ for( ; nPos < size(); ++nPos )
{
pTxtFtn = (*this)[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
@@ -199,7 +168,7 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
void SwFtnIdxs::UpdateAllFtn()
{
- if( !Count() )
+ if( empty() )
return;
// Get the NodesArray via the StartIndex of the first Footnote
@@ -224,7 +193,7 @@ void SwFtnIdxs::UpdateAllFtn()
if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei
{
sal_uLong nCapStt = rOutlNds[ n ]->GetIndex(); // Start of a new chapter
- for( ; nFtnIdx < Count(); ++nFtnIdx )
+ for( ; nFtnIdx < size(); ++nFtnIdx )
{
pTxtFtn = (*this)[ nFtnIdx ];
if( pTxtFtn->GetTxtNode().GetIndex() >= nCapStt )
@@ -237,13 +206,13 @@ void SwFtnIdxs::UpdateAllFtn()
pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++,
&rFtn.GetNumStr() );
}
- if( nFtnIdx >= Count() )
+ if( nFtnIdx >= size() )
break; // ok, everything is updated
nNo = 1;
}
}
- for( nNo = 1; nFtnIdx < Count(); ++nFtnIdx )
+ for( nNo = 1; nFtnIdx < size(); ++nFtnIdx )
{
// Endnotes are per-document
pTxtFtn = (*this)[ nFtnIdx ];
@@ -259,7 +228,7 @@ void SwFtnIdxs::UpdateAllFtn()
// We use sal_Bool here, so that we also iterate through the Endnotes with a chapter setting.
const sal_Bool bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum;
sal_uInt16 nFtnNo = 0, nEndNo = 0;
- for( sal_uInt16 nPos = 0; nPos < Count(); ++nPos )
+ for( sal_uInt16 nPos = 0; nPos < size(); ++nPos )
{
pTxtFtn = (*this)[ nPos ];
const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
@@ -286,7 +255,7 @@ SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, sal_uInt16* pFndPos ) c
{
sal_uLong nIdx = rPos.GetIndex();
- sal_uInt16 nO = Count(), nM, nU = 0;
+ sal_uInt16 nO = size(), nM, nU = 0;
if( nO > 0 )
{
nO--;
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 4f5e709..7f0be84 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -354,7 +354,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
}
sal_Bool bUpdateFtn = sal_False;
- if( GetFtnIdxs().Count() && pAttr )
+ if( GetFtnIdxs().size() && pAttr )
{
sal_uInt16 nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get(
RES_FTN_AT_TXTEND )).GetValue();
@@ -769,14 +769,14 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
void lcl_DeleteFtn( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd )
{
SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs();
- if( rFtnArr.Count() )
+ if( rFtnArr.size() )
{
sal_uInt16 nPos;
rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
SwTxtFtn* pSrch;
// loesche erstmal alle, die dahinter stehen
- while( nPos < rFtnArr.Count() &&
+ while( nPos < rFtnArr.size() &&
_SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) <= nEnd )
{
// Werden die Nodes nicht geloescht mussen sie bei den Seiten
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 3f4f5aa..93a0aed 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -684,7 +684,7 @@ const SwPageDesc* SwNode::FindPageDesc( sal_Bool bCalcLay,
// der Anker kann nur im Bodytext sein
const SwTxtFtn* pTxtFtn;
const SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs();
- for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n )
if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
(SwNode*)pSttNd ==
&pTxtFtn->GetStartNode()->GetNode() )
@@ -1806,7 +1806,7 @@ sal_Bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
const SwTxtFtn* pTxtFtn;
const SwNode* pSrchNd = pSttNd;
- for( sal_uInt16 n = 0; n < rFtnArr.Count(); ++n )
+ for( sal_uInt16 n = 0; n < rFtnArr.size(); ++n )
if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
pSrchNd == &pTxtFtn->GetStartNode()->GetNode() )
{
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 8d78f07..b1dcfe2 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -325,7 +325,7 @@ bool SwEditShell::SetCurFtn( const SwFmtFtn& rFillFtn )
bool SwEditShell::HasFtns( bool bEndNotes ) const
{
const SwFtnIdxs &rIdxs = pDoc->GetFtnIdxs();
- for ( sal_uInt16 i = 0; i < rIdxs.Count(); ++i )
+ for ( sal_uInt16 i = 0; i < rIdxs.size(); ++i )
{
const SwFmtFtn &rFtn = rIdxs[i]->GetFtn();
if ( bEndNotes == rFtn.IsEndNote() )
@@ -340,7 +340,7 @@ sal_uInt16 SwEditShell::GetSeqFtnList( SwSeqFldList& rList, bool bEndNotes )
{
rList.Clear();
- sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+ sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().size();
SwTxtFtn* pTxtFtn;
for( n = 0; n < nFtnCnt; ++n )
{
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 420a445..5b8094f 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -389,7 +389,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
case REF_FOOTNOTE:
case REF_ENDNOTE:
// die Nummer oder den NumString besorgen
- for( unsigned i = 0; i < pDoc->GetFtnIdxs().Count(); ++i )
+ for( unsigned i = 0; i < pDoc->GetFtnIdxs().size(); ++i )
{
SwTxtFtn* const pFtnIdx = pDoc->GetFtnIdxs()[i];
if( nSeqNo == pFtnIdx->GetSeqRefNo() )
@@ -912,7 +912,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark,
case REF_FOOTNOTE:
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list