summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-01-30 22:01:45 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-02-08 13:34:37 +0000
commit059f6f1916c17ee3d78b2b815d01b59d7abf3924 (patch)
treeeae91e815b3f973f6596d2025082f8d3080aa50c
parent54b372fb76d352d9bb6ab33518735e8fd9d21fa3 (diff)
tdf#105629: Let's move the advanced-filter specific stuff ...
to the place where we actually parse the filtering rules for advanced filter queries. Change-Id: I87650227e15fa54303efd720530d31ecf9827226 Reviewed-on: https://gerrit.libreoffice.org/33816 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> (cherry picked from commit 42e472b5870278058537d43d03d457dc80b16166) Reviewed-on: https://gerrit.libreoffice.org/33852 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/core/data/table3.cxx29
1 files changed, 14 insertions, 15 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index fcd6984f650d..84601f8be4b2 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2889,26 +2889,15 @@ public:
void operator() (ScQueryEntry::Item& rItem)
{
- if (rItem.meType != ScQueryEntry::ByString && rItem.meType != ScQueryEntry::ByDate)
+ // Double-check if the query by date is really appropriate.
+
+ if (rItem.meType != ScQueryEntry::ByDate)
return;
sal_uInt32 nIndex = 0;
bool bNumber = mrDoc.GetFormatTable()->
IsNumberFormat(rItem.maString.getString(), nIndex, rItem.mfVal);
- // Advanced Filter creates only ByString queries that need to be
- // converted to ByValue if appropriate. rItem.mfVal now holds the value
- // if bNumber==true.
-
- if (rItem.meType == ScQueryEntry::ByString)
- {
- if (bNumber)
- rItem.meType = ScQueryEntry::ByValue;
- return;
- }
-
- // Double-check if the query by date is really appropriate.
-
if (bNumber && ((nIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0))
{
const SvNumberformat* pEntry = mrDoc.GetFormatTable()->GetEntry(nIndex);
@@ -3273,12 +3262,22 @@ bool ScTable::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow
if (!bValid)
bValid = CreateExcelQuery(nCol1, nRow1, nCol2, nRow2, rQueryParam);
+ SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
nCount = rQueryParam.GetEntryCount();
+
if (bValid)
{
// bQueryByString must be set
for (i=0; i < nCount; i++)
- rQueryParam.GetEntry(i).GetQueryItem().meType = ScQueryEntry::ByString;
+ {
+ ScQueryEntry::Item& rItem = rQueryParam.GetEntry(i).GetQueryItem();
+
+ sal_uInt32 nIndex = 0;
+ bool bNumber = pFormatter->IsNumberFormat(
+ rItem.maString.getString(), nIndex, rItem.mfVal);
+
+ rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
+ }
}
else
{