summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/queryentry.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-30 01:20:45 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-30 01:22:39 -0500
commite4b924df8f9ad02c66549751cb8e123e420e8508 (patch)
treea064bfe21771881fd3e3e95cb9b4953fae371ff4 /sc/source/core/tool/queryentry.cxx
parentfc912cb1087d4133502647aac131affc10355af9 (diff)
Reduce usage of GetQueryItem() (singular version).
I added that as a convenience method while working on implementing multi-value filtering. But we need to stick with the plural version GetQueryItems() from now on for clarity.
Diffstat (limited to 'sc/source/core/tool/queryentry.cxx')
-rw-r--r--sc/source/core/tool/queryentry.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/sc/source/core/tool/queryentry.cxx b/sc/source/core/tool/queryentry.cxx
index be107e761f88..1f9be975d92d 100644
--- a/sc/source/core/tool/queryentry.cxx
+++ b/sc/source/core/tool/queryentry.cxx
@@ -101,7 +101,8 @@ const ScQueryEntry::QueryItemsType& ScQueryEntry::GetQueryItems() const
void ScQueryEntry::SetQueryByEmpty()
{
eOp = SC_EQUAL;
- Item& rItem = GetQueryItem();
+ maQueryItems.resize(1);
+ Item& rItem = maQueryItems[0];
rItem.meType = ByEmpty;
rItem.maString = rtl::OUString();
rItem.mfVal = SC_EMPTYFIELDS;
@@ -109,11 +110,10 @@ void ScQueryEntry::SetQueryByEmpty()
bool ScQueryEntry::IsQueryByEmpty() const
{
- if (maQueryItems.size() > 1)
- // multi-item query.
+ if (maQueryItems.size() != 1)
return false;
- const Item& rItem = GetQueryItem();
+ const Item& rItem = maQueryItems[0];
return eOp == SC_EQUAL &&
rItem.meType == ByEmpty &&
rItem.maString.isEmpty() &&
@@ -123,7 +123,8 @@ bool ScQueryEntry::IsQueryByEmpty() const
void ScQueryEntry::SetQueryByNonEmpty()
{
eOp = SC_EQUAL;
- Item& rItem = GetQueryItem();
+ maQueryItems.resize(1);
+ Item& rItem = maQueryItems[0];
rItem.meType = ByEmpty;
rItem.maString = rtl::OUString();
rItem.mfVal = SC_NONEMPTYFIELDS;
@@ -131,11 +132,10 @@ void ScQueryEntry::SetQueryByNonEmpty()
bool ScQueryEntry::IsQueryByNonEmpty() const
{
- if (maQueryItems.size() > 1)
- // multi-item query.
+ if (maQueryItems.size() != 1)
return false;
- const Item& rItem = GetQueryItem();
+ const Item& rItem = maQueryItems[0];
return eOp == SC_EQUAL &&
rItem.meType == ByEmpty &&
rItem.maString.isEmpty() &&