summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx14
-rw-r--r--include/formula/FormulaCompiler.hxx6
-rw-r--r--sc/source/core/tool/compiler.cxx2
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);