[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Mon Apr 25 20:46:26 UTC 2016
sc/inc/conditio.hxx | 4 +++-
sc/source/core/data/conditio.cxx | 6 +++++-
sc/source/core/data/validat.cxx | 4 ++--
sc/source/filter/excel/xecontent.cxx | 14 +++++++-------
4 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 4613f38c50c719bef36190246e1d13558b4ecbc0
Author: Eike Rathke <erack at redhat.com>
Date: Mon Apr 25 22:43:03 2016 +0200
comment flat copy sharing code tokens
Change-Id: I80f8f7cc8f812fe412346876593c11aa221cb1b9
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 49b0f3a..e1a42f8 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -468,12 +468,16 @@ void ScConditionEntry::MakeCells( const ScAddress& rPos )
{
if ( pFormula1 && !pFCell1 && !bRelRef1 )
{
+ // pFCell1 will hold a flat-copied ScTokenArray sharing ref-counted
+ // code tokens with pFormula1
pFCell1 = new ScFormulaCell(mpDoc, rPos, *pFormula1);
pFCell1->StartListeningTo( mpDoc );
}
if ( pFormula2 && !pFCell2 && !bRelRef2 )
{
+ // pFCell2 will hold a flat-copied ScTokenArray sharing ref-counted
+ // code tokens with pFormula2
pFCell2 = new ScFormulaCell(mpDoc, rPos, *pFormula2);
pFCell2->StartListeningTo( mpDoc );
}
commit 403d0d4a5452f2b31edd89d67fbcc532fd7fbf5a
Author: Eike Rathke <erack at redhat.com>
Date: Mon Apr 25 22:00:27 2016 +0200
be explicit about what it does, CreateFlatCopiedTokenArray()
Change-Id: I3652e4e46f85343488fb77bc4169bf6825086cf4
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 3bf6a14..a982594 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 8cbc8ef..49b0f3a 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 953af5c..803140d 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 0623f18..1a5ce8d 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)
More information about the Libreoffice-commits
mailing list