Kaydet (Commit) 942589b4 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

More on killing direct use of ScEditCell (and some of ScBaseCell).

Change-Id: I65d530333213f8b3db38a269e74a0beabcd1ff89
üst 47924382
......@@ -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;
......
......@@ -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();
......
......@@ -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
{
......
......@@ -1820,7 +1820,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
......@@ -1879,7 +1879,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 )
{
......@@ -1904,15 +1904,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 )
......@@ -1923,9 +1923,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;
}
}
......@@ -1938,7 +1936,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;
}
}
......@@ -1951,12 +1949,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
......@@ -1975,9 +1973,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;
}
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment