summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-13 15:48:08 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-14 15:35:52 -0400
commit351536e40a6c822d95a87d851f5d3cce829e69a7 (patch)
treeaed4599bc4a5d461fc9fd481f29356cc12083bab
parentdf52ec007bb8e03be22caf5095ac214896ba2a73 (diff)
Reduce scope level.
Change-Id: I28db9130864ac3408398834bfbbdeb904ca4948e
-rw-r--r--sc/source/core/data/documen8.cxx192
1 files changed, 97 insertions, 95 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 9ac10a7f13fe..6b50d1268a21 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -549,131 +549,133 @@ bool ScDocument::IdleCalcTextWidth() // true = demnaechst wieder vers
ScStyleSheet* pStyle = (ScStyleSheet*)aScope.getStylePool()->Find(pTable->aPageStyle, SFX_STYLE_FAMILY_PAGE);
OSL_ENSURE( pStyle, "Missing StyleSheet :-/" );
- if (pStyle && 0 == getScaleValue(*pStyle, ATTR_PAGE_SCALETOPAGES))
+ if (!pStyle || getScaleValue(*pStyle, ATTR_PAGE_SCALETOPAGES) == 0)
{
- sal_uInt16 nRestart = 0;
- sal_uInt16 nCount = 0;
- ScBaseCell* pCell = NULL;
+ // Move to the next sheet as the current one has scale-to-pages set,
+ // and bail out.
+ aScope.incTab();
+ return false;
+ }
- sal_uInt16 nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
- Fraction aZoomFract( nZoom, 100 );
+ sal_uInt16 nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
+ Fraction aZoomFract(nZoom, 100);
- // Start at specified cell position (nCol, nRow, nTab).
- ScColumn* pColumn = &pTable->aCol[aScope.Col()];
- boost::scoped_ptr<ScColumnIterator> pColIter(
- new ScColumnIterator(pColumn, aScope.Row(), MAXROW));
+ // Start at specified cell position (nCol, nRow, nTab).
+ ScColumn* pColumn = &pTable->aCol[aScope.Col()];
+ boost::scoped_ptr<ScColumnIterator> pColIter(
+ new ScColumnIterator(pColumn, aScope.Row(), MAXROW));
- OutputDevice* pDev = NULL;
- while ( (nZoom > 0) && (nCount < CALCMAX) && (nRestart < 2) )
+ OutputDevice* pDev = NULL;
+ sal_uInt16 nRestart = 0;
+ sal_uInt16 nCount = 0;
+ while ( (nZoom > 0) && (nCount < CALCMAX) && (nRestart < 2) )
+ {
+ SCROW nRow;
+ ScBaseCell* pCell = NULL;
+ if ( pColIter->Next(nRow, pCell) )
{
- SCROW nRow;
- if ( pColIter->Next(nRow, pCell) )
- {
- // More cell in this column.
- aScope.setRow(nRow);
+ // More cell in this column.
+ aScope.setRow(nRow);
- if ( TEXTWIDTH_DIRTY == pCell->GetTextWidth() )
+ if ( TEXTWIDTH_DIRTY == pCell->GetTextWidth() )
+ {
+ // Calculate text width for this cell.
+ double nPPTX = 0.0;
+ double nPPTY = 0.0;
+ if ( !pDev )
{
- // Calculate text width for this cell.
- double nPPTX = 0.0;
- double nPPTY = 0.0;
- if ( !pDev )
- {
- pDev = GetPrinter();
- aScope.setOldMapMode(pDev->GetMapMode());
- pDev->SetMapMode( MAP_PIXEL ); // wichtig fuer GetNeededSize
+ pDev = GetPrinter();
+ aScope.setOldMapMode(pDev->GetMapMode());
+ pDev->SetMapMode( MAP_PIXEL ); // wichtig fuer GetNeededSize
- Point aPix1000 = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
- nPPTX = aPix1000.X() / 1000.0;
- nPPTY = aPix1000.Y() / 1000.0;
- }
+ Point aPix1000 = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
+ nPPTX = aPix1000.X() / 1000.0;
+ nPPTY = aPix1000.Y() / 1000.0;
+ }
- if (!aScope.hasProgressBar() && pCell->GetCellType() == CELLTYPE_FORMULA
- && ((ScFormulaCell*)pCell)->GetDirty())
- {
- aScope.createProgressBar();
- }
+ if (!aScope.hasProgressBar() && pCell->GetCellType() == CELLTYPE_FORMULA
+ && ((ScFormulaCell*)pCell)->GetDirty())
+ {
+ aScope.createProgressBar();
+ }
- sal_uInt16 nNewWidth = (sal_uInt16)GetNeededSize(
- aScope.Col(), aScope.Row(), aScope.Tab(),
- pDev, nPPTX, nPPTY, aZoomFract,aZoomFract, true, true); // bTotalSize
+ sal_uInt16 nNewWidth = (sal_uInt16)GetNeededSize(
+ aScope.Col(), aScope.Row(), aScope.Tab(),
+ pDev, nPPTX, nPPTY, aZoomFract,aZoomFract, true, true); // bTotalSize
- pCell->SetTextWidth( nNewWidth );
- aScope.setNeedMore(true);
- }
+ pCell->SetTextWidth( nNewWidth );
+ aScope.setNeedMore(true);
}
- else
- {
- // No more cell in this column. Move to the left column and start at row 0.
+ }
+ else
+ {
+ // No more cell in this column. Move to the left column and start at row 0.
- bool bNewTab = false;
+ bool bNewTab = false;
- aScope.setRow(0);
- aScope.incCol(-1);
+ aScope.setRow(0);
+ aScope.incCol(-1);
- if (aScope.Col() < 0)
- {
- // No more column to the left. Move to the right-most column of the next sheet.
- aScope.setCol(MAXCOL);
- aScope.incTab();
- bNewTab = true;
- }
+ if (aScope.Col() < 0)
+ {
+ // No more column to the left. Move to the right-most column of the next sheet.
+ aScope.setCol(MAXCOL);
+ aScope.incTab();
+ bNewTab = true;
+ }
- if (!ValidTab(aScope.Tab()) || aScope.Tab() >= static_cast<SCTAB>(maTabs.size()) || !maTabs[aScope.Tab()] )
- {
- // Sheet doesn't exist at specified sheet position. Restart at sheet 0.
- aScope.setTab(0);
- nRestart++;
- bNewTab = true;
- }
+ if (!ValidTab(aScope.Tab()) || aScope.Tab() >= static_cast<SCTAB>(maTabs.size()) || !maTabs[aScope.Tab()] )
+ {
+ // Sheet doesn't exist at specified sheet position. Restart at sheet 0.
+ aScope.setTab(0);
+ nRestart++;
+ bNewTab = true;
+ }
- if ( nRestart < 2 )
+ if ( nRestart < 2 )
+ {
+ if ( bNewTab )
{
- if ( bNewTab )
- {
- pTable = maTabs[aScope.Tab()];
- pStyle = (ScStyleSheet*)aScope.getStylePool()->Find(
- pTable->aPageStyle, SFX_STYLE_FAMILY_PAGE);
+ pTable = maTabs[aScope.Tab()];
+ pStyle = (ScStyleSheet*)aScope.getStylePool()->Find(
+ pTable->aPageStyle, SFX_STYLE_FAMILY_PAGE);
- if ( pStyle )
+ if ( pStyle )
+ {
+ // Check if the scale-to-pages setting is set. If
+ // set, we exit the loop. If not, get the page
+ // scale factor of the new sheet.
+ if (getScaleValue(*pStyle, ATTR_PAGE_SCALETOPAGES) == 0)
{
- // Check if the scale-to-pages setting is set. If
- // set, we exit the loop. If not, get the page
- // scale factor of the new sheet.
- if (getScaleValue(*pStyle, ATTR_PAGE_SCALETOPAGES) == 0)
- {
- nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
- aZoomFract = Fraction(nZoom, 100);
- }
- else
- nZoom = 0;
+ nZoom = getScaleValue(*pStyle, ATTR_PAGE_SCALE);
+ aZoomFract = Fraction(nZoom, 100);
}
else
- {
- OSL_FAIL( "Missing StyleSheet :-/" );
- }
+ nZoom = 0;
}
-
- if ( nZoom > 0 )
+ else
{
- pColumn = &pTable->aCol[aScope.Col()];
- pColIter.reset(new ScColumnIterator(pColumn, aScope.Row(), MAXROW));
+ OSL_FAIL( "Missing StyleSheet :-/" );
}
- else
- aScope.incTab(); // Move to the next sheet as the current one has scale-to-pages set.
}
+
+ if ( nZoom > 0 )
+ {
+ pColumn = &pTable->aCol[aScope.Col()];
+ pColIter.reset(new ScColumnIterator(pColumn, aScope.Row(), MAXROW));
+ }
+ else
+ aScope.incTab(); // Move to the next sheet as the current one has scale-to-pages set.
}
+ }
- nCount++;
+ nCount++;
- // Quit if either 1) its duration exceeds 50 ms, or 2) there is
- // any pending event after processing 32 cells.
- if ((50L < Time::GetSystemTicks() - aScope.getStartTime()) || (nCount > 31 && Application::AnyInput(ABORT_EVENTS)))
- nCount = CALCMAX;
- }
+ // Quit if either 1) its duration exceeds 50 ms, or 2) there is any
+ // pending event after processing 32 cells.
+ if ((50L < Time::GetSystemTicks() - aScope.getStartTime()) || (nCount > 31 && Application::AnyInput(ABORT_EVENTS)))
+ nCount = CALCMAX;
}
- else
- aScope.incTab(); // Move to the next sheet as the current one has scale-to-pages set.
return aScope.getNeedMore();
}