[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Mar 10 12:56:00 PDT 2014


 sc/source/filter/excel/xecontent.cxx         |   12 ++++++------
 sc/source/filter/excel/xeextlst.cxx          |    2 +-
 sc/source/filter/excel/xeroot.cxx            |    6 ------
 sc/source/filter/excel/xestream.cxx          |   17 ++---------------
 sc/source/filter/excel/xetable.cxx           |    4 ++--
 sc/source/filter/inc/xeroot.hxx              |    2 --
 sc/source/filter/inc/xestream.hxx            |    4 +---
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |    3 +--
 8 files changed, 13 insertions(+), 37 deletions(-)

New commits:
commit 4f53e684ab1d44f67b544f5dc3c30e148a82007e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Mar 10 14:02:00 2014 -0400

    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 at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 3cee5e6..4c4db7f 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 92fb6c6..852647c 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 7e650c6..f74f352 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 97676df..805629f 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 89a778b..6adfe87 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 a0978a7..706c3ac 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 a6c371e..e29ed1a 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 2c6424e..7033b3e 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:


More information about the Libreoffice-commits mailing list