diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-15 19:03:56 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-18 17:25:39 -0500 |
commit | af7f6edd2fa36c8e28c43e707e30361fa3f7bf25 (patch) | |
tree | 4d493cc5103f407865b11b7e0aed148b2fd293f6 | |
parent | 0df2c02d4f40b627f17d68d80a18999f4f40aea2 (diff) |
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
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 22 |
2 files changed, 22 insertions, 2 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 294dd6597338..9eef1eec9d05 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 89efbc319ad9..b1d7e941f8d9 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; @@ -3318,7 +3319,26 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons } break; case svExternal: - // TODO : Implement this. + { + // mapped or translated name of AddIns + OUString aAddIn = rToken.GetExternal(); + 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: { |