[Libreoffice-commits] .: 3 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Dec 9 15:52:01 PST 2010
sc/inc/rangelst.hxx | 36 +-
sc/source/core/data/clipparam.cxx | 35 +-
sc/source/core/data/conditio.cxx | 6
sc/source/core/data/documen3.cxx | 17 -
sc/source/core/data/documen5.cxx | 8
sc/source/core/data/document.cxx | 53 +--
sc/source/core/data/drwlayer.cxx | 10
sc/source/core/data/markdata.cxx | 17 -
sc/source/core/data/table2.cxx | 27 -
sc/source/core/data/table6.cxx | 18 -
sc/source/core/tool/chartarr.cxx | 6
sc/source/core/tool/charthelper.cxx | 13
sc/source/core/tool/chartpos.cxx | 51 +--
sc/source/core/tool/rangelst.cxx | 161 +++++------
sc/source/core/tool/rangeutl.cxx | 11
sc/source/core/tool/reftokenhelper.cxx | 6
sc/source/filter/excel/excform.cxx | 2
sc/source/filter/excel/excform8.cxx | 2
sc/source/filter/excel/xecontent.cxx | 16 -
sc/source/filter/excel/xeformula.cxx | 6
sc/source/filter/excel/xehelper.cxx | 14 -
sc/source/filter/excel/xename.cxx | 8
sc/source/filter/excel/xicontent.cxx | 23 +
sc/source/filter/excel/xiescher.cxx | 10
sc/source/filter/excel/xiformula.cxx | 2
sc/source/filter/excel/xihelper.cxx | 2
sc/source/filter/excel/xistyle.cxx | 18 -
sc/source/filter/html/htmlpars.cxx | 16 -
sc/source/filter/xcl97/xcl97rec.cxx | 4
sc/source/filter/xml/XMLStylesImportHelper.cxx | 58 ----
sc/source/filter/xml/XMLStylesImportHelper.hxx | 6
sc/source/filter/xml/xmlsceni.cxx | 4
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 22 -
sc/source/ui/app/inputwin.cxx | 20 -
sc/source/ui/app/rfindlst.cxx | 2
sc/source/ui/docshell/docfunc.cxx | 7
sc/source/ui/docshell/docsh3.cxx | 5
sc/source/ui/docshell/docsh4.cxx | 4
sc/source/ui/docshell/externalrefmgr.cxx | 2
sc/source/ui/docshell/tablink.cxx | 6
sc/source/ui/drawfunc/fuins2.cxx | 13
sc/source/ui/inc/rfindlst.hxx | 6
sc/source/ui/miscdlgs/acredlin.cxx | 77 ++---
sc/source/ui/miscdlgs/anyrefdg.cxx | 28 --
sc/source/ui/miscdlgs/highred.cxx | 5
sc/source/ui/miscdlgs/optsolver.cxx | 6
sc/source/ui/undo/undoblk.cxx | 39 +-
sc/source/ui/unoobj/cellsuno.cxx | 261 +++++++++----------
sc/source/ui/unoobj/chart2uno.cxx | 170 ------------
sc/source/ui/unoobj/chartuno.cxx | 12
sc/source/ui/unoobj/cursuno.cxx | 54 +--
sc/source/ui/unoobj/docuno.cxx | 22 -
sc/source/ui/unoobj/funcuno.cxx | 6
sc/source/ui/unoobj/viewuno.cxx | 19 -
sc/source/ui/vba/vbaapplication.cxx | 6
sc/source/ui/vba/vbaeventshelper.cxx | 4
sc/source/ui/vba/vbahyperlinks.cxx | 8
sc/source/ui/vba/vbapagesetup.cxx | 6
sc/source/ui/vba/vbarange.cxx | 65 ++--
sc/source/ui/view/cellsh.cxx | 25 -
sc/source/ui/view/dbfunc3.cxx | 6
sc/source/ui/view/gridwin.cxx | 9
sc/source/ui/view/gridwin4.cxx | 19 -
sc/source/ui/view/hdrcont.cxx | 6
sc/source/ui/view/tabview3.cxx | 19 -
sc/source/ui/view/viewfun2.cxx | 16 -
sc/source/ui/view/viewfun3.cxx | 9
sc/source/ui/view/viewfun4.cxx | 6
sc/source/ui/view/viewfun6.cxx | 17 -
sc/source/ui/view/viewfunc.cxx | 6
70 files changed, 701 insertions(+), 978 deletions(-)
New commits:
commit 1e02a4be11be862e952c423ee6cf356b8330c824
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Dec 9 18:51:33 2010 -0500
Suppressed compiler warnings.
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 8cd8acf..774377b 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4460,7 +4460,7 @@ void SAL_CALL ScCellRangesObj::insertByName( const rtl::OUString& aName, const u
}
BOOL lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
- const String& rName, ULONG& rIndex )
+ const String& rName, size_t& rIndex )
{
if (pDocSh)
{
@@ -4541,7 +4541,7 @@ void SAL_CALL ScCellRangesObj::removeByName( const rtl::OUString& aName )
String aNameStr(aName);
ScDocShell* pDocSh = GetDocShell();
const ScRangeList& rRanges = GetRangeList();
- ULONG nIndex = 0;
+ size_t nIndex = 0;
if ( lcl_FindRangeByName( rRanges, pDocSh, aNameStr, nIndex ) )
{
// einzelnen Range weglassen
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index eaaf34e..4e18ca4 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -173,7 +173,7 @@ void ScViewFunc::MarkAndJumpToRanges(const ScRangeList& rRanges)
size_t ListSize = aRanges.size();
for ( size_t i = 0; i < ListSize; ++i )
{
- ScRangePtr p = aRanges.at( i );
+ p = aRanges.at( i );
// Collect only those ranges that are on the same sheet as the current
// cursor.
if (p->aStart.Tab() == aCurPos.Tab())
commit 3d0d8fb2d8e31a5acd427c8dbc70854d0f938d6b
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Dec 9 18:50:56 2010 -0500
Delete its objects before removing pointers.
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 12962a4..19b3639 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -48,6 +48,9 @@
ScRangeList::~ScRangeList()
{
+ std::vector<ScRangePtr>::iterator itr = begin(), itrEnd = end();
+ for (; itr != itrEnd; ++itr)
+ delete *itr;
clear();
}
@@ -148,7 +151,7 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
}
bool bJoinedInput = false;
- for ( size_t i = 0, nRanges = size(); i < nRanges; ++i )
+ for ( size_t i = 0, nRanges = size(); i < nRanges && pOver; ++i )
{
ScRangePtr p = at( i );
if ( p == pOver )
@@ -203,6 +206,7 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
if ( bIsInList )
{ // innerhalb der Liste Range loeschen
erase( begin() + nOldPos );
+ delete pOver;
pOver = NULL;
if ( nOldPos )
nOldPos--; // Seek richtig aufsetzen
commit 7a37b8be2239133a2a5df51285db93f22ed81c99
Author: Joseph Powers <jpowers27 at cox.net>
Date: Wed Dec 8 22:38:24 2010 -0800
Remove another DECLARE_LIST() from Calc
Signed-off-by: Kohei Yoshida <kyoshida at novell.com>
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 912f9af..6f71f1b 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -32,45 +32,49 @@
#include "global.hxx"
#include "address.hxx"
#include <tools/solar.h>
+#include <vector>
class ScDocument;
typedef ScRange* ScRangePtr;
-DECLARE_LIST( ScRangeListBase, ScRangePtr )
+typedef ::std::vector< ScRangePtr > ScRangeListBase;
class SC_DLLPUBLIC ScRangeList : public ScRangeListBase, public SvRefBase
{
-private:
- using ScRangeListBase::operator==;
- using ScRangeListBase::operator!=;
-
public:
ScRangeList() {}
ScRangeList( const ScRangeList& rList );
virtual ~ScRangeList();
ScRangeList& operator=(const ScRangeList& rList);
- void RemoveAll();
void Append( const ScRange& rRange )
{
ScRangePtr pR = new ScRange( rRange );
- Insert( pR, LIST_APPEND );
+ push_back( pR );
}
+
USHORT Parse( const String&, ScDocument* = NULL,
USHORT nMask = SCA_VALID,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
sal_Unicode cDelimiter = 0 );
+
void Format( String&, USHORT nFlags = 0, ScDocument* = NULL,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
sal_Unicode cDelimiter = 0 ) const;
- void Join( const ScRange&, BOOL bIsInList = FALSE );
- BOOL UpdateReference( UpdateRefMode, ScDocument*,
- const ScRange& rWhere,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+
+ void Join( const ScRange&, bool bIsInList = false );
+
+ bool UpdateReference( UpdateRefMode, ScDocument*,
+ const ScRange& rWhere,
+ SCsCOL nDx,
+ SCsROW nDy,
+ SCsTAB nDz
+ );
+
ScRange* Find( const ScAddress& ) const;
- BOOL operator==( const ScRangeList& ) const;
- BOOL operator!=( const ScRangeList& r ) const;
- BOOL Intersects( const ScRange& ) const;
- BOOL In( const ScRange& ) const;
- ULONG GetCellCount() const;
+ bool operator==( const ScRangeList& ) const;
+ bool operator!=( const ScRangeList& r ) const;
+ bool Intersects( const ScRange& ) const;
+ bool In( const ScRange& ) const;
+ size_t GetCellCount() const;
};
SV_DECL_IMPL_REF( ScRangeList );
diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx
index aa080ef..967c10a 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -57,12 +57,12 @@ ScClipParam::ScClipParam(const ScClipParam& r) :
bool ScClipParam::isMultiRange() const
{
- return maRanges.Count() > 1;
+ return maRanges.size() > 1;
}
SCCOL ScClipParam::getPasteColSize()
{
- if (!maRanges.Count())
+ if (maRanges.empty())
return 0;
switch (meDirection)
@@ -70,14 +70,17 @@ SCCOL ScClipParam::getPasteColSize()
case ScClipParam::Column:
{
SCCOL nColSize = 0;
- for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
+ for ( size_t i = 0, nListSize = maRanges.size(); i < nListSize; ++i )
+ {
+ ScRangePtr p = maRanges[ i ];
nColSize += p->aEnd.Col() - p->aStart.Col() + 1;
+ }
return nColSize;
}
case ScClipParam::Row:
{
// We assume that all ranges have identical column size.
- const ScRange& rRange = *maRanges.First();
+ const ScRange& rRange = *maRanges.front();
return rRange.aEnd.Col() - rRange.aStart.Col() + 1;
}
case ScClipParam::Unspecified:
@@ -89,7 +92,7 @@ SCCOL ScClipParam::getPasteColSize()
SCROW ScClipParam::getPasteRowSize()
{
- if (!maRanges.Count())
+ if (maRanges.empty())
return 0;
switch (meDirection)
@@ -97,14 +100,17 @@ SCROW ScClipParam::getPasteRowSize()
case ScClipParam::Column:
{
// We assume that all ranges have identical row size.
- const ScRange& rRange = *maRanges.First();
+ const ScRange& rRange = *maRanges.front();
return rRange.aEnd.Row() - rRange.aStart.Row() + 1;
}
case ScClipParam::Row:
{
SCROW nRowSize = 0;
- for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
+ for ( size_t i = 0, nListSize = maRanges.size(); i < nListSize; ++i )
+ {
+ ScRangePtr p = maRanges[ i ];
nRowSize += p->aEnd.Row() - p->aStart.Row() + 1;
+ }
return nRowSize;
}
case ScClipParam::Unspecified:
@@ -118,9 +124,9 @@ ScRange ScClipParam::getWholeRange() const
{
ScRange aWhole;
bool bFirst = true;
- ScRangeList aRanges = maRanges;
- for (ScRange* p = aRanges.First(); p; p = aRanges.Next())
+ for ( size_t i = 0, n = maRanges.size(); i < n; ++i )
{
+ ScRange* p = maRanges[ i ];
if (bFirst)
{
aWhole = *p;
@@ -159,13 +165,15 @@ void ScClipParam::transpose()
}
ScRangeList aNewRanges;
- if (maRanges.Count())
+ if (!maRanges.empty())
{
- ScRange* p = maRanges.First();
+ ScRange* p = maRanges.front();
SCCOL nColOrigin = p->aStart.Col();
SCROW nRowOrigin = p->aStart.Row();
- for (; p; p = maRanges.Next())
+
+ for ( size_t i = 1, n = maRanges.size(); i < n; ++i )
{
+ p = maRanges[ i ];
SCCOL nColDelta = p->aStart.Col() - nColOrigin;
SCROW nRowDelta = p->aStart.Row() - nRowOrigin;
SCCOL nCol1 = 0;
@@ -176,8 +184,7 @@ void ScClipParam::transpose()
nCol2 += static_cast<SCCOL>(nRowDelta);
nRow1 += static_cast<SCROW>(nColDelta);
nRow2 += static_cast<SCROW>(nColDelta);
- ScRange aNew(nCol1, nRow1, p->aStart.Tab(), nCol2, nRow2, p->aStart.Tab());
- aNewRanges.Append(aNew);
+ aNewRanges.push_back( new ScRange(nCol1, nRow1, p->aStart.Tab(), nCol2, nRow2, p->aStart.Tab() ) );
}
}
maRanges = aNewRanges;
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 8bf17e1..2a7f8f1 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1356,7 +1356,6 @@ BOOL lcl_CutRange( ScRange& rRange, const ScRange& rOther )
void ScConditionalFormat::DoRepaint( const ScRange* pModified )
{
- USHORT i;
SfxObjectShell* pSh = pDoc->GetDocumentShell();
if (pSh)
{
@@ -1371,10 +1370,9 @@ void ScConditionalFormat::DoRepaint( const ScRange* pModified )
pAreas = new ScRangeList;
pDoc->FindConditionalFormat( nKey, *pAreas );
}
- USHORT nCount = (USHORT) pAreas->Count();
- for (i=0; i<nCount; i++)
+ for (size_t i = 0, nCount = pAreas->size(); i < nCount; i++ )
{
- ScRange aRange = *pAreas->GetObject(i);
+ ScRange aRange = *pAreas->at( i );
BOOL bDo = TRUE;
if ( pModified )
{
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index d446e4f..8b8a1b0 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -652,7 +652,6 @@ void ScDocument::CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, BOOL bNewScenario
// und aktuelle Werte in bisher aktive Szenarios zurueckschreiben
ScRangeList aRanges = *pTab[nSrcTab]->GetScenarioRanges();
- const ULONG nRangeCount = aRanges.Count();
// nDestTab ist die Zieltabelle
for ( SCTAB nTab = nDestTab+1;
@@ -662,9 +661,9 @@ void ScDocument::CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, BOOL bNewScenario
if ( pTab[nTab]->IsActiveScenario() ) // auch wenn's dasselbe Szenario ist
{
BOOL bTouched = FALSE;
- for ( ULONG nR=0; nR<nRangeCount && !bTouched; nR++)
+ for ( size_t nR=0, nRangeCount = aRanges.size(); nR < nRangeCount && !bTouched; nR++ )
{
- const ScRange* pRange = aRanges.GetObject(nR);
+ const ScRange* pRange = aRanges[ nR ];
if ( pTab[nTab]->HasScenarioRange( *pRange ) )
bTouched = TRUE;
}
@@ -704,10 +703,6 @@ void ScDocument::MarkScenario( SCTAB nSrcTab, SCTAB nDestTab, ScMarkData& rDestM
BOOL ScDocument::HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const
{
return ValidTab(nTab) && pTab[nTab] && pTab[nTab]->HasScenarioRange( rRange );
- //if (ValidTab(nTab) && pTab[nTab])
- // return pTab[nTab]->HasScenarioRange( rRange );
-
- //return FALSE;
}
const ScRangeList* ScDocument::GetScenarioRanges( SCTAB nTab ) const
@@ -721,10 +716,6 @@ const ScRangeList* ScDocument::GetScenarioRanges( SCTAB nTab ) const
BOOL ScDocument::IsActiveScenario( SCTAB nTab ) const
{
return ValidTab(nTab) && pTab[nTab] && pTab[nTab]->IsActiveScenario( );
- //if (ValidTab(nTab) && pTab[nTab])
- // return pTab[nTab]->IsActiveScenario();
-
- //return FALSE;
}
void ScDocument::SetActiveScenario( SCTAB nTab, BOOL bActive )
@@ -948,8 +939,8 @@ void ScDocument::UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDo
ScRange aSource;
ScClipParam& rClipParam = GetClipParam();
- if (rClipParam.maRanges.Count())
- aSource = *rClipParam.maRanges.First();
+ if (!rClipParam.maRanges.empty())
+ aSource = *rClipParam.maRanges.front();
ScAddress aDest = rDestPos;
SCTAB nClipTab = 0;
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index c9884b5..a5ebc87 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -396,9 +396,8 @@ void ScDocument::UpdateChartArea( const String& rChartName,
aNewRanges = new ScRangeList;
aNewRanges->Parse( aRangesStr, this );
- ULONG nAddCount = rNewList->Count();
- for ( ULONG nAdd=0; nAdd<nAddCount; nAdd++ )
- aNewRanges->Append( *rNewList->GetObject(nAdd) );
+ for ( size_t nAdd = 0, nAddCount = rNewList->size(); nAdd < nAddCount; ++nAdd )
+ aNewRanges->Append( *rNewList->at( nAdd ) );
}
else
{
@@ -513,8 +512,9 @@ void ScDocument::UpdateChartRef( UpdateRefMode eUpdateRefMode,
ScRangeListRef aNewRLR( new ScRangeList );
BOOL bChanged = FALSE;
BOOL bDataChanged = FALSE;
- for ( ScRangePtr pR = aRLR->First(); pR; pR = aRLR->Next() )
+ for ( size_t i = 0, nListSize = aRLR->size(); i < nListSize; ++i )
{
+ ScRangePtr pR = aRLR->at( i );
SCCOL theCol1 = pR->aStart.Col();
SCROW theRow1 = pR->aStart.Row();
SCTAB theTab1 = pR->aStart.Tab();
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5b2a821..5407585 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -752,10 +752,9 @@ void ScDocument::LimitChartIfAll( ScRangeListRef& rRangeList )
ScRangeListRef aNew = new ScRangeList;
if (rRangeList.Is())
{
- ULONG nCount = rRangeList->Count();
- for (ULONG i=0; i<nCount; i++)
+ for ( size_t i = 0, nCount = rRangeList->size(); i < nCount; i++ )
{
- ScRange aRange(*rRangeList->GetObject( i ));
+ ScRange aRange( *rRangeList->at( i ) );
if ( ( aRange.aStart.Col() == 0 && aRange.aEnd.Col() == MAXCOL ) ||
( aRange.aStart.Row() == 0 && aRange.aEnd.Row() == MAXROW ) )
{
@@ -1680,7 +1679,7 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
ScClipParam& rClipParam = pClipDoc->GetClipParam();
pClipDoc->aDocName = aDocName;
- rClipParam.maRanges.RemoveAll();
+ rClipParam.maRanges.clear();
rClipParam.maRanges.Append(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0));
pClipDoc->ResetClip( this, nTab );
@@ -1908,9 +1907,9 @@ void ScDocument::UpdateRangeNamesInFormulas(
rRangeNames.mpRangeNames[i]->ReplaceRangeNamesInUse(rRangeNames.maRangeMap);
}
// then update the formulas, they might need just the updated range names
- for (ULONG nRange = 0; nRange < rDestRanges.Count(); ++nRange)
+ for ( size_t nRange = 0, n = rDestRanges.size(); nRange < n; ++nRange )
{
- const ScRange* pRange = rDestRanges.GetObject( nRange);
+ const ScRange* pRange = rDestRanges.at( nRange);
SCCOL nCol1 = pRange->aStart.Col();
SCROW nRow1 = pRange->aStart.Row();
SCCOL nCol2 = pRange->aEnd.Col();
@@ -2097,8 +2096,8 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
SCROW nSourceRow = rClipStartRow;
SCROW nSourceEnd = 0;
- if (pCBFCP->pClipDoc->GetClipParam().maRanges.Count())
- nSourceEnd = pCBFCP->pClipDoc->GetClipParam().maRanges.First()->aEnd.Row();
+ if ( !pCBFCP->pClipDoc->GetClipParam().maRanges.empty() )
+ nSourceEnd = pCBFCP->pClipDoc->GetClipParam().maRanges.front()->aEnd.Row();
SCROW nDestRow = nRow1;
while ( nSourceRow <= nSourceEnd && nDestRow <= nRow2 )
@@ -2241,9 +2240,9 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
SCROW nClipStartRow = aClipRange.aStart.Row();
// WaE: commented because unused: SCCOL nClipEndCol = pClipDoc->aClipRange.aEnd.Col();
SCROW nClipEndRow = aClipRange.aEnd.Row();
- for (ULONG nRange = 0; nRange < pDestRanges->Count(); ++nRange)
+ for ( size_t nRange = 0; nRange < pDestRanges->size(); ++nRange )
{
- const ScRange* pRange = pDestRanges->GetObject( nRange);
+ const ScRange* pRange = pDestRanges->at( nRange);
SCCOL nCol1 = pRange->aStart.Col();
SCROW nRow1 = pRange->aStart.Row();
SCCOL nCol2 = pRange->aEnd.Col();
@@ -2390,8 +2389,9 @@ void ScDocument::CopyMultiRangeFromClip(
sal_uInt16 nDelFlag = IDF_CONTENTS;
const ScBitMaskCompressedArray<SCROW, BYTE>& rFlags = GetRowFlagsArray(aCBFCP.nTabStart);
- for (ScRange* p = rClipParam.maRanges.First(); p; p = rClipParam.maRanges.Next())
+ for ( size_t i = 0, n = rClipParam.maRanges.size(); i < n; ++i )
{
+ ScRangePtr p = rClipParam.maRanges[ i ];
// The begin row must not be filtered.
SCROW nRowCount = p->aEnd.Row() - p->aStart.Row() + 1;
@@ -2467,7 +2467,7 @@ void ScDocument::SetClipArea( const ScRange& rArea, BOOL bCut )
if (bIsClip)
{
ScClipParam& rClipParam = GetClipParam();
- rClipParam.maRanges.RemoveAll();
+ rClipParam.maRanges.clear();
rClipParam.maRanges.Append(rArea);
rClipParam.mbCutMode = bCut;
}
@@ -2487,17 +2487,18 @@ void ScDocument::GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered
}
ScRangeList& rClipRanges = GetClipParam().maRanges;
- if (!rClipRanges.Count())
+ if (rClipRanges.empty())
// No clip range. Bail out.
return;
- ScRangePtr p = rClipRanges.First();
+ ScRangePtr p = rClipRanges.front();
SCCOL nStartCol = p->aStart.Col();
SCCOL nEndCol = p->aEnd.Col();
SCROW nStartRow = p->aStart.Row();
SCROW nEndRow = p->aEnd.Row();
- for (p = rClipRanges.Next(); p; p = rClipRanges.Next())
+ for ( size_t i = 1, n = rClipRanges.size(); i < n; ++i )
{
+ p = rClipRanges[ i ];
if (p->aStart.Col() < nStartCol)
nStartCol = p->aStart.Col();
if (p->aStart.Row() < nStartRow)
@@ -2535,10 +2536,10 @@ void ScDocument::GetClipStart(SCCOL& nClipX, SCROW& nClipY)
if (bIsClip)
{
ScRangeList& rClipRanges = GetClipParam().maRanges;
- if (rClipRanges.Count())
+ if ( !rClipRanges.empty() )
{
- nClipX = rClipRanges.First()->aStart.Col();
- nClipY = rClipRanges.First()->aStart.Row();
+ nClipX = rClipRanges.front()->aStart.Col();
+ nClipY = rClipRanges.front()->aStart.Row();
}
}
else
@@ -2556,11 +2557,12 @@ BOOL ScDocument::HasClipFilteredRows()
++nCountTab;
ScRangeList& rClipRanges = GetClipParam().maRanges;
- if (!rClipRanges.Count())
+ if ( rClipRanges.empty() )
return false;
- for (ScRange* p = rClipRanges.First(); p; p = rClipRanges.Next())
+ for ( size_t i = 0, n = rClipRanges.size(); i < n; ++i )
{
+ ScRangePtr p = rClipRanges[ i ];
bool bAnswer = pTab[nCountTab]->HasFilteredRows(p->aStart.Row(), p->aEnd.Row());
if (bAnswer)
return true;
@@ -3064,10 +3066,9 @@ void ScDocument::SetTableOpDirty( const ScRange& rRange )
void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges )
{
- ULONG nRangeCount = rRanges.Count();
- for (ULONG nPos=0; nPos<nRangeCount; nPos++)
+ for (size_t nPos=0, nRangeCount = rRanges.size(); nPos < nRangeCount; nPos++)
{
- ScCellIterator aIter( this, *rRanges.GetObject(nPos) );
+ ScCellIterator aIter( this, *rRanges[ nPos ] );
ScBaseCell* pCell = aIter.GetFirst();
while (pCell)
{
@@ -4914,14 +4915,14 @@ void ScDocument::ApplySelectionFrame( const ScMarkData& rMark,
{
ScRangeList aRangeList;
rMark.FillRangeListWithMarks( &aRangeList, FALSE );
- ULONG nRangeCount = aRangeList.Count();
+ size_t nRangeCount = aRangeList.size();
for (SCTAB i=0; i<=MAXTAB; i++)
{
if (pTab[i] && rMark.GetTableSelect(i))
{
- for (ULONG j=0; j<nRangeCount; j++)
+ for ( size_t j=0; j < nRangeCount; j++ )
{
- ScRange aRange = *aRangeList.GetObject(j);
+ ScRange aRange = *aRangeList[ j ];
pTab[i]->ApplyBlockFrame( pLineOuter, pLineInner,
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row() );
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 14f6719..c7de022 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1384,10 +1384,9 @@ BOOL lcl_IsAllInRange( const ::std::vector< ScRangeList >& rRangesVector, const
for( ;aIt!=rRangesVector.end(); ++aIt )
{
const ScRangeList& rRanges = *aIt;
- ULONG nCount = rRanges.Count();
- for (ULONG i=0; i<nCount; i++)
+ for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
{
- ScRange aRange = *rRanges.GetObject(i);
+ ScRange aRange = *rRanges[ i ];
if ( !rClipRange.In( aRange ) )
{
return FALSE; // at least one range is not valid
@@ -1406,10 +1405,9 @@ BOOL lcl_MoveRanges( ::std::vector< ScRangeList >& rRangesVector, const ScRange&
for( ;aIt!=rRangesVector.end(); ++aIt )
{
ScRangeList& rRanges = *aIt;
- ULONG nCount = rRanges.Count();
- for (ULONG i=0; i<nCount; i++)
+ for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
{
- ScRange* pRange = rRanges.GetObject(i);
+ ScRange* pRange = rRanges[ i ];
if ( rSourceRange.In( *pRange ) )
{
SCsCOL nDiffX = rDestPos.Col() - (SCsCOL)rSourceRange.aStart.Col();
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index f3dde73..456c05a 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -345,18 +345,18 @@ void ScMarkData::MarkFromRangeList( const ScRangeList& rList, BOOL bReset )
ResetMark();
}
- ULONG nCount = rList.Count();
+ size_t nCount = rList.size();
if ( nCount == 1 && !bMarked && !bMultiMarked )
{
- ScRange aRange = *rList.GetObject(0);
+ ScRange aRange = *rList[ 0 ];
SetMarkArea( aRange );
SelectTable( aRange.aStart.Tab(), TRUE );
}
else
{
- for (ULONG i=0; i<nCount; i++)
+ for (size_t i=0; i < nCount; i++)
{
- ScRange aRange = *rList.GetObject(i);
+ ScRange aRange = *rList[ i ];
SetMultiMarkArea( aRange, TRUE );
SelectTable( aRange.aStart.Tab(), TRUE );
}
@@ -369,7 +369,7 @@ void ScMarkData::FillRangeListWithMarks( ScRangeList* pList, BOOL bClear ) const
return;
if (bClear)
- pList->RemoveAll();
+ pList->clear();
//! bei mehreren selektierten Tabellen mehrere Ranges eintragen !!!
@@ -406,15 +406,14 @@ void ScMarkData::ExtendRangeListTables( ScRangeList* pList ) const
return;
ScRangeList aOldList(*pList);
- pList->RemoveAll(); //! oder die vorhandenen unten weglassen
+ pList->clear(); //! oder die vorhandenen unten weglassen
for (SCTAB nTab=0; nTab<=MAXTAB; nTab++)
if (bTabMarked[nTab])
{
- ULONG nCount = aOldList.Count();
- for (ULONG i=0; i<nCount; i++)
+ for ( size_t i=0, nCount = aOldList.size(); i<nCount; i++)
{
- ScRange aRange = *aOldList.GetObject(i);
+ ScRange aRange = *aOldList[ i ];
aRange.aStart.SetTab(nTab);
aRange.aEnd.SetTab(nTab);
pList->Append( aRange );
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 7413c70..4061354 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -466,13 +466,14 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
}
-void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
+void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
bool bKeepScenarioFlags, bool bCloneNoteCaptions)
{
ScRangeList aRanges(rRanges);
- for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
+ for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
{
- CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(),
+ ScRangePtr p = aRanges[ i ];
+ CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(),
pTable, bKeepScenarioFlags, bCloneNoteCaptions);
}
}
@@ -915,23 +916,17 @@ BOOL ScTable::HasScenarioRange( const ScRange& rRange ) const
{
DBG_ASSERT( bScenario, "bScenario == FALSE" );
-// ScMarkData aMark;
-// MarkScenarioIn( aMark, 0 ); //! Bits als Parameter von HasScenarioRange?
-// return aMark.IsAllMarked( rRange );
-
ScRange aTabRange = rRange;
aTabRange.aStart.SetTab( nTab );
aTabRange.aEnd.SetTab( nTab );
const ScRangeList* pList = GetScenarioRanges();
-// return ( pList && pList->Find( aTabRange ) );
if (pList)
{
- ULONG nCount = pList->Count();
- for ( ULONG j = 0; j < nCount; j++ )
+ for ( size_t j = 0, n = pList->size(); j < n; j++ )
{
- ScRange* pR = pList->GetObject( j );
+ ScRange* pR = pList->at( j );
if ( pR->Intersects( aTabRange ) )
return TRUE;
}
@@ -1711,15 +1706,14 @@ BOOL ScTable::IsSelectionEditable( const ScMarkData& rMark,
// in the active scenario range.
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, FALSE );
- ULONG nRangeCount = aRanges.Count();
SCTAB nScenTab = nTab+1;
while(pDocument->IsScenario(nScenTab) && bIsEditable)
{
if(pDocument->IsActiveScenario(nScenTab))
{
- for (ULONG i=0; i<nRangeCount && bIsEditable; i++)
+ for (size_t i=0, nRange = aRanges.size(); (i < nRange) && bIsEditable; i++ )
{
- ScRange aRange = *aRanges.GetObject(i);
+ ScRange aRange = *aRanges[ i ];
if(pDocument->HasScenarioRange(nScenTab, aRange))
{
USHORT nFlags;
@@ -1746,10 +1740,9 @@ BOOL ScTable::IsSelectionEditable( const ScMarkData& rMark,
{
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, FALSE );
- ULONG nRangeCount = aRanges.Count();
- for (ULONG i=0; i<nRangeCount && bIsEditable; i++)
+ for (size_t i = 0, nRange = aRanges.size(); (i < nRange) && bIsEditable; i++)
{
- ScRange aRange = *aRanges.GetObject(i);
+ ScRange aRange = *aRanges[ i ];
if(pDocument->HasScenarioRange(nTab, aRange))
{
USHORT nFlags;
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 566c420..11548ed 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -768,8 +768,9 @@ bool ScTable::SearchAndReplaceEmptyCells(
ScRangeList aMarkedRanges, aNewRanges;
rMark.FillRangeListWithMarks(&aMarkedRanges, true);
- for (ScRangePtr p = aMarkedRanges.First(); p; p = aMarkedRanges.Next())
+ for ( size_t i = 0, n = aMarkedRanges.size(); i < n; ++i )
{
+ ScRangePtr p = aMarkedRanges[ i ];
if (p->aStart.Col() > nColEnd || p->aStart.Row() > nRowEnd)
// This range is outside the data area. Skip it.
continue;
@@ -795,17 +796,19 @@ bool ScTable::SearchAndReplaceEmptyCells(
{
if (rSearchItem.GetBackward())
{
- for (ScRangePtr p = aRanges.Last(); p; p = aRanges.Prev())
+ for ( size_t i = aRanges.size(); i > 0; --i )
{
- if (SearchRangeForEmptyCell(*p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc))
+ ScRangePtr p = aRanges[ i - 1 ];
+ if (SearchRangeForEmptyCell( *p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc))
return true;
}
}
else
{
- for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
+ for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
{
- if (SearchRangeForEmptyCell(*p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc))
+ ScRangePtr p = aRanges[ i ];
+ if (SearchRangeForEmptyCell( *p, rSearchItem, rCol, rRow, rUndoStr, pUndoDoc ))
return true;
}
}
@@ -815,8 +818,11 @@ bool ScTable::SearchAndReplaceEmptyCells(
bool bFound = false;
ScMarkData aNewMark(rMark);
aNewMark.ResetMark();
- for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
+ for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
+ {
+ ScRangePtr p = aRanges[ i ];
bFound |= SearchRangeForAllEmptyCells(*p, rSearchItem, aNewMark, rUndoStr, pUndoDoc);
+ }
rMark = aNewMark;
return bFound;
}
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index 027d2f0..f7fe3bc 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -129,12 +129,12 @@ BOOL ScChartArray::operator==(const ScChartArray& rCmp) const
ScMemChart* ScChartArray::CreateMemChart()
{
ScRangeListRef aRangeListRef(GetRangeList());
- ULONG nCount = aRangeListRef->Count();
+ size_t nCount = aRangeListRef->size();
if ( nCount > 1 )
return CreateMemChartMulti();
else if ( nCount == 1 )
{
- ScRange* pR = aRangeListRef->First();
+ ScRangePtr pR = aRangeListRef->front();
if ( pR->aStart.Tab() != pR->aEnd.Tab() )
return CreateMemChartMulti();
else
@@ -163,7 +163,7 @@ ScMemChart* ScChartArray::CreateMemChartSingle()
SCROW nRow2;
SCTAB nTab2;
ScRangeListRef aRangeListRef(GetRangeList());
- aRangeListRef->First()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+ aRangeListRef->front()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
SCCOL nStrCol = nCol1; // fuer Beschriftung merken
SCROW nStrRow = nRow1;
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 5c5879d..963563e 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -97,27 +97,26 @@ BOOL lcl_AdjustRanges( ScRangeList& rRanges, SCTAB nSourceTab, SCTAB nDestTab, S
{
//! if multiple sheets are copied, update references into the other copied sheets?
- BOOL bChanged = FALSE;
+ bool bChanged = false;
- ULONG nCount = rRanges.Count();
- for (ULONG i=0; i<nCount; i++)
+ for ( size_t i=0, nCount = rRanges.size(); i < nCount; i++ )
{
- ScRange* pRange = rRanges.GetObject(i);
+ ScRangePtr pRange = rRanges[ i ];
if ( pRange->aStart.Tab() == nSourceTab && pRange->aEnd.Tab() == nSourceTab )
{
pRange->aStart.SetTab( nDestTab );
pRange->aEnd.SetTab( nDestTab );
- bChanged = TRUE;
+ bChanged = true;
}
if ( pRange->aStart.Tab() >= nTabCount )
{
pRange->aStart.SetTab( nTabCount > 0 ? ( nTabCount - 1 ) : 0 );
- bChanged = TRUE;
+ bChanged = true;
}
if ( pRange->aEnd.Tab() >= nTabCount )
{
pRange->aEnd.SetTab( nTabCount > 0 ? ( nTabCount - 1 ) : 0 );
- bChanged = TRUE;
+ bChanged = true;
}
}
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index a7414c5..ae4bd80 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -106,10 +106,11 @@ void ScChartPositioner::GlueState()
return;
bDummyUpperLeft = FALSE;
ScRangePtr pR;
- if ( aRangeListRef->Count() <= 1 )
+ if ( aRangeListRef->size() <= 1 )
{
- if ( (pR = aRangeListRef->First())!=NULL )
+ if ( !aRangeListRef->empty() )
{
+ pR = aRangeListRef->front();
if ( pR->aStart.Tab() == pR->aEnd.Tab() )
eGlue = SC_CHARTGLUE_NONE;
else
@@ -126,29 +127,25 @@ void ScChartPositioner::GlueState()
return;
}
- pR = aRangeListRef->First();
+ pR = aRangeListRef->front();
nStartCol = pR->aStart.Col();
nStartRow = pR->aStart.Row();
SCCOL nMaxCols, nEndCol;
SCROW nMaxRows, nEndRow;
nMaxCols = nEndCol = 0;
nMaxRows = nEndRow = 0;
- do
+ for ( size_t i = 1, nRanges = aRangeListRef->size(); i <= nRanges; ++i ) // <= so 1 extra pass after last item
{ // umspannenden Bereich etc. feststellen
SCCOLROW nTmp, n1, n2;
- if ( (n1 = pR->aStart.Col()) < nStartCol )
- nStartCol = static_cast<SCCOL>(n1);
- if ( (n2 = pR->aEnd.Col()) > nEndCol )
- nEndCol = static_cast<SCCOL>(n2);
- if ( (nTmp = n2 - n1 + 1) > nMaxCols )
- nMaxCols = static_cast<SCCOL>(nTmp);
- if ( (n1 = pR->aStart.Row()) < nStartRow )
- nStartRow = static_cast<SCROW>(n1);
- if ( (n2 = pR->aEnd.Row()) > nEndRow )
- nEndRow = static_cast<SCROW>(n2);
- if ( (nTmp = n2 - n1 + 1) > nMaxRows )
- nMaxRows = static_cast<SCROW>(nTmp);
- } while ( (pR = aRangeListRef->Next())!=NULL );
+ if ( (n1 = pR->aStart.Col()) < nStartCol ) nStartCol = static_cast<SCCOL>(n1 );
+ if ( (n2 = pR->aEnd.Col() ) > nEndCol ) nEndCol = static_cast<SCCOL>(n2 );
+ if ( (nTmp = n2 - n1 + 1 ) > nMaxCols ) nMaxCols = static_cast<SCCOL>(nTmp);
+ if ( (n1 = pR->aStart.Row()) < nStartRow ) nStartRow = static_cast<SCROW>(n1 );
+ if ( (n2 = pR->aEnd.Row() ) > nEndRow ) nEndRow = static_cast<SCROW>(n2 );
+ if ( (nTmp = n2 - n1 + 1 ) > nMaxRows ) nMaxRows = static_cast<SCROW>(nTmp);
+ if ( i < nRanges ) // in last pass; i = nRanges so don't use at()
+ pR = aRangeListRef->at( i );
+ }
SCCOL nC = nEndCol - nStartCol + 1;
if ( nC == 1 )
{
@@ -197,8 +194,9 @@ void ScChartPositioner::GlueState()
SCCOL nCol, nCol1, nCol2;
SCROW nRow, nRow1, nRow2;
- for ( pR = aRangeListRef->First(); pR; pR = aRangeListRef->Next() )
+ for ( size_t i = 0, nRanges = aRangeListRef->size(); i < nRanges; ++i )
{ // Selektionen 2D als belegt markieren
+ pR = aRangeListRef->at( i );
nCol1 = pR->aStart.Col() - nStartCol;
nCol2 = pR->aEnd.Col() - nStartCol;
nRow1 = pR->aStart.Row() - nStartRow;
@@ -301,9 +299,9 @@ void ScChartPositioner::CheckColRowHeaders()
BOOL bColStrings = TRUE;
BOOL bRowStrings = TRUE;
GlueState();
- if ( aRangeListRef->Count() == 1 )
+ if ( aRangeListRef->size() == 1 )
{
- aRangeListRef->First()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+ aRangeListRef->front()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
if ( nCol1 > nCol2 || nRow1 > nRow2 )
bColStrings = bRowStrings = FALSE;
else
@@ -323,10 +321,12 @@ void ScChartPositioner::CheckColRowHeaders()
else
{
BOOL bVert = (eGlue == SC_CHARTGLUE_NONE || eGlue == SC_CHARTGLUE_ROWS);
- for ( ScRangePtr pR = aRangeListRef->First();
- pR && (bColStrings || bRowStrings);
- pR = aRangeListRef->Next() )
+ for ( size_t i = 0, nRanges = aRangeListRef->size();
+ (i < nRanges) && (bColStrings || bRowStrings);
+ ++i
+ )
{
+ ScRangePtr pR = aRangeListRef->at( i );
pR->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
BOOL bTopRow = (nRow1 == nStartRow);
if ( bRowStrings && (bVert || nCol1 == nStartCol) )
@@ -392,12 +392,12 @@ void ScChartPositioner::CreatePositionMap()
Table* pCols = new Table;
Table* pNewRowTable = new Table;
ScAddress* pNewAddress = new ScAddress;
- ScRangePtr pR;
Table* pCol;
ScAddress* pPos;
SCROW nNoGlueRow = 0;
- for ( pR = aRangeListRef->First(); pR; pR = aRangeListRef->Next() )
+ for ( size_t i = 0, nRanges = aRangeListRef->size(); i < nRanges; ++i )
{
+ ScRangePtr pR = aRangeListRef->at( i );
pR->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
for ( nTab = nTab1; nTab <= nTab2; nTab++ )
{
@@ -461,7 +461,6 @@ void ScChartPositioner::CreatePositionMap()
if ( nColCount==0 || nRowCount==0 )
{ // einen Eintrag ohne Daten erzeugen
- pR = aRangeListRef->First();
if ( pCols->Count() > 0 )
pCol = (Table*) pCols->First();
else
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index b7d2133..12962a4 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -48,15 +48,7 @@
ScRangeList::~ScRangeList()
{
- for ( ScRangePtr pR = First(); pR; pR = Next() )
- delete pR;
-}
-
-void ScRangeList::RemoveAll()
-{
- for ( ScRangePtr pR = First(); pR; pR = Next() )
- delete pR;
- Clear();
+ clear();
}
USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask,
@@ -116,11 +108,10 @@ void ScRangeList::Format( String& rStr, USHORT nFlags, ScDocument* pDoc,
if (!cDelimiter)
cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
- ULONG nCnt = Count();
- for ( ULONG nIdx = 0; nIdx < nCnt; nIdx++ )
+ for ( size_t nIdx = 0, nCnt = size(); nIdx < nCnt; ++nIdx )
{
String aStr;
- GetObject( nIdx )->Format( aStr, nFlags, pDoc, eConv );
+ at( nIdx )->Format( aStr, nFlags, pDoc, eConv );
if ( nIdx )
rStr += cDelimiter;
rStr += aStr;
@@ -128,9 +119,9 @@ void ScRangeList::Format( String& rStr, USHORT nFlags, ScDocument* pDoc,
}
-void ScRangeList::Join( const ScRange& r, BOOL bIsInList )
+void ScRangeList::Join( const ScRange& r, bool bIsInList )
{
- if ( !Count() )
+ if ( empty() )
{
Append( r );
return ;
@@ -141,32 +132,42 @@ void ScRangeList::Join( const ScRange& r, BOOL bIsInList )
SCCOL nCol2 = r.aEnd.Col();
SCROW nRow2 = r.aEnd.Row();
SCTAB nTab2 = r.aEnd.Tab();
+
ScRangePtr pOver = (ScRangePtr) &r; // fies aber wahr wenn bInList
- ULONG nOldPos = 0;
+ size_t nOldPos = 0;
if ( bIsInList )
{ // merken um ggbf. zu loeschen bzw. wiederherzustellen
- nOldPos = GetPos( pOver );
+ for ( size_t i = 0, nRanges = size(); i < nRanges; ++i )
+ {
+ if ( at( i ) == pOver )
+ {
+ nOldPos = i;
+ break;
+ }
+ }
}
- BOOL bJoinedInput = FALSE;
- for ( ScRangePtr p = First(); p && pOver; p = Next() )
+ bool bJoinedInput = false;
+
+ for ( size_t i = 0, nRanges = size(); i < nRanges; ++i )
{
+ ScRangePtr p = at( i );
if ( p == pOver )
continue; // derselbe, weiter mit dem naechsten
- BOOL bJoined = FALSE;
+ bool bJoined = false;
if ( p->In( r ) )
{ // Range r in Range p enthalten oder identisch
if ( bIsInList )
- bJoined = TRUE; // weg mit Range r
+ bJoined = true; // weg mit Range r
else
{ // das war's dann
- bJoinedInput = TRUE; // nicht anhaengen
+ bJoinedInput = true; // nicht anhaengen
break; // for
}
}
else if ( r.In( *p ) )
{ // Range p in Range r enthalten, r zum neuen Range machen
*p = r;
- bJoined = TRUE;
+ bJoined = true;
}
if ( !bJoined && p->aStart.Tab() == nTab1 && p->aEnd.Tab() == nTab2 )
{ // 2D
@@ -175,12 +176,12 @@ void ScRangeList::Join( const ScRange& r, BOOL bIsInList )
if ( p->aStart.Row() == nRow2+1 )
{ // oben
p->aStart.SetRow( nRow1 );
- bJoined = TRUE;
+ bJoined = true;
}
else if ( p->aEnd.Row() == nRow1-1 )
{ // unten
p->aEnd.SetRow( nRow2 );
- bJoined = TRUE;
+ bJoined = true;
}
}
else if ( p->aStart.Row() == nRow1 && p->aEnd.Row() == nRow2 )
@@ -188,12 +189,12 @@ void ScRangeList::Join( const ScRange& r, BOOL bIsInList )
if ( p->aStart.Col() == nCol2+1 )
{ // links
p->aStart.SetCol( nCol1 );
- bJoined = TRUE;
+ bJoined = true;
}
else if ( p->aEnd.Col() == nCol1-1 )
{ // rechts
p->aEnd.SetCol( nCol2 );
- bJoined = TRUE;
+ bJoined = true;
}
}
}
@@ -201,49 +202,51 @@ void ScRangeList::Join( const ScRange& r, BOOL bIsInList )
{
if ( bIsInList )
{ // innerhalb der Liste Range loeschen
- Remove( nOldPos );
- delete pOver;
+ erase( begin() + nOldPos );
pOver = NULL;
if ( nOldPos )
nOldPos--; // Seek richtig aufsetzen
}
- bJoinedInput = TRUE;
- Join( *p, TRUE ); // rekursiv!
+ bJoinedInput = true;
+ Join( *p, true ); // rekursiv!
}
}
- if ( bIsInList )
- Seek( nOldPos );
- else if ( !bJoinedInput )
+ if ( !bIsInList && !bJoinedInput )
Append( r );
}
-BOOL ScRangeList::operator==( const ScRangeList& r ) const
+bool ScRangeList::operator==( const ScRangeList& r ) const
{
if ( this == &r )
- return TRUE; // identische Referenz
- if ( Count() != r.Count() )
- return FALSE;
- ULONG nCnt = Count();
- for ( ULONG nIdx = 0; nIdx < nCnt; nIdx++ )
+ return true; // identische Referenz
+ size_t nCnt = size();
+ if ( nCnt != r.size() )
+ return false;
+ for ( size_t nIdx = 0; nIdx < nCnt; nIdx++ )
{
- if ( *GetObject( nIdx ) != *r.GetObject( nIdx ) )
- return FALSE; // auch andere Reihenfolge ist ungleich
+ if ( *at( nIdx ) != *r.at( nIdx ) )
+ return false; // auch andere Reihenfolge ist ungleich
}
- return TRUE;
+ return true;
}
-BOOL ScRangeList::operator!=( const ScRangeList& r ) const
+bool ScRangeList::operator!=( const ScRangeList& r ) const
{
return !operator==( r );
}
-BOOL ScRangeList::UpdateReference( UpdateRefMode eUpdateRefMode,
- ScDocument* pDoc, const ScRange& rWhere,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
+bool ScRangeList::UpdateReference(
+ UpdateRefMode eUpdateRefMode,
+ ScDocument* pDoc,
+ const ScRange& rWhere,
+ SCsCOL nDx,
+ SCsROW nDy,
+ SCsTAB nDz
+)
{
- BOOL bChanged = FALSE;
- if ( Count() )
+ bool bChanged = FALSE;
+ if ( !empty() )
{
SCCOL nCol1;
SCROW nRow1;
@@ -252,8 +255,9 @@ BOOL ScRangeList::UpdateReference( UpdateRefMode eUpdateRefMode,
SCROW nRow2;
SCTAB nTab2;
rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- for ( ScRange* pR = First(); pR; pR = Next() )
+ for ( size_t i = 0, nRanges = size(); i < nRanges; ++i )
{
+ ScRangePtr pR = at( i );
SCCOL theCol1;
SCROW theRow1;
SCTAB theTab1;
@@ -276,13 +280,11 @@ BOOL ScRangeList::UpdateReference( UpdateRefMode eUpdateRefMode,
return bChanged;
}
-
ScRange* ScRangeList::Find( const ScAddress& rAdr ) const
{
- ULONG nListCount = Count();
- for ( ULONG j = 0; j < nListCount; j++ )
+ for ( size_t j = 0, nListCount = size(); j < nListCount; j++ )
{
- ScRange* pR = GetObject( j );
+ ScRangePtr pR = at( j );
if ( pR->In( rAdr ) )
return pR;
}
@@ -294,56 +296,49 @@ ScRangeList::ScRangeList( const ScRangeList& rList ) :
ScRangeListBase(),
SvRefBase()
{
- ULONG nListCount = rList.Count();
- for ( ULONG j = 0; j < nListCount; j++ )
- Append( *rList.GetObject( j ) );
+ for ( size_t j = 0, nListCount = rList.size(); j < nListCount; j++ )
+ Append( *rList[ j ] );
}
ScRangeList& ScRangeList::operator=(const ScRangeList& rList)
{
- RemoveAll();
-
- ULONG nListCount = rList.Count();
- for ( ULONG j = 0; j < nListCount; j++ )
- Append( *rList.GetObject( j ) );
-
+ clear();
+ for ( size_t j = 0, nListCount = rList.size(); j < nListCount; j++ )
+ Append( *rList[ j ] );
return *this;
}
-BOOL ScRangeList::Intersects( const ScRange& rRange ) const
+bool ScRangeList::Intersects( const ScRange& rRange ) const
{
- ULONG nListCount = Count();
- for ( ULONG j = 0; j < nListCount; j++ )
- if ( GetObject(j)->Intersects( rRange ) )
- return TRUE;
+ for ( size_t j = 0, nListCount = size(); j < nListCount; j++ )
+ if ( at( j )->Intersects( rRange ) )
+ return true;
- return FALSE;
+ return false;
}
-BOOL ScRangeList::In( const ScRange& rRange ) const
+bool ScRangeList::In( const ScRange& rRange ) const
{
- ULONG nListCount = Count();
- for ( ULONG j = 0; j < nListCount; j++ )
- if ( GetObject(j)->In( rRange ) )
- return TRUE;
+ for ( size_t j = 0, nListCount = size(); j < nListCount; j++ )
+ if ( at( j )->In( rRange ) )
+ return true;
- return FALSE;
+ return false;
}
-ULONG ScRangeList::GetCellCount() const
+size_t ScRangeList::GetCellCount() const
{
- ULONG nCellCount = 0;
- ULONG nListCount = Count();
- for ( ULONG j = 0; j < nListCount; j++ )
+ size_t nCellCount = 0;
+ for ( size_t j = 0, nListCount = size(); j < nListCount; j++ )
{
- ScRange* pR = GetObject( j );
- nCellCount += ULONG(pR->aEnd.Col() - pR->aStart.Col() + 1)
- * ULONG(pR->aEnd.Row() - pR->aStart.Row() + 1)
- * ULONG(pR->aEnd.Tab() - pR->aStart.Tab() + 1);
+ ScRangePtr pR = at( j );
+ nCellCount += size_t(pR->aEnd.Col() - pR->aStart.Col() + 1)
+ * size_t(pR->aEnd.Row() - pR->aStart.Row() + 1)
+ * size_t(pR->aEnd.Tab() - pR->aStart.Tab() + 1);
}
return nCellCount;
}
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 752914e..f5b172d 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -566,8 +566,10 @@ sal_Bool ScRangeStringConverter::GetRangeListFromString(
while( nOffset >= 0 )
{
ScRange* pRange = new ScRange;
- if( GetRangeFromString( *pRange, rRangeListStr, pDocument, eConv, nOffset, cSeperator, cQuote ) && (nOffset >= 0) )
- rRangeList.Insert( pRange, LIST_APPEND );
+ if ( GetRangeFromString( *pRange, rRangeListStr, pDocument, eConv, nOffset, cSeperator, cQuote )
+ && (nOffset >= 0)
+ )
+ rRangeList.push_back( pRange );
else if (nOffset > -1)
bRet = sal_False;
}
@@ -721,10 +723,9 @@ void ScRangeStringConverter::GetStringFromRangeList(
OUString sRangeListStr;
if( pRangeList )
{
- sal_Int32 nCount = pRangeList->Count();
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
+ for( size_t nIndex = 0, nCount = pRangeList->size(); nIndex < nCount; nIndex++ )
{
- const ScRange* pRange = pRangeList->GetObject( nIndex );
+ const ScRangePtr pRange = pRangeList->at( nIndex );
if( pRange )
GetStringFromRange( sRangeListStr, *pRange, pDocument, eConv, cSeperator, sal_True, nFormatFlags );
}
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 1d28745..8c3f3a2 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -198,11 +198,11 @@ void ScRefTokenHelper::getTokenFromRange(ScSharedTokenRef& pToken, const ScRange
void ScRefTokenHelper::getTokensFromRangeList(vector<ScSharedTokenRef>& pTokens, const ScRangeList& rRanges)
{
vector<ScSharedTokenRef> aTokens;
- sal_uInt32 nCount = rRanges.Count();
+ size_t nCount = rRanges.size();
aTokens.reserve(nCount);
- for (sal_uInt32 i = 0; i < nCount; ++i)
+ for (size_t i = 0; i < nCount; ++i)
{
- ScRange* pRange = static_cast<ScRange*>(rRanges.GetObject(i));
+ ScRange* pRange = rRanges[ i ];
if (!pRange)
// failed.
return;
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 4d19e26..d064edd 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1524,7 +1524,7 @@ BOOL ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Si
}
rStrm.Seek( nEndPos );
- return rRangeList.Count() != 0;
+ return !rRangeList.empty();
}
void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCount )
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index e66855d..de6d259 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1586,7 +1586,7 @@ BOOL ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, sal_Size nLen )
}
aIn.Seek( nEndPos );
- return r.Count() != 0;
+ return !r.empty();
}
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index b2bacb7..b46466e 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -335,9 +335,12 @@ sal_uInt32 XclExpMergedcells::GetBaseXFId( const ScAddress& rPos ) const
DBG_ASSERT( maBaseXFIds.size() == maMergedRanges.Count(), "XclExpMergedcells::GetBaseXFId - invalid lists" );
ScfUInt32Vec::const_iterator aIt = maBaseXFIds.begin();
ScRangeList& rNCRanges = const_cast< ScRangeList& >( maMergedRanges );
- for( const ScRange* pScRange = rNCRanges.First(); pScRange; pScRange = rNCRanges.Next(), ++aIt )
+ for ( size_t i = 0, nRanges = rNCRanges.size(); i < nRanges; ++i, ++aIt )
+ {
+ const ScRangePtr pScRange = rNCRanges[ i ];
if( pScRange->In( rPos ) )
return *aIt;
+ }
return EXC_XFID_NOTFOUND;
}
@@ -363,16 +366,16 @@ void XclExpMergedcells::Save( XclExpStream& rStrm )
void XclExpMergedcells::SaveXml( XclExpXmlStream& rStrm )
{
- ULONG nCount = maMergedRanges.Count();
+ size_t nCount = maMergedRanges.size();
if( !nCount )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_mergeCells,
XML_count, OString::valueOf( (sal_Int32) nCount ).getStr(),
FSEND );
- for( ULONG i = 0; i < nCount; ++i )
+ for( size_t i = 0; i < nCount; ++i )
{
- if( const ScRange* pRange = maMergedRanges.GetObject( i ) )
+ if( const ScRange* pRange = maMergedRanges[ i ] )
{
rWorksheet->singleElement( XML_mergeCell,
XML_ref, XclXmlUtils::ToOString( *pRange ).getStr(),
@@ -576,9 +579,12 @@ XclExpLabelranges::XclExpLabelranges( const XclExpRoot& rRoot ) :
// row label ranges
FillRangeList( maRowRanges, rRoot.GetDoc().GetRowNameRangesRef(), nScTab );
// row labels only over 1 column (restriction of Excel97/2000/XP)
- for( ScRange* pScRange = maRowRanges.First(); pScRange; pScRange = maRowRanges.Next() )
+ for ( size_t i = 0, nRanges = maRowRanges.size(); i < nRanges; ++i )
+ {
+ ScRangePtr pScRange = maRowRanges[ i ];
if( pScRange->aStart.Col() != pScRange->aEnd.Col() )
pScRange->aEnd.SetCol( pScRange->aStart.Col() );
+ }
// col label ranges
FillRangeList( maColRanges, rRoot.GetDoc().GetColNameRangesRef(), nScTab );
}
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 9829b2e..5644285 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -2603,18 +2603,18 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, con
XclTokenArrayRef XclExpFormulaCompiler::CreateFormula( XclFormulaType eType, const ScRangeList& rScRanges )
{
- ULONG nCount = rScRanges.Count();
+ size_t nCount = rScRanges.size();
if( nCount == 0 )
return XclTokenArrayRef();
ScTokenArray aScTokArr;
SCTAB nCurrScTab = GetCurrScTab();
bool b3DRefOnly = mxImpl->Is3DRefOnly( eType );
- for( ULONG nIdx = 0; nIdx < nCount; ++nIdx )
+ for( size_t nIdx = 0; nIdx < nCount; ++nIdx )
{
if( nIdx > 0 )
aScTokArr.AddOpCode( ocUnion );
- lclPutRangeToTokenArray( aScTokArr, *rScRanges.GetObject( nIdx ), nCurrScTab, b3DRefOnly );
+ lclPutRangeToTokenArray( aScTokArr, *rScRanges[ nIdx ], nCurrScTab, b3DRefOnly );
}
return mxImpl->CreateFormula( eType, aScTokArr );
}
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index b6f3945..47fa4b4 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -260,13 +260,11 @@ bool XclExpAddressConverter::ConvertRange( XclRange& rXclRange,
void XclExpAddressConverter::ValidateRangeList( ScRangeList& rScRanges, bool bWarn )
{
- ULONG nIdx = rScRanges.Count();
- while( nIdx )
+ for ( size_t nRange = rScRanges.size(); nRange > 0; )
{
- --nIdx; // backwards to keep nIdx valid
- ScRange* pScRange = rScRanges.GetObject( nIdx );
- if( pScRange && !CheckRange( *pScRange, bWarn ) )
- delete rScRanges.Remove( nIdx );
+ ScRangePtr pScRange = rScRanges[ --nRange ];
+ if( !CheckRange( *pScRange, bWarn ) )
+ rScRanges.erase( rScRanges.begin() + nRange );
}
}
@@ -274,9 +272,9 @@ void XclExpAddressConverter::ConvertRangeList( XclRangeList& rXclRanges,
const ScRangeList& rScRanges, bool bWarn )
{
rXclRanges.clear();
- for( ULONG nPos = 0, nCount = rScRanges.Count(); nPos < nCount; ++nPos )
+ for( size_t nPos = 0, nCount = rScRanges.size(); nPos < nCount; ++nPos )
{
- if( const ScRange* pScRange = rScRanges.GetObject( nPos ) )
+ if( const ScRange* pScRange = rScRanges[ nPos ] )
{
XclRange aXclRange( ScAddress::UNINITIALIZED );
if( ConvertRange( aXclRange, *pScRange, bWarn ) )
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 1196a9a..25cf5f4 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -639,7 +639,7 @@ void XclExpNameManagerImpl::CreateBuiltInNames()
}
// create the NAME record (do not warn if ranges are shrunken)
GetAddressConverter().ValidateRangeList( aRangeList, false );
- if( aRangeList.Count() > 0 )
+ if( !aRangeList.empty() )
GetNameManager().InsertBuiltInName( EXC_BUILTIN_PRINTAREA, aRangeList );
}
@@ -658,7 +658,7 @@ void XclExpNameManagerImpl::CreateBuiltInNames()
GetXclMaxPos().Col(), pRowRange->aEnd.Row(), nScTab ) );
// create the NAME record
GetAddressConverter().ValidateRangeList( aTitleList, false );
- if( aTitleList.Count() > 0 )
+ if( !aTitleList.empty() )
GetNameManager().InsertBuiltInName( EXC_BUILTIN_PRINTTITLES, aTitleList );
// *** 3) filter ranges *** ---------------------------------------
@@ -731,10 +731,10 @@ sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScR
sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRangeList& rRangeList )
{
sal_uInt16 nNameIdx = 0;
- if( rRangeList.Count() )
+ if( !rRangeList.empty() )
{
XclTokenArrayRef xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_NAME, rRangeList );
- nNameIdx = mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRangeList.GetObject( 0 )->aStart.Tab() );
+ nNameIdx = mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRangeList.front()->aStart.Tab() );
}
return nNameIdx;
}
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index a76af13..7e15282 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -438,8 +438,9 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm )
ScRangeList aRowScRanges;
rAddrConv.ConvertRangeList( aRowScRanges, aRowXclRanges, nScTab, false );
xLabelRangesRef = rDoc.GetRowNameRangesRef();
- for( pScRange = aRowScRanges.First(); pScRange; pScRange = aRowScRanges.Next() )
+ for ( size_t i = 0, nRanges = aRowScRanges.size(); i < nRanges; ++i )
{
+ pScRange = aRowScRanges[ i ];
ScRange aDataRange( *pScRange );
if( aDataRange.aEnd.Col() < MAXCOL )
{
@@ -458,8 +459,10 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm )
ScRangeList aColScRanges;
rAddrConv.ConvertRangeList( aColScRanges, aColXclRanges, nScTab, false );
xLabelRangesRef = rDoc.GetColNameRangesRef();
- for( pScRange = aColScRanges.First(); pScRange; pScRange = aColScRanges.Next() )
+
+ for ( size_t i = 0, nRanges = aColScRanges.size(); i < nRanges; ++i )
{
+ pScRange = aColScRanges[ i ];
ScRange aDataRange( *pScRange );
if( aDataRange.aEnd.Row() < MAXROW )
{
@@ -508,7 +511,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
}
// entire conditional format outside of valid range?
- if( !maRanges.Count() )
+ if( maRanges.empty() )
return;
sal_uInt8 nType, nOperator;
@@ -594,7 +597,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
// *** formulas ***
- const ScAddress& rPos = maRanges.GetObject( 0 )->aStart; // assured above that maRanges is not empty
+ const ScAddress& rPos = maRanges.front()->aStart; // assured above that maRanges is not empty
ExcelToSc& rFmlaConv = GetOldFmlaConverter();
::std::auto_ptr< ScTokenArray > xTokArr1;
@@ -643,8 +646,9 @@ void XclImpCondFormat::Apply()
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nKey ) );
// maRanges contains only valid cell ranges
- for( const ScRange* pScRange = maRanges.First(); pScRange; pScRange = maRanges.Next() )
+ for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
{
+ const ScRangePtr pScRange = maRanges[ i ];
rDoc.ApplyPatternAreaTab(
pScRange->aStart.Col(), pScRange->aStart.Row(),
pScRange->aEnd.Col(), pScRange->aEnd.Row(),
@@ -776,7 +780,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
rRoot.GetAddressConverter().ConvertRangeList( aScRanges, aXclRanges, nScTab, true );
// only continue if there are valid ranges
- if ( !aScRanges.Count() )
+ if ( aScRanges.empty() )
return;
bool bIsValid = true; // valid settings in flags field
@@ -816,7 +820,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
// first range for base address for relative references
- const ScRange& rScRange = *aScRanges.GetObject( 0 ); // aScRanges is not empty
+ const ScRange& rScRange = *aScRanges.front(); // aScRanges is not empty
// process string list of a list validity (convert to list of string tokens)
if( xTokArr1.get() && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) )
@@ -864,9 +868,12 @@ void XclImpValidationManager::Apply()
aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nHandle ) );
// apply all ranges
- for( const ScRange* pScRange = rItem.maRanges.First(); pScRange; pScRange = rItem.maRanges.Next() )
+ for ( size_t i = 0, nRanges = rItem.maRanges.size(); i < nRanges; ++i )
+ {
+ const ScRangePtr pScRange = rItem.maRanges[ i ];
rDoc.ApplyPatternAreaTab( pScRange->aStart.Col(), pScRange->aStart.Row(),
pScRange->aEnd.Col(), pScRange->aEnd.Row(), pScRange->aStart.Tab(), aPattern );
+ }
}
maDVItems.clear();
}
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 99f7d12..cf9d15c 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1860,8 +1860,11 @@ void XclImpControlHelper::ReadCellLinkFormula( XclImpStream& rStrm, bool bWithBo
ScRangeList aScRanges;
ReadRangeList( aScRanges, rStrm, bWithBoundSize );
// Use first cell of first range
- if( const ScRange* pScRange = aScRanges.GetObject( 0 ) )
+ if ( !aScRanges.empty() )
+ {
+ const ScRangePtr pScRange = aScRanges.front();
mxCellLink.reset( new ScAddress( pScRange->aStart ) );
+ }
}
void XclImpControlHelper::ReadSourceRangeFormula( XclImpStream& rStrm, bool bWithBoundSize )
@@ -1869,8 +1872,11 @@ void XclImpControlHelper::ReadSourceRangeFormula( XclImpStream& rStrm, bool bWit
ScRangeList aScRanges;
ReadRangeList( aScRanges, rStrm, bWithBoundSize );
// Use first range
- if( const ScRange* pScRange = aScRanges.GetObject( 0 ) )
+ if ( !aScRanges.empty() )
+ {
+ const ScRangePtr pScRange = aScRanges.front();
mxSrcRange.reset( new ScRange( *pScRange ) );
+ }
}
void XclImpControlHelper::DoProcessControl( ScfPropertySet& ) const
diff --git a/sc/source/filter/excel/xiformula.cxx b/sc/source/filter/excel/xiformula.cxx
index 4ccb3d6..e859d40 100644
--- a/sc/source/filter/excel/xiformula.cxx
+++ b/sc/source/filter/excel/xiformula.cxx
@@ -67,7 +67,7 @@ void XclImpFmlaCompImpl::CreateRangeList(
ScRangeList& rScRanges, XclFormulaType /*eType*/,
const XclTokenArray& rXclTokArr, XclImpStream& /*rStrm*/ )
{
- rScRanges.RemoveAll();
+ rScRanges.clear();
//! evil hack, using old formula import :-)
if( !rXclTokArr.Empty() )
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index bb17cc6..f01213e 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -140,7 +140,7 @@ bool XclImpAddressConverter::ConvertRange( ScRange& rScRange,
void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges,
const XclRangeList& rXclRanges, SCTAB nScTab, bool bWarn )
{
- rScRanges.RemoveAll();
+ rScRanges.clear();
for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
{
ScRange aScRange( ScAddress::UNINITIALIZED );
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 62541f9..e459ed1 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1763,7 +1763,7 @@ void XclImpXFRangeBuffer::Initialize()
{
maColumns.clear();
maHyperlinks.clear();
- maMergeList.RemoveAll();
+ maMergeList.clear();
}
void XclImpXFRangeBuffer::SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, XclImpXFInsertMode eMode )
@@ -1788,10 +1788,15 @@ void XclImpXFRangeBuffer::SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, X
if( pXF && ((pXF->GetHorAlign() == EXC_XF_HOR_CENTER_AS) || (pXF->GetHorAlign() == EXC_XF_HOR_FILL)) )
{
// expand last merged range if this attribute is set repeatedly
- ScRange* pRange = maMergeList.Last();
- if( pRange && (pRange->aEnd.Row() == nScRow) && (pRange->aEnd.Col() + 1 == nScCol)
- && (eMode == xlXFModeBlank) )
- pRange->aEnd.IncCol();
+ if ( !maMergeList.empty() )
+ {
+ ScRange* pRange = maMergeList.back();
+ if( (pRange->aEnd.Row() == nScRow)
+ && (pRange->aEnd.Col() + 1 == nScCol)
+ && (eMode == xlXFModeBlank)
+ )
+ pRange->aEnd.IncCol();
+ }
else if( eMode != xlXFModeBlank ) // #108781# do not merge empty cells
SetMerge( nScCol, nScRow );
}
@@ -1913,8 +1918,9 @@ void XclImpXFRangeBuffer::Finalize()
XclImpHyperlink::InsertUrl( GetRoot(), aLIt->first, aLIt->second );
// apply cell merging
- for( const ScRange* pRange = maMergeList.First(); pRange; pRange = maMergeList.Next() )
+ for ( size_t i = 0, nRange = maMergeList.size(); i < nRange; ++i )
{
+ const ScRangePtr pRange = maMergeList[ i ];
const ScAddress& rStart = pRange->aStart;
const ScAddress& rEnd = pRange->aEnd;
bool bMultiCol = rStart.Col() != rEnd.Col();
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 87f444a..83fa26b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -370,8 +370,9 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, BOOL bJoin )
do
{
bAgain = FALSE;
- for ( ScRange* pR = xLockedList->First(); pR; pR = xLockedList->Next() )
+ for ( size_t i = 0, nRanges = xLockedList->size(); i < nRanges; ++i )
{
+ ScRangePtr pR = xLockedList->at( i );
if ( pR->Intersects( aRange ) )
{
pE->nCol = pR->aEnd.Col() + 1;
@@ -396,9 +397,7 @@ void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, BOOL bJoin )
void ScHTMLLayoutParser::Adjust()
{
- for ( ScRange* pR = xLockedList->First(); pR; pR = xLockedList->Next() )
- delete pR;
- xLockedList->Clear();
+ xLockedList->clear();
ScHTMLAdjustStack aStack;
ScHTMLAdjustStackEntry* pS;
USHORT nTab = 0;
@@ -2039,7 +2038,9 @@ ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos ) const
{
ScHTMLSize aSpan( 1, 1 );
ScRange* pRange = 0;
- if( ((pRange = maVMergedCells.Find( rCellPos.MakeAddr() )) != 0) || ((pRange = maHMergedCells.Find( rCellPos.MakeAddr() )) != 0) )
+ if( ( (pRange = maVMergedCells.Find( rCellPos.MakeAddr() ) ) != 0)
+ || ( (pRange = maHMergedCells.Find( rCellPos.MakeAddr() ) ) != 0)
+ )
aSpan.Set( pRange->aEnd.Col() - pRange->aStart.Col() + 1, pRange->aEnd.Row() - pRange->aStart.Row() + 1 );
return aSpan;
}
@@ -2621,8 +2622,11 @@ void ScHTMLTable::FillEmptyCells()
aIter->FillEmptyCells();
// insert the final vertically merged ranges into maUsedCells
- for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next() )
+ for ( size_t i = 0, nRanges = maVMergedCells.size(); i < nRanges; ++i )
+ {
+ ScRangePtr pRange = maVMergedCells[ i ];
maUsedCells.Join( *pRange );
+ }
for( ScAddress aAddr; aAddr.Row() < maSize.mnRows; aAddr.IncRow() )
{
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index de10f90..faf87b4 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1216,9 +1216,9 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
String sText;
double fVal;
- for( UINT32 nRange = 0; (nRange < pRList->Count()) && bContLoop; nRange++ )
+ for( size_t nRange = 0; (nRange < pRList->size()) && bContLoop; nRange++ )
{
- const ScRange* pRange = pRList->GetObject( nRange );
+ const ScRange* pRange = pRList->at( nRange );
for( nRow = pRange->aStart.Row(); (nRow <= pRange->aEnd.Row()) && bContLoop; nRow++ )
for( nCol = pRange->aStart.Col(); (nCol <= pRange->aEnd.Col()) && bContLoop; nCol++ )
{
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index b4ad5c1..b22beed 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -65,54 +65,6 @@ ScMyStyleRanges::~ScMyStyleRanges()
delete pCurrencyList;
}
-void ScMyStyleRanges::AddRange(const ScRange& rRange, ScRangeList* pList,
- const rtl::OUString* pStyleName, const sal_Int16 nType,
- ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
-{
- pList->Join(rRange);
- DBG_ASSERT(nMaxRanges > 0, "MaxRanges to less");
- if (pList->Count() > nMaxRanges)
- {
- sal_Int32 nCount(pList->Count());
- ScRange* pRange(NULL);
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- pRange = pList->GetObject(i);
- if (pRange && (pRange->aEnd.Row() + 1 < rRange.aStart.Row()))
- {
- rImport.SetStyleToRange(*pRange, pStyleName, nType, NULL);
- delete pRange;
- pRange = NULL;
- pList->Remove(i);
- }
- }
- }
-}
-
-void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, ScRangeListRef xList,
- const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
- ScXMLImport& rImport, const sal_uInt32 nMaxRanges)
-{
- xList->Join(rRange);
- DBG_ASSERT(nMaxRanges > 0, "MaxRanges to less");
- if (xList->Count() > nMaxRanges)
- {
- sal_Int32 nCount(xList->Count());
- ScRange* pRange(NULL);
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- pRange = xList->GetObject(i);
- if (pRange && (pRange->aEnd.Row() + 1 < rRange.aStart.Row()))
- {
- rImport.SetStyleToRange(*pRange, pStyleName, util::NumberFormat::CURRENCY, pCurrency);
- delete pRange;
- pRange = NULL;
- xList->Remove(i);
- }
- }
- }
-}
-
void ScMyStyleRanges::AddRange(const ScRange& rRange,
const rtl::OUString* /*pStyleName*/, const sal_Int16 nType,
ScXMLImport& /*rImport*/, const sal_uInt32 /*nMaxRanges*/)
@@ -270,18 +222,16 @@ void ScMyStyleRanges::SetStylesToRanges(ScRangeList* pList,
const rtl::OUString* pStyleName, const sal_Int16 nCellType,
const rtl::OUString* pCurrency, ScXMLImport& rImport)
{
- sal_Int32 nCount(pList->Count());
- for (sal_Int32 i = 0; i < nCount; ++i)
- rImport.SetStyleToRange(*pList->GetObject(i), pStyleName, nCellType, pCurrency);
+ for ( size_t i = 0, nCount = pList->size(); i < nCount; ++i)
+ rImport.SetStyleToRange( *pList->at(i), pStyleName, nCellType, pCurrency );
}
void ScMyStyleRanges::SetStylesToRanges(ScRangeListRef xList,
const rtl::OUString* pStyleName, const sal_Int16 nCellType,
const rtl::OUString* pCurrency, ScXMLImport& rImport)
{
- sal_Int32 nCount(xList->Count());
- for (sal_Int32 i = 0; i < nCount; ++i)
- rImport.SetStyleToRange(*xList->GetObject(i), pStyleName, nCellType, pCurrency);
+ for (size_t i = 0, nCount = xList->size(); i < nCount; ++i)
+ rImport.SetStyleToRange( *xList->at(i), pStyleName, nCellType, pCurrency );
}
void ScMyStyleRanges::SetStylesToRanges(const rtl::OUString* pStyleName, ScXMLImport& rImport)
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 526959f..677ff57 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -105,12 +105,6 @@ class ScMyStyleRanges : public SvRefBase
::boost::shared_ptr<ScSimpleRangeList> mpUndefinedList;
ScMyCurrencyStylesSet* pCurrencyList;
- void AddRange(const ScRange& rRange, ScRangeList* pList,
- const rtl::OUString* pStyleName, const sal_Int16 nType,
- ScXMLImport& rImport, const sal_uInt32 nMaxRanges);
- void AddCurrencyRange(const ScRange& rRange, ScRangeListRef xList,
- const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
- ScXMLImport& rImport, const sal_uInt32 nMaxRanges);
void SetStylesToRanges(const ::std::list<ScRange>& rList,
const rtl::OUString* pStyleName, const sal_Int16 nCellType,
const rtl::OUString* pCurrency, ScXMLImport& rImport);
diff --git a/sc/source/filter/xml/xmlsceni.cxx b/sc/source/filter/xml/xmlsceni.cxx
index 5e2d19b..a81eada 100644
--- a/sc/source/filter/xml/xmlsceni.cxx
+++ b/sc/source/filter/xml/xmlsceni.cxx
@@ -163,9 +163,9 @@ void ScXMLTableScenarioContext::EndElement()
if( bProtected )
nFlags |= SC_SCENARIO_PROTECT;
pDoc->SetScenarioData( nCurrTable, String( sComment ), aBorderColor, nFlags );
- for( sal_Int32 i = 0; i < static_cast<sal_Int32>(aScenarioRanges.Count()); ++i )
+ for( size_t i = 0; i < aScenarioRanges.size(); ++i )
{
- ScRange* pRange(aScenarioRanges.GetObject( i ));
+ ScRange* pRange(aScenarioRanges[ i ]);
if( pRange )
pDoc->ApplyFlagsTab( pRange->aStart.Col(), pRange->aStart.Row(),
pRange->aEnd.Col(), pRange->aEnd.Row(), nCurrTable, SC_MF_SCENARIO );
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 49e345a..06f8d9c 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -270,14 +270,6 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
else
mbDelIns = sal_False;
}
- // no longer needed, because the document calls the VisAreaChanged method
-/* else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
- CommitChange(aEvent);*/
// commented out, because to use a ModelChangeEvent is not the right way
// at the moment there is no way, but the Java/Gnome Api should be extended sometime
/* if (mpViewShell)
@@ -296,15 +288,6 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
CommitTableModelChange(aNewPos.Top(), aNewPos.Left(), aNewPos.Bottom(), aNewPos.Right(), AccessibleTableModelChangeType::UPDATE);
}
}*/
- // no longer needed, because the document calls the BoundingBoxChanged method
-/* else if (rRef.GetId() == SC_HINT_ACC_WINDOWRESIZED)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
- CommitChange(aEvent);
- }*/
}
else if (rHint.ISA( ScUpdateRefHint ))
{
@@ -781,9 +764,9 @@ void ScAccessibleSpreadsheet::CreateSortedMarkedCells()
{
mpSortedMarkedCells = new std::vector<ScMyAddress>();
mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount());
- ScRange* pRange = mpMarkedRanges->First();
- while (pRange)
+ for ( size_t i = 0, ListSize = mpMarkedRanges->size(); i < ListSize; ++i )
{
+ ScRangePtr pRange = mpMarkedRanges->at( i );
if (pRange->aStart.Tab() != pRange->aEnd.Tab())
{
if ((maActiveCell.Tab() >= pRange->aStart.Tab()) ||
@@ -805,7 +788,6 @@ void ScAccessibleSpreadsheet::CreateSortedMarkedCells()
{
DBG_ERROR("Range of wrong table");
}
- pRange = mpMarkedRanges->Next();
}
std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end());
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 2a5fee5..7ec14c7 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -273,11 +273,11 @@ sal_Bool ScInputWindow::UseSubTotal(ScRangeList* pRangeList) const
if ( pViewSh )
{
ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
- sal_Int32 nRangeCount (pRangeList->Count());
- sal_Int32 nRangeIndex (0);
+ size_t nRangeCount (pRangeList->size());
+ size_t nRangeIndex (0);
while (!bSubTotal && nRangeIndex < nRangeCount)
{
- const ScRange* pRange = pRangeList->GetObject( nRangeIndex );
+ const ScRange* pRange = pRangeList->at( nRangeIndex );
if( pRange )
{
SCTAB nTabEnd(pRange->aEnd.Tab());
@@ -310,7 +310,7 @@ sal_Bool ScInputWindow::UseSubTotal(ScRangeList* pRangeList) const
nRangeIndex = 0;
while (!bSubTotal && nRangeIndex < nRangeCount)
{
- const ScRange* pRange = pRangeList->GetObject( nRangeIndex );
+ const ScRange* pRange = pRangeList->at( nRangeIndex );
if( pRange )
{
ScRange aDBArea;
@@ -375,10 +375,10 @@ void __EXPORT ScInputWindow::Select()
// check if one of the marked ranges is empty
bool bEmpty = false;
- const ULONG nCount = aMarkRangeList.Count();
- for ( ULONG i = 0; i < nCount; ++i )
+ const size_t nCount = aMarkRangeList.size();
+ for ( size_t i = 0; i < nCount; ++i )
{
- const ScRange aRange( *aMarkRangeList.GetObject( i ) );
+ const ScRange aRange( *aMarkRangeList.at( i ) );
if ( pDoc->IsBlockEmpty( aRange.aStart.Tab(),
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row() ) )
@@ -394,7 +394,7 @@ void __EXPORT ScInputWindow::Select()
const BOOL bDataFound = pViewSh->GetAutoSumArea( aRangeList );
if ( bDataFound )
{
- ScAddress aAddr = aRangeList.Last()->aEnd;
+ ScAddress aAddr = aRangeList.back()->aEnd;
aAddr.IncRow();
const sal_Bool bSubTotal( UseSubTotal( &aRangeList ) );
pViewSh->EnterAutoSum( aRangeList, bSubTotal, aAddr );
@@ -403,9 +403,9 @@ void __EXPORT ScInputWindow::Select()
else
{
const sal_Bool bSubTotal( UseSubTotal( &aMarkRangeList ) );
- for ( ULONG i = 0; i < nCount; ++i )
+ for ( size_t i = 0; i < nCount; ++i )
{
- const ScRange aRange( *aMarkRangeList.GetObject( i ) );
+ const ScRange aRange( *aMarkRangeList.at( i ) );
const bool bSetCursor = ( i == nCount - 1 ? true : false );
const bool bContinue = ( i != 0 ? true : false );
if ( !pViewSh->AutoSum( aRange, bSubTotal, bSetCursor, bContinue ) )
diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx
index 9831a8b..9a9d5fc 100644
--- a/sc/source/ui/app/rfindlst.cxx
+++ b/sc/source/ui/app/rfindlst.cxx
@@ -59,7 +59,7 @@ ScRangeFindList::~ScRangeFindList()
}
}
-ColorData ScRangeFindList::GetColorName( USHORT nIndex ) // static
+ColorData ScRangeFindList::GetColorName( size_t nIndex ) // static
{
return aColNames[nIndex % SC_RANGECOLORS];
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index a414a73..8557360 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -547,13 +547,14 @@ static void lcl_collectAllPredOrSuccRanges(
ScDocument* pDoc = rDocShell.GetDocument();
vector<ScSharedTokenRef> aRefTokens;
ScRangeList aSrcRanges(rSrcRanges);
- ScRange* p = aSrcRanges.First();
- if (!p)
+ if ( aSrcRanges.empty() )
return;
+ ScRangePtr p = aSrcRanges.front();
ScDetectiveFunc aDetFunc(pDoc, p->aStart.Tab());
ScRangeList aDestRanges;
- for (; p; p = aSrcRanges.Next())
+ for ( size_t i = 1, ListSize = aSrcRanges.size(); i < ListSize; ++i )
{
+ p = aSrcRanges[ i ];
if (bPred)
{
aDetFunc.GetAllPreds(
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 543e4c9..7cb19d4 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -261,11 +261,10 @@ void ScDocShell::UnlockPaint_Impl(BOOL bDoc)
if (xRangeList)
{
USHORT nParts = pPaint->GetParts();
- ULONG nCount = xRangeList->Count();
- for ( ULONG i=0; i<nCount; i++ )
+ for ( size_t i = 0, nCount = xRangeList->size(); i < nCount; i++ )
{
//! nExtFlags ???
- ScRange aRange = *xRangeList->GetObject(i);
+ ScRange aRange = *xRangeList->at( i );
PostPaint( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab(),
aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab(),
nParts );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 0814c05..24c18bf 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -345,10 +345,10 @@ void ScDocShell::Execute( SfxRequest& rReq )
{
aRangeListRef = new ScRangeList;
aRangeListRef->Parse( aRangeName, pDoc );
- if ( aRangeListRef->Count() )
+ if ( !aRangeListRef->empty() )
{
bMultiRange = TRUE;
- aSingleRange = *aRangeListRef->GetObject(0); // fuer Header
+ aSingleRange = *aRangeListRef->front(); // fuer Header
bValid = TRUE;
}
else
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 47e2378..85dbdbe 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -407,7 +407,7 @@ void ScExternalRefCache::Table::setCachedCell(SCCOL nCol, SCROW nRow)
void ScExternalRefCache::Table::setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
{
ScRange aRange(nCol1, nRow1, 0, nCol2, nRow2, 0);
- if (!maCachedRanges.Count())
+ if ( maCachedRanges.empty() )
maCachedRanges.Append(aRange);
else
maCachedRanges.Join(aRange);
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index a656ee0..dcb4629 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -341,7 +341,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
pCell = aCellIter.GetNext();
}
- ULONG nRanges = aErrorCells.Count();
+ size_t nRanges = aErrorCells.size();
if ( nRanges ) // found any?
{
ScTokenArray aTokenArr;
@@ -350,9 +350,9 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
aTokenArr.AddOpCode( ocClose );
aTokenArr.AddOpCode( ocStop );
- for (ULONG nPos=0; nPos<nRanges; nPos++)
+ for (size_t nPos=0; nPos < nRanges; nPos++)
{
- const ScRange* pRange = aErrorCells.GetObject(nPos);
+ const ScRange* pRange = aErrorCells[ nPos ];
SCCOL nStartCol = pRange->aStart.Col();
SCROW nStartRow = pRange->aStart.Row();
SCCOL nEndCol = pRange->aEnd.Col();
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index d2bd1c7..ff12660 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -162,7 +162,7 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
// use ScChartPositioner to auto-detect column/row headers (like ScChartArray in old version)
ScRangeListRef aRangeListRef( new ScRangeList );
aRangeListRef->Parse( aRangeString, pScDoc );
- if ( aRangeListRef->Count() )
+ if ( !aRangeListRef->empty() )
{
pScDoc->LimitChartIfAll( aRangeListRef ); // limit whole columns/rows to used area
@@ -532,12 +532,13 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
aRangeString = aStr;
// get "total" range for positioning
- ULONG nCount = aRanges.Count();
- if ( nCount > 0 )
+ if ( !aRanges.empty() )
{
- aPositionRange = *aRanges.GetObject(0);
- for (ULONG i=1; i<nCount; i++)
- aPositionRange.ExtendTo( *aRanges.GetObject(i) );
+ aPositionRange = *aRanges[ 0 ];
+ for ( size_t i = 1, nCount = aRanges.size(); i < nCount; ++i )
+ {
+ aPositionRange.ExtendTo( *aRanges[ i ] );
+ }
}
if(bAutomaticMark)
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 1175d93..f71e11a 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -50,7 +50,7 @@ class ScRangeFindList
{
List aEntries;
String aDocName;
- BOOL bHidden;
+ bool bHidden;
public:
ScRangeFindList(const String& rName);
@@ -64,9 +64,9 @@ public:
void SetHidden( BOOL bSet ) { bHidden = bSet; }
const String& GetDocName() const { return aDocName; }
- BOOL IsHidden() const { return bHidden; }
+ bool IsHidden() const { return bHidden; }
- static ColorData GetColorName( USHORT nIndex );
+ static ColorData GetColorName( size_t nIndex );
};
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 425b391..f74d8e7 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -296,11 +296,11 @@ void __EXPORT ScAcceptChgDlg::Init()
pTPFilter->CheckRange(aChangeViewSet.HasRange());
- ScRange* pRangeEntry=aChangeViewSet.GetTheRangeList().GetObject(0);
aRangeList=aChangeViewSet.GetTheRangeList();
- if(pRangeEntry!=NULL)
+ if( !aChangeViewSet.GetTheRangeList().empty() )
{
+ ScRangePtr pRangeEntry = aChangeViewSet.GetTheRangeList().front();
String aRefStr;
pRangeEntry->Format( aRefStr, ABS_DREF3D, pDoc );
pTPFilter->SetRange(aRefStr);
@@ -394,17 +394,13 @@ BOOL ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
{
if(pTPFilter->IsRange())
{
- ScRange* pRangeEntry=aRangeList.First();
-
- while(pRangeEntry!=NULL)
- {
- if(pRangeEntry->Intersects(aRef)) break;
- pRangeEntry=aRangeList.Next();
- }
-
- if(pRangeEntry!=NULL)
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
- bFlag=TRUE;
+ ScRangePtr pRangeEntry = aRangeList[ i ];
+ if (pRangeEntry->Intersects(aRef)) {
+ bFlag = TRUE;
+ break;
+ }
}
}
else
@@ -520,18 +516,15 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction(const ScChangeAction* pScChangeA
{
if(pTPFilter->IsRange())
{
- ScRange* pRangeEntry=aRangeList.First();
-
- while(pRangeEntry!=NULL)
- {
- if(pRangeEntry->Intersects(aRef)) break;
- pRangeEntry=aRangeList.Next();
- }
- //SC_CAS_VIRGIN,SC_CAS_ACCEPTED,SC_CAS_REJECTED
- if(pRangeEntry!=NULL)
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
- bHasFilterEntry=TRUE;
- bFlag=TRUE;
+ ScRangePtr pRangeEntry = aRangeList[ i ];
+ if( pRangeEntry->Intersects(aRef) )
+ {
+ bHasFilterEntry=TRUE;
+ bFlag=TRUE;
+ break;
+ }
}
}
else if(!bIsGenerated)
@@ -590,18 +583,15 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction(const ScChangeAction* pScChang
{
if(pTPFilter->IsRange())
{
- ScRange* pRangeEntry=aRangeList.First();
-
- while(pRangeEntry!=NULL)
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
- if(pRangeEntry->Intersects(aRef)) break;
- pRangeEntry=aRangeList.Next();
- }
- //SC_CAS_VIRGIN,SC_CAS_ACCEPTED,SC_CAS_REJECTED
- if(pRangeEntry!=NULL &&
- pScChangeAction->GetState()==eState)
- {
- bFlag=TRUE;
+ ScRangePtr pRangeEntry=aRangeList[ i ];
+ if( pRangeEntry->Intersects(aRef) )
+ {
+ if( pScChangeAction->GetState()==eState )
+ bFlag=TRUE;
+ break;
+ }
}
}
else if(pScChangeAction->GetState()==eState && !bIsGenerated)
@@ -719,17 +709,14 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionConte
{
if(pTPFilter->IsRange())
{
- ScRange* pRangeEntry=aRangeList.First();
-
- while(pRangeEntry!=NULL)
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
- if(pRangeEntry->Intersects(aRef)) break;
- pRangeEntry=aRangeList.Next();
- }
- //SC_CAS_VIRGIN,SC_CAS_ACCEPTED,SC_CAS_REJECTED
- if(pRangeEntry!=NULL)
- {
- bFlag=TRUE;
+ ScRange* pRangeEntry = aRangeList[ i ];
+ if( pRangeEntry->Intersects(aRef) )
+ {
+ bFlag=TRUE;
+ break;
+ }
}
}
else if(!bIsGenerated)
@@ -1036,7 +1023,7 @@ IMPL_LINK( ScAcceptChgDlg, FilterHandle, SvxTPFilter*, pRef )
if(pRef!=NULL)
{
ClearView();
- aRangeList.Clear();
+ aRangeList.clear();
aRangeList.Parse(pTPFilter->GetRange(),pDoc);
UpdateView();
}
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 54ceb60..7138938 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -61,9 +61,9 @@
#include "global.hxx"
#include "inputopt.hxx"
#include "rangeutl.hxx"
-
-ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindings* _pBindings)
+
+ScFormulaReferenceHelper::ScFormulaReferenceHelper(IAnyRefDialog* _pDlg,SfxBindings* _pBindings)
: m_pDlg(_pDlg)
, pRefEdit (NULL)
, m_pWindow(NULL)
@@ -131,7 +131,7 @@ void ScFormulaReferenceHelper::enableInput( BOOL bEnable )
// -----------------------------------------------------------------------------
void ScFormulaReferenceHelper::ShowSimpleReference( const XubString& rStr )
{
- if( /*!pRefEdit &&*/ bEnableColorRef )
+ if( bEnableColorRef )
{
bHighLightRef=TRUE;
ScViewData* pViewData=ScDocShell::GetViewData();
@@ -147,16 +147,12 @@ void ScFormulaReferenceHelper::ShowSimpleReference( const XubString& rStr )
if( ParseWithNames( aRangeList, rStr, pDoc ) )
{
- ScRange* pRangeEntry = aRangeList.First();
-
- USHORT nIndex=0;
- while(pRangeEntry != NULL)
+ for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
{
- ColorData aColName = ScRangeFindList::GetColorName(nIndex++);
- pTabViewShell->AddHighlightRange(*pRangeEntry, aColName);
-
- pRangeEntry = aRangeList.Next();
- }
+ ScRangePtr pRangeEntry = aRangeList[ i ];
+ ColorData aColName = ScRangeFindList::GetColorName( i );
+ pTabViewShell->AddHighlightRange( *pRangeEntry, aColName );
+ }
}
}
}
@@ -165,7 +161,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference( const XubString& rStr )
bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const String& rStr, ScDocument* pDoc )
{
bool bError = false;
- rRanges.RemoveAll();
+ rRanges.clear();
ScAddress::Details aDetails(pDoc->GetAddressConvention(), 0, 0);
ScRangeUtil aRangeUtil;
@@ -187,7 +183,7 @@ bool ScFormulaReferenceHelper::ParseWithNames( ScRangeList& rRanges, const Strin
else if ( aRangeUtil.MakeRangeFromName( aRangeStr, pDoc, nRefTab, aRange, RUTL_NAMES, aDetails ) )
rRanges.Append( aRange );
else
- bError = true;
+ bError = true;
}
return !bError;
@@ -317,9 +313,9 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit, formula::R
ScRangeList aRangeList;
if( ParseWithNames( aRangeList, pRefEdit->GetText(), pDoc ) )
{
- const ScRange* pRange = aRangeList.GetObject( 0 );
- if( pRange )
+ if ( !aRangeList.empty() )
{
+ const ScRangePtr pRange = aRangeList.front();
pViewShell->SetTabNo( pRange->aStart.Tab() );
pViewShell->MoveCursorAbs( pRange->aStart.Col(),
pRange->aStart.Row(), SC_FOLLOW_JUMP, FALSE, FALSE );
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index cd503a9..1b5f211 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -162,12 +162,11 @@ void __EXPORT ScHighlightChgDlg::Init()
}
aFilterCtr.CheckRange(aChangeViewSet.HasRange());
- ScRange* pRangeEntry=aChangeViewSet.GetTheRangeList().GetObject(0);
-
- if(pRangeEntry!=NULL)
+ if ( !aChangeViewSet.GetTheRangeList().empty() )
{
String aRefStr;
+ ScRangePtr pRangeEntry = aChangeViewSet.GetTheRangeList().front();
pRangeEntry->Format( aRefStr, ABS_DREF3D, pDoc );
aFilterCtr.SetRange(aRefStr);
}
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 1293363..c4a4e5b 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -841,10 +841,10 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
}
uno::Sequence<table::CellAddress> aVariables;
sal_Int32 nVarPos = 0;
- ULONG nRangeCount = aVarRanges.Count();
- for (ULONG nRangePos=0; nRangePos<nRangeCount; ++nRangePos)
+
+ for ( size_t nRangePos=0, nRange = aVarRanges.size(); nRangePos < nRange; ++nRangePos )
{
- ScRange aRange(*aVarRanges.GetObject(nRangePos));
+ ScRange aRange(*aVarRanges[ nRangePos ] );
aRange.Justify();
SCTAB nTab = aRange.aStart.Tab();
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index c46a59d..c4604f6 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -2175,26 +2175,18 @@ void ScUndoRemoveMerge::SetCurTab()
ScRange lcl_TotalRange( const ScRangeList& rRanges )
{
ScRange aTotal;
- ULONG nCount = rRanges.Count();
- for (ULONG i=0; i<nCount; i++)
+ if ( !rRanges.empty() )
{
- ScRange aRange = *rRanges.GetObject(i);
- if (i==0)
- aTotal = aRange;
- else
+ aTotal = *rRanges[ 0 ];
+ for ( size_t i = 1, nCount = rRanges.size(); i < nCount; ++i )
{
- if (aRange.aStart.Col() < aTotal.aStart.Col())
- aTotal.aStart.SetCol(aRange.aStart.Col());
- if (aRange.aStart.Row() < aTotal.aStart.Row())
- aTotal.aStart.SetRow(aRange.aStart.Row());
- if (aRange.aStart.Tab() < aTotal.aStart.Tab())
- aTotal.aStart.SetTab(aRange.aStart.Tab());
- if (aRange.aEnd.Col() > aTotal.aEnd.Col())
- aTotal.aEnd.SetCol(aRange.aEnd.Col());
- if (aRange.aEnd.Row() > aTotal.aEnd.Row())
- aTotal.aEnd.SetRow(aRange.aEnd.Row());
- if (aRange.aEnd.Tab() > aTotal.aEnd.Tab())
- aTotal.aEnd.SetTab(aRange.aEnd.Tab());
+ ScRange aRange = *rRanges[ i ];
+ if (aRange.aStart.Col() < aTotal.aStart.Col()) aTotal.aStart.SetCol(aRange.aStart.Col());
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list