summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-10 14:02:00 -0400
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-10 14:55:40 -0500
commit4f53e684ab1d44f67b544f5dc3c30e148a82007e (patch)
treedfdbe70dc49fdb8af27d0eb6ca807f2259929424
parent7dba6e0a71d090f06a6a1a39e87572674593b48a (diff)
fdo#75950: Just set the right grammar and be done with it.
Using the Excel A1 syntax with custom opcode was probably a hack back in the day. These days we can just set the right grammar and expect the compiler to do the right thing. Change-Id: Iae98f9f09a7da0b7b9549e06308d5d313bbff1ea (cherry picked from commit ca8ca8c28742879220f3ff88ae0d71c8d69b11cd) Reviewed-on: https://gerrit.libreoffice.org/8521 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/filter/excel/xecontent.cxx12
-rw-r--r--sc/source/filter/excel/xeextlst.cxx2
-rw-r--r--sc/source/filter/excel/xeroot.cxx6
-rw-r--r--sc/source/filter/excel/xestream.cxx17
-rw-r--r--sc/source/filter/excel/xetable.cxx4
-rw-r--r--sc/source/filter/inc/xeroot.hxx2
-rw-r--r--sc/source/filter/inc/xestream.hxx4
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx3
8 files changed, 13 insertions, 37 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 3cee5e6e909f..4c4db7f04a6f 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -943,13 +943,13 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
{
rWorksheet->startElement( XML_formula, FSEND );
rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
- mrFormatEntry.CreateTokenArry( 0 ), GetRoot().GetOpCodeMap() ));
+ mrFormatEntry.CreateTokenArry(0)));
rWorksheet->endElement( XML_formula );
if (bFmla2)
{
rWorksheet->startElement( XML_formula, FSEND );
rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(),
- mrFormatEntry.CreateTokenArry( 1 ), GetRoot().GetOpCodeMap() ));
+ mrFormatEntry.CreateTokenArry(1)));
rWorksheet->endElement( XML_formula );
}
}
@@ -1090,7 +1090,7 @@ void XclExpCfvo::SaveXml( XclExpXmlStream& rStrm )
if(mrEntry.GetType() == COLORSCALE_FORMULA)
{
OUString aFormula = XclXmlUtils::ToOUString( GetRoot().GetDoc(), maSrcPos,
- mrEntry.GetFormula()->Clone(), GetRoot().GetOpCodeMap() );
+ mrEntry.GetFormula()->Clone());
aValue = OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8 );
}
else
@@ -1599,7 +1599,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) :
CreateDataValFormula() and CreateListValFormula(). */
mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_LISTVAL, *xScTokArr );
msFormula1 = XclXmlUtils::ToOUString( GetDoc(), pValData->GetSrcPos(),
- xScTokArr.get(), GetRoot().GetOpCodeMap() );
+ xScTokArr.get());
}
}
else
@@ -1607,7 +1607,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) :
// no list validation -> convert the formula
mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, *xScTokArr );
msFormula1 = XclXmlUtils::ToOUString( GetDoc(), pValData->GetSrcPos(),
- xScTokArr.get(), GetRoot().GetOpCodeMap() );
+ xScTokArr.get());
}
}
@@ -1617,7 +1617,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) :
{
mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_DATAVAL, *xScTokArr );
msFormula2 = XclXmlUtils::ToOUString( GetDoc(), pValData->GetSrcPos(),
- xScTokArr.get(), GetRoot().GetOpCodeMap() );
+ xScTokArr.get());
}
}
else
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index 92fb6c6bac7f..852647c33cfc 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -63,7 +63,7 @@ XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry&
if(pArr)
{
aFormula = XclXmlUtils::ToOUString( GetRoot().GetDoc(), rSrcPos,
- pArr->Clone(), GetRoot().GetOpCodeMap() );
+ pArr->Clone());
}
maValue = OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8 );
}
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 7e650c6a986e..f74f35200f87 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -167,12 +167,6 @@ XclExpPivotTableManager& XclExpRoot::GetPivotTableManager() const
return *mrExpData.mxPTableMgr;
}
-ScCompiler::OpCodeMapPtr XclExpRoot::GetOpCodeMap() const
-{
- OSL_ENSURE( mrExpData.mxOpCodeMap, "XclExpRoot::GetOpCodeMap - missing object (wrong BIFF?)" );
- return mrExpData.mxOpCodeMap;
-}
-
void XclExpRoot::InitializeConvert()
{
mrExpData.mxTabInfo.reset( new XclExpTabInfo( GetRoot() ) );
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 97676dfb7bd1..805629ff3442 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -839,23 +839,10 @@ OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sa
}
OUString XclXmlUtils::ToOUString(
- ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray,
- const FormulaCompiler::OpCodeMapPtr & xOpCodeMap )
+ ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray )
{
ScCompiler aCompiler( &rDocument, rAddress, const_cast<ScTokenArray&>(*pTokenArray));
- if (xOpCodeMap)
- {
- aCompiler.SetFormulaLanguage( xOpCodeMap );
- /* TODO: The correct ref convention would be CONV_XL_OOX but that would
- * need aCompiler.SetExternalLinks() and so far we don't have the links
- * mapping. */
- aCompiler.SetRefConvention( formula::FormulaGrammar::CONV_XL_A1 );
- }
- else
- {
- SAL_WARN( "sc", "XclXmlUtils::ToOUString - no opcodemap, dumb fallback to PODF");
- aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_A1);
- }
+ aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_OOX);
OUStringBuffer aBuffer( pTokenArray->GetLen() * 5 );
aCompiler.CreateStringFromTokenArray( aBuffer );
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 89a778b41229..6adfe87bae9d 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -962,8 +962,8 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
// OOXTODO: XML_si, uint
// OOXTODO: XML_bx bool
FSEND );
- rWorksheet->writeEscaped( XclXmlUtils::ToOUString( *mrScFmlaCell.GetDocument(), mrScFmlaCell.aPos,
- mrScFmlaCell.GetCode(), rStrm.GetRoot().GetOpCodeMap() ) );
+ rWorksheet->writeEscaped( XclXmlUtils::ToOUString(
+ *mrScFmlaCell.GetDocument(), mrScFmlaCell.aPos, mrScFmlaCell.GetCode()));
rWorksheet->endElement( XML_f );
if( strcmp( sType, "inlineStr" ) == 0 )
{
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index a0978a72b4da..706c3aca763d 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -145,8 +145,6 @@ public:
XclExpPivotTableManager& GetPivotTableManager() const;
/** Returns the differential formatting list */
XclExpDxfs& GetDxfs() const;
- /** Returns the op-code mapping */
- ScCompiler::OpCodeMapPtr GetOpCodeMap() const;
/** Is called when export filter starts to create the Excel document (all BIFF versions). */
void InitializeConvert();
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index a6c371eb55ff..e29ed1ad65bf 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -34,7 +34,6 @@
#include "xlstream.hxx"
#include "xestring.hxx"
-#include "compiler.hxx"
#include <filter/msfilter/mscodec.hxx>
#include <vector>
@@ -285,8 +284,7 @@ public:
static OUString ToOUString( const char* s );
static OUString ToOUString( const ScfUInt16Vec& rBuffer, sal_Int32 nStart = 0, sal_Int32 nLength = -1 );
- static OUString ToOUString( ScDocument& rDocument, const ScAddress& rAddress,
- const ScTokenArray* pTokenArray, const ScCompiler::OpCodeMapPtr & xOpCodeMap );
+ static OUString ToOUString( ScDocument& rDocument, const ScAddress& rAddress, const ScTokenArray* pTokenArray );
static OUString ToOUString( const XclExpString& s );
static const char* ToPsz( bool b );
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 2c6424e62069..7033b3ea121a 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -984,8 +984,7 @@ static void lcl_WriteCell( XclExpXmlStream& rStrm, sal_Int32 nElement, const ScA
FSEND );
pStream->writeEscaped( XclXmlUtils::ToOUString(
*pData->mpFormulaCell->GetDocument(),
- pData->mpFormulaCell->aPos, pData->mpFormulaCell->GetCode(),
- rStrm.GetRoot().GetOpCodeMap() ) );
+ pData->mpFormulaCell->aPos, pData->mpFormulaCell->GetCode()));
pStream->endElement( XML_f );
break;
case EXC_CHTR_TYPE_STRING: