From a9a7f2501228e0f47085d937fc3727f1a452249f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 22 Mar 2013 20:54:13 -0400 Subject: More on ScCellIterator usage conversion... Still not done. Change-Id: I5023a57f3a089f1af7cd7fe53f57f82c60eb2b65 --- sc/source/ui/unoobj/funcuno.cxx | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'sc/source/ui/unoobj') diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 776f946ce164..40fa41c17a41 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -175,27 +175,25 @@ static sal_Bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, // If the range contains formula cells with default number format, // apply a number format for the formula result ScCellIterator aIter( pClipDoc, rSrcRange ); - ScBaseCell* pCell = aIter.GetFirst(); - while (pCell) + for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { - if (pCell->GetCellType() == CELLTYPE_FORMULA) + if (aIter.getType() != CELLTYPE_FORMULA) + continue; + + ScAddress aCellPos = aIter.GetPos(); + sal_uInt32 nFormat = pClipDoc->GetNumberFormat(aCellPos); + if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) { - ScAddress aCellPos = aIter.GetPos(); - sal_uInt32 nFormat = pClipDoc->GetNumberFormat(aCellPos); - if ( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) + ScFormulaCell* pFCell = aIter.getFormulaCell(); + sal_uInt16 nErrCode = pFCell->GetErrCode(); + if ( nErrCode == 0 && pFCell->IsValue() ) { - ScFormulaCell* pFCell = static_cast(pCell); - sal_uInt16 nErrCode = pFCell->GetErrCode(); - if ( nErrCode == 0 && pFCell->IsValue() ) - { - sal_uInt32 nNewFormat = pFCell->GetStandardFormat( *pClipDoc->GetFormatTable(), nFormat ); - if ( nNewFormat != nFormat ) - pClipDoc->ApplyAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), - SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) ); - } + sal_uInt32 nNewFormat = pFCell->GetStandardFormat( *pClipDoc->GetFormatTable(), nFormat ); + if ( nNewFormat != nFormat ) + pClipDoc->ApplyAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), + SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) ); } } - pCell = aIter.GetNext(); } ScMarkData aDestMark; -- cgit