diff options
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 22 | ||||
-rw-r--r-- | include/formula/FormulaCompiler.hxx | 1 | ||||
-rw-r--r-- | sc/inc/compiler.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 5 |
4 files changed, 25 insertions, 4 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 867c9ecc6b3a..0358741026c1 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -2699,11 +2699,20 @@ const FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf bool bMapped = mxSymbols->isPODF(); // ODF 1.1 directly uses programmatical name if (!bMapped && mxSymbols->hasExternals()) { - ExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap().find( aAddIn); - if (iLook != mxSymbols->getReverseExternalHashMap().end()) + if (mxSymbols->isOOXML()) { - aAddIn = (*iLook).second; - bMapped = true; + // Write compatibility name, if any. + if (GetExcelName( aAddIn)) + bMapped = true; + } + if (!bMapped) + { + ExternalHashMap::const_iterator iLook = mxSymbols->getReverseExternalHashMap().find( aAddIn); + if (iLook != mxSymbols->getReverseExternalHashMap().end()) + { + aAddIn = (*iLook).second; + bMapped = true; + } } } if (!bMapped && !mxSymbols->isEnglish()) @@ -3002,6 +3011,11 @@ void FormulaCompiler::LocalizeString( OUString& /*rName*/ ) const { } +bool FormulaCompiler::GetExcelName( OUString& /*rName*/ ) const +{ + return false; +} + formula::ParamClass FormulaCompiler::GetForceArrayParameter( const FormulaToken* /*pToken*/, sal_uInt16 /*nParam*/ ) const { return ParamClass::Unknown; diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index 2c4d816053d1..7e4477b53d6d 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -357,6 +357,7 @@ protected: virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const; virtual void CreateStringFromIndex( OUStringBuffer& rBuffer, const FormulaToken* pToken ) const; virtual void LocalizeString( OUString& rName ) const; // modify rName - input: exact name + virtual bool GetExcelName( OUString& rName ) const; // modify rName - input: exact name bool GetToken(); OpCode NextToken(); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index d0305bf474e2..33fe7ca97361 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -533,6 +533,7 @@ private: virtual void CreateStringFromMatrix( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override; virtual void CreateStringFromIndex( OUStringBuffer& rBuffer, const formula::FormulaToken* pToken ) const override; virtual void LocalizeString( OUString& rName ) const override; // modify rName - input: exact name + virtual bool GetExcelName( OUString& rName ) const override; // modify rName - input: exact name virtual formula::ParamClass GetForceArrayParameter( const formula::FormulaToken* pToken, sal_uInt16 nParam ) const override; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 53bb6d556c4b..652bc14d17fe 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5599,6 +5599,11 @@ void ScCompiler::LocalizeString( OUString& rName ) const ScGlobal::GetAddInCollection()->LocalizeString( rName ); } +bool ScCompiler::GetExcelName( OUString& rName ) const +{ + return ScGlobal::GetAddInCollection()->GetExcelName( rName, LANGUAGE_ENGLISH_US, rName); +} + FormulaTokenRef ScCompiler::ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2 ) { return extendRangeReference( rDoc.GetSheetLimits(), rTok1, rTok2, aPos, true/*bReuseDoubleRef*/ ); |