diff options
author | Mike Kaganski <mikekaganski@hotmail.com> | 2015-04-29 23:43:18 +1000 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-04-29 16:43:43 +0000 |
commit | 1b4ae9a937e25c371a6cbfcbeeb9d7c93563acc7 (patch) | |
tree | 6872905d0ab8a123040dd87d978ca1d98fd8c499 /sc | |
parent | 6cf3cdce6d66651f69346fd342e8a7040bbb0786 (diff) |
tdf#56036: allow calc compiler treat tabs and newlines as spacers
Currently these characters are illegal in input formulas. This is inconsistent
with ODF spec, and brings incompatibility with other ODF implementations,
as well as with OOXML. This patch fixes this by providing corresponding
character flags for these chars (tab, cr and lf). This effectively converts
these characters to spaces. Keeping the original whitespace characters should
be done in another patch.
Change-Id: Id9362de9138ec7cd7b23c6d999181e15d5b71d5b
Reviewed-on: https://gerrit.libreoffice.org/15566
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index a2f83eb2160a..05e9f9c15705 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -314,6 +314,15 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv ) for (i = 0; i < 128; i++) t[i] = SC_COMPILER_C_ILLEGAL; +// tdf#56036: Allow tabs/newlines in imported formulas (for now simply treat them as (and convert to) space) +// TODO: tdf#76310: allow saving newlines as is (as per OpenFormula specification v.1.2, clause 5.14 "Whitespace") +// This is compliant with the OASIS decision (see https://issues.oasis-open.org/browse/OFFICE-701) +// Also, this would enable correct roundtrip from/to OOXML without loosing tabs/newlines +// This requires saving actual space characters in ocSpaces token, using them in UI and saving +/* tab */ t[ 9] = SC_COMPILER_C_CHAR_DONTCARE | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; +/* lf */ t[10] = SC_COMPILER_C_CHAR_DONTCARE | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; +/* cr */ t[13] = SC_COMPILER_C_CHAR_DONTCARE | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; + /* */ t[32] = SC_COMPILER_C_CHAR_DONTCARE | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; /* ! */ t[33] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; if (FormulaGrammar::CONV_ODF == meConv) |