diff options
-rw-r--r-- | sc/inc/conditio.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/validat.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 14 |
4 files changed, 13 insertions, 11 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 3bf6a144f7ee..a9825940c28b 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -254,7 +254,9 @@ public: OUString GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uLong nNumFmt = 0, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; - ScTokenArray* CreateTokenArry( sal_uInt16 nPos ) const; + /** Create a flat copy using ScTokenArray copy-ctor with + shared tokens. */ + ScTokenArray* CreateFlatCopiedTokenArray( sal_uInt16 nPos ) const; void CompileAll(); void CompileXML(); diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 8cbc8ef3b8bc..49b0f3ab829a 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1366,7 +1366,7 @@ OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 n return aRet; } -ScTokenArray* ScConditionEntry::CreateTokenArry( sal_uInt16 nIndex ) const +ScTokenArray* ScConditionEntry::CreateFlatCopiedTokenArray( sal_uInt16 nIndex ) const { assert(nIndex <= 1); ScTokenArray* pRet = nullptr; diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 953af5c08fcb..803140daf380 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -811,7 +811,7 @@ bool ScValidationData::FillSelectionList(std::vector<ScTypedStrData>& rStrColl, if( HasSelectionList() ) { - std::unique_ptr<ScTokenArray> pTokArr( CreateTokenArry(0) ); + std::unique_ptr<ScTokenArray> pTokArr( CreateFlatCopiedTokenArray(0) ); // *** try if formula is a string list *** @@ -864,7 +864,7 @@ bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& rPos 5) A formula resulting in a cell/range reference or matrix/array. */ - std::unique_ptr< ScTokenArray > pTokArr( CreateTokenArry( 0 ) ); + std::unique_ptr< ScTokenArray > pTokArr( CreateFlatCopiedTokenArray( 0 ) ); // *** try if formula is a string list *** diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 0623f18cbb6b..1a5ce8d7fa1e 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -701,12 +701,12 @@ void XclExpCFImpl::WriteBody( XclExpStream& rStrm ) XclExpFormulaCompiler& rFmlaComp = GetFormulaCompiler(); - std::unique_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateTokenArry( 0 ) ); + std::unique_ptr< ScTokenArray > xScTokArr( mrFormatEntry.CreateFlatCopiedTokenArray( 0 ) ); mxTokArr1 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr ); if (mbFormula2) { - xScTokArr.reset( mrFormatEntry.CreateTokenArry( 1 ) ); + xScTokArr.reset( mrFormatEntry.CreateFlatCopiedTokenArray( 1 ) ); mxTokArr2 = rFmlaComp.CreateFormula( EXC_FMLATYPE_CONDFMT, *xScTokArr ); } @@ -944,7 +944,7 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm ) // we need to write the text without quotes // we have to actually get the string from // the token array for that - std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateTokenArry(0)); + std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0)); if(pTokenArray->GetLen()) aText = XclXmlUtils::ToOString(pTokenArray->First()->GetString().getString()); } @@ -965,14 +965,14 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm ) if(!IsTextRule(eOperation) && !IsTopBottomRule(eOperation)) { rWorksheet->startElement( XML_formula, FSEND ); - std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateTokenArry(0)); + std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0)); rWorksheet->writeEscaped(XclXmlUtils::ToOUString( GetCompileFormulaContext(), mrFormatEntry.GetValidSrcPos(), pTokenArray.get())); rWorksheet->endElement( XML_formula ); if (bFmla2) { rWorksheet->startElement( XML_formula, FSEND ); - std::unique_ptr<ScTokenArray> pTokenArray2(mrFormatEntry.CreateTokenArry(1)); + std::unique_ptr<ScTokenArray> pTokenArray2(mrFormatEntry.CreateFlatCopiedTokenArray(1)); rWorksheet->writeEscaped(XclXmlUtils::ToOUString( GetCompileFormulaContext(), mrFormatEntry.GetValidSrcPos(), pTokenArray2.get())); rWorksheet->endElement( XML_formula ); @@ -1620,7 +1620,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : std::unique_ptr< ScTokenArray > xScTokArr; // first formula - xScTokArr.reset( pValData->CreateTokenArry( 0 ) ); + xScTokArr.reset( pValData->CreateFlatCopiedTokenArray( 0 ) ); if( xScTokArr.get() ) { if( pValData->GetDataMode() == SC_VALID_LIST ) @@ -1682,7 +1682,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : } // second formula - xScTokArr.reset( pValData->CreateTokenArry( 1 ) ); + xScTokArr.reset( pValData->CreateFlatCopiedTokenArray( 1 ) ); if( xScTokArr.get() ) { if(GetOutput() == EXC_OUTPUT_BINARY) |