[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Nov 15 13:58:16 PST 2011
sc/inc/document.hxx | 2
sc/source/core/data/documen2.cxx | 1
sc/source/core/data/documen8.cxx | 2
sc/source/core/data/document.cxx | 16 +---
sc/source/core/tool/addinlis.cxx | 1
sc/source/core/tool/adiasync.cxx | 1
sc/source/ui/docshell/docsh3.cxx | 5 -
sc/source/ui/view/gridwin4.cxx | 3
sc/source/ui/view/tabview3.cxx | 152 +++++++++++++++++++--------------------
9 files changed, 86 insertions(+), 97 deletions(-)
New commits:
commit 3b1e88a8eb6b3f9da7c899a791e491db21d1bbdc
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Nov 15 16:55:49 2011 -0500
Reset formula cell's changed flag only for those within visible range.
Especially avoid marking all cells in all sheets which would cause a
performance problem.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index de903d0..02cc60d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -864,7 +864,7 @@ public:
const ::editeng::SvxBorderLine** ppRight,
const ::editeng::SvxBorderLine** ppBottom ) const;
- void ResetChanged( const ScRangeList& rRanges );
+ void ResetChanged( const ScRange& rRange );
void SetDirty();
void SetDirty( const ScRange& );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 223c505..5798f4d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -336,7 +336,6 @@ IMPL_LINK( ScDocument, TrackTimeHdl, Timer*, EMPTYARG )
{
TrackFormulas();
pShell->Broadcast( SfxSimpleHint( FID_DATACHANGED ) );
- ResetChanged( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB) );
// modified...
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 914cfef..1a439a7 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1056,7 +1056,6 @@ void ScDocument::UpdateExternalRefLinks(Window* pWin)
{
TrackFormulas();
pShell->Broadcast( SfxSimpleHint(FID_DATACHANGED) );
- ResetChanged( ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB) );
// #i101960# set document modified, as in TrackTimeHdl for DDE links
if (!pShell->IsModified())
@@ -1117,7 +1116,6 @@ void ScDocument::UpdateDdeLinks(Window* pWin)
// Formeln berechnen und painten wie im TrackTimeHdl
TrackFormulas();
pShell->Broadcast( SfxSimpleHint( FID_DATACHANGED ) );
- ResetChanged( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB) );
// wenn FID_DATACHANGED irgendwann mal asynchron werden sollte
// (z.B. mit Invalidate am Window), muss hier ein Update erzwungen werden.
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9f44829..40e85d7 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3504,18 +3504,14 @@ sal_uInt16 ScDocument::GetErrCode( const ScAddress& rPos ) const
}
-void ScDocument::ResetChanged( const ScRangeList& rRanges )
+void ScDocument::ResetChanged( const ScRange& rRange )
{
SCTAB nTabSize = static_cast<SCTAB>(maTabs.size());
- for (size_t i = 0, n = rRanges.size(); i < n; ++i)
- {
- const ScRange& rRange = *rRanges[i];
- SCTAB nTab1 = rRange.aStart.Tab();
- SCTAB nTab2 = rRange.aEnd.Tab();
- for (SCTAB nTab = nTab1; nTab1 <= nTab2 && nTab < nTabSize; ++nTab)
- if (maTabs[nTab])
- maTabs[nTab]->ResetChanged(rRange);
- }
+ SCTAB nTab1 = rRange.aStart.Tab();
+ SCTAB nTab2 = rRange.aEnd.Tab();
+ for (SCTAB nTab = nTab1; nTab1 <= nTab2 && nTab < nTabSize; ++nTab)
+ if (maTabs[nTab])
+ maTabs[nTab]->ResetChanged(rRange);
}
//
diff --git a/sc/source/core/tool/addinlis.cxx b/sc/source/core/tool/addinlis.cxx
index 267d006..292824a 100644
--- a/sc/source/core/tool/addinlis.cxx
+++ b/sc/source/core/tool/addinlis.cxx
@@ -135,7 +135,6 @@ void SAL_CALL ScAddInListener::modified( const ::com::sun::star::sheet::ResultEv
ScDocument* pDoc = (ScDocument*)*ppDoc;
pDoc->TrackFormulas();
pDoc->GetDocumentShell()->Broadcast( SfxSimpleHint( FID_DATACHANGED ) );
- pDoc->ResetChanged( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB) );
}
}
diff --git a/sc/source/core/tool/adiasync.cxx b/sc/source/core/tool/adiasync.cxx
index 341aee1..208305f 100644
--- a/sc/source/core/tool/adiasync.cxx
+++ b/sc/source/core/tool/adiasync.cxx
@@ -151,7 +151,6 @@ void ScAddInAsync::CallBack( sal_uLong nHandleP, void* pData )
ScDocument* pDoc = (ScDocument*)*ppDoc;
pDoc->TrackFormulas();
pDoc->GetDocumentShell()->Broadcast( SfxSimpleHint( FID_DATACHANGED ) );
- pDoc->ResetChanged( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB) );
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index b392c2d..b7a139f 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -105,8 +105,6 @@ void ScDocShell::PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddre
void ScDocShell::PostDataChanged()
{
Broadcast( SfxSimpleHint( FID_DATACHANGED ) );
- aDocument.ResetChanged( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB) );
-
SFX_APP()->Broadcast(SfxSimpleHint( FID_ANYDATACHANGED )); // Navigator
//! Navigator direkt benachrichtigen!
}
@@ -184,9 +182,6 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
}
Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart));
-
- if (nPart & PAINT_GRID)
- aDocument.ResetChanged(aPaintRanges);
}
void ScDocShell::PostPaintGridAll()
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 1db7cd9..1ee84cf 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -885,6 +885,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
--nPaintCount;
if (!nPaintCount)
CheckNeedsRepaint();
+
+ // Flag drawn formula cells "unchanged".
+ pDoc->ResetChanged(ScRange(nX1,nY1,nTab,nX2,nY2,nTab));
}
void ScGridWindow::CheckNeedsRepaint()
commit 5fc37762b68c9b94734b84546fce2309ff7bb2c0
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Nov 15 16:01:09 2011 -0500
Reduce scoping.
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index fdb0b92..b7f7ef8 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1841,7 +1841,6 @@ void ScTabView::UpdateFormulas()
void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
ScUpdateMode eMode )
{
- sal_uInt16 i;
SCCOL nCol1;
SCROW nRow1;
SCCOL nCol2;
@@ -1850,87 +1849,88 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
PutInOrder( nStartCol, nEndCol );
PutInOrder( nStartRow, nEndRow );
- for (i=0; i<4; i++)
- if (pGridWin[i])
- if (pGridWin[i]->IsVisible())
+ for (size_t i = 0; i < 4; ++i)
+ {
+ if (!pGridWin[i] || !pGridWin[i]->IsVisible())
+ continue;
+
+ ScHSplitPos eHWhich = WhichH( (ScSplitPos) i );
+ ScVSplitPos eVWhich = WhichV( (ScSplitPos) i );
+ bool bOut = false;
+
+ nCol1 = nStartCol;
+ nRow1 = nStartRow;
+ nCol2 = nEndCol;
+ nRow2 = nEndRow;
+
+ SCCOL nScrX = aViewData.GetPosX( eHWhich );
+ SCROW nScrY = aViewData.GetPosY( eVWhich );
+ if (nCol1 < nScrX) nCol1 = nScrX;
+ if (nCol2 < nScrX)
+ {
+ if ( eMode == SC_UPDATE_ALL ) // for UPDATE_ALL, paint anyway
+ nCol2 = nScrX; // (because of extending strings to the right)
+ else
+ bOut = true; // completely outside the window
+ }
+ if (nRow1 < nScrY) nRow1 = nScrY;
+ if (nRow2 < nScrY) bOut = true;
+
+ SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
+ SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
+ if (nCol1 > nLastX) bOut = true;
+ if (nCol2 > nLastX) nCol2 = nLastX;
+ if (nRow1 > nLastY) bOut = true;
+ if (nRow2 > nLastY) nRow2 = nLastY;
+
+ if (bOut)
+ continue;
+
+ if ( eMode == SC_UPDATE_CHANGED )
+ pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, eMode );
+ else // ALL oder MARKS
+ {
+ bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
+ long nLayoutSign = bLayoutRTL ? -1 : 1;
+
+ Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i );
+ Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i );
+ if ( eMode == SC_UPDATE_ALL )
+ aEnd.X() = bLayoutRTL ? 0 : (pGridWin[i]->GetOutputSizePixel().Width());
+ aEnd.X() -= nLayoutSign;
+ aEnd.Y() -= 1;
+
+ // #i85232# include area below cells (could be done in GetScrPos?)
+ if ( eMode == SC_UPDATE_ALL && nRow2 >= MAXROW )
+ aEnd.Y() = pGridWin[i]->GetOutputSizePixel().Height();
+
+ bool bShowChanges = true; //! ...
+ if (bShowChanges)
{
- ScHSplitPos eHWhich = WhichH( (ScSplitPos) i );
- ScVSplitPos eVWhich = WhichV( (ScSplitPos) i );
- bool bOut = false;
-
- nCol1 = nStartCol;
- nRow1 = nStartRow;
- nCol2 = nEndCol;
- nRow2 = nEndRow;
-
- SCCOL nScrX = aViewData.GetPosX( eHWhich );
- SCROW nScrY = aViewData.GetPosY( eVWhich );
- if (nCol1 < nScrX) nCol1 = nScrX;
- if (nCol2 < nScrX)
- {
- if ( eMode == SC_UPDATE_ALL ) // for UPDATE_ALL, paint anyway
- nCol2 = nScrX; // (because of extending strings to the right)
- else
- bOut = true; // completely outside the window
- }
- if (nRow1 < nScrY) nRow1 = nScrY;
- if (nRow2 < nScrY) bOut = true;
-
- SCCOL nLastX = nScrX + aViewData.VisibleCellsX( eHWhich ) + 1;
- SCROW nLastY = nScrY + aViewData.VisibleCellsY( eVWhich ) + 1;
- if (nCol1 > nLastX) bOut = true;
- if (nCol2 > nLastX) nCol2 = nLastX;
- if (nRow1 > nLastY) bOut = true;
- if (nRow2 > nLastY) nRow2 = nLastY;
+ aStart.X() -= nLayoutSign; // include change marks
+ aStart.Y() -= 1;
+ }
- if (!bOut)
+ bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS );
+ if (bMarkClipped)
+ {
+ // dazu muesste ScColumn::IsEmptyBlock optimiert werden
+ // (auf Search() umstellen)
+ //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty(
+ //! aViewData.GetTabNo(),
+ //! 0, nRow1, nCol1-1, nRow2 ) )
{
- if ( eMode == SC_UPDATE_CHANGED )
- pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, eMode );
- else // ALL oder MARKS
- {
- bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() );
- long nLayoutSign = bLayoutRTL ? -1 : 1;
-
- Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i );
- Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i );
- if ( eMode == SC_UPDATE_ALL )
- aEnd.X() = bLayoutRTL ? 0 : (pGridWin[i]->GetOutputSizePixel().Width());
- aEnd.X() -= nLayoutSign;
- aEnd.Y() -= 1;
-
- // #i85232# include area below cells (could be done in GetScrPos?)
- if ( eMode == SC_UPDATE_ALL && nRow2 >= MAXROW )
- aEnd.Y() = pGridWin[i]->GetOutputSizePixel().Height();
-
- bool bShowChanges = true; //! ...
- if (bShowChanges)
- {
- aStart.X() -= nLayoutSign; // include change marks
- aStart.Y() -= 1;
- }
-
- bool bMarkClipped = aViewData.GetOptions().GetOption( VOPT_CLIPMARKS );
- if (bMarkClipped)
- {
- // dazu muesste ScColumn::IsEmptyBlock optimiert werden
- // (auf Search() umstellen)
- //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty(
- //! aViewData.GetTabNo(),
- //! 0, nRow1, nCol1-1, nRow2 ) )
- {
- long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
- aStart.X() -= nMarkPixel * nLayoutSign;
- if (!bShowChanges)
- aStart.X() -= nLayoutSign; // cell grid
- }
- }
-
- pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( Rectangle( aStart,aEnd ) ) );
- }
+ long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() );
+ aStart.X() -= nMarkPixel * nLayoutSign;
+ if (!bShowChanges)
+ aStart.X() -= nLayoutSign; // cell grid
}
}
+ pGridWin[i]->Invalidate( pGridWin[i]->PixelToLogic( Rectangle( aStart,aEnd ) ) );
+ }
+ }
+
// #i79909# Calling UpdateAllOverlays here isn't necessary and would lead to overlay calls from a timer,
// with a wrong MapMode if editing in a cell (reference input).
// #i80499# Overlays need updates in a lot of cases, e.g. changing row/column size,
More information about the Libreoffice-commits
mailing list