diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-27 23:27:30 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 01:12:51 -0400 |
commit | 629c793388f071ff9624e78c578a76eadef2fc34 (patch) | |
tree | 88cf305aa7ddcf4d48629709eb4a9761daab9276 | |
parent | e610388522c31455bb989c957e9480fa7fbcdf6c (diff) |
More on replacing ScBaseCell.
Change-Id: I2a512d0421ddac5bf92ad128ea2dde5772f854dd
-rw-r--r-- | sc/inc/fillinfo.hxx | 1 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 21 | ||||
-rw-r--r-- | sc/source/filter/excel/excform.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/collab/sendfunc.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/inc/output.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsha.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun4.cxx | 3 |
11 files changed, 45 insertions, 57 deletions
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index de57d8f5c6f9..a55d63850819 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -32,7 +32,6 @@ class SvxLineItem; class SvxShadowItem; class Color; -class ScBaseCell; class ScPatternAttr; const sal_uInt8 SC_ROTDIR_NONE = 0; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ec0769588db1..6d4895632e7a 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4397,10 +4397,11 @@ void Test::testStreamValid() CPPUNIT_ASSERT_MESSAGE("Cell A1 should not have moved.", test.equals(a1)); test = m_pDoc->GetString(0, 3, 0); CPPUNIT_ASSERT_MESSAGE("the old cell A2 should now be at A4.", test.equals(a2)); - const ScBaseCell* pCell = m_pDoc->GetCell(ScAddress(0, 1, 0)); - CPPUNIT_ASSERT_MESSAGE("Cell A2 should be empty.", pCell == NULL); - pCell = m_pDoc->GetCell(ScAddress(0, 2, 0)); - CPPUNIT_ASSERT_MESSAGE("Cell A3 should be empty.", pCell == NULL); + ScRefCellValue aCell; + aCell.assign(*m_pDoc, ScAddress(0,1,0)); + CPPUNIT_ASSERT_MESSAGE("Cell A2 should be empty.", aCell.isEmpty()); + aCell.assign(*m_pDoc, ScAddress(0,2,0)); + CPPUNIT_ASSERT_MESSAGE("Cell A3 should be empty.", aCell.isEmpty()); // After the move, Sheet1, Sheet2, and Sheet4 should have their stream // invalidated, whereas Sheet3's stream should still be valid. @@ -6256,17 +6257,17 @@ void Test::testFormulaGrouping() for (unsigned j = 0; j < SAL_N_ELEMENTS( aGroupTests[0].pFormula ); j++) { - ScBaseCell *pCell = NULL; - m_pDoc->GetCell( 0, (SCROW)j, 0, pCell ); - if( !pCell ) + ScRefCellValue aCell; + aCell.assign(*m_pDoc, ScAddress(0, (SCROW)j, 0)); + if (aCell.isEmpty()) { CPPUNIT_ASSERT_MESSAGE("invalid empty cell", !aGroupTests[i].bGroup[j]); continue; } - CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", pCell != NULL); + CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", !aCell.isEmpty()); CPPUNIT_ASSERT_MESSAGE("Cell wrong type.", - pCell->GetCellType() == CELLTYPE_FORMULA); - ScFormulaCell *pCur = static_cast< ScFormulaCell *>( pCell ); + aCell.meType == CELLTYPE_FORMULA); + ScFormulaCell *pCur = aCell.mpFormula; if( !!pCur->GetCellGroup().get() ^ aGroupTests[i].bGroup[j] ) { diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 289eee840e77..155fad900f1d 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -131,9 +131,7 @@ void ImportExcel::Formula( CellType eCellType = pD->GetCellType(aScPos); if( eCellType == CELLTYPE_FORMULA ) { - ScBaseCell* pBaseCell; - pD->GetCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pBaseCell ); - pCell = ( ScFormulaCell* ) pBaseCell; + pCell = pD->GetFormulaCell(aScPos); if( pCell ) pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE ); } diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx index 797246d20a43..032ff0147154 100644 --- a/sc/source/ui/collab/sendfunc.hxx +++ b/sc/source/ui/collab/sendfunc.hxx @@ -14,7 +14,6 @@ #include "docfunc.hxx" class ScCollaboration; -class ScBaseCell; namespace { diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index e9d5cc8d169f..36811e739642 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -625,20 +625,19 @@ void lcl_GetColumnTypes( if ( !bTypeDefined ) { // Feldtyp - ScBaseCell* pCell; - pDoc->GetCell( nCol, nFirstDataRow, nTab, pCell ); - if ( !pCell || pCell->HasStringData() ) + ScRefCellValue aCell; + aCell.assign(*pDoc, ScAddress(nCol, nFirstDataRow, nTab)); + if (aCell.isEmpty() || aCell.hasString()) nDbType = sdbc::DataType::VARCHAR; else { sal_uInt32 nFormat; pDoc->GetNumberFormat( nCol, nFirstDataRow, nTab, nFormat ); - if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA - && ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) ) + if (aCell.meType == CELLTYPE_FORMULA && ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)) { nFormat = ScGlobal::GetStandardFormat( - ((ScFormulaCell*)pCell)->GetValue(), *pNumFmt, nFormat, - ((ScFormulaCell*)pCell)->GetFormatType() ); + aCell.mpFormula->GetValue(), *pNumFmt, nFormat, + aCell.mpFormula->GetFormatType()); } switch ( pNumFmt->GetType( nFormat ) ) { diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 990a947b5dba..1e715a70977c 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -32,7 +32,6 @@ class Font; class OutputDevice; class EditEngine; class ScDocument; -class ScBaseCell; class ScPatternAttr; class SdrObject; struct RowInfo; @@ -206,10 +205,10 @@ private: sal_Bool GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY, SCCOL& rOverX, SCROW& rOverY, sal_Bool bVisRowChanged ); - sal_Bool IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY ); + bool IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY ); void GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue& rCell ); - sal_Bool IsAvailable( SCCOL nX, SCROW nY ); + bool IsAvailable( SCCOL nX, SCROW nY ); void GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY, SCCOL nCellX, SCROW nCellY, long nNeeded, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index c31a2c3ef99c..9daf85939485 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -353,11 +353,10 @@ static sal_Bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange ) rRange.aEnd.Col(),rRange.aEnd.Row() ) ) return false; + ScRefCellValue aCell; + aCell.assign(*pDoc, rRange.aEnd); ScAddress aPos; - const ScBaseCell* pCell = pDoc->GetCell( rRange.aEnd ); - return ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && - ((ScFormulaCell*)pCell)->GetMatrixOrigin(aPos) && aPos == rRange.aStart ); - + return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(aPos) && aPos == rRange.aStart); } static void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, const Point& rPos, ScViewData* pViewData ) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index a69ef998515c..afa0dabc21c4 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1072,11 +1072,11 @@ inline sal_Bool IsAmbiguousScript( sal_uInt8 nScript ) nScript != SCRIPTTYPE_COMPLEX ); } -sal_Bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY ) +bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY ) { // pThisRowInfo may be NULL - sal_Bool bEmpty; + bool bEmpty; if ( pThisRowInfo && nX <= nX2 ) bEmpty = pThisRowInfo->pCellInfo[nX+1].bEmptyCellText; else @@ -1087,23 +1087,22 @@ sal_Bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW n // for the range nX1..nX2 in RowInfo, cell protection attribute is already evaluated // into bEmptyCellText in ScDocument::FillInfo / lcl_HidePrint (printfun) - sal_Bool bIsPrint = ( eType == OUTTYPE_PRINTER ); + bool bIsPrint = ( eType == OUTTYPE_PRINTER ); if ( bIsPrint || bTabProtected ) { const ScProtectionAttr* pAttr = (const ScProtectionAttr*) mpDoc->GetEffItem( nX, nY, nTab, ATTR_PROTECTION ); if ( bIsPrint && pAttr->GetHidePrint() ) - bEmpty = sal_True; + bEmpty = true; else if ( bTabProtected ) { if ( pAttr->GetHideCell() ) - bEmpty = sal_True; + bEmpty = true; else if ( mbShowFormulas && pAttr->GetHideFormula() ) { - ScBaseCell* pCell = mpDoc->GetCell( ScAddress( nX, nY, nTab ) ); - if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA ) - bEmpty = sal_True; + if (mpDoc->GetCellType(ScAddress(nX, nY, nTab)) == CELLTYPE_FORMULA) + bEmpty = true; } } } @@ -1118,17 +1117,16 @@ void ScOutputData::GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTabP, ScRefCel rCell.clear(); } -sal_Bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY ) +bool ScOutputData::IsAvailable( SCCOL nX, SCROW nY ) { // apply the same logic here as in DrawStrings/DrawEdit: // 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 - const ScBaseCell* pCell = mpDoc->GetCell( ScAddress( nX, nY, nTab ) ); - if ( pCell && pCell->GetCellType() != CELLTYPE_NOTE && !IsEmptyCellText( NULL, nX, nY ) ) - { + ScRefCellValue aCell; + aCell.assign(*mpDoc, ScAddress(nX, nY, nTab)); + if (!aCell.isEmpty() && !IsEmptyCellText(NULL, nX, nY)) return false; - } const ScPatternAttr* pPattern = mpDoc->GetPattern( nX, nY, nTab ); if ( ((const ScMergeAttr&)pPattern->GetItem(ATTR_MERGE)).IsMerged() || diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 071c4e48813e..a6e624e6857b 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -50,7 +50,7 @@ #include "scabstdlg.hxx" #include "compiler.hxx" #include "markdata.hxx" - +#include "cellvalue.hxx" sal_Bool ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode ) { @@ -111,13 +111,10 @@ sal_Bool ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode ) pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt ); if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) { - ScBaseCell* pCell; - pDoc->GetCell( nPosX, nPosY, nTab, pCell ); - if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) - { - - nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(*pFormatter, nNumFmt ); - } + ScRefCellValue aCell; + aCell.assign(*pDoc, aCursor); + if (aCell.meType == CELLTYPE_FORMULA) + nNumFmt = aCell.mpFormula->GetStandardFormat(*pFormatter, nNumFmt); } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 6494cd2bc500..72407dc1ceff 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -213,13 +213,13 @@ enum ScAutoSum static ScAutoSum lcl_IsAutoSumData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, ScDirection eDir, SCCOLROW& nExtend ) { - ScBaseCell* pCell; - pDoc->GetCell( nCol, nRow, nTab, pCell ); - if ( pCell && pCell->HasValueData() ) + ScRefCellValue aCell; + aCell.assign(*pDoc, ScAddress(nCol, nRow, nTab)); + if (aCell.hasNumeric()) { - if ( pCell->GetCellType() == CELLTYPE_FORMULA ) + if (aCell.meType == CELLTYPE_FORMULA) { - ScTokenArray* pCode = ((ScFormulaCell*)pCell)->GetCode(); + ScTokenArray* pCode = aCell.mpFormula->GetCode(); if ( pCode && pCode->GetOuterFuncOpCode() == ocSum ) { if ( pCode->GetAdjacentExtendOfOuterFuncRefs( nExtend, diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 7e7e3df92053..84a4202c4764 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -311,7 +311,6 @@ void ScViewFunc::DoThesaurus( sal_Bool bRecord ) String sOldText, sNewString; EditTextObject* pOldTObj = NULL; const EditTextObject* pTObject = NULL; - ScBaseCell* pCell = NULL; EditView* pEditView = NULL; boost::scoped_ptr<ESelection> pEditSel; ScEditEngineDefaulter* pThesaurusEngine; @@ -406,7 +405,7 @@ void ScViewFunc::DoThesaurus( sal_Bool bRecord ) if (pThesaurusEngine->IsModified()) { EditTextObject* pNewTObj = NULL; - if (pCell && pTObject) + if (pTObject) { // The cell will own the text object instance. pDoc->SetEditText( |