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

Kohei Yoshida kohei.yoshida at collabora.com
Tue Apr 15 08:45:38 PDT 2014


 formula/source/core/api/token.cxx            |   37 ++++++++++++++-------------
 include/formula/tokenarray.hxx               |   18 ++++++++++---
 reportdesign/source/ui/dlg/Formula.cxx       |    6 ++--
 reportdesign/source/ui/inc/Formula.hxx       |   13 ++++++++-
 reportdesign/source/ui/misc/UITools.cxx      |   11 +++++++-
 sc/inc/tokenarray.hxx                        |    5 ++-
 sc/source/core/data/conditio.cxx             |   13 +++++++--
 sc/source/core/data/validat.cxx              |    6 ++--
 sc/source/core/tool/formulagroup.cxx         |    5 ++-
 sc/source/core/tool/token.cxx                |   29 ++++++++++-----------
 sc/source/filter/excel/excform.cxx           |    6 +---
 sc/source/filter/excel/excform8.cxx          |    4 --
 sc/source/filter/excel/frmbase.cxx           |   15 ++++------
 sc/source/filter/excel/tokstack.cxx          |   11 +++++---
 sc/source/filter/excel/xicontent.cxx         |    2 -
 sc/source/filter/excel/xlformula.cxx         |    6 ++--
 sc/source/filter/inc/XclImpChangeTrack.hxx   |   14 ----------
 sc/source/filter/inc/excform.hxx             |    4 +-
 sc/source/filter/inc/formel.hxx              |   12 ++++++--
 sc/source/filter/inc/lotform.hxx             |    3 +-
 sc/source/filter/inc/qproform.hxx            |    8 ++---
 sc/source/filter/inc/tokstack.hxx            |   14 ++++++++--
 sc/source/filter/inc/xlformula.hxx           |    9 +++++-
 sc/source/filter/lotus/lotform.cxx           |    4 +-
 sc/source/filter/lotus/lotimpop.cxx          |   11 ++++----
 sc/source/filter/lotus/op.cxx                |    6 ++--
 sc/source/filter/oox/condformatbuffer.cxx    |    4 ++
 sc/source/filter/qpro/qpro.cxx               |   11 +++++---
 sc/source/filter/qpro/qproform.cxx           |    4 +-
 sc/source/filter/xcl97/XclImpChangeTrack.cxx |    5 +++
 sc/source/ui/formdlg/formula.cxx             |    2 -
 sc/source/ui/unoobj/funcuno.cxx              |    4 ++
 sc/source/ui/unoobj/tokenuno.cxx             |    2 -
 33 files changed, 187 insertions(+), 117 deletions(-)

New commits:
commit 1f87e2e837b4e35b909bf68ccdd3cefd84253940
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Apr 14 16:57:52 2014 -0400

    fdo#76294: Properly intern string literals in formula on xls import.
    
    (cherry picked from commit b09426b83c12b0cd27cd909602251cb076ffa4ba)
    (cherry picked from commit 625c595fc30d2e6153735dc2ed2359ff4f8a1e3a)
    (cherry picked from commit 6bb7fa8df523d3ae7b9945009fb1034f28cb0a0a)
    
    Conflicts:
    	formula/source/core/api/token.cxx
    	include/formula/tokenarray.hxx
    	sc/source/filter/excel/excform.cxx
    	sc/source/filter/excel/excform8.cxx
    	sc/source/filter/excel/frmbase.cxx
    	sc/source/filter/inc/XclImpChangeTrack.hxx
    	sc/source/filter/inc/lotform.hxx
    	sc/source/filter/inc/qproform.hxx
    	sc/source/filter/lotus/lotform.cxx
    	sc/source/filter/lotus/lotimpop.cxx
    	sc/source/filter/lotus/op.cxx
    	reportdesign/source/ui/inc/Formula.hxx
    
    Change-Id: Icf962a4363887f323da6d2bdf935a027df3319fa
    Reviewed-on: https://gerrit.libreoffice.org/9008
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 7499a2b..3777d09 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -29,6 +29,7 @@
 #include "formula/tokenarray.hxx"
 #include "formula/FormulaCompiler.hxx"
 #include <formula/compiler.hrc>
+#include <svl/sharedstringpool.hxx>
 
 namespace formula
 {
@@ -286,12 +287,13 @@ FormulaJumpToken::~FormulaJumpToken()
 }
 
 
-bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,ExternalReferenceHelper* /*_pRef*/)
+bool FormulaTokenArray::AddFormulaToken(
+    const sheet::FormulaToken& rToken, svl::SharedStringPool& rSPool, ExternalReferenceHelper* /*pExtRef*/)
 {
     bool bError = false;
-    const OpCode eOpCode = static_cast<OpCode>(_aToken.OpCode);      //! assuming equal values for the moment
+    const OpCode eOpCode = static_cast<OpCode>(rToken.OpCode);      //! assuming equal values for the moment
 
-    const uno::TypeClass eClass = _aToken.Data.getValueTypeClass();
+    const uno::TypeClass eClass = rToken.Data.getValueTypeClass();
     switch ( eClass )
     {
         case uno::TypeClass_VOID:
@@ -301,14 +303,14 @@ bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,Exter
         case uno::TypeClass_DOUBLE:
             // double is only used for "push"
             if ( eOpCode == ocPush )
-                AddDouble( _aToken.Data.get<double>() );
+                AddDouble( rToken.Data.get<double>() );
             else
                 bError = true;
             break;
         case uno::TypeClass_LONG:
             {
                 // long is svIndex, used for name / database area, or "byte" for spaces
-                sal_Int32 nValue = _aToken.Data.get<sal_Int32>();
+                sal_Int32 nValue = rToken.Data.get<sal_Int32>();
                 if ( eOpCode == ocDBArea )
                     AddToken( formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) ) );
                 else if ( eOpCode == ocSpaces )
@@ -319,9 +321,9 @@ bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,Exter
             break;
         case uno::TypeClass_STRING:
             {
-                OUString aStrVal( _aToken.Data.get<OUString>() );
+                OUString aStrVal( rToken.Data.get<OUString>() );
                 if ( eOpCode == ocPush )
-                    AddString( aStrVal );
+                    AddString(rSPool.intern(aStrVal));
                 else if ( eOpCode == ocBad )
                     AddBad( aStrVal );
                 else if ( eOpCode == ocStringXML )
@@ -337,13 +339,16 @@ bool FormulaTokenArray::AddFormulaToken(const sheet::FormulaToken& _aToken,Exter
     } // switch ( eClass )
     return bError;
 }
-bool FormulaTokenArray::Fill(const uno::Sequence< sheet::FormulaToken >& _aSequence,ExternalReferenceHelper* _pRef)
+
+bool FormulaTokenArray::Fill(
+    const uno::Sequence<sheet::FormulaToken>& rSequence,
+    svl::SharedStringPool& rSPool, ExternalReferenceHelper* pExtRef )
 {
     bool bError = false;
-    const sal_Int32 nCount = _aSequence.getLength();
+    const sal_Int32 nCount = rSequence.getLength();
     for (sal_Int32 nPos=0; nPos<nCount; nPos++)
     {
-        bool bOneError = AddFormulaToken( _aSequence[nPos] ,_pRef);
+        bool bOneError = AddFormulaToken(rSequence[nPos], rSPool, pExtRef);
         if (bOneError)
         {
             AddOpCode( ocErrName);  // add something that indicates an error
@@ -790,12 +795,7 @@ FormulaToken* FormulaTokenArray::Add( FormulaToken* t )
     }
 }
 
-FormulaToken* FormulaTokenArray::AddString( const sal_Unicode* pStr )
-{
-    return AddString( OUString( pStr ) );
-}
-
-FormulaToken* FormulaTokenArray::AddString( const OUString& rStr )
+FormulaToken* FormulaTokenArray::AddString( const svl::SharedString& rStr )
 {
     return Add( new FormulaStringToken( rStr ) );
 }
@@ -1363,7 +1363,10 @@ bool FormulaDoubleToken::operator==( const FormulaToken& r ) const
 }
 
 FormulaStringToken::FormulaStringToken( const svl::SharedString& r ) :
-    FormulaToken( svString ), maString( r ) {}
+    FormulaToken( svString ), maString( r )
+{
+}
+
 FormulaStringToken::FormulaStringToken( const FormulaStringToken& r ) :
     FormulaToken( r ), maString( r.maString ) {}
 
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
index a479c10..3c6e12a 100644
--- a/include/formula/tokenarray.hxx
+++ b/include/formula/tokenarray.hxx
@@ -28,6 +28,13 @@
 
 #include <boost/unordered_set.hpp>
 
+namespace svl {
+
+class SharedString;
+class SharedStringPool;
+
+}
+
 namespace formula
 {
 
@@ -197,14 +204,18 @@ public:
         Derived classes must overload it when they want to support derived classes from FormulaToken.
         @return true        when an error occurs
     */
-    virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken, ExternalReferenceHelper* _pRef = NULL);
+    virtual bool AddFormulaToken(
+        const css::sheet::FormulaToken& rToken, svl::SharedStringPool& rSPool,
+        ExternalReferenceHelper* pExtRef );
 
     /** fill the array with the tokens from the sequence.
         It calls AddFormulaToken for each token in the list.
         @param  _aSequence  the token to add
         @return true        when an error occurs
     */
-    bool Fill(const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& _aSequence, ExternalReferenceHelper* _pRef = NULL);
+    bool Fill(
+        const css::uno::Sequence<css::sheet::FormulaToken>& rSequence,
+        svl::SharedStringPool& rSPool, ExternalReferenceHelper* pExtRef );
 
     /**
      * Do some checking based on the individual tokens. For now, we use this
@@ -213,8 +224,7 @@ public:
     virtual void CheckToken( const FormulaToken& t );
 
     FormulaToken* AddToken( const FormulaToken& );
-    FormulaToken* AddString( const sal_Unicode* pStr );
-    FormulaToken* AddString( const OUString& rStr );
+    FormulaToken* AddString( const svl::SharedString& rStr );
     FormulaToken* AddDouble( double fVal );
     FormulaToken* AddExternal( const sal_Unicode* pStr );
     /** Xcl import may play dirty tricks with OpCode!=ocExternal.
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
index 0d37c49..6eaa92e 100644
--- a/reportdesign/source/ui/dlg/Formula.cxx
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -46,7 +46,8 @@ FormulaDialog::FormulaDialog(Window* pParent
                              , const uno::Reference<lang::XMultiServiceFactory>& _xServiceFactory
                              , const ::boost::shared_ptr< IFunctionManager >&  _pFunctionMgr
                              , const OUString& _sFormula
-                             , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet)
+                             , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+                             , svl::SharedStringPool& rStrPool )
     : FormulaModalDialog( pParent, false,false,false,_pFunctionMgr.get(),this)
     ,m_aFunctionManager(_pFunctionMgr)
     ,m_pFormulaData(new FormEditData())
@@ -56,6 +57,7 @@ FormulaDialog::FormulaDialog(Window* pParent
     ,m_sFormula("=")
     ,m_nStart(0)
     ,m_nEnd(1)
+    ,mrStringPool(rStrPool)
 {
     if ( !_sFormula.isEmpty() )
     {
@@ -255,7 +257,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
 ::std::auto_ptr<formula::FormulaTokenArray> FormulaDialog::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
 {
     ::std::auto_ptr<formula::FormulaTokenArray> pArray(new FormulaTokenArray());
-    pArray->Fill(_aTokenList, NULL);
+    pArray->Fill(_aTokenList, mrStringPool, NULL);
     return pArray;
 }
 
diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx
index a341094..0e53c47 100644
--- a/reportdesign/source/ui/inc/Formula.hxx
+++ b/reportdesign/source/ui/inc/Formula.hxx
@@ -30,7 +30,12 @@ namespace com { namespace sun { namespace star { namespace lang {
     class XMultiServiceFactory;
 } } } }
 
-//============================================================================
+namespace svl {
+
+class SharedStringPool;
+
+}
+
 namespace rptui
 {
 //============================================================================
@@ -51,13 +56,17 @@ class FormulaDialog : public formula::FormulaModalDialog,
     xub_StrLen                  m_nStart;
     xub_StrLen                  m_nEnd;
 
+    svl::SharedStringPool& mrStringPool;
+
     DECL_LINK( OnClickHdl, OAddFieldWindow*);
 public:
     FormulaDialog( Window* pParent
         , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xServiceFactory
         , const ::boost::shared_ptr< formula::IFunctionManager >& _pFunctionMgr
         , const OUString& _sFormula
-        , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet);
+        , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+        , svl::SharedStringPool& rStrPool );
+
     virtual ~FormulaDialog();
 
     // IFormulaEditorHelper
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 965f429..9a7b285 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -75,9 +75,11 @@
 #include <svx/unoprov.hxx>
 
 #include <unotools/pathoptions.hxx>
+#include <unotools/charclass.hxx>
 #include <svtools/ctrltool.hxx>
 #include <svl/itempool.hxx>
 #include <svl/itemset.hxx>
+#include <svl/sharedstringpool.hxx>
 
 #include <comphelper/propmultiplex.hxx>
 #include <comphelper/namedvaluecollection.hxx>
@@ -1027,7 +1029,14 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula
         {
             ::boost::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) );
             ReportFormula aFormula( _in_out_rFormula );
-            FormulaDialog aDlg(pParent,xServiceFactory,pFormulaManager,aFormula.getUndecoratedContent(),_xRowSet);
+
+            LanguageTag aLangTag(LANGUAGE_SYSTEM);
+            CharClass aCC(_xContext, aLangTag);
+            svl::SharedStringPool aStringPool(&aCC);
+
+            FormulaDialog aDlg(
+                pParent, xServiceFactory, pFormulaManager, aFormula.getUndecoratedContent(), _xRowSet, aStringPool);
+
             bSuccess = aDlg.Execute() == RET_OK;
             if ( bSuccess )
             {
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 5b3e080..bc63154 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -84,7 +84,10 @@ public:
                                 const ScAddress& rPos, ScDirection );
 
     formula::FormulaToken* AddRawToken( const ScRawToken& );
-    virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken,formula::ExternalReferenceHelper* _pRef);
+    virtual bool AddFormulaToken(
+        const css::sheet::FormulaToken& rToken,
+        svl::SharedStringPool& rSPool,
+        formula::ExternalReferenceHelper* _pRef);
     virtual void CheckToken( const formula::FormulaToken& r );
     virtual formula::FormulaToken* AddOpCode( OpCode eCode );
     /** ScSingleRefToken with ocPush. */
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 1a9f869..ae5e098 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -40,7 +40,8 @@
 #include "editutil.hxx"
 #include "tokenarray.hxx"
 #include "refupdatecontext.hxx"
-#include "svl/sharedstring.hxx"
+#include <svl/sharedstring.hxx>
+#include <svl/sharedstringpool.hxx>
 
 using namespace formula;
 //------------------------------------------------------------------------
@@ -1306,7 +1307,10 @@ ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const
         {
             pRet = new ScTokenArray();
             if (bIsStr1)
-                pRet->AddString( aStrVal1 );
+            {
+                svl::SharedStringPool& rSPool = mpDoc->GetSharedStringPool();
+                pRet->AddString(rSPool.intern(aStrVal1));
+            }
             else
                 pRet->AddDouble( nVal1 );
         }
@@ -1319,7 +1323,10 @@ ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const
         {
             pRet = new ScTokenArray();
             if (bIsStr2)
-                pRet->AddString( aStrVal2 );
+            {
+                svl::SharedStringPool& rSPool = mpDoc->GetSharedStringPool();
+                pRet->AddString(rSPool.intern(aStrVal2));
+            }
             else
                 pRet->AddDouble( nVal2 );
         }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index cbd3a94..8f13db7 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -714,6 +714,7 @@ bool ScValidationData::GetSelectionFromFormula(
     }
 
     bool bHaveEmpty = false;
+    svl::SharedStringPool& rSPool = pDocument->GetSharedStringPool();
 
     /* XL artificially limits things to a single col or row in the UI but does
      * not list the constraint in MOOXml. If a defined name or INDIRECT
@@ -749,7 +750,7 @@ bool ScValidationData::GetSelectionFromFormula(
                     pEntry = new ScTypedStrData( aValStr, 0.0, ScTypedStrData::Standard);
 
                 if (!rCell.isEmpty() && rMatch < 0)
-                    aCondTokArr.AddString( aValStr );
+                    aCondTokArr.AddString(rSPool.intern(aValStr));
             }
             else
             {
@@ -877,6 +878,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos
 
     // *** try if formula is a string list ***
 
+    svl::SharedStringPool& rSPool = GetDocument()->GetSharedStringPool();
     sal_uInt32 nFormat = lclGetCellFormat( *GetDocument(), rPos );
     ScStringTokenIterator aIt( *pTokArr );
     for (rtl_uString* pString = aIt.First(); pString && aIt.Ok(); pString = aIt.Next())
@@ -892,7 +894,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos
             if (GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue))
                 aCondTokArr.AddDouble( fValue );
             else
-                aCondTokArr.AddString(aStr);
+                aCondTokArr.AddString(rSPool.intern(aStr));
 
             bIsValid = IsEqualToTokenArray(rCell, rPos, aCondTokArr);
         }
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 736d48c..aa8d152 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -356,8 +356,11 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres
                     }
 
                     if (pStr)
+                    {
                         // This is a string cell.
-                        aCode2.AddString(OUString(pStr));
+                        svl::SharedStringPool& rPool = rDoc.GetSharedStringPool();
+                        aCode2.AddString(rPool.intern(OUString(pStr)));
+                    }
                     else if (rtl::math::isNan(fVal))
                         // Value of NaN represents an empty cell.
                         aCode2.AddToken(ScEmptyCellToken(false, false));
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ce6a644..320c42e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1187,27 +1187,26 @@ bool ScHybridCellToken::operator==( const FormulaToken& r ) const
 
 
 
-//////////////////////////////////////////////////////////////////////////
-
-bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken,formula::ExternalReferenceHelper* _pRef)
+bool ScTokenArray::AddFormulaToken(
+    const css::sheet::FormulaToken& rToken, svl::SharedStringPool& rSPool, formula::ExternalReferenceHelper* pExtRef)
 {
-    bool bError = FormulaTokenArray::AddFormulaToken(_aToken,_pRef);
+    bool bError = FormulaTokenArray::AddFormulaToken(rToken, rSPool, pExtRef);
     if ( bError )
     {
         bError = false;
-        const OpCode eOpCode = static_cast<OpCode>(_aToken.OpCode);      //! assuming equal values for the moment
+        const OpCode eOpCode = static_cast<OpCode>(rToken.OpCode);      //! assuming equal values for the moment
 
-        const uno::TypeClass eClass = _aToken.Data.getValueTypeClass();
+        const uno::TypeClass eClass = rToken.Data.getValueTypeClass();
         switch ( eClass )
         {
             case uno::TypeClass_STRUCT:
                 {
-                    uno::Type aType = _aToken.Data.getValueType();
+                    uno::Type aType = rToken.Data.getValueType();
                     if ( aType.equals( cppu::UnoType<sheet::SingleReference>::get() ) )
                     {
                         ScSingleRefData aSingleRef;
                         sheet::SingleReference aApiRef;
-                        _aToken.Data >>= aApiRef;
+                        rToken.Data >>= aApiRef;
                         lcl_SingleRefToCalc( aSingleRef, aApiRef );
                         if ( eOpCode == ocPush )
                             AddSingleReference( aSingleRef );
@@ -1220,7 +1219,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                     {
                         ScComplexRefData aComplRef;
                         sheet::ComplexReference aApiRef;
-                        _aToken.Data >>= aApiRef;
+                        rToken.Data >>= aApiRef;
                         lcl_SingleRefToCalc( aComplRef.Ref1, aApiRef.Reference1 );
                         lcl_SingleRefToCalc( aComplRef.Ref2, aApiRef.Reference2 );
 
@@ -1232,7 +1231,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                     else if ( aType.equals( cppu::UnoType<sheet::NameToken>::get() ) )
                     {
                         sheet::NameToken aTokenData;
-                        _aToken.Data >>= aTokenData;
+                        rToken.Data >>= aTokenData;
                         if ( eOpCode == ocName )
                             AddRangeName(aTokenData.Index, aTokenData.Global);
                         else if (eOpCode == ocDBArea)
@@ -1243,7 +1242,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                     else if ( aType.equals( cppu::UnoType<sheet::ExternalReference>::get() ) )
                     {
                         sheet::ExternalReference aApiExtRef;
-                        if( (eOpCode == ocPush) && (_aToken.Data >>= aApiExtRef) && (0 <= aApiExtRef.Index) && (aApiExtRef.Index <= SAL_MAX_UINT16) )
+                        if( (eOpCode == ocPush) && (rToken.Data >>= aApiExtRef) && (0 <= aApiExtRef.Index) && (aApiExtRef.Index <= SAL_MAX_UINT16) )
                         {
                             sal_uInt16 nFileId = static_cast< sal_uInt16 >( aApiExtRef.Index );
                             sheet::SingleReference aApiSRef;
@@ -1253,7 +1252,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                             {
                                 // try to resolve cache index to sheet name
                                 size_t nCacheId = static_cast< size_t >( aApiSRef.Sheet );
-                                OUString aTabName = _pRef->getCacheTableName( nFileId, nCacheId );
+                                OUString aTabName = pExtRef->getCacheTableName( nFileId, nCacheId );
                                 if( !aTabName.isEmpty() )
                                 {
                                     ScSingleRefData aSingleRef;
@@ -1268,7 +1267,7 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                             {
                                 // try to resolve cache index to sheet name.
                                 size_t nCacheId = static_cast< size_t >( aApiCRef.Reference1.Sheet );
-                                OUString aTabName = _pRef->getCacheTableName( nFileId, nCacheId );
+                                OUString aTabName = pExtRef->getCacheTableName( nFileId, nCacheId );
                                 if( !aTabName.isEmpty() )
                                 {
                                     ScComplexRefData aComplRef;
@@ -1304,12 +1303,12 @@ bool ScTokenArray::AddFormulaToken(const com::sun::star::sheet::FormulaToken& _a
                 {
                     if ( eOpCode != ocPush )
                         bError = true;      // not an inline array
-                    else if (!_aToken.Data.getValueType().equals( getCppuType(
+                    else if (!rToken.Data.getValueType().equals( getCppuType(
                                     (uno::Sequence< uno::Sequence< uno::Any > > *)0)))
                         bError = true;      // unexpected sequence type
                     else
                     {
-                        ScMatrixRef xMat = ScSequenceToMatrix::CreateMixedMatrix( _aToken.Data);
+                        ScMatrixRef xMat = ScSequenceToMatrix::CreateMixedMatrix( rToken.Data);
                         if (xMat)
                             AddMatrix( xMat);
                         else
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 644485f..1f1336e 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -181,10 +181,8 @@ void ImportExcel::Formula(
 }
 
 
-
-
-ExcelToSc::ExcelToSc( const XclImpRoot& rRoot ) :
-    ExcelConverterBase( 512 ),
+ExcelToSc::ExcelToSc( XclImpRoot& rRoot ) :
+    ExcelConverterBase(rRoot.GetDocImport().getDoc().GetSharedStringPool(), 512),
     XclImpRoot( rRoot ),
     maFuncProv( rRoot ),
     meBiff( rRoot.GetBiff() )
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 9cc81da..f2c2938 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -79,9 +79,7 @@ ExcelToSc8::ExternalTabInfo::ExternalTabInfo() :
 {
 }
 
-// ============================================================================
-
-ExcelToSc8::ExcelToSc8( const XclImpRoot& rRoot ) :
+ExcelToSc8::ExcelToSc8( XclImpRoot& rRoot ) :
     ExcelToSc( rRoot ),
     rLinkMan( rRoot.GetLinkManager() )
 {
diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx
index 6d167ff..d2179e0 100644
--- a/sc/source/filter/excel/frmbase.cxx
+++ b/sc/source/filter/excel/frmbase.cxx
@@ -167,7 +167,8 @@ const ScRange* _ScRangeListTabs::Next ()
     return &(*maItrCur);
 }
 
-ConverterBase::ConverterBase( sal_uInt16 nNewBuffer ) :
+ConverterBase::ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer ) :
+    aPool(rSPool),
     aEingPos( 0, 0, 0 ),
     eStatus( ConvOK ),
     nBufferSize( nNewBuffer )
@@ -189,10 +190,8 @@ void ConverterBase::Reset()
 }
 
 
-
-
-ExcelConverterBase::ExcelConverterBase( sal_uInt16 nNewBuffer ) :
-    ConverterBase( nNewBuffer )
+ExcelConverterBase::ExcelConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer ) :
+    ConverterBase(rSPool, nNewBuffer)
 {
 }
 
@@ -213,10 +212,8 @@ void ExcelConverterBase::Reset()
 }
 
 
-
-
-LotusConverterBase::LotusConverterBase( SvStream &rStr, sal_uInt16 nNewBuffer ) :
-    ConverterBase( nNewBuffer ),
+LotusConverterBase::LotusConverterBase( SvStream &rStr, svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffers ) :
+    ConverterBase(rSPool, nNewBuffers),
     aIn( rStr ),
     nBytesLeft( 0 )
 {
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 5503409..1afbafa 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -17,14 +17,16 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <string.h>
 
-#include "compiler.hxx"
 #include "tokstack.hxx"
+#include "compiler.hxx"
 #include "global.hxx"
 #include "scmatrix.hxx"
 
+#include <svl/sharedstringpool.hxx>
+
 #include <stdio.h>
+#include <string.h>
 
 const sal_uInt16    TokenPool::nScTokenOff = 8192;
 
@@ -53,7 +55,8 @@ TokenStack::~TokenStack()
 //              -> Unterscheidung von anderen Token
 
 
-TokenPool::TokenPool( void )
+TokenPool::TokenPool( svl::SharedStringPool& rSPool ) :
+    mrStringPool(rSPool)
 {
     sal_uInt16  nLauf = nScTokenOff;
 
@@ -394,7 +397,7 @@ bool TokenPool::GetElement( const sal_uInt16 nId )
                     sal_uInt16 n = pElement[ nId ];
                     OUString* p = ( n < nP_Str )? ppP_Str[ n ] : NULL;
                     if (p)
-                        pScToken->AddString( *p );
+                        pScToken->AddString(mrStringPool.intern(*p));
                     else
                         bRet = false;
                 }
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 09a9c5c..edfe61e 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -825,7 +825,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm )
 
     // process string list of a list validity (convert to list of string tokens)
     if( xTokArr1.get() && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) )
-        XclTokenArrayHelper::ConvertStringToList( *xTokArr1, '\n', true );
+        XclTokenArrayHelper::ConvertStringToList(*xTokArr1, rDoc.GetSharedStringPool(), '\n', true);
 
     maDVItems.push_back(
         new DVItem(aScRanges, ScValidationData(eValMode, eCondMode, xTokArr1.get(), xTokArr2.get(), &rDoc, rScRange.aStart)));
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index a803af1..f486914 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -28,6 +28,7 @@
 #include "xlroot.hxx"
 
 #include <comphelper/string.hxx>
+#include <svl/sharedstringpool.hxx>
 
 using namespace ::formula;
 
@@ -821,7 +822,8 @@ bool XclTokenArrayHelper::GetStringList( OUString& rStringList, const ScTokenArr
     return bRet;
 }
 
-void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unicode cStringSep, bool bTrimLeadingSpaces )
+void XclTokenArrayHelper::ConvertStringToList(
+    ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep, bool bTrimLeadingSpaces )
 {
     OUString aString;
     if( GetString( aString, rScTokArr ) )
@@ -836,7 +838,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic
                 aToken = comphelper::string::stripStart(aToken, ' ');
             if( nToken > 0 )
                 rScTokArr.AddOpCode( ocSep );
-            rScTokArr.AddString( aToken );
+            rScTokArr.AddString(rSPool.intern(aToken));
         }
     }
 }
diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx
index 307cace..ffce967 100644
--- a/sc/source/filter/inc/XclImpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclImpChangeTrack.hxx
@@ -165,22 +165,10 @@ private:
     virtual bool                Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
 
 public:
-    inline                      XclImpChTrFmlConverter(
-                                    const XclImpRoot& rRoot,
-                                    XclImpChangeTrack& rXclChTr );
+    XclImpChTrFmlConverter( XclImpRoot& rRoot, XclImpChangeTrack& rXclChTr );
     virtual                     ~XclImpChTrFmlConverter();
 };
 
-inline XclImpChTrFmlConverter::XclImpChTrFmlConverter(
-        const XclImpRoot& rRoot,
-        XclImpChangeTrack& rXclChTr ) :
-    ExcelToSc8( rRoot ),
-    rChangeTrack( rXclChTr )
-{
-}
-
-//___________________________________________________________________
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx
index ed59df7..131aacc 100644
--- a/sc/source/filter/inc/excform.hxx
+++ b/sc/source/filter/inc/excform.hxx
@@ -49,7 +49,7 @@ protected:
     void                ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const sal_Bool bName );
 
 public:
-                        ExcelToSc( const XclImpRoot& rRoot );
+    ExcelToSc( XclImpRoot& rRoot );
     virtual             ~ExcelToSc();
     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
@@ -126,7 +126,7 @@ private:
 
     bool                HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
 public:
-                        ExcelToSc8( const XclImpRoot& rRoot );
+    ExcelToSc8( XclImpRoot& rRoot );
     virtual             ~ExcelToSc8();
 
     virtual ConvErr     Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx
index faf61b7..b87c0d0 100644
--- a/sc/source/filter/inc/formel.hxx
+++ b/sc/source/filter/inc/formel.hxx
@@ -31,6 +31,12 @@
 #include <boost/ptr_container/ptr_map.hpp>
 #include <vector>
 
+namespace svl {
+
+class SharedStringPool;
+
+}
+
 class XclImpStream;
 class ScTokenArray;
 struct ScSingleRefData;
@@ -84,7 +90,7 @@ protected:
     sal_Char*           pBuffer;        // universal buffer
     sal_uInt16              nBufferSize;    // ...and its size
 
-                        ConverterBase( sal_uInt16 nNewBuffer );
+    ConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer );
     virtual             ~ConverterBase();
 
     void                Reset();
@@ -95,7 +101,7 @@ protected:
 class ExcelConverterBase : public ConverterBase
 {
 protected:
-                        ExcelConverterBase( sal_uInt16 nNewBuffer );
+    ExcelConverterBase( svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer );
     virtual             ~ExcelConverterBase();
 
 public:
@@ -124,7 +130,7 @@ protected:
     inline void         Read( double& fDouble );
         inline void                     Read( sal_uInt32& nUINT32 );
 
-                        LotusConverterBase( SvStream& rStr, sal_uInt16 nNewBuffer );
+    LotusConverterBase( SvStream& rStr, svl::SharedStringPool& rSPool, sal_uInt16 nNewBuffer );
     virtual             ~LotusConverterBase();
 
 public:
diff --git a/sc/source/filter/inc/lotform.hxx b/sc/source/filter/inc/lotform.hxx
index f805edb..ce5bf95 100644
--- a/sc/source/filter/inc/lotform.hxx
+++ b/sc/source/filter/inc/lotform.hxx
@@ -88,7 +88,8 @@ private:
     void                NegToken( TokenId& rParam );
                         // ACHTUNG: wie ~, nur wird '-(<rParam>)' gebildet
 public:
-                        LotusToSc( SvStream& aStr, rtl_TextEncoding eSrc, sal_Bool b );
+    LotusToSc( SvStream& aStr, svl::SharedStringPool& rSPool, rtl_TextEncoding eSrc, bool b );
+
     virtual ConvErr     Convert( const ScTokenArray*& rpErg, sal_Int32& nRest,
                                     const FORMULA_TYPE eFT = FT_CellFormula );
 
diff --git a/sc/source/filter/inc/qproform.hxx b/sc/source/filter/inc/qproform.hxx
index 0ae50df..131d49c 100644
--- a/sc/source/filter/inc/qproform.hxx
+++ b/sc/source/filter/inc/qproform.hxx
@@ -54,16 +54,16 @@ enum FUNC_TYPE
 
 class QProToSc : public ConverterBase
 {
-    private:
+private:
     TokenId mnAddToken;
     TokenId mnSubToken;
     TokenId mn0Token;
     SvStream& maIn;
 
-    public:
+public:
     static const size_t nBufSize = 256;
-    QProToSc( SvStream &aStr, const ScAddress& rRefPos );
-    ~QProToSc(){ };
+    QProToSc( SvStream &aStr, svl::SharedStringPool& rSPool, const ScAddress& rRefPos );
+    virtual ~QProToSc(){ };
     ConvErr Convert( const ScTokenArray*& pArray, sal_uInt16 nLen,
                                                                          const FORMULA_TYPE eFT = FT_CellFormula );
     void DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtString );
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index fd1f031..4ada6a0 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -26,6 +26,12 @@
 
 #include <vector>
 
+namespace svl {
+
+class SharedStringPool;
+
+}
+
 typedef OpCode DefTokenId;
 // in PRODUCT version: ambiguity between OpCode (being sal_uInt16) and UINT16
 // Unfortunately a typedef is just a dumb alias and not a real type ...
@@ -80,7 +86,9 @@ class TokenPool
 {
     // !ACHTUNG!: externe Id-Basis ist 1, interne 0!
     // Ausgabe Id = 0 -> Fehlerfall
-    private:
+private:
+    svl::SharedStringPool& mrStringPool;
+
         OUString**                      ppP_Str;    // Pool fuer Strings
         sal_uInt16                      nP_Str;     // ...mit Groesse
         sal_uInt16                      nP_StrAkt;  // ...und Schreibmarke
@@ -186,8 +194,8 @@ class TokenPool
 		bool						GrowMatrix( void );
 		bool						GetElement( const sal_uInt16 nId );
 		bool						GetElementRek( const sal_uInt16 nId );
-    public:
-                                    TokenPool( void );
+public:
+    TokenPool( svl::SharedStringPool& rSPool );
                                     ~TokenPool();
         inline TokenPool&           operator <<( const TokenId nId );
         inline TokenPool&           operator <<( const DefTokenId eId );
diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx
index 7688220..6ff8c79 100644
--- a/sc/source/filter/inc/xlformula.hxx
+++ b/sc/source/filter/inc/xlformula.hxx
@@ -26,6 +26,12 @@
 #include "ftools.hxx"
 #include <boost/shared_ptr.hpp>
 
+namespace svl {
+
+class SharedStringPool;
+
+}
+
 // Constants ==================================================================
 
 const size_t EXC_TOKARR_MAXLEN              = 4096;     /// Maximum size of a token array.
@@ -530,7 +536,8 @@ public:
         @param rScTokArr  (in/out-parameter) The token array to modify.
         @param cStringSep  The separator in the source string.
         @param bTrimLeadingSpaces  true = remove leading spaces from each token. */
-    static void         ConvertStringToList( ScTokenArray& rScTokArr, sal_Unicode cStringSep, bool bTrimLeadingSpaces );
+    static void ConvertStringToList(
+        ScTokenArray& rScTokArr, svl::SharedStringPool& rSPool, sal_Unicode cStringSep, bool bTrimLeadingSpaces );
 
     // multiple operations ----------------------------------------------------
 
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index c230710..da0ba0f 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -341,8 +341,8 @@ void LotusToSc::Reset( const ScAddress& rEingPos )
 }
 
 
-LotusToSc::LotusToSc( SvStream &rStream, rtl_TextEncoding e, sal_Bool b ) :
-    LotusConverterBase( rStream, 128 )
+LotusToSc::LotusToSc( SvStream &rStream, svl::SharedStringPool& rSPool, rtl_TextEncoding e, bool b ) :
+    LotusConverterBase(rStream, rSPool, 128)
 {
     eSrcChar = e;
     bWK3 = false;
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index f8fc773..5f3ed5c 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -64,11 +64,12 @@ LOTUS_ROOT::~LOTUS_ROOT()
 
 static osl::Mutex aLotImpSemaphore;
 
-
-ImportLotus::ImportLotus( SvStream& aStream, ScDocument* pDoc, rtl_TextEncoding eQ ) :
-    ImportTyp( pDoc, eQ ),
-    pIn( &aStream ),
-    aConv( *pIn, eQ, false )
+ImportLotus::ImportLotus( SvStream& aStream, ScDocument* pDoc, rtl_TextEncoding eQ )
+    : ImportTyp(pDoc, eQ)
+    , pIn(&aStream)
+    , aConv(*pIn, pDoc->GetSharedStringPool(), eQ, false)
+    , nTab(0)
+    , nExtTab(0)
 {
     // good point to start locking of import lotus
     aLotImpSemaphore.acquire();
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index c42211d..b994a0d 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -163,7 +163,8 @@ void OP_Formula( SvStream& r, sal_uInt16 /*n*/ )
     sal_Int32               nBytesLeft = nFormulaSize;
     ScAddress           aAddress( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab );
 
-    LotusToSc           aConv( r, pLotusRoot->eCharsetQ, false );
+    svl::SharedStringPool& rSPool = pLotusRoot->pDoc->GetSharedStringPool();
+    LotusToSc aConv(r, rSPool, pLotusRoot->eCharsetQ, false);
     aConv.Reset( aAddress );
     aConv.Convert( pErg, nBytesLeft );
 
@@ -407,7 +408,8 @@ void OP_Formula123( SvStream& r, sal_uInt16 n )
     sal_Int32 nBytesLeft = (n > 12) ? n - 12 : 0;
     ScAddress aAddress( nCol, nRow, nTab );
 
-    LotusToSc aConv( r, pLotusRoot->eCharsetQ, sal_True );
+    svl::SharedStringPool& rSPool = pLotusRoot->pDoc->GetSharedStringPool();
+    LotusToSc aConv(r, rSPool, pLotusRoot->eCharsetQ, true);
     aConv.Reset( aAddress );
     aConv.Convert( pErg, nBytesLeft );
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index d14ff5d..c34fedd 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -35,6 +35,7 @@
 #include <com/sun/star/table/XCellRange.hpp>
 #include <rtl/ustrbuf.hxx>
 #include <svl/intitem.hxx>
+#include <svl/sharedstringpool.hxx>
 #include "oox/helper/attributelist.hxx"
 #include "oox/helper/containerhelper.hxx"
 #include "oox/helper/propertyset.hxx"
@@ -807,7 +808,8 @@ void CondFormatRule::finalizeImport()
     {
         ScDocument& rDoc = getScDocument();
         ScTokenArray aTokenArray;
-        aTokenArray.AddString(maModel.maText);
+        svl::SharedStringPool& rSPool = rDoc.GetSharedStringPool();
+        aTokenArray.AddString(rSPool.intern(maModel.maText));
         OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
         ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, NULL, &rDoc, aPos, aStyleName );
         mpFormat->AddEntry(pNewEntry);
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index fc651eb..c370492 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -99,13 +99,16 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
                 }
                 break;
 
-            case 0x0010:{ // Formula cell
+            case 0x0010:
+            {
+                // Formula cell
                 double nValue;
                 sal_uInt16 nState, nLen;
                 *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nValue >> nState >> nLen;
                 ScAddress aAddr( nCol, nRow, nTab );
                 const ScTokenArray *pArray;
-                QProToSc aConv( *mpStream, aAddr );
+
+                QProToSc aConv(*mpStream, pDoc->GetSharedStringPool(), aAddr);
                 if (ConvOK != aConv.Convert( pArray, nLen ))
                     eRet = eERR_FORMAT;
                 else
@@ -117,8 +120,8 @@ FltError ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSt
                     pDoc->EnsureTable(nTab);
                     pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pFormula);
                 }
-                }
-                break;
+            }
+            break;
         }
     }
     return eRet;
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 91399bb..90a185b 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -65,8 +65,8 @@ void QProToSc::ReadSRD( ScSingleRefData& rSRD, sal_Int8 nPage, sal_Int8 nCol, sa
         rSRD.SetFlag3D(true);
 }
 
-QProToSc::QProToSc( SvStream& rStream, const ScAddress& rRefPos ) :
-    ConverterBase( 128 ),
+QProToSc::QProToSc( SvStream& rStream, svl::SharedStringPool& rSPool, const ScAddress& rRefPos ) :
+    ConverterBase(rSPool, 128),
     maIn( rStream )
 {
     aEingPos = rRefPos;
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 4892861..58c2540 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -500,6 +500,11 @@ void XclImpChangeTrack::Apply()
 //___________________________________________________________________
 // class XclImpChTrFmlConverter
 
+XclImpChTrFmlConverter::XclImpChTrFmlConverter(
+    XclImpRoot& rRoot, XclImpChangeTrack& rXclChTr ) :
+    ExcelToSc8( rRoot ),
+    rChangeTrack( rXclChTr ) {}
+
 XclImpChTrFmlConverter::~XclImpChTrFmlConverter()
 {
 }
diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx
index 1503a8c..d93c29c 100644
--- a/sc/source/ui/formdlg/formula.cxx
+++ b/sc/source/ui/formdlg/formula.cxx
@@ -664,7 +664,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
 ::std::auto_ptr<formula::FormulaTokenArray> ScFormulaDlg::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
 {
     ::std::auto_ptr<formula::FormulaTokenArray> pArray(new ScTokenArray());
-    pArray->Fill( _aTokenList, pDoc->GetExternalRefManager());
+    pArray->Fill(_aTokenList, pDoc->GetSharedStringPool(), pDoc->GetExternalRefManager());
     return pArray;
 }
 // for mysterious reasons Apple llvm-g++ 4.2.1 needs these explicit
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 174b6a6..a36663f 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -19,6 +19,7 @@
 
 #include <sfx2/app.hxx>
 #include <svl/itemprop.hxx>
+#include <svl/sharedstringpool.hxx>
 
 #include "scitems.hxx"
 #include "funcuno.hxx"
@@ -539,6 +540,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
     long nArgCount = aArguments.getLength();
     const uno::Any* pArgArr = aArguments.getConstArray();
 
+    svl::SharedStringPool& rSPool = pDoc->GetSharedStringPool();
     aTokenArr.AddOpCode(ocOpen);
     for (long nPos=0; nPos<nArgCount; nPos++)
     {
@@ -568,7 +570,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName,
         {
             OUString aUStr;
             rArg >>= aUStr;
-            aTokenArr.AddString( aUStr );
+            aTokenArr.AddString(rSPool.intern(aUStr));
         }
         else if ( aType.equals( getCppuType( (uno::Sequence< uno::Sequence<sal_Int16> > *)0 ) ) )
         {
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index ff1b417..3717f25 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -369,7 +369,7 @@ static void lcl_SingleRefToApi( sheet::SingleReference& rAPI, const ScSingleRefD
 bool ScTokenConversion::ConvertToTokenArray( ScDocument& rDoc,
         ScTokenArray& rTokenArray, const uno::Sequence<sheet::FormulaToken>& rSequence )
 {
-    return !rTokenArray.Fill(rSequence,rDoc.GetExternalRefManager());
+    return !rTokenArray.Fill(rSequence, rDoc.GetSharedStringPool(), rDoc.GetExternalRefManager());
 }
 
 bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc,


More information about the Libreoffice-commits mailing list