[Libreoffice-commits] core.git: 2 commits - sc/inc sc/qa sc/source
Eike Rathke
erack at redhat.com
Mon Nov 2 09:08:26 PST 2015
sc/inc/cellvalue.hxx | 10 ++
sc/qa/unit/helper/csv_handler.hxx | 3
sc/source/core/data/attarray.cxx | 3
sc/source/core/data/cellvalue.cxx | 10 ++
sc/source/core/data/conditio.cxx | 3
sc/source/core/data/dociter.cxx | 3
sc/source/core/data/documen4.cxx | 16 +---
sc/source/core/data/documen8.cxx | 3
sc/source/core/data/document.cxx | 3
sc/source/core/data/table3.cxx | 9 --
sc/source/core/tool/cellform.cxx | 6 -
sc/source/core/tool/compiler.cxx | 3
sc/source/core/tool/detfunc.cxx | 9 --
sc/source/core/tool/interpr1.cxx | 108 ++++++++++---------------------
sc/source/core/tool/interpr2.cxx | 6 -
sc/source/core/tool/interpr3.cxx | 21 ++----
sc/source/core/tool/interpr4.cxx | 39 +++--------
sc/source/core/tool/interpr5.cxx | 12 +--
sc/source/core/tool/interpr6.cxx | 3
sc/source/core/tool/rangeseq.cxx | 3
sc/source/filter/dif/difexp.cxx | 4 -
sc/source/filter/html/htmlexp.cxx | 3
sc/source/filter/oox/worksheethelper.cxx | 3
sc/source/ui/docshell/docsh8.cxx | 6 -
sc/source/ui/docshell/externalrefmgr.cxx | 6 -
sc/source/ui/docshell/impex.cxx | 3
sc/source/ui/unoobj/cellsuno.cxx | 33 +++------
sc/source/ui/unoobj/chart2uno.cxx | 3
sc/source/ui/view/cellsh1.cxx | 3
sc/source/ui/view/gridwin.cxx | 18 +----
sc/source/ui/view/output2.cxx | 6 -
sc/source/ui/view/tabvwsh.cxx | 3
sc/source/ui/view/tabvwsh5.cxx | 3
sc/source/ui/view/viewfun2.cxx | 3
34 files changed, 135 insertions(+), 235 deletions(-)
New commits:
commit 708bcf9055b04a82943e597747c0d74894714a9e
Author: Eike Rathke <erack at redhat.com>
Date: Mon Nov 2 18:03:30 2015 +0100
trash usage of ScRefCellValue default ctor followed by assign()
... that only results in a performance penalty.
Change-Id: Ia161ab7fb03f2d32cf966ce9da9d0319d919fc4c
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 6d16928..915bdee 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -111,12 +111,22 @@ struct SC_DLLPUBLIC ScRefCellValue
ScRefCellValue( const EditTextObject* pEditText );
ScRefCellValue( ScFormulaCell* pFormula );
ScRefCellValue( const ScRefCellValue& r );
+
+ /**
+ * Take cell value from specified position in specified document.
+ */
+ ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos );
+
~ScRefCellValue();
void clear();
/**
* Take cell value from specified position in specified document.
+ *
+ * Avoid the sequence of ScRefCellValue() default ctor followed by assign()
+ * as it results in performance penalty, use the
+ * ScRefCellValue(ScDocument&,const ScAddress&) ctor instead.
*/
void assign( ScDocument& rDoc, const ScAddress& rPos );
diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx
index 915ffc6..59f2137 100644
--- a/sc/qa/unit/helper/csv_handler.hxx
+++ b/sc/qa/unit/helper/csv_handler.hxx
@@ -32,8 +32,7 @@ OUString getConditionalFormatString(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SC
{
OUString aString;
Color* pColor;
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab));
if (aCell.isEmpty())
return aString;
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index f27f34c..0701254 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -343,8 +343,7 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow,
for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
{
ScAddress aPos(nCol, nRow, nTab);
- ScRefCellValue aCell;
- aCell.assign(*pDocument, aPos);
+ ScRefCellValue aCell(*pDocument, aPos);
if (aCell.meType != CELLTYPE_EDIT || !aCell.mpEditText)
continue;
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index c44701d..a1fcfbb 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -285,8 +285,7 @@ void ScCellValue::assign( const ScDocument& rDoc, const ScAddress& rPos )
{
clear();
- ScRefCellValue aRefVal;
- aRefVal.assign(const_cast<ScDocument&>(rDoc), rPos);
+ ScRefCellValue aRefVal(const_cast<ScDocument&>(rDoc), rPos);
meType = aRefVal.meType;
switch (meType)
@@ -494,6 +493,13 @@ ScRefCellValue::ScRefCellValue( ScFormulaCell* pFormula ) : meType(CELLTYPE_FORM
// as the pointer values.
ScRefCellValue::ScRefCellValue( const ScRefCellValue& r ) : meType(r.meType), mfValue(r.mfValue) {}
+ScRefCellValue::ScRefCellValue( ScDocument& rDoc, const ScAddress& rPos )
+{
+ const ScRefCellValue& rCell = rDoc.GetRefCellValue(rPos);
+ meType = rCell.meType;
+ mfValue = rCell.mfValue;
+}
+
ScRefCellValue::~ScRefCellValue()
{
clear();
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index be54ecd..d8ecee6 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -788,8 +788,7 @@ void ScConditionEntry::FillCache() const
for( SCROW r = nRowStart; r <= nRow; r++ )
for( SCCOL c = nColStart; c <= nCol; c++ )
{
- ScRefCellValue aCell;
- aCell.assign(*mpDoc, ScAddress(c, r, nTab));
+ ScRefCellValue aCell(*mpDoc, ScAddress(c, r, nTab));
if (aCell.isEmpty())
continue;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 39ae93b..986b17e 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1036,8 +1036,7 @@ bool ScCellIterator::isEmpty() const
bool ScCellIterator::equalsWithoutFormat( const ScAddress& rPos ) const
{
- ScRefCellValue aOther;
- aOther.assign(*mpDoc, rPos);
+ ScRefCellValue aOther(*mpDoc, rPos);
return maCurCell.equalsWithoutFormat(aOther);
}
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 48319ba..12ed061 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -756,8 +756,7 @@ const SfxPoolItem* ScDocument::GetEffItem(
if ( pForm )
{
ScAddress aPos(nCol, nRow, nTab);
- ScRefCellValue aCell;
- aCell.assign(const_cast<ScDocument&>(*this), aPos);
+ ScRefCellValue aCell(const_cast<ScDocument&>(*this), aPos);
OUString aStyle = pForm->GetCellStyle(aCell, aPos);
if (!aStyle.isEmpty())
{
@@ -784,8 +783,7 @@ const SfxItemSet* ScDocument::GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab
return NULL;
ScAddress aPos(nCol, nRow, nTab);
- ScRefCellValue aCell;
- aCell.assign(const_cast<ScDocument&>(*this), aPos);
+ ScRefCellValue aCell(const_cast<ScDocument&>(*this), aPos);
const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab );
const std::vector<sal_uInt32>& rIndex =
static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData();
@@ -920,9 +918,8 @@ sal_uInt16 ScDocument::RowDifferences( SCROW nThisRow, SCTAB nThisTab,
if (ValidCol(nOtherCol)) // only compare columns that are common to both docs
{
- ScRefCellValue aThisCell, aOtherCell;
- aThisCell.assign(*this, ScAddress(nThisCol, nThisRow, nThisTab));
- aOtherCell.assign(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
+ ScRefCellValue aThisCell(*this, ScAddress(nThisCol, nThisRow, nThisTab));
+ ScRefCellValue aOtherCell(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
if (!aThisCell.equalsWithoutFormat(aOtherCell))
{
if (!aThisCell.isEmpty() && !aOtherCell.isEmpty())
@@ -962,9 +959,8 @@ sal_uInt16 ScDocument::ColDifferences( SCCOL nThisCol, SCTAB nThisTab,
if (ValidRow(nOtherRow)) // only compare rows that are common to both docs
{
- ScRefCellValue aThisCell, aOtherCell;
- aThisCell.assign(*this, ScAddress(nThisCol, nThisRow, nThisTab));
- aOtherCell.assign(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
+ ScRefCellValue aThisCell(*this, ScAddress(nThisCol, nThisRow, nThisTab));
+ ScRefCellValue aOtherCell(rOtherDoc, ScAddress(nOtherCol, nOtherRow, nOtherTab));
if (!aThisCell.equalsWithoutFormat(aOtherCell))
{
if (!aThisCell.isEmpty() && !aOtherCell.isEmpty())
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index a6aca8f..3666fc4 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1219,8 +1219,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
while (bFound)
{
- ScRefCellValue aCell;
- aCell.assign(*this, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*this, ScAddress(nCol, nRow, nTab));
// fdo#32786 TITLE_CASE/SENTENCE_CASE need the extra handling in EditEngine (loop over words/sentences).
// Still use TransliterationWrapper directly for text cells with other transliteration types,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9786c2a..9bfee0b 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3425,8 +3425,7 @@ sal_uInt16 ScDocument::GetStringForFormula( const ScAddress& rPos, OUString& rSt
// ScInterpreter::GetCellString: always format values as numbers.
// The return value is the error code.
- ScRefCellValue aCell;
- aCell.assign(*this, rPos);
+ ScRefCellValue aCell(*this, rPos);
if (aCell.isEmpty())
{
rString = EMPTY_OUSTRING;
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 3321686..cb82e7f 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -140,15 +140,13 @@ OUString ScCellFormat::GetString(
{
case CELLTYPE_STRING:
{
- ScRefCellValue aCell;
- aCell.assign(rDoc, rPos);
+ ScRefCellValue aCell(rDoc, rPos);
rFormatter.GetOutputString(aCell.mpString->getString(), nFormat, aString, ppColor, bUseStarFormat);
}
break;
case CELLTYPE_EDIT:
{
- ScRefCellValue aCell;
- aCell.assign(rDoc, rPos);
+ ScRefCellValue aCell(rDoc, rPos);
rFormatter.GetOutputString(aCell.getString(&rDoc), nFormat, aString, ppColor);
}
break;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f7f796a..2cb0b89 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4909,8 +4909,7 @@ bool ScCompiler::HandleColRowName()
}
if ( !bInList && pDoc->GetDocOptions().IsLookUpColRowNames() )
{ // automagically or created by copying and NamePos isn't in list
- ScRefCellValue aCell;
- aCell.assign(*pDoc, aLook);
+ ScRefCellValue aCell(*pDoc, aLook);
bool bString = aCell.hasString();
if (!bString && aCell.isEmpty())
bString = true; // empty cell is ok
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 1b31801..710161a 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -801,8 +801,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevelArea( const ScRange& rRef,
sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData,
sal_uInt16 nLevel )
{
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab));
if (aCell.meType != CELLTYPE_FORMULA)
return DET_INS_EMPTY;
@@ -890,8 +889,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL
{
OSL_ENSURE( nLevel<1000, "Level" );
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab));
if (aCell.meType != CELLTYPE_FORMULA)
return nLevel;
@@ -948,8 +946,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL
sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData,
sal_uInt16 nLevel )
{
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab));
if (aCell.meType != CELLTYPE_FORMULA)
return DET_INS_EMPTY;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 577503e..13c47b8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -279,8 +279,7 @@ void ScInterpreter::ScIfError( bool bNAonly )
else
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
nGlobalError = GetCellErrCode(aCell);
if (nGlobalError)
bError = true;
@@ -593,8 +592,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
}
else
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
pJumpMatrix->PutResultEmpty( nC, nR );
else if (aCell.hasNumeric())
@@ -661,8 +659,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel )
nRow = aRange.aStart.Row();
aAdr.SetCol( static_cast<SCCOL>(nCol) );
aAdr.SetRow( static_cast<SCROW>(nRow) );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
pJumpMatrix->PutResultEmpty( nC, nR );
else if (aCell.hasNumeric())
@@ -832,8 +829,7 @@ double ScInterpreter::Compare( ScQueryOp eOp )
ScAddress aAdr;
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
rCell.mbEmpty = true;
else if (aCell.hasString())
@@ -922,8 +918,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO
case svSingleRef:
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
rCell.mbEmpty = true;
else if (aCell.hasString())
@@ -1206,8 +1201,7 @@ void ScInterpreter::ScAnd()
PopSingleRef( aAdr );
if ( !nGlobalError )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
bHaveValue = true;
@@ -1305,8 +1299,7 @@ void ScInterpreter::ScOr()
PopSingleRef( aAdr );
if ( !nGlobalError )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
bHaveValue = true;
@@ -1406,8 +1399,7 @@ void ScInterpreter::ScXor()
PopSingleRef( aAdr );
if ( !nGlobalError )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
bHaveValue = true;
@@ -1826,8 +1818,7 @@ void ScInterpreter::ScIsEmpty()
// NOTE: this differs from COUNTBLANK() ScCountEmptyCells() that
// may treat ="" in the referenced cell as blank for Excel
// interoperability.
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.meType == CELLTYPE_NONE)
nRes = 1;
}
@@ -1876,8 +1867,7 @@ bool ScInterpreter::IsString()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (GetCellErrCode(aCell) == 0)
{
switch (aCell.meType)
@@ -1941,8 +1931,7 @@ void ScInterpreter::ScIsLogical()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (GetCellErrCode(aCell) == 0)
{
if (aCell.hasNumeric())
@@ -1979,8 +1968,7 @@ void ScInterpreter::ScType()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (GetCellErrCode(aCell) == 0)
{
switch (aCell.meType)
@@ -2136,8 +2124,7 @@ void ScInterpreter::ScCell()
PushIllegalParameter();
else
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aCellPos);
+ ScRefCellValue aCell(*pDok, aCellPos);
ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell);
@@ -2489,8 +2476,7 @@ void ScInterpreter::ScIsValue()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (GetCellErrCode(aCell) == 0)
{
switch (aCell.meType)
@@ -2592,8 +2578,7 @@ void ScInterpreter::ScFormula()
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
{
aAdr.SetRow(nRow);
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
{
case CELLTYPE_FORMULA :
@@ -2619,8 +2604,7 @@ void ScInterpreter::ScFormula()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
{
case CELLTYPE_FORMULA :
@@ -2653,8 +2637,7 @@ void ScInterpreter::ScIsNV()
bRes = true;
else if (bOk)
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
sal_uInt16 nErr = GetCellErrCode(aCell);
bRes = (nErr == NOTAVAILABLE);
}
@@ -2701,8 +2684,7 @@ void ScInterpreter::ScIsErr()
bRes = true;
else
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
sal_uInt16 nErr = GetCellErrCode(aCell);
bRes = (nErr && nErr != NOTAVAILABLE);
}
@@ -2759,8 +2741,7 @@ void ScInterpreter::ScIsError()
bRes = true;
else
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
bRes = (GetCellErrCode(aCell) != 0);
}
}
@@ -2805,8 +2786,7 @@ bool ScInterpreter::IsEven()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
sal_uInt16 nErr = GetCellErrCode(aCell);
if (nErr != 0)
SetError(nErr);
@@ -2972,8 +2952,7 @@ void ScInterpreter::ScT()
return ;
}
bool bValue = false;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (GetCellErrCode(aCell) == 0)
{
switch (aCell.meType)
@@ -3050,8 +3029,7 @@ void ScInterpreter::ScValue()
PushInt(0);
return;
}
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasString())
{
svl::SharedString aSS;
@@ -3373,8 +3351,7 @@ void ScInterpreter::ScMin( bool bTextAsZero )
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
nVal = GetCellValue(aAdr, aCell);
@@ -3469,8 +3446,7 @@ void ScInterpreter::ScMax( bool bTextAsZero )
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
nVal = GetCellValue(aAdr, aCell);
@@ -3570,8 +3546,7 @@ void ScInterpreter::GetStVarParams( double& rVal, double& rValCount,
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -4341,8 +4316,7 @@ void ScInterpreter::ScMatch()
PushInt(0);
return ;
}
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -4601,8 +4575,7 @@ void ScInterpreter::ScCountEmptyCells()
nMaxCount = 1;
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (!isCellContentEmpty(aCell))
nCount = 1;
}
@@ -4714,8 +4687,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
if ( !PopDoubleRefOrSingleRef( aAdr ) )
return 0;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
{
case CELLTYPE_VALUE :
@@ -4961,8 +4933,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
{
aAdr.SetCol( nCol + nColDiff);
aAdr.SetRow( nRow + nRowDiff);
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -5013,8 +4984,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
{
aAdr.SetCol( aCellIter.GetCol() + nColDiff);
aAdr.SetRow( aCellIter.GetRow() + nRowDiff);
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -5075,8 +5045,7 @@ void ScInterpreter::ScCountIf()
PushInt(0);
return ;
}
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
{
case CELLTYPE_VALUE :
@@ -5293,8 +5262,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
if ( !PopDoubleRefOrSingleRef( aAdr ) )
return 0;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
{
case CELLTYPE_VALUE :
@@ -5625,8 +5593,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
{
aAdr.SetCol( static_cast<SCCOL>(nCol) + nMainCol1);
aAdr.SetRow( static_cast<SCROW>(nRow) + nMainRow1);
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -5808,8 +5775,7 @@ void ScInterpreter::ScLookup()
case svSingleRef:
{
PopSingleRef( aDataAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aDataAdr);
+ ScRefCellValue aCell(*pDok, aDataAdr);
if (aCell.hasEmptyValue())
{
// Empty cells aren't found anywhere, bail out early.
@@ -6518,8 +6484,7 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
PushInt(0);
return false;
}
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
rItem.meType = ScQueryEntry::ByValue;
@@ -6719,8 +6684,7 @@ std::unique_ptr<ScDBQueryParamBase> ScInterpreter::GetDBParams( bool& rMissingFi
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
nVal = GetCellValue(aAdr, aCell);
else
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 23c1aa9..4d64021 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1163,8 +1163,7 @@ void ScInterpreter::ScNPV()
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (!aCell.hasEmptyValue() && aCell.hasNumeric())
{
double nCellVal = GetCellValue(aAdr, aCell);
@@ -2875,8 +2874,7 @@ void ScInterpreter::ScHyperLink()
if ( !PopDoubleRefOrSingleRef( aAdr ) )
break;
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
nResultType = SC_MATVAL_EMPTY;
else
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index eb8e0d9..411a752 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2518,8 +2518,7 @@ void ScInterpreter::ScZTest()
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -2933,8 +2932,7 @@ void ScInterpreter::ScHarMean()
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
double x = GetCellValue(aAdr, aCell);
@@ -3056,8 +3054,7 @@ void ScInterpreter::ScGeoMean()
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
double x = GetCellValue(aAdr, aCell);
@@ -3194,8 +3191,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
@@ -3669,8 +3665,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
rArray.push_back(GetCellValue(aAdr, aCell));
}
@@ -3954,8 +3949,7 @@ void ScInterpreter::ScAveDev()
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
{
rVal += GetCellValue(aAdr, aCell);
@@ -4037,8 +4031,7 @@ void ScInterpreter::ScAveDev()
case svSingleRef :
{
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
rVal += fabs(GetCellValue(aAdr, aCell) - nMiddle);
}
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 6bd1da9..d21e9e6 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -348,8 +348,7 @@ bool ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
{
aAdr.SetCol( nCol );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (!aCell.isEmpty())
{
sal_uInt16 nErr = 0;
@@ -429,8 +428,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol = nCol1;
while (nCol <= nCol2)
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDok, ScAddress(nCol, nRow, nTab));
if (!aCell.isEmpty())
{
OUString aStr;
@@ -530,8 +528,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
while (nCol <= nCol2)
{
aAdr.SetCol( nCol );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (!aCell.isEmpty())
{
sal_uInt16 nErr = 0;
@@ -714,8 +711,7 @@ void ScInterpreter::PushTempToken( const FormulaToken& r )
void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
const ScAddress & rAddress, short * pRetTypeExpr, sal_uLong * pRetIndexExpr )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, rAddress);
+ ScRefCellValue aCell(*pDok, rAddress);
if (aCell.hasEmptyValue())
{
bool bInherited = (aCell.meType == CELLTYPE_FORMULA);
@@ -1962,8 +1958,7 @@ double ScInterpreter::GetDouble()
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
nVal = GetCellValue(aAdr, aCell);
}
break;
@@ -1974,8 +1969,7 @@ double ScInterpreter::GetDouble()
ScAddress aAdr;
if ( !nGlobalError && DoubleRefToPosSingleRef( aRange, aAdr ) )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
nVal = GetCellValue(aAdr, aCell);
}
else
@@ -2063,8 +2057,7 @@ svl::SharedString ScInterpreter::GetString()
PopSingleRef( aAdr );
if (nGlobalError == 0)
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
svl::SharedString aSS;
GetCellString(aSS, aCell);
return aSS;
@@ -2079,8 +2072,7 @@ svl::SharedString ScInterpreter::GetString()
ScAddress aAdr;
if ( !nGlobalError && DoubleRefToPosSingleRef( aRange, aAdr ) )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
svl::SharedString aSS;
GetCellString(aSS, aCell);
return aSS;
@@ -2607,8 +2599,7 @@ void ScInterpreter::ScExternal()
ScAddress aAdr;
if ( PopDoubleRefOrSingleRef( aAdr ) )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasString())
{
svl::SharedString aStr;
@@ -2658,8 +2649,7 @@ void ScInterpreter::ScExternal()
ScAddress aAdr;
if ( PopDoubleRefOrSingleRef( aAdr ) )
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasString())
{
svl::SharedString aStr;
@@ -3181,8 +3171,7 @@ void ScInterpreter::ScMacro()
bool ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos )
{
bool bOk = true;
- ScRefCellValue aCell;
- aCell.assign(*pDok, rPos);
+ ScRefCellValue aCell(*pDok, rPos);
if (!aCell.isEmpty())
{
sal_uInt16 nErr;
@@ -3270,8 +3259,7 @@ void ScInterpreter::ScTableOp()
iBroadcast != pTableOp->aNotifiedFormulaPos.end();
++iBroadcast )
{ // emulate broadcast and indirectly collect cell pointers
- ScRefCellValue aCell;
- aCell.assign(*pDok, *iBroadcast);
+ ScRefCellValue aCell(*pDok, *iBroadcast);
if (aCell.meType == CELLTYPE_FORMULA)
aCell.mpFormula->SetTableOpDirty();
}
@@ -3284,8 +3272,7 @@ void ScInterpreter::ScTableOp()
}
pTableOp->bCollectNotifications = false;
- ScRefCellValue aCell;
- aCell.assign(*pDok, pTableOp->aFormulaPos);
+ ScRefCellValue aCell(*pDok, pTableOp->aFormulaPos);
if (aCell.meType == CELLTYPE_FORMULA)
aCell.mpFormula->SetDirtyVar();
if (aCell.hasNumeric())
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 4548acb..f44bb88 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -389,8 +389,7 @@ ScMatrixRef ScInterpreter::GetMatrix()
pMat = GetNewMat(1, 1);
if (pMat)
{
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasEmptyValue())
pMat->PutEmpty(0, 0);
else if (aCell.hasNumeric())
@@ -516,8 +515,7 @@ void ScInterpreter::ScMatValue()
{
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.meType == CELLTYPE_FORMULA)
{
sal_uInt16 nErrCode = aCell.mpFormula->GetErrCode();
@@ -548,8 +546,7 @@ void ScInterpreter::ScMatValue()
{
ScAddress aAdr( sal::static_int_cast<SCCOL>( nCol1 + nR ),
sal::static_int_cast<SCROW>( nRow1 + nC ), nTab1 );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.hasNumeric())
PushDouble(GetCellValue(aAdr, aCell));
else
@@ -3173,8 +3170,7 @@ void ScInterpreter::ScMatRef()
ScAddress aAdr;
PopSingleRef( aAdr );
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (aCell.meType != CELLTYPE_FORMULA)
{
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 0ef3ac1..cd8346e 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -623,8 +623,7 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
break;
}
- ScRefCellValue aCell;
- aCell.assign(*pDok, aAdr);
+ ScRefCellValue aCell(*pDok, aAdr);
if (!aCell.isEmpty())
{
if( eFunc == ifCOUNT2 )
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 9670939..e047083 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -257,8 +257,7 @@ bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, ScDocument* pDoc, const
uno::Any& rElement = pColAry[nCol];
ScAddress aPos( (SCCOL)(nStartCol+nCol), (SCROW)(nStartRow+nRow), nTab );
- ScRefCellValue aCell;
- aCell.assign(*pDoc, aPos);
+ ScRefCellValue aCell(*pDoc, aPos);
if (aCell.isEmpty())
{
diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx
index ba17c2c..702ee1a 100644
--- a/sc/source/filter/dif/difexp.cxx
+++ b/sc/source/filter/dif/difexp.cxx
@@ -143,8 +143,6 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc
SCCOL nColCnt;
SCROW nRowCnt;
- ScRefCellValue aCell;
-
for( nRowCnt = rRange.aStart.Row() ; nRowCnt <= nEndRow ; nRowCnt++ )
{
OSL_ASSERT(aOS.getLength() == 0);
@@ -156,7 +154,7 @@ FltError ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc
{
OSL_ASSERT(aOS.getLength() == 0);
bool bWriteStringData = false;
- aCell.assign(*pDoc, ScAddress(nColCnt, nRowCnt, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nColCnt, nRowCnt, nTab));
switch (aCell.meType)
{
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index ea35369..22dc489 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -899,8 +899,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
}
}
- ScRefCellValue aCell;
- aCell.assign(*pDoc, aPos);
+ ScRefCellValue aCell(*pDoc, aPos);
sal_uLong nFormat = pAttr->GetNumberFormat( pFormatter );
bool bValueData = aCell.hasNumeric();
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 8f0e7cc..69fdb25 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -1023,8 +1023,7 @@ void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUStr
{
ScDocumentImport& rDoc = getDocImport();
ScAddress aPos(rAddress.Column, rAddress.Row, rAddress.Sheet);
- ScRefCellValue aCell;
- aCell.assign(rDoc.getDoc(), aPos);
+ ScRefCellValue aCell(rDoc.getDoc(), aPos);
if (aCell.meType == CELLTYPE_STRING || aCell.meType == CELLTYPE_EDIT)
{
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 317cbf2..411dbef 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -610,8 +610,7 @@ void lcl_GetColumnTypes(
if ( !bTypeDefined )
{ // Field type.
- ScRefCellValue aCell;
- aCell.assign(rDoc, ScAddress(nCol, nFirstDataRow, nTab));
+ ScRefCellValue aCell(rDoc, ScAddress(nCol, nFirstDataRow, nTab));
if (aCell.isEmpty() || aCell.hasString())
nDbType = sdbc::DataType::VARCHAR;
else
@@ -966,8 +965,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi
{
case sdbc::DataType::LONGVARCHAR:
{
- ScRefCellValue aCell;
- aCell.assign(aDocument, ScAddress(nDocCol, nDocRow, nTab));
+ ScRefCellValue aCell(aDocument, ScAddress(nDocCol, nDocRow, nTab));
if (!aCell.isEmpty())
{
if (aCell.meType == CELLTYPE_EDIT)
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 04bbe7e..d24b9ae 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1505,7 +1505,6 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
ScMatrixRef xMat = new ScMatrix(
static_cast<SCSIZE>(nCol2-nCol1+1), static_cast<SCSIZE>(nRow2-nRow1+1));
- ScRefCellValue aCell;
ColumnBatch<svl::SharedString> aStringBatch(pHostDoc, pSrcDoc, CELLTYPE_STRING, CELLTYPE_EDIT);
ColumnBatch<double> aDoubleBatch(pHostDoc, pSrcDoc, CELLTYPE_VALUE, CELLTYPE_VALUE);
@@ -1516,7 +1515,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
{
const SCSIZE nR = nRow - nRow1;
- aCell.assign(*pSrcDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pSrcDoc, ScAddress(nCol, nRow, nTab));
aStringBatch.update(aCell, nC, nR, xMat);
aDoubleBatch.update(aCell, nC, nR, xMat);
@@ -2158,8 +2157,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefTokenFromSrcDoc(
ScExternalRefCache::CellFormat* pFmt)
{
// Get the cell from src doc, and convert it into a token.
- ScRefCellValue aCell;
- aCell.assign(*pSrcDoc, rPos);
+ ScRefCellValue aCell(*pSrcDoc, rPos);
ScExternalRefCache::TokenRef pToken(convertToToken(mpDoc, pSrcDoc, aCell));
if (!pToken.get())
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 7089b07..6f2164f 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1969,8 +1969,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
bool bForm = false;
SCROW r = nRow - nStartRow + 1;
SCCOL c = nCol - nStartCol + 1;
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, aRange.aStart.Tab()));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, aRange.aStart.Tab()));
CellType eType = aCell.meType;
switch( eType )
{
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index e816b07..7033bc5 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1330,8 +1330,7 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
// used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, bool bEnglish )
{
- ScRefCellValue aCell;
- aCell.assign(rDoc, rPos);
+ ScRefCellValue aCell(rDoc, rPos);
if (aCell.isEmpty())
return EMPTY_OUSTRING;
@@ -2313,8 +2312,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
/* TODO: Iterate through the range */
ScAddress aAddr = aRange.aStart;
ScDocument& rDoc = pDocShell->GetDocument();
- ScRefCellValue aCell;
- aCell.assign(rDoc, aAddr);
+ ScRefCellValue aCell(rDoc, aAddr);
OUString aStr = aCell.getString(&rDoc);
EditEngine aEngine( rDoc.GetEnginePool() );
@@ -5077,10 +5075,8 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula() throw(uno::RuntimeException,
OUString aFormula;
ScDocument& rDoc = pDocSh->GetDocument();
- ScRefCellValue aCell1;
- ScRefCellValue aCell2;
- aCell1.assign(rDoc, aRange.aStart);
- aCell2.assign(rDoc, aRange.aEnd);
+ ScRefCellValue aCell1(rDoc, aRange.aStart);
+ ScRefCellValue aCell2(rDoc, aRange.aEnd);
if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
{
const ScFormulaCell* pFCell1 = aCell1.mpFormula;
@@ -5146,10 +5142,8 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens()
return aSequence;
ScDocument& rDoc = pDocSh->GetDocument();
- ScRefCellValue aCell1;
- ScRefCellValue aCell2;
- aCell1.assign(rDoc, aRange.aStart);
- aCell2.assign(rDoc, aRange.aEnd);
+ ScRefCellValue aCell1(rDoc, aRange.aStart);
+ ScRefCellValue aCell2(rDoc, aRange.aEnd);
if (aCell1.meType == CELLTYPE_FORMULA && aCell2.meType == CELLTYPE_FORMULA)
{
const ScFormulaCell* pFCell1 = aCell1.mpFormula;
@@ -6177,8 +6171,7 @@ OUString ScCellObj::GetOutputString_Impl() const
if ( pDocSh )
{
ScDocument& rDoc = pDocSh->GetDocument();
- ScRefCellValue aCell;
- aCell.assign(rDoc, aCellPos);
+ ScRefCellValue aCell(rDoc, aCellPos);
aVal = ScCellFormat::GetOutputString(rDoc, aCellPos, aCell);
}
@@ -6539,8 +6532,7 @@ table::CellContentType ScCellObj::GetResultType_Impl()
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
- ScRefCellValue aCell;
- aCell.assign(pDocSh->GetDocument(), aCellPos);
+ ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
bool bValue = aCell.mpFormula->IsValue();
@@ -6561,8 +6553,7 @@ sal_Int32 SAL_CALL ScCellObj::getError() throw(uno::RuntimeException, std::excep
}
sal_uInt16 nError = 0;
- ScRefCellValue aCell;
- aCell.assign(pDocSh->GetDocument(), aCellPos);
+ ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
nError = aCell.mpFormula->GetErrCode();
@@ -6581,8 +6572,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens()
return aSequence;
ScDocument& rDoc = pDocSh->GetDocument();
- ScRefCellValue aCell;
- aCell.assign(rDoc, aCellPos);
+ ScRefCellValue aCell(rDoc, aCellPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
ScTokenArray* pTokenArray = aCell.mpFormula->GetCode();
@@ -9124,8 +9114,7 @@ void ScCellsEnumeration::CheckPos_Impl()
bool bFound = false;
ScDocument& rDoc = pDocShell->GetDocument();
- ScRefCellValue aCell;
- aCell.assign(rDoc, aPos);
+ ScRefCellValue aCell(rDoc, aPos);
if (!aCell.isEmpty())
{
if (!pMark)
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index ce6e62a..fb4746c 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3265,8 +3265,7 @@ sal_uLong getDisplayNumberFormat(ScDocument* pDoc, const ScAddress& rPos)
// TODO: use nicer heuristic
for (const Item& rItem : m_aDataArray)
{
- ScRefCellValue aCell;
- aCell.assign(*m_pDocument, rItem.mAddress);
+ ScRefCellValue aCell(*m_pDocument, rItem.mAddress);
if (!aCell.isEmpty())
{
return static_cast<sal_Int32>(getDisplayNumberFormat(m_pDocument, rItem.mAddress));
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 718b33c..4d5d912 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2866,10 +2866,9 @@ void ScCellShell::ExecuteFillSingleEdit()
// Get the initial text value from the above cell.
ScDocument* pDoc = GetViewData()->GetDocument();
- ScRefCellValue aCell;
ScAddress aPrevPos = aCurPos;
aPrevPos.IncRow(-1);
- aCell.assign(*pDoc, aPrevPos);
+ ScRefCellValue aCell(*pDoc, aPrevPos);
if (aCell.meType == CELLTYPE_FORMULA)
{
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index ae6503e..0c37ab9 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -382,8 +382,7 @@ static bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
rRange.aEnd.Col(),rRange.aEnd.Row() ) )
return false;
- ScRefCellValue aCell;
- aCell.assign(*pDoc, rRange.aEnd);
+ ScRefCellValue aCell(*pDoc, rRange.aEnd);
ScAddress aPos;
return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(aPos) && aPos == rRange.aStart);
}
@@ -1689,11 +1688,10 @@ bool ScGridWindow::IsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB nTab, S
ScDocument* pDoc = pViewData->GetDocument();
// find the first non-empty cell (this, or to the left)
- ScRefCellValue aCell;
SCsCOL nNonEmptyX = nPosX;
for (; nNonEmptyX >= 0; --nNonEmptyX)
{
- aCell.assign(*pDoc, ScAddress(nNonEmptyX, nPosY, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nNonEmptyX, nPosY, nTab));
if (!aCell.isEmpty())
break;
}
@@ -1807,8 +1805,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
SCTAB nTab = pViewData->GetTabNo();
pViewData->GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY);
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nPosX, nPosY, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nPosX, nPosY, nTab));
bool bIsEmpty = aCell.isEmpty();
bool bIsCoveredByText = bIsEmpty && IsCellCoveredByText(nPosX, nPosY, nTab, nNonEmptyX);
@@ -2413,8 +2410,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
// case we used the double-click to select the empty cell
if (bIsTiledRendering && bDouble)
{
- ScRefCellValue aCell;
- aCell.assign(*pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab));
+ ScRefCellValue aCell(*pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab));
if (aCell.isEmpty())
return;
}
@@ -3077,7 +3073,6 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
bool bSpellError = false;
SCCOL nColSpellError = nCellX;
- ScRefCellValue aSpellCheckCell;
if ( bMouse )
{
@@ -3105,7 +3100,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
{
// Find the first string to the left for spell checking in case the current cell is empty.
ScAddress aPos(nCellX, nCellY, nTab);
- aSpellCheckCell.assign(*pDoc, aPos);
+ ScRefCellValue aSpellCheckCell(*pDoc, aPos);
while (aSpellCheckCell.meType == CELLTYPE_NONE)
{
// Loop until we get the first non-empty cell in the row.
@@ -5467,8 +5462,7 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow
ScDocument& rDoc = pDocSh->GetDocument();
ScAddress aCellPos(nCol1, nRow, nTab);
- ScRefCellValue aCell;
- aCell.assign(rDoc, aCellPos);
+ ScRefCellValue aCell(rDoc, aCellPos);
if (aCell.meType != CELLTYPE_STRING && aCell.meType != CELLTYPE_EDIT)
return false;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 72d8849..f610daa 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1075,8 +1075,7 @@ bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY )
bEmpty = pThisRowInfo->pCellInfo[nX+1].bEmptyCellText;
else
{
- ScRefCellValue aCell;
- aCell.assign(*mpDoc, ScAddress(nX, nY, nTab));
+ ScRefCellValue aCell(*mpDoc, ScAddress(nX, nY, nTab));
bEmpty = aCell.isEmpty();
}
@@ -1121,8 +1120,7 @@ bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY )
// Stop at non-empty or merged or overlapped cell,
// where a note is empty as well as a cell that's hidden by protection settings
- ScRefCellValue aCell;
- aCell.assign(*mpDoc, ScAddress(nX, nY, nTab));
+ ScRefCellValue aCell(*mpDoc, ScAddress(nX, nY, nTab));
if (!aCell.isEmpty() && !IsEmptyCellText(NULL, nX, nY))
return false;
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 632757d..a765612 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -112,8 +112,7 @@ OUString ScTabViewShell::GetFormula(ScAddress& rAddress)
{
OUString sFormula;
ScDocument* pDoc = GetViewData().GetDocument();
- ScRefCellValue aCell;
- aCell.assign(*pDoc, rAddress);
+ ScRefCellValue aCell(*pDoc, rAddress);
if (!aCell.isEmpty() && aCell.meType == CELLTYPE_FORMULA)
{
sFormula = aCell.mpString->getString();
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 7fc6659..9ccfb50 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -313,8 +313,7 @@ SvxNumberInfoItem* ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc, ScViewD
double nCellValue = 0;
OUString aCellString;
- ScRefCellValue aCell;
- aCell.assign(*pDoc, pViewData->GetCurPos());
+ ScRefCellValue aCell(*pDoc, pViewData->GetCurPos());
switch (aCell.meType)
{
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5a34f90..d04433b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -207,8 +207,7 @@ enum ScAutoSum
static ScAutoSum lcl_IsAutoSumData( ScDocument* pDoc, SCCOL nCol, SCROW nRow,
SCTAB nTab, ScDirection eDir, SCCOLROW& nExtend )
{
- ScRefCellValue aCell;
- aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab));
+ ScRefCellValue aCell(*pDoc, ScAddress(nCol, nRow, nTab));
if (aCell.hasNumeric())
{
if (aCell.meType == CELLTYPE_FORMULA)
commit 5bcc5a690f9707464195483c400427d9ccd6d8dc
Author: Eike Rathke <erack at redhat.com>
Date: Mon Nov 2 14:35:01 2015 +0100
avoid construction of ScRefCellValue with default ctor, tdf#95419 related
... to just assign a new value, which takes a significant amount of time
(~13% of ScTable::ValidQuery()) in ScRefCellValue::operator=() due to
its implementation using a temporary and swap.
Change-Id: Ia205850e10c5fa9083eec5fb7563d98561b52462
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index a95dd68..861ac3d 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2625,12 +2625,9 @@ bool ScTable::ValidQuery(
const ScQueryEntry& rEntry = *it;
SCCOL nCol = static_cast<SCCOL>(rEntry.nField);
- // we can only handle one single direct query
- ScRefCellValue aCell;
- if (pCell && it == itBeg)
- aCell = *pCell;
- else
- aCell = GetCellValue(nCol, nRow);
+ // We can only handle one single direct query passed as a known pCell,
+ // subsequent queries have to obtain the cell.
+ ScRefCellValue aCell( (pCell && it == itBeg) ? *pCell : GetCellValue(nCol, nRow));
std::pair<bool,bool> aRes(false, false);
More information about the Libreoffice-commits
mailing list