[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/inc sc/qa sc/source

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Wed May 12 09:28:11 UTC 2021


 sc/inc/column.hxx                            |    1 
 sc/inc/document.hxx                          |    2 
 sc/inc/table.hxx                             |    2 
 sc/qa/unit/tiledrendering/tiledrendering.cxx |    8 +-
 sc/source/core/data/column3.cxx              |  108 ---------------------------
 sc/source/core/data/documen3.cxx             |   24 ------
 sc/source/core/data/table3.cxx               |    5 -
 sc/source/ui/app/inputhdl.cxx                |    4 -
 8 files changed, 8 insertions(+), 146 deletions(-)

New commits:
commit cbf77c8bcad7f6aedca288f1f04fafa730cd12c9
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Mon May 10 17:37:45 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Wed May 12 11:27:36 2021 +0200

    Revert "autocomplete from superblock of str/edittext"
    
    This reverts commit 1c39d881c365adf453ffb1b80a74788342088c1b
    and temporarily disables checks which ensures autocomplete do not
    autocomplete through empty blocks.
    
    Change-Id: Ia190c66c80dfedfa52ce7275b20234ef7d02c547
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115343
    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 bbf9bce9be73..64485ccd5f2c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -537,7 +537,6 @@ public:
         sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
         ScFilterEntries& rFilterEntries );
 
-    bool GetStringBlockEntries(SCROW nCursorRow, std::set<ScTypedStrData>& rStrings) const;
     bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
 
     void UpdateInsertTabAbs(SCTAB nNewPos);
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index aefdd253467c..4d385e97d0c9 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2060,8 +2060,6 @@ public:
                                             SCTAB nTab, bool bCaseSens,
                                             ScFilterEntries& rFilterEntries );
 
-    void              GetStringBlockEntries( SCCOL nCursorCol, SCROW nCursorRow, SCTAB nTab,
-                                             std::vector<ScTypedStrData>& rStrings) const;
     void              GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab,
                                       std::vector<ScTypedStrData>& rStrings, bool bLimit = false );
     void              GetFormulaEntries( ScTypedCaseStrSet& rStrings );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 437ee058f640..8fa962081a05 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -948,8 +948,6 @@ 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 GetStringBlockEntries(SCCOL nCursorCol, SCROW nCursorRow, std::set<ScTypedStrData>& rStrings) const;
-    [[nodiscard]]
     bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
 
     bool        HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index a058d7257bbc..f131766d4bd3 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2455,9 +2455,9 @@ void ScTiledRenderingTest::testAutoInputStringBlock()
     pDoc->SetEditText(ScAddress(0, 5, 0), rEE.CreateTextObject()); // A6
     pDoc->SetString(ScAddress(0, 6, 0), "ZZZ");  // A7
 
-    ScAddress aA1(0, 0, 0);
+    /*ScAddress aA1(0, 0, 0);
     lcl_typeCharsInCell("X", aA1.Col(), aA1.Row(), pView, pModelObj); // Type 'X' in A1
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("A1 should not autocomplete", OUString("X"), pDoc->GetString(aA1));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("A1 should not autocomplete", OUString("X"), pDoc->GetString(aA1));*/
 
     ScAddress aA3(0, 2, 0); // Adjacent to the string "superblock" A4:A7
     lcl_typeCharsInCell("X", aA3.Col(), aA3.Row(), pView, pModelObj); // Type 'X' in A3
@@ -2467,9 +2467,9 @@ void ScTiledRenderingTest::testAutoInputStringBlock()
     lcl_typeCharsInCell("X", aA7.Col(), aA7.Row(), pView, pModelObj); // Type 'X' in A7
     CPPUNIT_ASSERT_EQUAL_MESSAGE("A7 should autocomplete", OUString("XYZ"), pDoc->GetString(aA7));
 
-    ScAddress aA10(0, 9, 0);
+    /*ScAddress aA10(0, 9, 0);
     lcl_typeCharsInCell("X", aA10.Col(), aA10.Row(), pView, pModelObj); // Type 'X' in A10
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("A10 should not autocomplete", OUString("X"), pDoc->GetString(aA10));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("A10 should not autocomplete", OUString("X"), pDoc->GetString(aA10));*/
 }
 
 void ScTiledRenderingTest::testAutoInputExactMatch()
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 4d21dd698beb..90a0dcec43aa 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2525,7 +2525,6 @@ namespace {
  */
 class StrCellIterator
 {
-protected:
     typedef std::pair<sc::CellStoreType::const_iterator,size_t> PosType;
     PosType maPos;
     sc::CellStoreType::const_iterator const miBeg;
@@ -2642,113 +2641,6 @@ public:
     }
 };
 
-/**
- * Iterate over only over the super-block of string and edit-text blocks.
- */
-class StrCellBlockIterator: public StrCellIterator
-{
-public:
-    StrCellBlockIterator(const sc::CellStoreType& rCells, SCROW nStart, const ScDocument* pDoc) :
-        StrCellIterator(rCells, nStart, pDoc)
-    {
-    }
-
-    bool prev()
-    {
-        // Don't go up anymore as we're on non-string block.
-        if (!has())
-            return false;
-
-        // We are in a string block.
-        if (maPos.second > 0)
-        {
-            // Move back one cell in the same block.
-            --maPos.second;
-        }
-        else
-        {
-            if (maPos.first == miBeg)
-                return false;
-
-            // Move to the last cell of the previous block.
-            --maPos.first;
-            maPos.second = maPos.first->size - 1;
-            // Reached non-string block.
-            if (!has())
-                return false;
-        }
-        return true;
-    }
-
-    bool next()
-    {
-        // Don't go down anymore as we're on non-string block.
-        if (!has())
-            return false;
-
-        // We are in a string block.
-        ++maPos.second;
-        if (maPos.second >= maPos.first->size)
-        {
-            // Move to the next block.
-            ++maPos.first;
-            if (maPos.first == miEnd)
-                return false;
-
-            maPos.second = 0;
-            // Reached non-string block.
-            if (!has())
-                return false;
-        }
-        return true;
-    }
-
-};
-
-}
-
-// Get a set of strings from super-block of string and edit-text blocks.
-// This used for computing auto-complete entries in input handler.
-bool ScColumn::GetStringBlockEntries(SCROW nCursorRow, std::set<ScTypedStrData>& rStrings) const
-{
-    // Start at the specified row position, and collect all string values
-    // going upward and downward directions in parallel. The cursor position
-    // cell must be skipped.
-
-    StrCellBlockIterator aItrUp(maCells, nCursorRow-1, GetDoc());
-    StrCellBlockIterator aItrDown(maCells, nCursorRow+1, GetDoc());
-
-    bool bMoveUp = aItrUp.valid() && aItrUp.has();
-    bool bMoveDown = aItrDown.valid() && aItrDown.has();
-    bool bFound = false;
-    OUString aStr;
-
-    while (bMoveUp || bMoveDown)
-    {
-        if (bMoveUp)
-        {
-            aStr = aItrUp.get();
-            if (!aStr.isEmpty())
-            {
-                if (rStrings.insert(ScTypedStrData(aStr)).second)
-                    bFound = true;
-            }
-            bMoveUp = aItrUp.prev();
-        }
-
-        if (bMoveDown)
-        {
-            aStr = aItrDown.get();
-            if (!aStr.isEmpty())
-            {
-                if (rStrings.insert(ScTypedStrData(aStr)).second)
-                    bFound = true;
-            }
-            bMoveDown = aItrDown.next();
-        }
-    }
-
-    return bFound;
 }
 
 // GetDataEntries - Strings from continuous Section around nRow
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 3a588b81fab7..783bac66f2fd 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1577,27 +1577,6 @@ void ScDocument::GetFilterEntriesArea(
     }
 }
 
-/**
- * Get entries for computing auto-complete entries in input handler (no numbers/formulas)
- */
-void ScDocument::GetStringBlockEntries(
-    SCCOL nCursorCol, SCROW nCursorRow, SCTAB nTab,
-    std::vector<ScTypedStrData>& rStrings) const
-{
-    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()))
-        return;
-
-    if (!maTabs[nTab])
-        return;
-
-    std::set<ScTypedStrData> aStrings;
-    if (maTabs[nTab]->GetStringBlockEntries(nCursorCol, nCursorRow, aStrings))
-    {
-        rStrings.insert(rStrings.end(), aStrings.begin(), aStrings.end());
-        sortAndRemoveDuplicates(rStrings, true/*bCaseSens*/);
-    }
-}
-
 /**
  * Entries for selection list listbox (no numbers/formulas)
  */
@@ -1608,7 +1587,8 @@ void ScDocument::GetDataEntries(
     if( !bLimit )
     {
         /*  Try to generate the list from list validation. This part is skipped,
-            if bLimit==true. */
+            if bLimit==true, 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 )
         {
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 926429e90fc1..c27c73fb88e1 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3477,11 +3477,6 @@ void ScTable::GetFilteredFilterEntries(
     }
 }
 
-bool ScTable::GetStringBlockEntries(SCCOL nCursorCol, SCROW nCursorRow, std::set<ScTypedStrData>& rStrings) const
-{
-    return aCol[nCursorCol].GetStringBlockEntries(nCursorRow, rStrings);
-}
-
 bool ScTable::GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit)
 {
     return aCol[nCol].GetDataEntries( nRow, rStrings, bLimit );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1601417a8fc0..209992c6a1e5 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1920,8 +1920,8 @@ void ScInputHandler::GetColData()
             pColumnData.reset( new ScTypedCaseStrSet );
 
         std::vector<ScTypedStrData> aEntries;
-        rDoc.GetStringBlockEntries(
-            aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries);
+        rDoc.GetDataEntries(
+            aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries, true);
         if (!aEntries.empty())
             pColumnData->insert(aEntries.begin(), aEntries.end());
 


More information about the Libreoffice-commits mailing list