[Libreoffice-commits] core.git: sc/source

Mike Kaganski mikekaganski at hotmail.com
Wed Apr 29 09:44:05 PDT 2015


 sc/source/core/tool/compiler.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 1b4ae9a937e25c371a6cbfcbeeb9d7c93563acc7
Author: Mike Kaganski <mikekaganski at hotmail.com>
Date:   Wed Apr 29 23:43:18 2015 +1000

    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 at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a2f83eb..05e9f9c 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)


More information about the Libreoffice-commits mailing list