[Libreoffice-commits] .: 2 commits - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Dec 10 09:47:10 PST 2010
sc/source/core/tool/rangelst.cxx | 57 ++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 27 deletions(-)
New commits:
commit a4eb457a8d546525624df3830a761cb30d29b04e
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Dec 10 12:45:49 2010 -0500
More on using iterators over element access operator.
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 2cc3af7..7688974 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -330,36 +330,39 @@ bool ScRangeList::UpdateReference(
SCsTAB nDz
)
{
+ if (maRanges.empty())
+ // No ranges to update. Bail out.
+ return false;
+
bool bChanged = false;
- if ( !maRanges.empty() )
+ SCCOL nCol1;
+ SCROW nRow1;
+ SCTAB nTab1;
+ SCCOL nCol2;
+ SCROW nRow2;
+ SCTAB nTab2;
+ rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+
+ vector<ScRange*>::iterator itr = maRanges.begin(), itrEnd = maRanges.end();
+ for (; itr != itrEnd; ++itr)
{
- SCCOL nCol1;
- SCROW nRow1;
- SCTAB nTab1;
- SCCOL nCol2;
- SCROW nRow2;
- SCTAB nTab2;
- rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
+ ScRange* pR = *itr;
+ SCCOL theCol1;
+ SCROW theRow1;
+ SCTAB theTab1;
+ SCCOL theCol2;
+ SCROW theRow2;
+ SCTAB theTab2;
+ pR->GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
+ if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
+ nCol1, nRow1, nTab1, nCol2, nRow2, nTab2,
+ nDx, nDy, nDz,
+ theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 )
+ != UR_NOTHING )
{
- ScRangePtr pR = maRanges[i];
- SCCOL theCol1;
- SCROW theRow1;
- SCTAB theTab1;
- SCCOL theCol2;
- SCROW theRow2;
- SCTAB theTab2;
- pR->GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
- if ( ScRefUpdate::Update( pDoc, eUpdateRefMode,
- nCol1, nRow1, nTab1, nCol2, nRow2, nTab2,
- nDx, nDy, nDz,
- theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 )
- != UR_NOTHING )
- {
- bChanged = true;
- pR->aStart.Set( theCol1, theRow1, theTab1 );
- pR->aEnd.Set( theCol2, theRow2, theTab2 );
- }
+ bChanged = true;
+ pR->aStart.Set( theCol1, theRow1, theTab1 );
+ pR->aEnd.Set( theCol2, theRow2, theTab2 );
}
}
return bChanged;
commit 5378b3f4e225fc9738678bcb7dbd253142b95358
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Dec 10 12:37:19 2010 -0500
Access data member directly if we can.
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index d5028e5..2cc3af7 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -342,7 +342,7 @@ bool ScRangeList::UpdateReference(
rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges; ++i )
{
- ScRangePtr pR = at( i );
+ ScRangePtr pR = maRanges[i];
SCCOL theCol1;
SCROW theRow1;
SCTAB theTab1;
More information about the Libreoffice-commits
mailing list