summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-03-05 10:20:03 +0100
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2021-04-29 15:09:03 +0200
commitce0fc9b59726f09e4ecbec540c3cf646d20f949e (patch)
treec8444e99569da9a8a66b8587be1f47bc3967c3ff
parentb83fc213bc90d00ca7304e7de964b4437fce5867 (diff)
tdf#36383 sc AutoFilter: fix changing row height
Changing row height showed the rows hidden by AutoFilter, removing the result of the filtering. Change-Id: Ie2cba567c1fa4b479bd351693ae6dd3fd604ffc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112006 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 3678e0efcb8bedc58dd329a430da0ac3b1572df8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114863 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--sc/qa/uitest/autofilter/tdf36383.py68
-rw-r--r--sc/source/ui/view/viewfunc.cxx22
2 files changed, 88 insertions, 2 deletions
diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py
new file mode 100644
index 000000000000..d55db21837b3
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf36383.py
@@ -0,0 +1,68 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_row
+
+#Bug 36383 - EDITING auto row height or change row height removes AutoFilter result
+
+class tdf36383(UITestCase):
+ def test_tdf36383_row_height(self):
+ self.ui_test.create_doc_in_start_center("calc")
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = calcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ enter_text_to_cell(gridwin, "A1", "A")
+ enter_text_to_cell(gridwin, "A2", "1")
+ enter_text_to_cell(gridwin, "A3", "2")
+ enter_text_to_cell(gridwin, "A4", "3")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+ self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ xEntry = xList.getChild("1")
+ xEntry.executeAction("CLICK", tuple())
+
+ xOkButton = xFloatWindow.getChild("ok")
+ xOkButton.executeAction("CLICK", tuple())
+
+ row = get_row(document, 2)
+ self.assertFalse(row.getPropertyValue("IsVisible"))
+
+ #row height
+ self.ui_test.execute_dialog_through_command(".uno:RowHeight")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvalue = xDialog.getChild("value")
+ xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
+
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+
+ self.assertFalse(row.getPropertyValue("IsVisible"))
+
+ #optimal row height
+ self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+
+ self.assertFalse(row.getPropertyValue("IsVisible"))
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 6e4be285c073..ae60a5cb06e5 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2158,7 +2158,17 @@ void ScViewFunc::SetWidthOrHeight(
aCxt.setExtraHeight(nSizeTwips);
rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
if (bAll)
- rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
+ {
+ for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
+ {
+ SCROW nLastRow = nRow;
+ // tdf#36383 skip consecutive rows hidden by AutoFilter
+ if (rDoc.RowFiltered(nRow, nTab, nullptr, &nLastRow))
+ nRow = nLastRow;
+ else
+ rDoc.ShowRow(nRow, nTab, true);
+ }
+ }
// Manual-Flag already (re)set in SetOptimalHeight in case of bAll=sal_True
// (set for Extra-Height, else reset).
@@ -2171,7 +2181,15 @@ void ScViewFunc::SetWidthOrHeight(
rDoc.SetManualHeight( nStartNo, nEndNo, nTab, true ); // height was set manually
}
- rDoc.ShowRows( nStartNo, nEndNo, nTab, nSizeTwips != 0 );
+ for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow)
+ {
+ SCROW nLastRow = nRow;
+ // tdf#36383 skip consecutive rows hidden by AutoFilter
+ if (rDoc.RowFiltered(nRow, nTab, nullptr, &nLastRow))
+ nRow = nLastRow;
+ else
+ rDoc.ShowRow(nRow, nTab, nSizeTwips != 0);
+ }
if (!bShow && nStartNo <= nCurY && nCurY <= nEndNo && nTab == nCurTab)
{