[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 31 10:16:24 UTC 2021
sc/inc/table.hxx | 2 -
sc/qa/uitest/autofilter/autofilter.py | 39 +++++++++++++++++++++++++++++++++-
sc/source/core/data/documen3.cxx | 2 -
sc/source/core/data/table3.cxx | 4 +--
sc/source/ui/dbgui/filtdlg.cxx | 7 +-----
5 files changed, 44 insertions(+), 10 deletions(-)
New commits:
commit 1f755525189884e4b2824889a6b9dea8933402db
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue May 25 18:23:16 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon May 31 12:15:41 2021 +0200
tdf#142402 sc UI: store formatted values in standard filter
value list and filter by formatted values later, just like
we do in the autofilter.
Follow-up to commit 4fd1333ba4bb4f2311e9098291154772bd310429
"tdf#140968 tdf#140978 XLSX import: fix lost rounded filters".
Change-Id: If26f4c0abd54de05b497861f2c278972bd8072de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116115
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index cbf97d7dbd36..4a538428c163 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -961,7 +961,7 @@ public:
SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub);
bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
- void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
+ void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering = false);
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);
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 334f7a90b3dd..70c6b3c3b89d 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -6,7 +6,7 @@
#
from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text
from libreoffice.uno.propertyvalue import mkPropertyValues
from libreoffice.calc.document import is_row_hidden
from uitest.uihelper.calc import enter_text_to_cell
@@ -455,5 +455,42 @@ class AutofilterTest(UITestCase):
self.assertTrue(is_row_hidden(doc, 7))
self.assertFalse(is_row_hidden(doc, 8))
+ self.ui_test.close_doc()
+
+ def test_tdf142402(self):
+ doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ #Choose Standard Filter... button
+ xMenu = xFloatWindow.getChild("menu")
+
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ xDialog = self.xUITest.getTopFocusWindow()
+ xval1 = xDialog.getChild("val1")
+
+ select_by_text(xval1, "0.365")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertFalse(is_row_hidden(doc, 1))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertTrue(is_row_hidden(doc, 4))
+ self.assertTrue(is_row_hidden(doc, 5))
+ self.assertTrue(is_row_hidden(doc, 6))
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 5db63b6e7815..8d6f6a2baadf 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1606,7 +1606,7 @@ void ScDocument::GetFilterEntriesArea(
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
{
- maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries );
+ maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries, true );
sortAndRemoveDuplicates( rFilterEntries.maStrData, bCaseSens);
}
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 7d86e77bdaa3..47d1ea2b852d 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3546,14 +3546,14 @@ bool ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCR
return false;
}
-void ScTable::GetFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries )
+void ScTable::GetFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering )
{
if (nCol >= aCol.size())
return;
sc::ColumnBlockConstPosition aBlockPos;
aCol[nCol].InitBlockPosition(aBlockPos);
- aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rFilterEntries, false);
+ aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rFilterEntries, bFiltering);
}
void ScTable::GetFilteredFilterEntries(
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 7e6808f655d7..a87da245775b 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -1105,11 +1105,8 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, weld::ComboBox&, rEd, void )
{
rItem.maString = pDoc->GetSharedStringPool().intern(aStrVal);
rItem.mfVal = 0.0;
-
- sal_uInt32 nIndex = 0;
- bool bNumber = pDoc->GetFormatTable()->IsNumberFormat(
- rItem.maString.getString(), nIndex, rItem.mfVal);
- rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
+ rItem.meType = ScQueryEntry::ByString;
+ rItem.mbFormattedValue = true;
}
const sal_Int32 nField = pLbField->get_active();
More information about the Libreoffice-commits
mailing list