summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2022-10-28 13:15:00 -0400
committerJustin Luth <jluth@mail.com>2022-10-29 00:11:38 +0200
commit4c8b1fa44d4f49510d3910981e649dcb08bceb36 (patch)
tree60bc732754d486cedce3ec97bcd5b33e778e5ce4 /sc
parent57b88487295bfbae056361d3614e477491c34055 (diff)
tdf#151794 sc validate: honor NO_BLANK in Cell range dropdown
This fixes LO 6.0 regression 3567d00b5e1168affd067330037e062e10b05b2d Not really a regression - it never let any blanks before then, regardless of the "Allow empty cells" setting in the Data - Validity rule. The default in LO is to allow empty cells. Change-Id: I2d6fb4d7be3622c81b28f5d30985cdb5e6b2fe11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142002 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/gridwin.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4e620c2c4f12..69a1daf6f9ce 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1376,12 +1376,12 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
mpFilterBox->EndInit();
}
-void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
+void ScGridWindow::LaunchDataSelectMenu(const SCCOL nCol, const SCROW nRow)
{
mpFilterBox.reset();
ScDocument& rDoc = mrViewData.GetDocument();
- SCTAB nTab = mrViewData.GetTabNo();
+ const SCTAB nTab = mrViewData.GetTabNo();
bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
tools::Long nSizeX = 0;
@@ -1417,6 +1417,9 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
// SetSize later
+ const sal_uInt32 nIndex = rDoc.GetAttr(nCol, nRow, nTab, ATTR_VALIDDATA)->GetValue();
+ const ScValidationData* pData = nIndex ? rDoc.GetValidationEntry(nIndex) : nullptr;
+
bool bEmpty = false;
std::vector<ScTypedStrData> aStrings; // case sensitive
// Fill List
@@ -1435,7 +1438,12 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
EnterWait();
for (const auto& rString : aStrings)
- rFilterBox.append_text(rString.GetString());
+ {
+ // IsIgnoreBlank allows blank values. Don't add empty string unless "Allow Empty Cells"
+ const OUString& rFilterString = rString.GetString();
+ if (!rFilterString.isEmpty() || !pData || pData->IsIgnoreBlank())
+ rFilterBox.append_text(rFilterString);
+ }
if (bWait)
LeaveWait();
@@ -1447,10 +1455,8 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow )
sal_Int32 nSelPos = -1;
- sal_uInt32 nIndex = rDoc.GetAttr( nCol, nRow, nTab, ATTR_VALIDDATA )->GetValue();
if ( nIndex )
{
- const ScValidationData* pData = rDoc.GetValidationEntry( nIndex );
if (pData)
{
std::unique_ptr<ScTypedStrData> pNew;