[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/inc sc/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 8 12:28:00 UTC 2021
sc/inc/queryentry.hxx | 6 ++++--
sc/source/core/tool/queryentry.cxx | 12 ++----------
sc/source/ui/dbgui/filtdlg.cxx | 2 +-
3 files changed, 7 insertions(+), 13 deletions(-)
New commits:
commit 7ba4eeb2e9b8153eb17779c93492ab80a5cd4644
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 8 10:12:16 2021 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 8 14:27:26 2021 +0200
tdf#141547: maQueryItems can be 0
E.g., fillQueryParam (sc/source/ui/unoobj/datauno.cxx) may clear it
and leave empty if relevant input item is empty.
Note how commit e4b924df8f9ad02c66549751cb8e123e420e8508 had changed
the same checks in ScQueryEntry::IsQueryBy[Non]Empty.
Change-Id: I552462c72e69ddce43711bcff645dc6c7b133db7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113783
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit a0d2fb3217094aa7158310f0bcf16093bcc4984f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113757
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx
index 46a65b957658..f1282e21a5a0 100644
--- a/sc/inc/queryentry.hxx
+++ b/sc/inc/queryentry.hxx
@@ -68,13 +68,15 @@ struct SC_DLLPUBLIC ScQueryEntry
bool IsQueryByEmpty() const;
void SetQueryByNonEmpty();
bool IsQueryByNonEmpty() const;
- const Item& GetQueryItem() const;
- Item& GetQueryItem();
+ const Item& GetQueryItem() const { return GetQueryItemImpl(); }
+ Item& GetQueryItem() { return GetQueryItemImpl(); }
void Clear();
ScQueryEntry& operator=( const ScQueryEntry& r );
bool operator==( const ScQueryEntry& r ) const;
private:
+ Item& GetQueryItemImpl() const;
+
/**
* Stores all query items. It must contain at least one item at all times
* (for single equality match queries or comparative queries). It may
diff --git a/sc/source/core/tool/queryentry.cxx b/sc/source/core/tool/queryentry.cxx
index 6ebcf0003e9b..1c4326c47b29 100644
--- a/sc/source/core/tool/queryentry.cxx
+++ b/sc/source/core/tool/queryentry.cxx
@@ -115,17 +115,9 @@ bool ScQueryEntry::IsQueryByNonEmpty() const
rItem.mfVal == SC_NONEMPTYFIELDS;
}
-const ScQueryEntry::Item& ScQueryEntry::GetQueryItem() const
+ScQueryEntry::Item& ScQueryEntry::GetQueryItemImpl() const
{
- if (maQueryItems.size() > 1)
- // Reset to a single query mode.
- maQueryItems.resize(1);
- return maQueryItems[0];
-}
-
-ScQueryEntry::Item& ScQueryEntry::GetQueryItem()
-{
- if (maQueryItems.size() > 1)
+ if (maQueryItems.size() != 1)
// Reset to a single query mode.
maQueryItems.resize(1);
return maQueryItems[0];
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 13f9fff9381a..322c617aa2f9 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -221,7 +221,6 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
ScQueryEntry& rEntry = theQueryData.GetEntry(i);
if ( rEntry.bDoQuery )
{
- const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
nCondPos = static_cast<size_t>(rEntry.eOp);
nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
if (rEntry.IsQueryByEmpty())
@@ -236,6 +235,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
}
else
{
+ const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
OUString aQueryStr = rItem.maString.getString();
SetValString(aQueryStr, rItem, aValStr);
}
More information about the Libreoffice-commits
mailing list