summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2015-05-29 11:53:50 -0400
committerHenry Castro <hcastro@collabora.com>2015-05-29 11:53:50 -0400
commitcd2e7b7e4e46cb298c50fe8d8b512b1b36b3e197 (patch)
tree414a0016f5a902dfa55c0eb49e59a1aef9d6f4ef /sc
parentbec67f339b9b000628e2b82e2b38cd1cae37f94a (diff)
sc: SvxSearchItem, m_nStartPoint{X,Y}
The idea is that if you have your cursor at the begining of a Calc document, and you scroll down a lot, then search, then it's annoying that search jumps back to the start of the document for the first hit. Add an optional way to provide what is the starting point of such a search, so we can have "when nothing is selected, then search from the top left corner of the visible area". Change-Id: I22624dd52a093759d46541e003d838aeb0db943f
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/viewfun2.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 49d70d8b6aff..47b0ace1ccef 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1640,6 +1640,23 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if (bAddUndo && !rDoc.IsUndoEnabled())
bAddUndo = false;
+ if ( !rMark.IsMarked() && !rMark.IsMultiMarked() && (pSearchItem->HasStartPoint()) )
+ {
+ // No selection -> but we have a start point (top left corner of the
+ // current view), start searching from there, not from the current
+ // cursor position.
+ SCsCOL nPosX;
+ SCsROW nPosY;
+
+ int nPixelX = pSearchItem->GetStartPointX() * GetViewData().GetPPTX();
+ int nPixelY = pSearchItem->GetStartPointY() * GetViewData().GetPPTY();
+
+ GetViewData().GetPosFromPixel(nPixelX, nPixelY, GetViewData().GetActivePart(), nPosX, nPosY);
+
+ AlignToCursor( nPosX, nPosY, SC_FOLLOW_JUMP );
+ SetCursor( nPosX, nPosY, true );
+ }
+
SCCOL nCol, nOldCol;
SCROW nRow, nOldRow;
SCTAB nTab, nOldTab;
@@ -1829,9 +1846,9 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if (pGridWindow)
{
// move the cell selection handles
+ pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_RESET, aCurPos.X(), aCurPos.Y());
pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_START, aCurPos.X(), aCurPos.Y());
pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_END, aCurPos.X(), aCurPos.Y());
- pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_RESET, aCurPos.X(), aCurPos.Y());
}
}