diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/column.hxx | 2 | ||||
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/column3.cxx | 54 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 2 |
8 files changed, 28 insertions, 48 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 56791cfd5f61..197dc17d4134 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -541,7 +541,7 @@ public: sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow, ScFilterEntries& rFilterEntries, bool bFiltering ); - 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 f90e74e9c030..d314ea660cd6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2089,7 +2089,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 416cbb5d9337..2436b0ccac87 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -961,7 +961,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, bool bFiltering ); [[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 51bc475d135f..de6870a6a9c9 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2697,14 +2697,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 @@ -2722,44 +2716,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 b47c03c0e6fe..8de06d151d78 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1616,12 +1616,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 ) @@ -1644,7 +1644,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 54c0850931ee..552abe5b0370 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -3570,9 +3570,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 3082cdb83455..2ef4df79dc4e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1941,7 +1941,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 c6c1f5250bf3..92b3e31d75fe 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1166,7 +1166,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) bool bEmpty = false; std::vector<ScTypedStrData> aStrings; // case sensitive // Fill List - rDoc.GetDataEntries(nCol, nRow, nTab, aStrings); + rDoc.GetDataEntries(nCol, nRow, nTab, aStrings, true /* bValidation */); if (aStrings.empty()) bEmpty = true; |