diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-01 14:41:51 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-01 16:30:04 -0400 |
commit | b10833d4db6046f2d32ea44a60cb19a626d80447 (patch) | |
tree | b042decf3f1dbec270bf9c2758564da1aa1c3f05 /sc/source | |
parent | cf0a88962f5c7835d417fb272e4792fb921139af (diff) |
No more "increase / decrease of recalc level" for drawing objects.
That scheme made it extremely hard to determine when the object's
positions get recalculated. It's better to figure out when to recalc
drawing objects' positions, and call SetDrawPageSize() manually at
that point (and only once!)
Change-Id: I05d9b693cfc9310f5472ed8287c7a2e36646f4d7
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/documen3.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 35 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 12 | ||||
-rw-r--r-- | sc/source/filter/excel/colrowst.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/docshell/olinefun.cxx | 15 |
7 files changed, 6 insertions, 92 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 54ce14f3a329..600bf607a42d 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2088,16 +2088,4 @@ void ScDocument::ExtendPrintArea( OutputDevice* pDev, SCTAB nTab, maTabs[nTab]->ExtendPrintArea( pDev, nStartCol, nStartRow, rEndCol, nEndRow ); } -void ScDocument::IncSizeRecalcLevel( SCTAB nTab ) -{ - if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - maTabs[nTab]->IncRecalcLevel(); -} - -void ScDocument::DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos ) -{ - if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - maTabs[nTab]->DecRecalcLevel( bUpdateNoteCaptionPos ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index c8773db2e29e..56a574ba092e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2411,7 +2411,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar if ( *itr < aCBFCP.nTabStart ) aCBFCP.nTabStart = *itr; aCBFCP.nTabEnd = *itr; - maTabs[*itr]->IncRecalcLevel(); } ScRangeList aLocalRangeList; @@ -2484,9 +2483,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar } itr = rMark.begin(); - for (; itr != itrEnd && *itr < nMax; ++itr) - if (maTabs[*itr] ) - maTabs[*itr]->DecRecalcLevel(); bInsertingFromOtherDoc = false; @@ -2554,7 +2550,6 @@ void ScDocument::CopyMultiRangeFromClip( if ( *itr < aCBFCP.nTabStart ) aCBFCP.nTabStart = *itr; aCBFCP.nTabEnd = *itr; - maTabs[*itr]->IncRecalcLevel(); } } @@ -2618,9 +2613,6 @@ void ScDocument::CopyMultiRangeFromClip( } itr = rMark.begin(); - for (; itr != itrEnd && *itr < nMax; ++itr) - if (maTabs[*itr]) - maTabs[*itr]->DecRecalcLevel(); bInsertingFromOtherDoc = false; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 6d61bd7b4b23..4da2595f7e16 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -160,12 +160,10 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase } }; -bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab, +bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj, ScBitMaskCompressedArray<SCROW, sal_uInt8>* pRowFlags, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra, const vector<sal_uInt16>& aHeights, bool bForce) { - pTab->IncRecalcLevel(); // #i116460# avoid problems with Excel files - SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1); bool bChanged = false; SCROW nRngStart = 0; @@ -222,8 +220,6 @@ bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab if (nLast) bChanged |= rFuncObj(nRngStart, nRngEnd, nLast); - pTab->DecRecalcLevel(); // #i116460# avoid problems with Excel files - return bChanged; } @@ -253,7 +249,6 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName pOutlineTable( NULL ), pSheetEvents( NULL ), nTab( nNewTab ), - nRecalcLvl( 0 ), pDocument( pDoc ), pSearchText ( NULL ), pSortCollator( NULL ), @@ -485,7 +480,7 @@ bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtr SetRowHeightRangeFunc aFunc(this, nPPTX, nPPTY); bool bChanged = SetOptimalHeightsToRows( - aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); + aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); if ( pProgress != pOuterProgress ) delete pProgress; @@ -516,7 +511,7 @@ void ScTable::SetOptimalHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n SetRowHeightOnlyFunc aFunc(this); SetOptimalHeightsToRows( - aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); + aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); if ( pProgress != pOuterProgress ) delete pProgress; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 2a51d544d31b..193e7f086e05 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -134,8 +134,6 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) cons void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { if (mpRowHeights && pRowFlags) @@ -201,8 +199,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE aNotes.ReleaseNote( nCol, nRow); } - DecRecalcLevel( false ); - InvalidatePageBreaks(); if (IsStreamValid()) @@ -215,8 +211,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, bool* pUndoOutline ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { if (pRowFlags) @@ -291,7 +285,6 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE for (SCCOL j=nStartCol; j<=nEndCol; j++) aCol[j].DeleteRow( nStartRow, nSize ); } - DecRecalcLevel(); InvalidatePageBreaks(); @@ -321,8 +314,6 @@ bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) cons void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { if (pColWidth && pColFlags) @@ -411,7 +402,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aCol[nStartCol+i].ClearItems( nStartRow, nEndRow, nWhichArray ); } } - DecRecalcLevel(); InvalidatePageBreaks(); @@ -425,8 +415,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { if (pColWidth && pColFlags) @@ -510,8 +498,6 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aNotes.ReleaseNote( nCol, nRow); } - DecRecalcLevel(); - InvalidatePageBreaks(); if (IsStreamValid()) @@ -736,7 +722,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { - IncRecalcLevel(); for ( SCCOL i = nCol1; i <= nCol2; i++) aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]); @@ -783,7 +768,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, // create deep copies for conditional formatting CopyConditionalFormat( nCol1, nRow1, nCol2, nRow2, nDx, nDy, pTable); } - DecRecalcLevel(); } } @@ -1026,8 +1010,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bWidth || bHeight) { - pDestTab->IncRecalcLevel(); - if (bWidth) { for (SCCOL i = nCol1; i <= nCol2; ++i) @@ -1092,7 +1074,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } pDestTab->SetRowManualBreaks( maRowManualBreaks); } - pDestTab->DecRecalcLevel(); } if (bFlagChange) @@ -1111,9 +1092,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth); bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pDestTab->mpRowHeights); - if (bWidth||bHeight) - IncRecalcLevel(); - for ( SCCOL i = 0; i <= MAXCOL; i++) { if ( i >= nCol1 && i <= nCol2 ) @@ -1147,7 +1125,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0); pDestTab->SetRowManualBreaks( maRowManualBreaks); } - DecRecalcLevel(); } } } @@ -2408,11 +2385,7 @@ void ScTable::SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth ) if ( nNewWidth != pColWidth[nCol] ) { - IncRecalcLevel(); - InitializeNoteCaptions(); pColWidth[nCol] = nNewWidth; - DecRecalcLevel(); - InvalidatePageBreaks(); } } @@ -2786,11 +2759,7 @@ void ScTable::ShowCol(SCCOL nCol, bool bShow) bool bWasVis = !ColHidden(nCol); if (bWasVis != bShow) { - IncRecalcLevel(); - InitializeNoteCaptions(); - SetColHidden(nCol, nCol, !bShow); - DecRecalcLevel(); ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) @@ -2891,8 +2860,6 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow) void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) { SCROW nStartRow = nRow1; - IncRecalcLevel(); - InitializeNoteCaptions(); // #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); @@ -2930,8 +2897,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) if (bShow) SetRowFiltered(nRow1, nRow2, false); } - - DecRecalcLevel(); } bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 8058e0a8d3c9..d84fe1fc552d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2306,16 +2306,4 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData, aCol[nCol].UpdateAreaFunction( rData, *mpHiddenRows, nStartRow, nEndRow ); } -void ScTable::IncRecalcLevel() -{ - ++nRecalcLvl; -} - -void ScTable::DecRecalcLevel(bool bUpdateNoteCaptionPos) -{ - if (!--nRecalcLvl) - SetDrawPageSize(true, bUpdateNoteCaptionPos); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 2b4dc058b162..f77779fb22ec 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -204,7 +204,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) return; ScDocument& rDoc = GetDoc(); - rDoc.IncSizeRecalcLevel( nScTab ); // column widths ---------------------------------------------------------- @@ -288,13 +287,11 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) // ------------------------------------------------------------------------ mbDirty = false; - rDoc.DecSizeRecalcLevel( nScTab ); } void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) { ScDocument& rDoc = GetDoc(); - rDoc.IncSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows // hide the columns for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol ) @@ -355,8 +352,6 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // #i47438# if default row format is hidden, hide remaining rows if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) ) rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false ); - - rDoc.DecSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx index 667daf3c14fc..aa032110ef8f 100644 --- a/sc/source/ui/docshell/olinefun.cxx +++ b/sc/source/ui/docshell/olinefun.cxx @@ -383,8 +383,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); ScSubOutlineIterator aIter( pArray ); // alle Eintraege ScOutlineEntry* pEntry; @@ -426,7 +424,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 } } - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); @@ -481,7 +478,7 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, sal_True ) ); } - pDoc->IncSizeRecalcLevel( nTab ); + pDoc->InitializeNoteCaptions(nTab); // Spalten @@ -534,7 +531,6 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b i = nFilterEnd; } - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); @@ -601,7 +597,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, false ) ); } - pDoc->IncSizeRecalcLevel( nTab ); + pDoc->InitializeNoteCaptions(nTab); // Spalten @@ -629,7 +625,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b HideOutline( nTab, false, nRowLevel, i, false, false, bApi ); } - pDoc->DecSizeRecalcLevel( nTab ); + pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP ); @@ -680,8 +676,6 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel, nEntry, sal_True ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); pEntry->SetHidden(false); SCCOLROW i; @@ -767,8 +761,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel, nEntry, false ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); pEntry->SetHidden(true); SCCOLROW i; @@ -780,7 +772,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 pArray->SetVisibleBelow( nLevel, nEntry, false ); - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->InvalidatePageBreaks(nTab); pDoc->UpdatePageBreaks( nTab ); |