[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Laurent Godard
lgodard.libre at laposte.net
Tue Nov 4 05:21:22 PST 2014
sc/inc/table.hxx | 3 +++
sc/source/core/data/table6.cxx | 26 +++++++++++++++++++++-----
2 files changed, 24 insertions(+), 5 deletions(-)
New commits:
commit fd1b1a153516934699cd7d87437b13511c9f9d14
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Tue Nov 4 12:42:15 2014 +0100
calc ScTable::ReplaceAll : avoid calling GetLastDataPos uselessly
Change-Id: Ibb6fb9ea3e524a889de96f560e308a4aa54fa2af
Reviewed-on: https://gerrit.libreoffice.org/12248
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index e4e7218..cf02241 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -496,10 +496,14 @@ bool ScTable::ReplaceAll(
SCCOL nCol = 0;
SCROW nRow = -1;
+ SCCOL nLastCol;
+ SCROW nLastRow;
+ GetLastDataPos(nLastCol, nLastRow);
+
bool bEverFound = false;
while (true)
{
- bool bFound = Search(rSearchItem, nCol, nRow, rMark, rUndoStr, pUndoDoc);
+ bool bFound = Search(rSearchItem, nCol, nRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
if (bFound)
{
commit 99df39b5206be1d03416142c97e77ebfd823b9d5
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Mon Nov 3 17:19:35 2014 +0100
calc ScTable::SearchAll : avoid calling GetLastDataPos uselessly
in the loop we are in the same table
refactor ScTable::Search too
perfchek result for testSheetFindAll-Search value
before : 804252982
after : 229861999
Change-Id: I907f1260472bcc5d93b2c6425c342187a5f4c787
Reviewed-on: https://gerrit.libreoffice.org/12225
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index d396402..0b5adfa 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -994,6 +994,9 @@ private:
const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
+ bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
+ const SCCOL& nLastCol, const SCROW& nLastRow,
+ const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index d9140ed..e4e7218 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -276,14 +276,22 @@ void ScTable::SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bFo
bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
{
+ SCCOL nLastCol;
+ SCROW nLastRow;
+ GetLastDataPos(nLastCol, nLastRow);
+ return Search(rSearchItem, rCol, rRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
+}
+
+bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
+ const SCCOL& nLastCol, const SCROW& nLastRow,
+ const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
+{
bool bFound = false;
bool bAll = (rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL)
||(rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL);
SCCOL nCol = rCol;
SCROW nRow = rRow;
- SCCOL nLastCol;
- SCROW nLastRow;
- GetLastDataPos(nLastCol, nLastRow);
+
bool bSkipFiltered = !rSearchItem.IsSearchFiltered();
if (!bAll && rSearchItem.GetBackward())
{
@@ -429,9 +437,13 @@ bool ScTable::SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMar
SCROW nRow = -1;
bool bEverFound = false;
+ SCCOL nLastCol;
+ SCROW nLastRow;
+ GetLastDataPos(nLastCol, nLastRow);
+
do
{
- bFound = Search(rSearchItem, nCol, nRow, rMark, rUndoStr, pUndoDoc);
+ bFound = Search(rSearchItem, nCol, nRow, nLastCol, nLastRow, rMark, rUndoStr, pUndoDoc);
if (bFound)
{
bEverFound = true;
More information about the Libreoffice-commits
mailing list