summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-11-30 00:54:06 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-11-30 00:54:06 -0500
commit04608abcf80b8182509a9fc8b5f0d8088c47e045 (patch)
tree55f45cbe2b17e9f27940135608e5f5537eb0bed3 /sc
parent9938610417b58421ec07386406e0604815c77eaa (diff)
Skip hidden cells while expanding range selection.
This commit happily fixes fdo#31796.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/tabview.hxx4
-rw-r--r--sc/source/ui/view/tabview2.cxx34
-rw-r--r--sc/source/ui/view/tabview3.cxx4
3 files changed, 36 insertions, 6 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index b53b3d70c..e459c9339 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -201,8 +201,8 @@ private:
void GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
SCsCOL& rAreaX, SCsROW& rAreaY, ScFollowMode& rMode);
- void SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nOldY, SCsROW nMovX);
- void SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nOldY, SCsROW nMovY);
+ void SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nMovX);
+ void SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, SCsROW nMovY);
protected:
void UpdateHeaderWidth( const ScVSplitPos* pWhich = NULL,
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index d875ca771..a42cb4667 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -504,7 +504,7 @@ void ScTabView::GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode
rMode = eMode;
}
-void ScTabView::SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nOldY, SCsROW nMovX)
+void ScTabView::SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nMovX)
{
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
@@ -564,7 +564,7 @@ void ScTabView::SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX,
}
}
-void ScTabView::SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, SCsROW nOldY, SCsROW nMovY)
+void ScTabView::SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, SCsROW nMovY)
{
ScDocument* pDoc = aViewData.GetDocument();
SCTAB nTab = aViewData.GetTabNo();
@@ -640,6 +640,32 @@ bool lcl_isCellQualified(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, b
return true;
}
+void skipHiddenRows(ScDocument* pDoc, SCTAB nTab, SCROW& rRow, bool bForward)
+{
+ SCROW nFirst, nLast;
+ if (!pDoc->RowHidden(rRow, nTab, &nFirst, &nLast))
+ // This row is visible. Nothing to do.
+ return;
+
+ if (bForward)
+ rRow = nLast < MAXROW ? nLast + 1 : MAXROW;
+ else
+ rRow = nFirst > 0 ? nFirst - 1 : 0;
+}
+
+void skipHiddenCols(ScDocument* pDoc, SCTAB nTab, SCCOL& rCol, bool bForward)
+{
+ SCCOL nFirst, nLast;
+ if (!pDoc->ColHidden(rCol, nTab, &nFirst, &nLast))
+ // This row is visible. Nothing to do.
+ return;
+
+ if (bForward)
+ rCol = nLast < MAXCOL ? nLast + 1 : MAXCOL;
+ else
+ rCol = nFirst > 0 ? nFirst - 1 : 0;
+}
+
void lcl_moveCursorByProtRule(
SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY, SCTAB nTab, ScDocument* pDoc)
{
@@ -661,6 +687,7 @@ void lcl_moveCursorByProtRule(
if (!lcl_isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked))
break;
++rCol;
+ skipHiddenCols(pDoc, nTab, rCol, true);
}
}
}
@@ -674,6 +701,7 @@ void lcl_moveCursorByProtRule(
if (!lcl_isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked))
break;
--rCol;
+ skipHiddenCols(pDoc, nTab, rCol, false);
}
}
}
@@ -687,6 +715,7 @@ void lcl_moveCursorByProtRule(
if (!lcl_isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked))
break;
++rRow;
+ skipHiddenRows(pDoc, nTab, rRow, true);
}
}
}
@@ -700,6 +729,7 @@ void lcl_moveCursorByProtRule(
if (!lcl_isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked))
break;
--rRow;
+ skipHiddenRows(pDoc, nTab, rRow, false);
}
}
}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 8ca62798c..d5a6f41f4 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -984,10 +984,10 @@ void ScTabView::MoveCursorRel( SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode,
aViewData.ResetOldCursor();
if (nMovX != 0 && VALIDCOLROW(nCurX,nCurY))
- SkipCursorHorizontal(nCurX, nCurY, nOldX, nOldY, nMovX);
+ SkipCursorHorizontal(nCurX, nCurY, nOldX, nMovX);
if (nMovY != 0 && VALIDCOLROW(nCurX,nCurY))
- SkipCursorVertical(nCurX, nCurY, nOldX, nOldY, nMovY);
+ SkipCursorVertical(nCurX, nCurY, nOldY, nMovY);
MoveCursorAbs( nCurX, nCurY, eMode, bShift, FALSE, TRUE, bKeepSel );
}