summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-10 14:02:00 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-10 14:24:52 -0400
commitca8ca8c28742879220f3ff88ae0d71c8d69b11cd (patch)
treebb2a2858c77cfedb456af9d537b9d3b9d0ad8b57
parent5f5cce2ca3ed6aa05bdaa4cdb046efeb6904d9a3 (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
-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 14baaea48ae5..0df97bbe030a 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -946,13 +946,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 );
}
}
@@ -1093,7 +1093,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
@@ -1602,7 +1602,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
@@ -1610,7 +1610,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());
}
}
@@ -1620,7 +1620,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 88ab3e3e2c4c..3da442773401 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 2c37fb177666..290bd6dab1cd 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -842,23 +842,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 5655910990c9..18b9e0ec9359 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 67c4f2eb694f..80a7ee58fa3c 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 8d58c8d52195..8d137ea69a70 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 f4e4ff338590..bcfab7b56084 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: