tdf#142350 sc AutoFilter: fix (empty) entry checking

When a column was filtered for values that included 0,
but not the (empty) entry, the (empty) entry also
was checked in the Autofilter dropdown.

Regression from commit 4fd1333ba4bb4f2311e9098291154772bd310429
"tdf#140968 tdf#140978 XLSX import: fix lost rounded filters".

Change-Id: Ic2595c707bd43f1a19c86d2ee796f06d9b1af1e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115755
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 7b1c043..00cfa6f 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -367,4 +367,47 @@ class AutofilterTest(UITestCase):
        self.assertFalse(is_row_hidden(doc, 6))

        self.ui_test.close_doc()

    def test_tdf142350(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", "0")
        enter_text_to_cell(gridwin, "A3", "")
        enter_text_to_cell(gridwin, "A4", "1")

        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("2")
        xEntry.executeAction("CLICK", tuple())

        xOkButton = xFloatWindow.getChild("ok")
        xOkButton.executeAction("CLICK", tuple())

        self.assertFalse(is_row_hidden(document, 1))
        self.assertTrue(is_row_hidden(document, 2))
        self.assertFalse(is_row_hidden(document, 3))

        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")
        self.assertEqual(3, len(xList.getChildren()))
        self.assertEqual('true', get_state_as_dict(xList.getChild('0'))['IsChecked'])
        self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked'])
        self.assertEqual('false', get_state_as_dict(xList.getChild('2'))['IsChecked'])
        xCloseButton = xFloatWindow.getChild("cancel")
        xCloseButton.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0cd9046..644feab 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -684,7 +684,14 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
        const double aDoubleVal = rEntry.GetValue();
        bool bSelected = true;
        if (!aSelectedValue.empty() || !aSelectedString.empty())
            bSelected = aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0;
        {
            if (aStringVal.isEmpty())
                bSelected = aSelectedString.count(aStringVal) > 0;
            else
                bSelected
                    = aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0;
        }

        if ( rEntry.IsDate() )
            rControl.addDateMember( aStringVal, rEntry.GetValue(), bSelected );
        else