Blob Blame History Raw
From cd0f96ac3e419aadf904256ee98f794f2e2e1704 Mon Sep 17 00:00:00 2001
Message-Id: <cd0f96ac3e419aadf904256ee98f794f2e2e1704.1513017362.git.erack@redhat.com>
From: Eike Rathke <erack@redhat.com>
Date: Mon, 11 Dec 2017 18:21:32 +0100
Subject: [PATCH] Resolves: tdf#114406 treat % as the operator that it is
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------erAck-patch-parts"

This is a multi-part message in MIME format.
--------------erAck-patch-parts
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Regression from

    commit 73c7e0921d752df53004ed55735f3e8888cc592f
    Date:   Tue Sep 20 21:39:10 2016 +0200

	sc-perf: tdf#79023 for ODFF do not call SvNumberFormatter to determine numeric

for ODFF, and for OOXML

    commit a8a8ff59c5749bbe1f2f58ea8fd42d66e6ae2a81
    Date:   Tue Sep 20 22:37:59 2016 +0200

	sc-perf: tdf#79023 do not call SvNumberFormatter also for numbers in OOXML

Numbers followed by a percent operator like 100% were always
(wrongly) treated as one entity (by '%' having ScCharFlags::Value)
and incidentally handled by the number formatter's parser, which
so far "worked" in the sense that the correct constant number was
produced (i.e. 1 here), but the expression detail was lost.

The commits above for performance reasons when reading ODF or
OOXML files don't let a symbol pass through the number formatter's
parser anymore and the "100%" does not represent a strict number,
so lead to #NAME? error at the end.

Set the proper flags in the compiler's character table to treat
'%' as operator in all circumstances.

Change-Id: I266beb74a313c779370e5fac42f45d0fb5cdba0c
(cherry picked from commit f6b2349e880afa82f9267087fb48b6e4f8a9aa05)
---
 sc/source/core/tool/compiler.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--------------erAck-patch-parts
Content-Type: text/x-patch; name="0001-Resolves-tdf-114406-treat-as-the-operator-that-it-is.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Resolves-tdf-114406-treat-as-the-operator-that-it-is.patch"

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e0f67fc1b5ef..32346f88d9dc 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -330,7 +330,7 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
 /* $ */     t[36] = ScCharFlags::CharWord | ScCharFlags::Word | ScCharFlags::CharIdent | ScCharFlags::Ident;
             if (FormulaGrammar::CONV_ODF == meConv)
 /* $ */         t[36] |= ScCharFlags::OdfNameMarker;
-/* % */     t[37] = ScCharFlags::Value;
+/* % */     t[37] = ScCharFlags::Char | ScCharFlags::WordSep | ScCharFlags::ValueSep;
 /* & */     t[38] = ScCharFlags::Char | ScCharFlags::WordSep | ScCharFlags::ValueSep;
 /* ' */     t[39] = ScCharFlags::NameSep;
 /* ( */     t[40] = ScCharFlags::Char | ScCharFlags::WordSep | ScCharFlags::ValueSep;

--------------erAck-patch-parts--