summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-28 00:54:35 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-28 01:12:52 -0400
commit226aefbc5587568c60c966ff22762e77c7838fd4 (patch)
treede00cac8e6dd9ae3873f850aab695aa24eb8a975 /sc
parent629c793388f071ff9624e78c578a76eadef2fc34 (diff)
Reduce calls to ScDocument::GetCell().
Change-Id: I39196eced68d25b6b2ae1378f712564badfc4572
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/cellform.hxx2
-rw-r--r--sc/inc/document.hxx5
-rw-r--r--sc/source/core/data/cell2.cxx31
-rw-r--r--sc/source/core/data/colorscale.cxx8
-rw-r--r--sc/source/core/data/column.cxx2
-rw-r--r--sc/source/core/data/documen7.cxx12
-rw-r--r--sc/source/core/data/table4.cxx5
-rw-r--r--sc/source/core/data/table5.cxx6
-rw-r--r--sc/source/core/inc/interpre.hxx6
-rw-r--r--sc/source/core/tool/cellform.cxx4
-rw-r--r--sc/source/core/tool/chartarr.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx6
-rw-r--r--sc/source/core/tool/interpr4.cxx81
-rw-r--r--sc/source/core/tool/interpr5.cxx3
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx3
-rw-r--r--sc/source/ui/docshell/docsh.cxx6
-rw-r--r--sc/source/ui/docshell/impex.cxx10
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx2
-rw-r--r--sc/source/ui/view/output2.cxx6
20 files changed, 116 insertions, 88 deletions
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index 373d6e64c0cc..08561f8f64bf 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -48,7 +48,7 @@ public:
bool bUseStarFormat = false );
static OUString GetString(
- const ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat,
+ ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat,
Color** ppColor, SvNumberFormatter& rFormatter, bool bNullVals = true,
bool bFormula = false, ScForceTextFmt eForceTextFmt = ftDontForce, bool bUseStarFormat = false );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ec944f68ed50..88fcd11f53a7 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1706,15 +1706,12 @@ public:
void EndListeningArea( const ScRange& rRange,
SvtListener* pListener );
/** Broadcast wrapper, calls
- SC_DLLPUBLIC rHint.GetCell()->Broadcast() and AreaBroadcast()
+ rHint.GetCell()->Broadcast() and AreaBroadcast()
and TrackFormulas() and conditional format list
SourceChanged().
Preferred.
*/
void Broadcast( const ScHint& rHint );
- /// deprecated
- void Broadcast( sal_uLong nHint, const ScAddress& rAddr,
- ScBaseCell* pCell );
/// only area, no cell broadcast
void AreaBroadcast( const ScHint& rHint );
/// only areas in range, no cell broadcasts
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 7603b05d6520..b443d658c087 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -593,7 +593,7 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos )
rOrgPos = aOrg;
ScFormulaCell* pFCell;
if ( cMatrixFlag == MM_REFERENCE )
- pFCell = (ScFormulaCell*) pDocument->GetCell( aOrg );
+ pFCell = pDocument->GetFormulaCell(aOrg);
else
pFCell = this; // this MM_FORMULA
// There's only one this, don't compare pFCell==this.
@@ -607,17 +607,15 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos )
nC = 1;
nR = 1;
ScAddress aTmpOrg;
- ScBaseCell* pCell;
+ ScFormulaCell* pCell;
ScAddress aAdr( aOrg );
aAdr.IncCol();
bool bCont = true;
do
{
- pCell = pDocument->GetCell( aAdr );
- if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA
- && ((ScFormulaCell*)pCell)->cMatrixFlag == MM_REFERENCE
- && ((ScFormulaCell*)pCell)->GetMatrixOrigin( aTmpOrg )
- && aTmpOrg == aOrg )
+ pCell = pDocument->GetFormulaCell(aAdr);
+ if (pCell && pCell->cMatrixFlag == MM_REFERENCE &&
+ pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
{
nC++;
aAdr.IncCol();
@@ -630,11 +628,9 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos )
bCont = true;
do
{
- pCell = pDocument->GetCell( aAdr );
- if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA
- && ((ScFormulaCell*)pCell)->cMatrixFlag == MM_REFERENCE
- && ((ScFormulaCell*)pCell)->GetMatrixOrigin( aTmpOrg )
- && aTmpOrg == aOrg )
+ pCell = pDocument->GetFormulaCell(aAdr);
+ if (pCell && pCell->cMatrixFlag == MM_REFERENCE &&
+ pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
{
nR++;
aAdr.IncRow();
@@ -1766,13 +1762,10 @@ bool ScFormulaCell::InterpretFormulaGroup()
InterpretTail( SCITP_NORMAL );
for ( sal_Int32 i = 0; i < xGroup->mnLength; i++ )
{
- ScBaseCell *pBaseCell = NULL;
- pDocument->GetCell( aPos.Col(),
- xGroup->mnStart + i,
- aPos.Tab(), pBaseCell );
- assert( pBaseCell != NULL );
- assert( pBaseCell->GetCellType() == CELLTYPE_FORMULA );
- ScFormulaCell *pCell = static_cast<ScFormulaCell *>( pBaseCell );
+ ScAddress aTmpPos = aPos;
+ aTmpPos.SetRow(xGroup->mnStart + i);
+ ScFormulaCell* pCell = pDocument->GetFormulaCell(aTmpPos);
+ assert( pCell != NULL );
// FIXME: this set of horrors is unclear to me ... certainly
// the above GetCell is profoundly nasty & slow ...
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 754cbdc78c69..f7d3493e83c5 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -282,7 +282,7 @@ std::vector<double>& ScColorFormat::getValues() const
}
else if(eType == CELLTYPE_FORMULA)
{
- if(static_cast<ScFormulaCell*>(mpDoc->GetCell(aAddr))->IsValue())
+ if (mpDoc->GetFormulaCell(aAddr)->IsValue())
{
double aVal = mpDoc->GetValue(nCol, nRow, nTab);
rValues.push_back(aVal);
@@ -406,7 +406,7 @@ Color* ScColorScaleFormat::GetColor( const ScAddress& rAddr ) const
if (eCellType == CELLTYPE_FORMULA)
{
- if(!static_cast<ScFormulaCell*>(mpDoc->GetCell(rAddr))->IsValue())
+ if (!mpDoc->GetFormulaCell(rAddr)->IsValue())
return NULL;
}
@@ -663,7 +663,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
if (eCellType == CELLTYPE_FORMULA)
{
- if(!static_cast<ScFormulaCell*>(mpDoc->GetCell(rAddr))->IsValue())
+ if (!mpDoc->GetFormulaCell(rAddr)->IsValue())
return NULL;
}
@@ -801,7 +801,7 @@ ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const
if (eCellType == CELLTYPE_FORMULA)
{
- if(!static_cast<ScFormulaCell*>(mpDoc->GetCell(rAddr))->IsValue())
+ if (!mpDoc->GetFormulaCell(rAddr)->IsValue())
return NULL;
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 150b5adca1ba..1712fbe04b1c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -221,7 +221,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
ScFormulaCell* pFCell;
if ( ((ScFormulaCell*)pCell)->GetMatrixFlag()
== MM_REFERENCE )
- pFCell = (ScFormulaCell*) pDocument->GetCell( aOrg );
+ pFCell = pDocument->GetFormulaCell(aOrg);
else
pFCell = (ScFormulaCell*)pCell;
SCCOL nC;
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index f81346422ee3..96ebc365279d 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -62,18 +62,6 @@ void ScDocument::EndListeningArea( const ScRange& rRange,
pBASM->EndListeningArea( rRange, pListener );
}
-
-void ScDocument::Broadcast( sal_uLong nHint, const ScAddress& rAddr,
- ScBaseCell* pCell
- )
-{
- if ( !pBASM )
- return ; // Clipboard or Undo
- ScHint aHint(nHint, rAddr, pCell ? pCell->GetBroadcaster() : NULL);
- Broadcast( aHint );
-}
-
-
void ScDocument::Broadcast( const ScHint& rHint )
{
if ( !pBASM )
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 6970b5473a76..b467745b8a24 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -440,9 +440,8 @@ void ScTable::FillFormula(sal_uLong& /* nFormulaCounter */, bool /* bFirst */, S
{
if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() )
{
- ScBaseCell* pOrgCell = pDocument->GetCell( aOrg );
- if ( pOrgCell && pOrgCell->GetCellType() == CELLTYPE_FORMULA
- && ((ScFormulaCell*)pOrgCell)->GetMatrixFlag() == MM_FORMULA )
+ ScFormulaCell* pOrgCell = pDocument->GetFormulaCell(aOrg);
+ if (pOrgCell && pOrgCell->GetMatrixFlag() == MM_FORMULA)
{
((ScFormulaCell*)pOrgCell)->SetMatColsRows(
nDestCol - aOrg.Col() + 1,
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 644b1a65df66..86e6b4fed71a 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1166,7 +1166,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
switch ( pCell->GetCellType() )
{
case CELLTYPE_VALUE :
- pDocument->Broadcast(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), pCell);
+ pDocument->Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
break;
case CELLTYPE_FORMULA :
((ScFormulaCell*)pCell)->SetDirty();
@@ -1208,8 +1208,8 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
switch ( pCell->GetCellType() )
{
case CELLTYPE_VALUE :
- pDocument->Broadcast( SC_HINT_DATACHANGED,
- ScAddress( nCol, nRow, nTab ), pCell );
+ pDocument->Broadcast(
+ ScHint(SC_HINT_DATACHANGED, ScAddress(nCol, nRow, nTab), pCell->GetBroadcaster()));
break;
case CELLTYPE_FORMULA :
((ScFormulaCell*)pCell)->SetDirty();
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 760a0c7239bb..0fdc89c1f185 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -52,6 +52,7 @@ struct ScComplexRefData;
class ScToken;
class ScJumpMatrix;
class ScCellIterator;
+class ScRefCellValue;
#define MAXSTACK (4096 / sizeof(formula::FormulaToken*))
@@ -187,12 +188,13 @@ bool IsTableOpInRange( const ScRange& );
sal_uLong GetCellNumberFormat( const ScAddress&, const ScBaseCell* );
double ConvertStringToValue( const String& );
double GetCellValue( const ScAddress&, const ScBaseCell* );
-double GetCellValue( ScCellIterator& rIter );
+double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
double GetCellValueOrZero( const ScAddress&, const ScBaseCell* );
-double GetCellValueOrZero( ScCellIterator& rIter );
+double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
double GetValueCellValue( const ScAddress&, const ScValueCell* );
ScBaseCell* GetCell( const ScAddress& rPos );
void GetCellString( String& rStr, const ScBaseCell* pCell );
+void GetCellString( OUString& rStr, ScRefCellValue& rCell );
sal_uInt16 GetCellErrCode( const ScBaseCell* pCell );
CellType GetCellType( const ScBaseCell* pCell );
bool HasCellEmptyData( const ScBaseCell* pCell );
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index d60627b11a05..1ddfaaa4645c 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -136,7 +136,7 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString
}
OUString ScCellFormat::GetString(
- const ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat, Color** ppColor,
+ ScDocument& rDoc, const ScAddress& rPos, sal_uLong nFormat, Color** ppColor,
SvNumberFormatter& rFormatter, bool bNullVals, bool bFormula, ScForceTextFmt eForceTextFmt,
bool bUseStarFormat )
{
@@ -180,7 +180,7 @@ OUString ScCellFormat::GetString(
break;
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(rDoc.GetCell(rPos));
+ ScFormulaCell* pFCell = rDoc.GetFormulaCell(rPos);
if (bFormula)
{
pFCell->GetFormula(aString);
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index e88c6c1122cb..34f4605810a6 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -116,7 +116,7 @@ ScMemChart* ScChartArray::CreateMemChart()
namespace {
-double getCellValue( const ScDocument& rDoc, const ScAddress& rPos, double fDefault, bool bCalcAsShown )
+double getCellValue( ScDocument& rDoc, const ScAddress& rPos, double fDefault, bool bCalcAsShown )
{
double fRet = fDefault;
@@ -135,7 +135,7 @@ double getCellValue( const ScDocument& rDoc, const ScAddress& rPos, double fDefa
break;
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(rDoc.GetCell(rPos));
+ ScFormulaCell* pFCell = rDoc.GetFormulaCell(rPos);
if (!pFCell->GetErrCode() && pFCell->IsValue())
fRet = pFCell->GetValue();
}
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 80428a4fb070..b8bf5dde27c4 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5277,8 +5277,10 @@ bool ScCompiler::HandleSingleRef()
}
if ( !bInList && pDoc->GetDocOptions().IsLookUpColRowNames() )
{ // automagically or created by copying and NamePos isn't in list
- bool bString = pDoc->HasStringData( nCol, nRow, nTab );
- if ( !bString && !pDoc->GetCell( aLook ) )
+ ScRefCellValue aCell;
+ aCell.assign(*pDoc, aLook);
+ bool bString = aCell.hasString();
+ if (!bString && aCell.isEmpty())
bString = true; // empty cell is ok
if ( bString )
{ //! coresponds with ScInterpreter::ScColRowNameAuto()
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a3d77ffad4b0..a54748fab99a 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -470,11 +470,11 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCe
return nVal;
}
-double ScInterpreter::GetCellValue( ScCellIterator& rIter )
+double ScInterpreter::GetCellValue( const ScAddress& rPos, ScRefCellValue& rCell )
{
sal_uInt16 nErr = nGlobalError;
nGlobalError = 0;
- double nVal = GetCellValueOrZero(rIter);
+ double nVal = GetCellValueOrZero(rPos, rCell);
if ( !nGlobalError || nGlobalError == errCellNoValue )
nGlobalError = nErr;
return nVal;
@@ -552,18 +552,16 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
return fValue;
}
-double ScInterpreter::GetCellValueOrZero( ScCellIterator& rIter )
+double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue& rCell )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellValueOrZero" );
double fValue = 0.0;
- CellType eType = rIter.getType();
- const ScAddress& rPos = rIter.GetPos();
+ CellType eType = rCell.meType;
switch (eType)
{
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFCell = rIter.getFormulaCell();
+ ScFormulaCell* pFCell = rCell.mpFormula;
sal_uInt16 nErr = pFCell->GetErrCode();
if( !nErr )
{
@@ -588,7 +586,7 @@ double ScInterpreter::GetCellValueOrZero( ScCellIterator& rIter )
break;
case CELLTYPE_VALUE:
{
- fValue = rIter.getValue();
+ fValue = rCell.mfValue;
nCurFmtIndex = pDok->GetNumberFormat( rPos );
nCurFmtType = pFormatter->GetType( nCurFmtIndex );
if ( bCalcAsShown && fValue != 0.0 )
@@ -600,7 +598,7 @@ double ScInterpreter::GetCellValueOrZero( ScCellIterator& rIter )
{
// SUM(A1:A2) differs from A1+A2. No good. But people insist on
// it ... #i5658#
- OUString aStr = rIter.getString();
+ OUString aStr = rCell.getString();
fValue = ConvertStringToValue( aStr );
}
break;
@@ -673,6 +671,48 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell )
SetError(nErr);
}
+void ScInterpreter::GetCellString( OUString& rStr, ScRefCellValue& rCell )
+{
+ sal_uInt16 nErr = 0;
+
+ switch (rCell.meType)
+ {
+ case CELLTYPE_STRING:
+ case CELLTYPE_EDIT:
+ rStr = rCell.getString();
+ break;
+ case CELLTYPE_FORMULA:
+ {
+ ScFormulaCell* pFCell = rCell.mpFormula;
+ nErr = pFCell->GetErrCode();
+ if (pFCell->IsValue())
+ {
+ double fVal = pFCell->GetValue();
+ sal_uLong nIndex = pFormatter->GetStandardFormat(
+ NUMBERFORMAT_NUMBER,
+ ScGlobal::eLnge);
+ pFormatter->GetInputLineString(fVal, nIndex, rStr);
+ }
+ else
+ rStr = pFCell->GetString();
+ }
+ break;
+ case CELLTYPE_VALUE:
+ {
+ double fVal = rCell.mfValue;
+ sal_uLong nIndex = pFormatter->GetStandardFormat(
+ NUMBERFORMAT_NUMBER,
+ ScGlobal::eLnge);
+ pFormatter->GetInputLineString(fVal, nIndex, rStr);
+ }
+ break;
+ default:
+ rStr = ScGlobal::GetEmptyString();
+ break;
+ }
+
+ SetError(nErr);
+}
bool ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8* pCellArr)
@@ -3651,15 +3691,18 @@ void ScInterpreter::ScTableOp()
}
pTableOp->bCollectNotifications = false;
- ScBaseCell* pFCell = pDok->GetCell( pTableOp->aFormulaPos );
- if ( pFCell && pFCell->GetCellType() == CELLTYPE_FORMULA )
- ((ScFormulaCell*)pFCell)->SetDirtyVar();
- if ( HasCellValueData( pFCell ) )
- PushDouble( GetCellValue( pTableOp->aFormulaPos, pFCell ));
+ ScRefCellValue aCell;
+ aCell.assign(*pDok, pTableOp->aFormulaPos);
+ if (aCell.meType == CELLTYPE_FORMULA)
+ aCell.mpFormula->SetDirtyVar();
+ if (aCell.hasNumeric())
+ {
+ PushDouble(GetCellValue(pTableOp->aFormulaPos, aCell));
+ }
else
{
- String aCellString;
- GetCellString( aCellString, pFCell );
+ OUString aCellString;
+ GetCellString(aCellString, aCell);
PushString( aCellString );
}
@@ -3681,10 +3724,10 @@ void ScInterpreter::ScTableOp()
if ( !bReuseLastParams )
pDok->aLastTableOpParams = *pTableOp;
- if ( pFCell && pFCell->GetCellType() == CELLTYPE_FORMULA )
+ if (aCell.meType == CELLTYPE_FORMULA)
{
- ((ScFormulaCell*)pFCell)->SetDirtyVar();
- ((ScFormulaCell*)pFCell)->GetErrCode(); // recalculate original
+ aCell.mpFormula->SetDirtyVar();
+ aCell.mpFormula->GetErrCode(); // recalculate original
}
// Reset all dirty flags so next incarnation does really collect all cell
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index a9a432c3ea0e..f574c4acc33b 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -437,7 +437,8 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken
if (aCellIter.hasNumeric())
{
ScAddress aAdr(nCol, nThisRow, nTab1);
- double fVal = GetCellValue(aCellIter);
+ ScRefCellValue aCell = aCellIter.getRefCellValue();
+ double fVal = GetCellValue(aCellIter.GetPos(), aCell);
if ( nGlobalError )
{
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index d51e1b56d390..c57a951857bf 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1367,8 +1367,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
// cached result. For import, we only need to set the correct
// matrix geometry and the value type of the top-left element.
- ScFormulaCell* pFCell =
- static_cast<ScFormulaCell*>( rXMLImport.GetDocument()->GetCell(rCellPos) );
+ ScFormulaCell* pFCell = rXMLImport.GetDocument()->GetFormulaCell(rCellPos);
ScMatrixRef pMat(new ScMatrix(nMatrixCols, nMatrixRows));
if (bFormulaTextResult && maStringValue)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index f33a94c3d9df..0bd4dabd3f9f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -477,7 +477,7 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
else
{
// still need to recalc volatile formula cells.
- aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL );
+ aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
}
aDocument.SetXMLFromWrapper( false );
@@ -2738,7 +2738,7 @@ void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ )
{
// #i115009# broadcast BCA_BRDCST_ALWAYS, so a component can read recalculated results
// of RecalcModeAlways formulas (like OFFSET) after modifying cells
- aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL );
+ aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
aDocument.InvalidateTableArea(); // #i105279# needed here
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
@@ -2758,7 +2758,7 @@ void ScDocShell::SetDocumentModified( sal_Bool bIsModified /* = sal_True */ )
aDocument.InvalidateStyleSheetUsage();
aDocument.InvalidateTableArea();
aDocument.InvalidateLastTableOpParams();
- aDocument.Broadcast( SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL );
+ aDocument.Broadcast( ScHint(SC_HINT_DATACHANGED, BCA_BRDCST_ALWAYS, NULL) );
if ( aDocument.IsForcedFormulaPending() && aDocument.GetAutoCalc() )
aDocument.CalcFormulaTree( sal_True );
PostDataChanged();
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index e35551ab9d0e..5c525dc0dbd1 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -48,6 +48,7 @@
#include "patattr.hxx"
#include "docpool.hxx"
#include "stringutil.hxx"
+#include "cellvalue.hxx"
#include "globstr.hrc"
#include <vcl/svapp.hxx>
@@ -1968,9 +1969,9 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
bool bForm = false;
SCROW r = nRow - nStartRow + 1;
SCCOL c = nCol - nStartCol + 1;
- ScBaseCell* pCell;
- pDoc->GetCell( nCol, nRow, aRange.aStart.Tab(), pCell );
- CellType eType = (pCell ? pCell->GetCellType() : CELLTYPE_NONE);
+ ScRefCellValue aCell;
+ aCell.assign(*pDoc, ScAddress(nCol, nRow, aRange.aStart.Tab()));
+ CellType eType = aCell.meType;
switch( eType )
{
case CELLTYPE_FORMULA:
@@ -2014,8 +2015,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
checkformula:
if( bForm )
{
- const ScFormulaCell* pFCell =
- static_cast<const ScFormulaCell*>(pCell);
+ const ScFormulaCell* pFCell = aCell.mpFormula;
switch ( pFCell->GetMatrixFlag() )
{
case MM_REFERENCE :
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 20bd34613562..502a1ea451c5 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6605,7 +6605,7 @@ void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeExc
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh && pDocSh->GetDocument()->GetCellType( aCellPos ) == CELLTYPE_FORMULA )
{
- ScFormulaCell* pCell = (ScFormulaCell *)pDocSh->GetDocument()->GetCell( aCellPos );
+ ScFormulaCell* pCell = pDocSh->GetDocument()->GetFormulaCell(aCellPos);
pCell->SetHybridDouble( nValue );
pCell->ResetDirty();
pCell->ResetChanged();
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 60e65dc6038f..dc02354a0e75 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -2608,7 +2608,7 @@ void ScChart2DataSequence::BuildDataCache()
break;
case CELLTYPE_FORMULA:
{
- ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(m_pDocument->GetCell(aAdr));
+ ScFormulaCell* pFCell = m_pDocument->GetFormulaCell(aAdr);
sal_uInt16 nErr = pFCell->GetErrCode();
if (nErr)
break;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index afa0dabc21c4..4ecb1fc040af 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1080,7 +1080,11 @@ bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY )
if ( pThisRowInfo && nX <= nX2 )
bEmpty = pThisRowInfo->pCellInfo[nX+1].bEmptyCellText;
else
- bEmpty = ( mpDoc->GetCell( ScAddress( nX, nY, nTab ) ) == NULL );
+ {
+ ScRefCellValue aCell;
+ aCell.assign(*mpDoc, ScAddress(nX, nY, nTab));
+ bEmpty = aCell.isEmpty();
+ }
if ( !bEmpty && ( nX < nX1 || nX > nX2 || !pThisRowInfo ) )
{