Kaydet (Commit) 99314cb0 authored tarafından Daniel Bankston's avatar Daniel Bankston Kaydeden (comit) Kohei Yoshida

Reduce some redundant code

Change-Id: I23bf34793c8a1409c8753f572a6122dee2f4128f
üst d880f3d3
......@@ -741,6 +741,19 @@ void ScXMLTableRowCellContext::SetCellRangeSource( const ScAddress& rPosition )
}
}
void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
{
if(pFCell)
{
if( bFormulaTextResult && pOUTextValue && !pOUTextValue->isEmpty() )
pFCell->SetHybridString( *pOUTextValue );
else
pFCell->SetHybridDouble( fValue );
if( !pFCell->GetCode()->IsRecalcModeAlways() )
pFCell->ResetDirty();
}
}
void ScXMLTableRowCellContext::AddTextCellToDoc( const ScAddress& rCurrentPos,
const SCCOL nCurrentCol, const ::boost::optional< rtl::OUString >& pOUText )
{
......@@ -795,12 +808,7 @@ void ScXMLTableRowCellContext::AddNumberCellToDoc( const ScAddress& rCurrentPos
if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA )
{
ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
if( bFormulaTextResult && pOUTextValue && !pOUTextValue->isEmpty() )
pFCell->SetHybridString( *pOUTextValue );
else
pFCell->SetHybridDouble( fValue );
if( !pFCell->GetCode()->IsRecalcModeAlways() )
pFCell->ResetDirty();
SetFormulaCell(pFCell);
}
}
else
......@@ -1027,12 +1035,7 @@ void ScXMLTableRowCellContext::AddNonMatrixFormulaCell( const ScAddress& rCellPo
delete pCode;
ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pNewCell);
if( bFormulaTextResult && pOUTextValue && !pOUTextValue->isEmpty() )
pFCell->SetHybridString( *pOUTextValue );
else
pFCell->SetHybridDouble( fValue );
if( !(pFCell->GetCode()->IsRecalcModeOnLoad() || !pFCell->GetCode()->IsRecalcModeOnLoadOnce()) )
pFCell->ResetDirty();
SetFormulaCell(pFCell);
}
else if ( aText[0] == '\'' && aText.getLength() > 1 )
{
......@@ -1078,15 +1081,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
//add the cached formula result of the first matrix position
ScFormulaCell* pFCell =
static_cast<ScFormulaCell*>( rXMLImport.GetDocument()->GetCell(rCellPos) );
if(pFCell)
{
if( bFormulaTextResult && pOUTextValue && !pOUTextValue->isEmpty() )
pFCell->SetHybridString( *pOUTextValue );
else
pFCell->SetHybridDouble( fValue );
if( !pFCell->GetCode()->IsRecalcModeAlways() )
pFCell->ResetDirty();
}
SetFormulaCell(pFCell);
}
}
else
......
......@@ -45,6 +45,7 @@
#include <boost/optional.hpp>
class ScXMLImport;
class ScFormulaCell;
struct ScXMLAnnotationData;
class ScXMLTableRowCellContext : public SvXMLImportContext
......@@ -90,6 +91,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
bool HasSpecialContent() const;
bool CellsAreRepeated() const;
void SetFormulaCell ( ScFormulaCell* pFCell ) const;
void AddTextCellToDoc ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
const ::boost::optional< rtl::OUString >& pOUText );
void AddNumberCellToDoc ( const ScAddress& rScCurrentPos );
......
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