[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - sc/qa sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Nov 15 16:03:39 PST 2013


 sc/qa/unit/ucalc.cxx          |    2 +-
 sc/source/core/tool/token.cxx |   23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 70d85e6dc63f73cf5d73e77429facb177ceec209
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Nov 15 19:03:56 2013 -0500

    Handle external functions (add-ins).
    
    Unfortunately we can't test this piece easily just yet.  Enabling add-in
    functions would mess up the function list which is unit-tested and thus
    fail if we enable add-ins in unit test.
    
    Change-Id: Ieda5e5560d4c7e68d7c6272c5d85f2ac63bd4ee4

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 294dd65..9eef1ee 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2552,7 +2552,7 @@ void Test::testFunctionLists()
         for (sal_uInt32 j = 0; j < nFuncCount; ++j)
         {
             const formula::IFunctionDescription* pFunc = pCat->getFunction(j);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected function name", pFunc->getFunctionName(), OUString::createFromAscii(aTests[i].Functions[j]));
+            CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected function name", OUString::createFromAscii(aTests[i].Functions[j]), pFunc->getFunctionName());
         }
     }
 }
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index b60d77a..caa113f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -41,6 +41,7 @@
 #include "tokenstringcontext.hxx"
 #include "types.hxx"
 #include "globstr.hrc"
+#include "addincol.hxx"
 #include "svl/sharedstring.hxx"
 
 using ::std::vector;
@@ -3278,7 +3279,27 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons
         }
         break;
         case svExternal:
-            // TODO : Implement this.
+        {
+            // mapped or translated name of AddIns
+            OUString aAddIn = rToken.GetExternal();
+            fprintf(stdout, "appendTokenByType:   addin = '%s'\n", rtl::OUStringToOString(aAddIn, RTL_TEXTENCODING_UTF8).getStr());
+            bool bMapped = rCxt.mxOpCodeMap->isPODF();     // ODF 1.1 directly uses programmatical name
+            if (!bMapped && rCxt.mxOpCodeMap->hasExternals())
+            {
+                const ExternalHashMap& rExtMap = *rCxt.mxOpCodeMap->getReverseExternalHashMap();
+                ExternalHashMap::const_iterator it = rExtMap.find(aAddIn);
+                if (it != rExtMap.end())
+                {
+                    aAddIn = it->second;
+                    bMapped = true;
+                }
+            }
+
+            if (!bMapped && !rCxt.mxOpCodeMap->isEnglish())
+                ScGlobal::GetAddInCollection()->LocalizeString(aAddIn);
+
+            rBuf.append(aAddIn);
+        }
         break;
         case svError:
         {


More information about the Libreoffice-commits mailing list