Kaydet (Commit) 4481e3b2 authored tarafından Henry Castro's avatar Henry Castro Kaydeden (comit) Jan Holesovsky

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
üst dc2ddf00
......@@ -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());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment