[Libreoffice-commits] core.git: sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Thu Aug 29 13:13:38 PDT 2013
sc/source/ui/inc/gridwin.hxx | 3 ++-
sc/source/ui/inc/tabview.hxx | 2 +-
sc/source/ui/view/gridwin.cxx | 12 ++++++++++++
sc/source/ui/view/gridwin2.cxx | 7 ++-----
sc/source/ui/view/tabview.cxx | 8 ++++++--
sc/source/ui/view/tabview4.cxx | 8 ++++----
6 files changed, 27 insertions(+), 13 deletions(-)
New commits:
commit 8acb68bae5319836a8c0c9fa6ddfc907b0dd6c48
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Aug 29 16:11:56 2013 -0400
Check whether or not a visible range has changed.
Change-Id: I83581c8964ff43af1b1c42df82236274db446953
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index f32ea5e..1befc35 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -119,6 +119,7 @@ private:
VisibleRange();
bool isInside(SCCOL nCol, SCROW nRow) const;
+ bool set(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
};
VisibleRange maVisibleRange;
@@ -374,7 +375,7 @@ public:
void CheckNeedsRepaint();
void UpdateDPFromFieldPopupMenu();
- void UpdateVisibleRange();
+ bool UpdateVisibleRange();
void SetInRefMode( bool bRefMode );
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 9b971da..92a42ae 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -213,7 +213,7 @@ protected:
void ZoomChanged();
void UpdateShow();
- void UpdateVisibleRange();
+ bool UpdateVisibleRange();
void GetBorderSize( SvBorder& rBorder, const Size& rSize );
void ResetDrawDragMode();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index dc13e38..208318b 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -177,6 +177,18 @@ bool ScGridWindow::VisibleRange::isInside(SCCOL nCol, SCROW nRow) const
return mnCol1 <= nCol && nCol <= mnCol2 && mnRow1 <= nRow && nRow <= mnRow2;
}
+bool ScGridWindow::VisibleRange::set(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
+{
+ bool bChanged = mnCol1 != nCol1 || mnRow1 != nRow1 || mnCol2 != nCol2 || mnRow2 != nRow2;
+
+ mnCol1 = nCol1;
+ mnRow1 = nRow1;
+ mnCol2 = nCol2;
+ mnRow2 = nRow2;
+
+ return bChanged;
+}
+
// ============================================================================
class ScFilterListBox : public ListBox
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 554d737..71914da 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -594,7 +594,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu()
aFunc.UpdatePivotTable(*pDPObj, true, false);
}
-void ScGridWindow::UpdateVisibleRange()
+bool ScGridWindow::UpdateVisibleRange()
{
SCCOL nPosX = pViewData->GetPosX(eHWhich);
SCROW nPosY = pViewData->GetPosY(eVWhich);
@@ -604,10 +604,7 @@ void ScGridWindow::UpdateVisibleRange()
if (nYBottom > MAXROW) nYBottom = MAXROW;
// Store the current visible range.
- maVisibleRange.mnCol1 = nPosX;
- maVisibleRange.mnCol2 = nXRight;
- maVisibleRange.mnRow1 = nPosY;
- maVisibleRange.mnRow2 = nYBottom;
+ return maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
}
void ScGridWindow::DPMouseMove( const MouseEvent& rMEvt )
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 5a431dc..a83fba2 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1544,15 +1544,19 @@ void ScTabView::UpdateShow()
//! neue Gridwindows eintragen
}
-void ScTabView::UpdateVisibleRange()
+bool ScTabView::UpdateVisibleRange()
{
+ bool bChanged = false;
for (int i = 0; i < 4; ++i)
{
if (!pGridWin[i] || !pGridWin[i]->IsVisible())
continue;
- pGridWin[i]->UpdateVisibleRange();
+ if (pGridWin[i]->UpdateVisibleRange())
+ bChanged = true;
}
+
+ return bChanged;
}
// --- Splitter --------------------------------------------------------
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index e8f29a2..47fbc14 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -427,6 +427,9 @@ void ScTabView::UpdateScrollBars()
if ( aViewData.IsActive() )
{
+ if (UpdateVisibleRange())
+ SC_MOD()->AnythingChanged(); // if visible area has changed
+
ScSplitPos eActive = aViewData.GetActivePart();
ScHSplitPos eHWhich = WhichH( eActive );
ScVSplitPos eVWhich = WhichV( eActive );
@@ -437,10 +440,7 @@ void ScTabView::UpdateScrollBars()
if ( nEndX > MAXCOL ) nEndX = MAXCOL;
if ( nEndY > MAXROW ) nEndY = MAXROW;
ScRange aVisible( nPosX, nPosY, nTab, nEndX, nEndY, nTab );
- if ( pDoc->SetVisibleSpellRange( aVisible ) )
- SC_MOD()->AnythingChanged(); // if visible area has changed
-
- UpdateVisibleRange();
+ pDoc->SetVisibleSpellRange(aVisible);
}
}
More information about the Libreoffice-commits
mailing list