[Libreoffice-commits] .: 2 commits - sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 19 07:53:14 PST 2012
sc/source/core/data/clipparam.cxx | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
New commits:
commit 40af27d941ab578a341eefc63163b92d399262e7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Dec 19 16:55:35 2012 +0100
even simpler way to get the whole range
diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx
index 002e0c4..3935141 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -112,28 +112,7 @@ SCROW ScClipParam::getPasteRowSize()
ScRange ScClipParam::getWholeRange() const
{
- ScRange aWhole;
- size_t nRangeSize = maRanges.size();
- if (nRangeSize < 1)
- return aWhole;
- aWhole = *maRanges[0];
- for ( size_t i = 1; i < nRangeSize; ++i )
- {
- const ScRange* p = maRanges[i];
-
- if (aWhole.aStart.Col() > p->aStart.Col())
- aWhole.aStart.SetCol(p->aStart.Col());
-
- if (aWhole.aStart.Row() > p->aStart.Row())
- aWhole.aStart.SetRow(p->aStart.Row());
-
- if (aWhole.aEnd.Col() < p->aEnd.Col())
- aWhole.aEnd.SetCol(p->aEnd.Col());
-
- if (aWhole.aEnd.Row() < p->aEnd.Row())
- aWhole.aEnd.SetRow(p->aEnd.Row());
- }
- return aWhole;
+ return maRanges.Combine();
}
void ScClipParam::transpose()
commit 94deef9b29346a027b88f934b0ca83ef6a8bf846
Author: Rodolfo Ribeiro Gomes <rodolforg at gmail.com>
Date: Wed Dec 19 12:50:59 2012 -0200
Little optimisation when getting the whole range
Just avoid "if" statement every iteration since the condition
is true only at the first run
Change-Id: I0f2f93196b2b28d457dfbb7b18f568abb45adcbb
diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx
index 37094b6..002e0c4 100644
--- a/sc/source/core/data/clipparam.cxx
+++ b/sc/source/core/data/clipparam.cxx
@@ -113,16 +113,13 @@ SCROW ScClipParam::getPasteRowSize()
ScRange ScClipParam::getWholeRange() const
{
ScRange aWhole;
- bool bFirst = true;
- for ( size_t i = 0, n = maRanges.size(); i < n; ++i )
+ size_t nRangeSize = maRanges.size();
+ if (nRangeSize < 1)
+ return aWhole;
+ aWhole = *maRanges[0];
+ for ( size_t i = 1; i < nRangeSize; ++i )
{
const ScRange* p = maRanges[i];
- if (bFirst)
- {
- aWhole = *p;
- bFirst = false;
- continue;
- }
if (aWhole.aStart.Col() > p->aStart.Col())
aWhole.aStart.SetCol(p->aStart.Col());
More information about the Libreoffice-commits
mailing list