sc/qa/uitest/autofilter/tdf36383.py | 68 ++++++++++++++++++++++++++++++++++++ sc/source/ui/view/viewfunc.cxx | 22 ++++++++++- 2 files changed, 88 insertions(+), 2 deletions(-)
New commits: commit b1529bec79efc357cc001cad45eb11a077ddf403 Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Fri Mar 5 10:20:03 2021 +0100 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Tue Jun 29 10:33:21 2021 +0200 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 3678e0efcb8bedc58dd329a430da0ac3b1572df8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118065 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> 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 d0484beb37c9..14e80c98cd16 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2173,7 +2173,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). @@ -2186,7 +2196,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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits