[ooo-build-commit] .: 2 commits - formula/inc formula/source officecfg/registry

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Oct 5 11:49:29 PDT 2010


 formula/inc/formula/FormulaCompiler.hxx                  |    6 +-
 formula/source/core/api/FormulaCompiler.cxx              |   38 +++++++++++++--
 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |    8 +++
 3 files changed, 46 insertions(+), 6 deletions(-)

New commits:
commit 4e58bfec2cec6abf7b5fc9f21bfeee875c0e3275
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Oct 5 14:47:09 2010 -0400

    Ported calc-english-func-names-*.diff from ooo-build.
    
    Add option to switch to English function names instead of the
    localized ones.  In some locales (especially in Hungary) the users are
    more accustomed to the English function names rather other than
    translated names (i#38765).

diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx
index 47fefb3..1ccdf2d 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -121,7 +121,8 @@ public:
             mbEnglish = FormulaGrammar::isEnglish( meGrammar);
         }
         virtual ~OpCodeMap();
-        
+
+        void copyFrom( const OpCodeMap& r );
 
         /// Get the symbol String -> OpCode hash map for finds.
         inline const OpCodeHashMap* getHashMap() const { return mpHashMap; }
@@ -243,7 +244,8 @@ public:
     inline  FormulaGrammar::Grammar   GetGrammar() const { return meGrammar; }
 
     static void UpdateSeparatorsNative( const rtl::OUString& rSep, const rtl::OUString& rArrayColSep, const rtl::OUString& rArrayRowSep );
-
+    static void ResetNativeSymbols();
+    static void SetNativeSymbols( const OpCodeMapPtr& xMap );
 protected:
     virtual String FindAddInFunction( const String& rUpperName, BOOL bLocalFirst ) const;
     virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index fed0aab..2cd662d 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -642,6 +642,7 @@ const String& FormulaCompiler::GetNativeSymbol( OpCode eOp )
 // -----------------------------------------------------------------------------
 void FormulaCompiler::InitSymbolsNative() const
 {
+#if 0 // No point in keeping this since you can now do this from the UI.
     if (mxSymbolsNative.get())
         return;
     //! Experimental!
@@ -656,10 +657,9 @@ void FormulaCompiler::InitSymbolsNative() const
         mxSymbolsNative = mxSymbolsEnglish;
         return;
     }
-    static NonConstOpCodeMapPtr s_sSymbol;
-    if ( !s_sSymbol.get() )
-        lcl_fillNativeSymbols(s_sSymbol);
-    mxSymbolsNative = s_sSymbol;
+#endif
+
+    lcl_fillNativeSymbols(mxSymbolsNative);
 }
 // -----------------------------------------------------------------------------
 void FormulaCompiler::InitSymbolsEnglish() const
@@ -796,6 +796,22 @@ FormulaCompiler::OpCodeMap::~OpCodeMap()
     delete mpHashMap;
 }
 // -----------------------------------------------------------------------------
+void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r )
+{
+    delete mpHashMap;
+    mpHashMap = new OpCodeHashMap(mnSymbols);
+
+    USHORT n = r.getSymbolCount();
+    for (USHORT i = 0; i < n; ++i)
+    {
+        OpCode eOp = OpCode(i);
+        const String& rSymbol = r.getSymbol(eOp);
+        putOpCode(rSymbol, eOp);
+    }
+
+    // TODO: maybe copy the external maps too?
+}
+// -----------------------------------------------------------------------------
 sal_Int32 FormulaCompiler::OpCodeMap::getOpCodeUnknown()
 {
     static const sal_Int32 kOpCodeUnknown = -1;
@@ -1710,6 +1726,20 @@ void FormulaCompiler::UpdateSeparatorsNative(
     xSymbolsNative->putOpCode(rArrayRowSep, ocArrayRowSep);
 }
 
+void FormulaCompiler::ResetNativeSymbols()
+{
+    NonConstOpCodeMapPtr xSymbolsNative;
+    lcl_fillNativeSymbols(xSymbolsNative, true);
+    lcl_fillNativeSymbols(xSymbolsNative);
+}
+
+void FormulaCompiler::SetNativeSymbols( const OpCodeMapPtr& xMap )
+{
+    NonConstOpCodeMapPtr xSymbolsNative;
+    lcl_fillNativeSymbols(xSymbolsNative);
+    xSymbolsNative->copyFrom(*xMap);
+}
+
 // -----------------------------------------------------------------------------
 OpCode FormulaCompiler::NextToken()
 {
commit a6750150c2a25b947ee5b8dce49482f20add1d87
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Oct 5 14:46:12 2010 -0400

    Ported calc-english-func-names-*.diff from ooo-build.
    
    Add option to switch to English function names instead of the
    localized ones.  In some locales (especially in Hungary) the users are
    more accustomed to the English function names rather other than
    translated names (i#38765).

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 2db99d2..3a9cd02 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1281,6 +1281,14 @@
                         </enumeration>
                     </constraints>
                 </prop>
+                <prop oor:name="EnglishFunctionName" oor:type="xs:boolean">
+                    <!-- UIHints: Tools - Options  Spreadsheet  Formula -->
+                    <info>
+                        <author>kyoshida</author>
+                        <desc>Whether to use English function names or localized function names.</desc>
+                    </info>
+                    <value>false</value>
+                </prop>
                 <prop oor:name="SeparatorArg" oor:type="xs:string">
                     <!-- UIHints: Tools - Options  Spreadsheet  Formula -->
                     <info>


More information about the ooo-build-commit mailing list