summaryrefslogtreecommitdiff
path: root/formula/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-11-13 16:55:48 +0100
committerEike Rathke <erack@redhat.com>2013-11-13 17:15:59 +0100
commitdebe0835cad25931a934eb3e1f205d508e6498cd (patch)
treea80e0cc2f00c668e77f165e0289c65cc2338a1ab /formula/source
parenta500ab2ee19a5221817c13fc8975c27fe4e92246 (diff)
introduced FormulaGrammar::GRAM_OOXML with FormulaLanguage::OOXML
FormulaLanguage::XL_ENGLISH is not OOXML, unconditionally using SymbolsEnglishXL with RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML spoils the grammars of FormulaLanguage::XL_ENGLISH that are not OOXML. Change-Id: Id885d1c033cd15dc7b11c6490be3a98500027d37
Diffstat (limited to 'formula/source')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx37
1 files changed, 27 insertions, 10 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 1d84757eb871..6499aa4d0fa8 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -144,25 +144,25 @@ void lclPushOpCodeMapEntries( ::std::vector< sheet::FormulaOpCodeMapEntry >& rVe
class OpCodeList : public Resource // temp object for resource
{
public:
+ enum SeparatorType
+ {
+ SEMICOLON_BASE,
+ COMMA_BASE
+ };
- OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr );
+ OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr, SeparatorType = SEMICOLON_BASE );
private:
bool getOpCodeString( OUString& rStr, sal_uInt16 nOp );
void putDefaultOpCode( FormulaCompiler::NonConstOpCodeMapPtr xMap, sal_uInt16 nOp );
private:
- enum SeparatorType
- {
- SEMICOLON_BASE,
- COMMA_BASE
- };
SeparatorType meSepType;
};
-OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr xMap ) :
+OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr xMap, SeparatorType eSepType ) :
Resource( ResId( nRID, *ResourceManager::getResManager()))
- , meSepType( SEMICOLON_BASE)
+ , meSepType( eSepType)
{
for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
{
@@ -589,6 +589,11 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::GetOpCodeMap( const sal_Int32 nLa
InitSymbolsEnglishXL();
xMap = mxSymbolsEnglishXL;
break;
+ case FormulaLanguage::OOXML:
+ if (!mxSymbolsOOXML)
+ InitSymbolsOOXML();
+ xMap = mxSymbolsOOXML;
+ break;
default:
; // nothing, NULL map returned
}
@@ -703,7 +708,7 @@ void FormulaCompiler::InitSymbolsEnglishXL() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_ENGLISH, aMap.mxSymbolMap);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH, FormulaGrammar::GRAM_ENGLISH, aMap.mxSymbolMap);
mxSymbolsEnglishXL = aMap.mxSymbolMap;
// TODO: For now, just replace the separators to the Excel English
@@ -714,6 +719,15 @@ void FormulaCompiler::InitSymbolsEnglishXL() const
mxSymbolsEnglishXL->putOpCode( OUString(';'), ocArrayRowSep);
}
+void FormulaCompiler::InitSymbolsOOXML() const
+{
+ static OpCodeMapData aMap;
+ osl::MutexGuard aGuard(&aMap.maMtx);
+ if (!aMap.mxSymbolMap)
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_OOXML, aMap.mxSymbolMap);
+ mxSymbolsOOXML = aMap.mxSymbolMap;
+}
+
void FormulaCompiler::loadSymbols( sal_uInt16 nSymbols, FormulaGrammar::Grammar eGrammar,
NonConstOpCodeMapPtr& rxMap) const
@@ -723,7 +737,10 @@ void FormulaCompiler::loadSymbols( sal_uInt16 nSymbols, FormulaGrammar::Grammar
// not Core
rxMap.reset( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, eGrammar != FormulaGrammar::GRAM_ODFF, eGrammar ));
OModuleClient aModuleClient;
- OpCodeList aOpCodeList( nSymbols, rxMap );
+ OpCodeList aOpCodeList( nSymbols, rxMap,
+ ((eGrammar == FormulaGrammar::GRAM_OOXML) ?
+ OpCodeList::SeparatorType::COMMA_BASE :
+ OpCodeList::SeparatorType::SEMICOLON_BASE));
fillFromAddInMap( rxMap, eGrammar);
// Fill from collection for AddIns not already present.