sc/qa/uitest/autofilter2/tdf168478.py |   61 ++++++++++++++++++++++++++++++++++
 sc/source/ui/docshell/docsh5.cxx      |    7 +--
 sw/source/uibase/shells/textsh.cxx    |    4 +-
 3 files changed, 66 insertions(+), 6 deletions(-)

New commits:
commit 4c43f03303ccf634da44690e4c0d3dda2af37fad
Author:     Oliver Specht <[email protected]>
AuthorDate: Thu Sep 25 07:23:05 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Sep 29 16:54:56 2025 +0200

    tdf#167973 Fixes case rotation in selection in multiple paragraphs
    
    Broken in commit b1170251fbca5b6b243902cf10695ab4c4c5642b because it checked
    the selection in a single paragraph only.
    
    Change-Id: If84aca87c9fee5750751cd91cb08372714f17eba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191472
    Tested-by: Jenkins
    Reviewed-by: Oliver Specht <[email protected]>
    (cherry picked from commit bb496f5494a23c247c86fdf5ae65054908df44ce)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191601
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit fd25b527b3c03f20050aad763b8eb18982f018c0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191613
    Tested-by: Xisco Fauli <[email protected]>
    Reviewed-by: Michael Weghorn <[email protected]>
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index 9e26a068285f..d38ebe9f873a 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -894,7 +894,9 @@ void SwTextShell::ExecRotateTransliteration( SfxRequest& 
rReq )
         {
             if (bSentenceCase)
             {
-                OUString aSelection = rSh.GetSelText().trim();
+                OUString aSelection;
+                rSh.GetSelectedText(aSelection);
+                aSelection = aSelection.trim();
                 if (aSelection.getLength() <= 2 || (aSelection.indexOf(' ') < 
0 && aSelection.indexOf('        ') < 0))
                     transFlags = m_aRotateCase.getNextMode();
             }
commit a4d111994bda82d9156dfe7d8d78db96b2f174da
Author:     Andreas Heinisch <[email protected]>
AuthorDate: Sat Sep 20 18:47:13 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Sep 29 16:54:47 2025 +0200

    tdf#168478 - Use the previously found range rather than returning an empty 
one
    
    During the reset of a standard filter, if the correct boundaries are not
    selected, do not return an empty range. Instead, reuse the previously
    found range at the selection.
    
    Change-Id: I42a603a8a284036710b608a519abd781b90991e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191245
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <[email protected]>
    Tested-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 6f68c46d0aa5fe872de0dec8777d35ff91886043)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191421
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 79b1860c23ead30dd230768012db72075f4c11f5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191425
    Reviewed-by: Michael Weghorn <[email protected]>
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sc/qa/uitest/autofilter2/tdf168478.py 
b/sc/qa/uitest/autofilter2/tdf168478.py
new file mode 100644
index 000000000000..b886aa672441
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf168478.py
@@ -0,0 +1,61 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.calc.document import is_row_hidden
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf168478(UITestCase):
+
+    def test_tdf168478_restore_multiple_selection(self):
+        with self.ui_test.create_doc_in_start_center("calc") as calcDoc:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            xGridWindow = xCalcDoc.getChild("grid_window")
+
+            # Insert test data
+            enter_text_to_cell(xGridWindow, "A1", "Header")
+            enter_text_to_cell(xGridWindow, "A2", "1")
+            enter_text_to_cell(xGridWindow, "A3", "2")
+            enter_text_to_cell(xGridWindow, "A4", "1")
+
+            # Apply auto filter on A1:A4
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:A4"}))
+            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+            # Search for the first entry and apply the auto filter
+            xGridWindow.executeAction("LAUNCH", 
mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xTreeList = xFloatWindow.getChild("check_list_box")
+            xSearchEdit = xFloatWindow.getChild("search_edit")
+            xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "1"}))
+            self.ui_test.wait_until_property_is_updated(xTreeList, "Children", 
str(1))
+            self.assertEqual("1", 
get_state_as_dict(xTreeList.getChild('0'))['Text'])
+            self.assertEqual(1, len(xTreeList.getChildren()))
+
+            xOkButton = xFloatWindow.getChild("ok")
+            xOkButton.executeAction("CLICK", tuple())
+
+            # Check that the correct rows are hidden/visible
+            self.assertFalse(is_row_hidden(calcDoc, 0))
+            self.assertFalse(is_row_hidden(calcDoc, 1))
+            self.assertTrue(is_row_hidden(calcDoc, 2))
+            self.assertFalse(is_row_hidden(calcDoc, 3))
+
+            # Select more than one cell, remove filter and verify restored 
range includes all cells
+            xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A2:A4"}))
+            self.xUITest.executeCommand(".uno:DataFilterRemoveFilter")
+            gridWinState = get_state_as_dict(xGridWindow)
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: 'true' != 'false'
+            # i.e., not all cells have been restored
+            self.assertFalse(is_row_hidden(calcDoc, 2))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index ab4cdd7b62cc..ea9e5ddd4123 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -195,11 +195,8 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, 
ScGetDBMode eMode, ScGe
     {
         pData->GetArea( nStartTab, nStartCol,nStartRow, nEndCol,nEndRow );
     }
-    else if ( eMode == SC_DB_OLD )
-    {
-        pData = nullptr;                           // nothing found
-    }
-    else
+    // tdf #168478 - use the previously found range rather than returning an 
empty one
+    else if ( eMode != SC_DB_OLD )
     {
         if ( !bSelected )
         {                                       // continuous range

Reply via email to