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

Eike Rathke erack at redhat.com
Mon Jun 27 15:30:04 UTC 2016


 formula/source/core/resource/core_resource.src |    3 ++
 sc/source/core/tool/compiler.cxx               |   26 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit 2795cb694b6563772e1326b74cfd678ed251681f
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jun 27 16:37:56 2016 +0200

    add an isPODF() block to ScCompiler::IsOpCode(), tdf#100641 related
    
    ... as we can't rename RID_STRLIST_FUNCTION_NAMES_ENGLISH names.
    
    Should we need yet another resource block to differentiate between
    PODF/API names and actual always available English names? Ugly but
    maybe. A much better approach would be if Text[en-US] would be always
    available, additionally to the current localized resource.
    
    Change-Id: If8eaf18643f4e24c811149c52efff1097a3c1596

diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 2124218a..6a2d7d2 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -896,6 +896,9 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 // DO NOT CHANGE NAMES! Only add functions.
 // These English names are used internally to store/load ODF v1.0/v1.1 and for
 // API XFunctionAccess.
+// If there is a reason for another name for some function then add an
+// *additional* name to be recognized to sc/source/core/tool/compiler.cxx
+// ScCompiler::IsOpCode() in the else if (mxSymbols->isPODF()) block.
 Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
 {
     String SC_OPCODE_IF { Text = "IF" ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e5a91be..2ed3d59 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2762,6 +2762,32 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray )
             }
         }
     }
+    else if (mxSymbols->isPODF())
+    {
+        // PODF names are ODF 1.0/1.1 and also used in API XFunctionAccess.
+        // We can't rename them in
+        // formula/source/core/resource/core_resource.src but can add
+        // additional names to be recognized here so they match the UI names if
+        // those are renamed.
+        struct FunctionName
+        {
+            const sal_Char* pName;
+            OpCode          eOp;
+        };
+        static const FunctionName aPodfAliases[] = {
+            { "EFFECT",  ocEffect }      // EFFECTIVE -> EFFECT
+        };
+        for (const FunctionName& rPodfAlias : aPodfAliases)
+        {
+            if (rName.equalsIgnoreAsciiCaseAscii( rPodfAlias.pName))
+            {
+                maRawToken.SetOpCode( rPodfAlias.eOp);
+                bFound = true;
+                break;  // for
+            }
+        }
+    }
+
     if (!bFound)
     {
         OUString aIntName;


More information about the Libreoffice-commits mailing list