diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 00:54:35 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 01:12:52 -0400 |
commit | 226aefbc5587568c60c966ff22762e77c7838fd4 (patch) | |
tree | de00cac8e6dd9ae3873f850aab695aa24eb8a975 /sc/source/ui | |
parent | 629c793388f071ff9624e78c578a76eadef2fc34 (diff) |
Reduce calls to ScDocument::GetCell().
Change-Id: I39196eced68d25b6b2ae1378f712564badfc4572
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 6 |
5 files changed, 15 insertions, 11 deletions
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 ) ) { |