summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-09-28 00:19:47 +0200
committerEike Rathke <erack@redhat.com>2021-09-28 02:25:22 +0200
commitb60b6bfaafa1315e07108dba50f016975b619c59 (patch)
treec0f39a3277f08e02481a94f8507187563ebb6a4c /sc/inc
parent540ae5590f775a04168453f8c61a839303f598ef (diff)
Resolves: tdf#144740 Fix broken compareByValue() query, tdf#142910 tdf#144253
Fix regression of a series of commits that, intended for filter queries, unconditionally round numeric values as shown under ScTable::ValidQuery() and compareByValue() without having taken into account that the same query and compare functions are used by the interpreter for all functions that use query criteria, possibly delivering completely wrong results including in backports to 7.2.0.0 commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d CommitDate: Wed Jul 7 17:44:46 2021 +0200 tdf#142910 sc filter: fix "greater than" or "smaller than" etc commit 51375b48378915b6e95c1ac26b2ccf8e39880f7e CommitDate: Tue Sep 21 11:06:35 2021 +0200 tdf#144253 tdf#144324 sc filter: use formatted values in filters Several related and intertwined commits in filter context make assumptions about these queries always being executed rounded, so the only clean solution is to make that depend on the ScQueryEntry::Item being passed. Its mbRoundForFilter value is set to true for all items of all queries executed via ScTable::Query() and ScTable::GetFilteredFilterEntries(). It might be not all are necessary (or some even still harmful?) and unnecessarily obtaining number formats and calling RoundValueAsShown() is still a bottle neck for those, but that should be addressed and reworked independently. The important part is calculations work as before. Also, moved obtaining number formats for calling RoundValueAsShown() into logic that calls them only if necessary. Note the TODO in compareByValue() about suspicious rounding of rItem.mfVal in filter context that is to be addressed. Change-Id: Ieb178ad1ea15a635caeb1ba698c2f4b7ad676d57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122729 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/queryentry.hxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/sc/inc/queryentry.hxx b/sc/inc/queryentry.hxx
index 94ea761c1239..9b0b1cd98124 100644
--- a/sc/inc/queryentry.hxx
+++ b/sc/inc/queryentry.hxx
@@ -44,13 +44,14 @@ struct SC_DLLPUBLIC ScQueryEntry
struct SAL_DLLPRIVATE Item
{
- QueryType meType;
- double mfVal;
+ QueryType meType;
+ double mfVal;
svl::SharedString maString;
+ Color maColor;
bool mbMatchEmpty;
- Color maColor;
+ bool mbRoundForFilter;
- Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false) {}
+ Item() : meType(ByValue), mfVal(0.0), mbMatchEmpty(false), mbRoundForFilter(false) {}
bool operator== (const Item& r) const;
};