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@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
committed by
Eike Rathke
parent
02a10e6bdd
commit
99df39b520
@@ -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,
|
||||
|
||||
@@ -275,15 +275,23 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user