sc/inc/dociter.hxx | 5 +++-- sc/source/core/data/dociter.cxx | 23 ++++++++++++----------- sc/source/core/data/documen8.cxx | 19 ++++++++----------- sc/source/ui/docshell/docsh.cxx | 24 ++++++++++-------------- sc/source/ui/docshell/docsh8.cxx | 12 ++++-------- 5 files changed, 37 insertions(+), 46 deletions(-)
New commits: commit 99b00e76eef76246e6c3474b98b5b87eb85555df Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Wed Mar 27 16:43:51 2013 -0400 More on killing direct use of ScEditCell (and some of ScBaseCell). Change-Id: I65d530333213f8b3db38a269e74a0beabcd1ff89 diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 5e9b16d..c38f200 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -431,6 +431,7 @@ private: SCSIZE* pNextIndices; SCCOL nCol; SCROW nRow; + ScRefCellValue maCurCell; bool bMore; public: @@ -438,7 +439,7 @@ public: SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); ~ScHorizontalCellIterator(); - ScBaseCell* GetNext( SCCOL& rCol, SCROW& rRow ); + ScRefCellValue* GetNext( SCCOL& rCol, SCROW& rRow ); bool ReturnNext( SCCOL& rCol, SCROW& rRow ); /// Set a(nother) sheet and (re)init. void SetTab( SCTAB nTab ); @@ -524,7 +525,7 @@ private: SCCOL nCellCol; SCROW nCellRow; - ScBaseCell* pCell; + ScRefCellValue* pCell; SCCOL nAttrCol1; SCCOL nAttrCol2; SCROW nAttrRow; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index f64837e..c318e04 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1797,7 +1797,7 @@ void ScHorizontalCellIterator::SetTab( SCTAB nTabP ) Advance(); } -ScBaseCell* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow ) +ScRefCellValue* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow ) { if ( bMore ) { @@ -1820,7 +1820,8 @@ ScBaseCell* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow ) } Advance(); - return pCell; + maCurCell.assign(*pCell); + return &maCurCell; } else return NULL; @@ -1917,7 +1918,7 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr ) bool bFound = false; while ( !bFound ) { - ScBaseCell* pCell = pCellIter->GetNext( nCurCol, nCurRow ); + ScRefCellValue* pCell = pCellIter->GetNext( nCurCol, nCurRow ); while ( !pCell ) { if ( nCurTab < nEndTab ) @@ -1930,12 +1931,12 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr ) } if ( !bSubTotal || !pDoc->maTabs[nCurTab]->RowFiltered( nCurRow ) ) { - switch (pCell->GetCellType()) + switch (pCell->meType) { case CELLTYPE_VALUE: { bNumValid = false; - rValue = ((ScValueCell*)pCell)->GetValue(); + rValue = pCell->mfValue; rErr = 0; if ( bCalcAsShown ) { @@ -1949,12 +1950,12 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, sal_uInt16& rErr ) break; case CELLTYPE_FORMULA: { - if (!bSubTotal || !((ScFormulaCell*)pCell)->IsSubTotal()) + if (!bSubTotal || !pCell->mpFormula->IsSubTotal()) { - rErr = ((ScFormulaCell*)pCell)->GetErrCode(); - if ( rErr || ((ScFormulaCell*)pCell)->IsValue() ) + rErr = pCell->mpFormula->GetErrCode(); + if (rErr || pCell->mpFormula->IsValue()) { - rValue = ((ScFormulaCell*)pCell)->GetValue(); + rValue = pCell->mpFormula->GetValue(); bNumValid = false; bFound = true; } @@ -2161,7 +2162,7 @@ bool ScUsedAreaIterator::GetNext() if ( pCell && IsGreater( nNextCol, nNextRow, nCellCol, nCellRow ) ) pCell = aCellIter.GetNext( nCellCol, nCellRow ); - while ( pCell && pCell->IsBlank() ) + while (pCell && pCell->isEmpty()) pCell = aCellIter.GetNext( nCellCol, nCellRow ); if ( pPattern && IsGreater( nNextCol, nNextRow, nAttrCol2, nAttrRow ) ) @@ -2215,7 +2216,7 @@ bool ScUsedAreaIterator::GetNext() if ( bUseCell ) // Cell position { if (pCell) - maFoundCell.assign(*pCell); + maFoundCell = *pCell; else maFoundCell.clear(); diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 9a6c0fb..3dda38c1 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -752,7 +752,7 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe ScHorizontalCellIterator aIter( this, nTab, rSpellRange.aStart.Col(), nRow, rSpellRange.aEnd.Col(), rSpellRange.aEnd.Row() ); - ScBaseCell* pCell = aIter.GetNext( nCol, nRow ); + ScRefCellValue* pCell = aIter.GetNext( nCol, nRow ); // skip everything left of rSpellPos: while ( pCell && nRow == rSpellPos.Row() && nCol < rSpellPos.Col() ) pCell = aIter.GetNext( nCol, nRow ); @@ -763,7 +763,7 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe // Don't spell check within pivot tables. continue; - CellType eType = pCell->GetCellType(); + CellType eType = pCell->meType; if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT ) { if (!pEngine) @@ -796,11 +796,12 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe if ( eType == CELLTYPE_STRING ) { - rtl::OUString aText = static_cast<ScStringCell*>(pCell)->GetString(); - pEngine->SetText( aText ); + pEngine->SetText(*pCell->mpString); } + else if (pCell->mpEditText) + pEngine->SetText(*pCell->mpEditText); else - pEngine->SetText( *(static_cast<ScEditCell*>(pCell)->GetData() ) ); + pEngine->SetText(EMPTY_OUSTRING); aStatus.bModified = false; pEngine->CompleteOnlineSpelling(); @@ -815,12 +816,8 @@ bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe if ( bNeedEdit ) { - if ( eType == CELLTYPE_EDIT ) - // The cell will take ownership of pNewData. - static_cast<ScEditCell*>(pCell)->SetData(pEngine->CreateTextObject()); - else - // The cell will take ownership of pNewData. - SetEditText(ScAddress(nCol,nRow,nTab), pEngine->CreateTextObject()); + // The cell will take ownership of pNewData. + SetEditText(ScAddress(nCol,nRow,nTab), pEngine->CreateTextObject()); } else { diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index b87bb7b..b9e7517 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1818,7 +1818,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt ScHorizontalCellIterator aIter( &aDocument, nTab, nStartCol, nStartRow, nEndCol, nEndRow ); - ScBaseCell* pCell; + ScRefCellValue* pCell; while ( ( pCell = aIter.GetNext( nCol, nRow ) ) != NULL ) { bool bProgress = false; // only upon line change @@ -1877,7 +1877,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt else nNextCol = nCol + 1; - CellType eType = pCell->GetCellType(); + CellType eType = pCell->meType; ScAddress aPos(nCol, nRow, nTab); if ( bTabProtect ) { @@ -1902,15 +1902,15 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt sal_uInt16 nErrCode; if ( bShowFormulas ) { - ((ScFormulaCell*)pCell)->GetFormula( aString ); + pCell->mpFormula->GetFormula(aString); bString = true; } - else if ( ( nErrCode = ((ScFormulaCell*)pCell)->GetErrCode() ) != 0 ) + else if ((nErrCode = pCell->mpFormula->GetErrCode()) != 0) { aString = ScGlobal::GetErrorString( nErrCode ); bString = true; } - else if ( ((ScFormulaCell*)pCell)->IsValue() ) + else if (pCell->mpFormula->IsValue()) { sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos); if ( bFixedWidth || bSaveAsShown ) @@ -1921,9 +1921,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - ScRefCellValue aCell; - aCell.assign(*pCell); - ScCellFormat::GetInputString(aCell, nFormat, aString, rFormatter); + ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter); bString = false; } } @@ -1936,7 +1934,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); } else - aString = ((ScFormulaCell*)pCell)->GetString(); + aString = pCell->mpFormula->GetString(); bString = true; } } @@ -1949,12 +1947,12 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter); } else - aString = ((ScStringCell*)pCell)->GetString(); + aString = *pCell->mpString; bString = true; break; case CELLTYPE_EDIT : { - const EditTextObject* pObj = static_cast<const ScEditCell*>(pCell)->GetData(); + const EditTextObject* pObj = pCell->mpEditText; EditEngine& rEngine = aDocument.GetEditEngine(); rEngine.SetText( *pObj); aString = rEngine.GetText(); // including LF @@ -1973,9 +1971,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt } else { - ScRefCellValue aCell; - aCell.assign(*pCell); - ScCellFormat::GetInputString(aCell, nFormat, aString, rFormatter); + ScCellFormat::GetInputString(*pCell, nFormat, aString, rFormatter); bString = false; } } diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 2170b86..e9d5cc8 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -1081,7 +1081,7 @@ sal_uLong ScDocShell::DBaseExport( const rtl::OUString& rFullFileName, CharSet e const sal_Int32* pColLengths = aColLengths.getConstArray(); ScHorizontalCellIterator aIter( &aDocument, nTab, nFirstCol, nDocRow, nLastCol, nDocRow); - ScBaseCell* pCell = NULL; + ScRefCellValue* pCell = NULL; bool bTest = true; while (bTest && ((pCell = aIter.GetNext( nDocCol, nDocRow)) != NULL)) { @@ -1090,14 +1090,10 @@ sal_uLong ScDocShell::DBaseExport( const rtl::OUString& rFullFileName, CharSet e { case sdbc::DataType::LONGVARCHAR: { - if ( pCell->GetCellType() != CELLTYPE_NOTE ) + if (pCell->meType != CELLTYPE_NOTE) { - if ( pCell->GetCellType() == CELLTYPE_EDIT ) - { - ScRefCellValue aCell; - aCell.assign(*pCell); - lcl_getLongVarCharEditString(aString, aCell, aEditEngine); - } + if (pCell->meType == CELLTYPE_EDIT) + lcl_getLongVarCharEditString(aString, *pCell, aEditEngine); else lcl_getLongVarCharString( aString, aDocument, nDocCol, nDocRow, nTab, *pNumFmt); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits