[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/inc sc/source
Dennis Francis (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 12 09:29:36 UTC 2021
sc/inc/column.hxx | 2 -
sc/inc/document.hxx | 2 -
sc/inc/table.hxx | 2 -
sc/source/core/data/column3.cxx | 54 ++++++++++++---------------------------
sc/source/core/data/documen3.cxx | 8 ++---
sc/source/core/data/table3.cxx | 4 +-
sc/source/ui/app/inputhdl.cxx | 2 -
sc/source/ui/view/gridwin.cxx | 2 -
8 files changed, 28 insertions(+), 48 deletions(-)
New commits:
commit da74573e40c853308411fafddfe45ae6344117d8
Author: Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Mon May 10 17:56:34 2021 +0530
Commit: Dennis Francis <dennis.francis at collabora.com>
CommitDate: Wed May 12 11:29:01 2021 +0200
autoinput: remove search/entry count limits
Change-Id: Ib41f7c04b9a3802982105cbbfef3ae638bdb286f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115345
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Dennis Francis <dennis.francis at collabora.com>
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 64485ccd5f2c..38d47910a6b0 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -537,7 +537,7 @@ public:
sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
ScFilterEntries& rFilterEntries );
- bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
+ bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings) const;
void UpdateInsertTabAbs(SCTAB nNewPos);
bool TestTabRefAbs(SCTAB nTable) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 4d385e97d0c9..8c3c2ec79431 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2061,7 +2061,7 @@ public:
ScFilterEntries& rFilterEntries );
void GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
- std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
+ std::vector<ScTypedStrData>& rStrings, bool bValidation = false );
void GetFormulaEntries( ScTypedCaseStrSet& rStrings );
bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 8fa962081a05..47650bc82509 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -948,7 +948,7 @@ public:
void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, ScFilterEntries& rFilterEntries );
[[nodiscard]]
- bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
+ bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings);
bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 0f7ccf19a187..b9232f334644 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2660,14 +2660,8 @@ public:
}
// GetDataEntries - Strings from continuous Section around nRow
-
-// DATENT_MAX - max. number of entries in list for auto entry
-// DATENT_SEARCH - max. number of cells that get transparent - new: only count Strings
-#define DATENT_MAX 200
-#define DATENT_SEARCH 2000
-
bool ScColumn::GetDataEntries(
- SCROW nStartRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const
+ SCROW nStartRow, std::set<ScTypedStrData>& rStrings) const
{
// Start at the specified row position, and collect all string values
// going upward and downward directions in parallel. The start position
@@ -2685,44 +2679,30 @@ bool ScColumn::GetDataEntries(
bMoveDown = aItrDown.next(); // Find the next string cell position.
bool bFound = false;
- size_t nCellsSearched = 0;
- while (bMoveUp || bMoveDown)
+ while (bMoveUp)
{
- if (bMoveUp)
+ // Get the current string and move up.
+ OUString aStr = aItrUp.get();
+ if (!aStr.isEmpty())
{
- // Get the current string and move up.
- OUString aStr = aItrUp.get();
- if (!aStr.isEmpty())
- {
- bool bInserted = rStrings.insert(ScTypedStrData(aStr)).second;
- if (bInserted && bLimit && rStrings.size() >= DATENT_MAX)
- return true; // Maximum reached
+ if (rStrings.insert(ScTypedStrData(aStr)).second)
bFound = true;
- }
-
- if (bLimit && ++nCellsSearched >= DATENT_SEARCH)
- return bFound; // max search cell count reached.
-
- bMoveUp = aItrUp.prev();
}
- if (bMoveDown)
+ bMoveUp = aItrUp.prev();
+ }
+
+ while (bMoveDown)
+ {
+ // Get the current string and move down.
+ OUString aStr = aItrDown.get();
+ if (!aStr.isEmpty())
{
- // Get the current string and move down.
- OUString aStr = aItrDown.get();
- if (!aStr.isEmpty())
- {
- bool bInserted = rStrings.insert(ScTypedStrData(aStr)).second;
- if (bInserted && bLimit && rStrings.size() >= DATENT_MAX)
- return true; // Maximum reached
+ if (rStrings.insert(ScTypedStrData(aStr)).second)
bFound = true;
- }
-
- if (bLimit && ++nCellsSearched >= DATENT_SEARCH)
- return bFound; // max search cell count reached.
-
- bMoveDown = aItrDown.next();
}
+
+ bMoveDown = aItrDown.next();
}
return bFound;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 783bac66f2fd..c463a17f7a48 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1582,12 +1582,12 @@ void ScDocument::GetFilterEntriesArea(
*/
void ScDocument::GetDataEntries(
SCCOL nCol, SCROW nRow, SCTAB nTab,
- std::vector<ScTypedStrData>& rStrings, bool bLimit )
+ std::vector<ScTypedStrData>& rStrings, bool bValidation )
{
- if( !bLimit )
+ if( bValidation )
{
/* Try to generate the list from list validation. This part is skipped,
- if bLimit==true, because in that case this function is called to get
+ if bValidation==false, because in that case this function is called to get
cell values for auto completion on input. */
sal_uInt32 nValidation = GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue();
if( nValidation )
@@ -1610,7 +1610,7 @@ void ScDocument::GetDataEntries(
return;
std::set<ScTypedStrData> aStrings;
- if (maTabs[nTab]->GetDataEntries(nCol, nRow, aStrings, bLimit))
+ if (maTabs[nTab]->GetDataEntries(nCol, nRow, aStrings))
{
rStrings.insert(rStrings.end(), aStrings.begin(), aStrings.end());
sortAndRemoveDuplicates(rStrings, true/*bCaseSens*/);
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index c27c73fb88e1..a2357d352225 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3477,9 +3477,9 @@ void ScTable::GetFilteredFilterEntries(
}
}
-bool ScTable::GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit)
+bool ScTable::GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings)
{
- return aCol[nCol].GetDataEntries( nRow, rStrings, bLimit );
+ return aCol[nCol].GetDataEntries( nRow, rStrings);
}
sal_uLong ScTable::GetCellCount() const
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 209992c6a1e5..91a5679ddcf2 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1921,7 +1921,7 @@ void ScInputHandler::GetColData()
std::vector<ScTypedStrData> aEntries;
rDoc.GetDataEntries(
- aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries, true);
+ aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries);
if (!aEntries.empty())
pColumnData->insert(aEntries.begin(), aEntries.end());
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a7ae6626325a..650ab56cf520 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1144,7 +1144,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
bool bEmpty = false;
std::vector<ScTypedStrData> aStrings; // case sensitive
// Fill List
- pDoc->GetDataEntries(nCol, nRow, nTab, aStrings);
+ pDoc->GetDataEntries(nCol, nRow, nTab, aStrings, true /* bValidation */);
if (aStrings.empty())
bEmpty = true;
More information about the Libreoffice-commits
mailing list