diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-14 18:32:57 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-14 18:34:20 -0400 |
commit | 625c595fc30d2e6153735dc2ed2359ff4f8a1e3a (patch) | |
tree | b24941adb87381dcb5ef651b593fa4aadd2e3c2f /sc | |
parent | b09426b83c12b0cd27cd909602251cb076ffa4ba (diff) |
fdo#76294: Intern strings in AddFormulaToken() as well.
And a whole bunch of changes needed to make that happen.
Change-Id: Idd98fbc99322c0d72fb0a7848d89cb1a6abc88b6
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/tokenarray.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/formdlg/formula.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/tokenuno.cxx | 2 |
4 files changed, 20 insertions, 16 deletions
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index a1fae5b3f09a..1ea6658c2f39 100644 --- a/sc/inc/tokenarray.hxx +++ b/sc/inc/tokenarray.hxx @@ -83,7 +83,10 @@ public: const ScAddress& rPos, ScDirection ); formula::FormulaToken* AddRawToken( const ScRawToken& ); - virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken,formula::ExternalReferenceHelper* _pRef) SAL_OVERRIDE; + virtual bool AddFormulaToken( + const css::sheet::FormulaToken& rToken, + svl::SharedStringPool& rSPool, + formula::ExternalReferenceHelper* _pRef) SAL_OVERRIDE; virtual void CheckToken( const formula::FormulaToken& r ) SAL_OVERRIDE; virtual formula::FormulaToken* AddOpCode( OpCode eCode ) SAL_OVERRIDE; /** ScSingleRefToken with ocPush. */ diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 7af3123c4a04..58f64cc9dc1f 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1175,25 +1175,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 ); @@ -1206,7 +1207,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 ); @@ -1218,7 +1219,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) @@ -1229,7 +1230,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; @@ -1239,7 +1240,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; @@ -1254,7 +1255,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; @@ -1290,12 +1291,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/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index f8bd44e21607..c2bcb3ed2564 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -655,7 +655,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/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 98d81532c185..59bd144380ac 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -363,7 +363,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, |