diff options
author | Eike Rathke <erack@redhat.com> | 2015-04-24 16:51:36 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-04-24 17:04:47 +0200 |
commit | 13b9e62d66d1d34dcc66c0f6df592a7129fa3d0a (patch) | |
tree | 46e28d0d20d927ee01a13d4e462a18114d932b17 | |
parent | 9a8d327e023d59ad02378edf4cb9ccf2478fcdf5 (diff) |
TableRef: centralized FormulaCompiler::NeedsTableRefTransformation()
... and include OOXML until we actually write Table.
Change-Id: I95fa65bd593c72af409728cea1ec599481beaaab
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 14 | ||||
-rw-r--r-- | include/formula/FormulaCompiler.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 515c1fad05b7..dac5283006c8 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1868,7 +1868,7 @@ const FormulaToken* FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf case svIndex: CreateStringFromIndex( rBuffer, t ); - if (t->GetOpCode() == ocTableRef && bAllowArrAdvance && mxSymbols->getSymbol( ocTableRefOpen).isEmpty()) + if (t->GetOpCode() == ocTableRef && bAllowArrAdvance && NeedsTableRefTransformation()) { // Suppress all TableRef related tokens, the resulting // range was written by CreateStringFromIndex(). @@ -1989,6 +1989,18 @@ void FormulaCompiler::AppendString( OUStringBuffer& rBuffer, const OUString & rS rBuffer.append( '"'); } +bool FormulaCompiler::NeedsTableRefTransformation() const +{ + /* TODO: currently only UI representations use Table structured + * references. Not defined in ODFF, and not implemented yet for OOXML + * export. Change this once OOXML export is implemented, until then write + * A1 style references also for OOXML to not lose functionality. */ + // Unnecessary to explicitly check for ODFF grammar as the ocTableRefOpen + // symbol is not defined there. + return mxSymbols->getSymbol( ocTableRefOpen).isEmpty() || FormulaGrammar::isPODF( meGrammar) + || FormulaGrammar::isOOXML( meGrammar); +} + void FormulaCompiler::UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep ) { diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx index 4137e62e90ac..7d95ff156e23 100644 --- a/include/formula/FormulaCompiler.hxx +++ b/include/formula/FormulaCompiler.hxx @@ -255,6 +255,12 @@ public: including an address reference convention. */ inline FormulaGrammar::Grammar GetGrammar() const { return meGrammar; } + /** Whether current symbol set and grammar need transformation of Table + structured references to A1 style references when writing / exporting + (creating strings). + */ + bool NeedsTableRefTransformation() const; + static void UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep ); static void ResetNativeSymbols(); static void SetNativeSymbols( const OpCodeMapPtr& xMap ); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index e1e48a8d59b2..a2f83eb2160a 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4597,7 +4597,7 @@ void ScCompiler::CreateStringFromIndex( OUStringBuffer& rBuffer, const FormulaTo break; case ocTableRef: { - if (mxSymbols->getSymbol( ocTableRefOpen).isEmpty()) + if (NeedsTableRefTransformation()) { // Write the resulting reference if TableRef is not supported. const ScTableRefToken* pTR = dynamic_cast<const ScTableRefToken*>(_pTokenP); |