diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-04-08 22:16:21 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-04-08 22:19:55 +0200 |
commit | 69b505553331480c0ab97e3776ba31ef11e649a3 (patch) | |
tree | 6c20f5981e464919ebde399273451ac075c21fb3 /sc | |
parent | 7e056939d9a7ff94f61bd1008ec3cdac5cecc0d5 (diff) |
sc tiled editing: Reuse the selection method.
Change-Id: I05175f0d8c37994658e0dcdf355a753bf7c840b8
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 15 |
3 files changed, 16 insertions, 22 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1df53bb5c960..f2d62cfbe539 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -622,14 +622,7 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY) Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY)); - if (!pTableView->GetOutputArea().IsInside(aPoint)) - { - // if the handle does not stay in the editeng area, we want to turn - // the selection into the cell selection - pViewShell->UpdateInputLine(); - pViewShell->UpdateInputHandler(); - } - else + if (pTableView->GetOutputArea().IsInside(aPoint)) { switch (nType) { diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b351c4ccac47..6c15dd163ff6 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1718,18 +1718,8 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta aCell.assign(*pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab)); if (aCell.isEmpty()) { - // stop editing - ScTabViewShell* pViewShell = pViewData->GetViewShell(); - pViewShell->UpdateInputLine(); - pViewShell->UpdateInputHandler(); - - // select the given cell - ScTabView* pTabView = pViewData->GetView(); - pTabView->SetCursor(nPosX, nPosY); - pTabView->DoneBlockMode(); - pTabView->InitBlockMode(nPosX, nPosY, nTab, true); - pTabView->MarkCursor(nPosX, nPosY, nTab); - pTabView->SelectionChanged(); + SetCellSelectionPixel(LOK_SETTEXTSELECTION_START, aPos.X(), aPos.Y()); + SetCellSelectionPixel(LOK_SETTEXTSELECTION_END, aPos.X(), aPos.Y()); return; } } diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index a14c04e447ac..e9d21852fc49 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1010,6 +1010,15 @@ void ScGridWindow::LogicInvalidate(const Rectangle* pRectangle) void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) { ScTabView* pTabView = pViewData->GetView(); + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell); + + if (pInputHandler && pInputHandler->IsInputMode()) + { + // we need to switch off the editeng + pViewShell->UpdateInputLine(); + pViewShell->UpdateInputHandler(); + } if (nType == LOK_SETTEXTSELECTION_RESET) { @@ -1024,10 +1033,12 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) SCROW nRow1, nRow2; SCTAB nTab1, nTab2; + bool bWasEmpty = false; if (aRangeList.empty()) { nCol1 = nCol2 = pViewData->GetCurX(); nRow1 = nRow2 = pViewData->GetCurY(); + bWasEmpty = true; } else aRangeList.Combine().GetVars(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); @@ -1042,7 +1053,7 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) switch (nType) { case LOK_SETTEXTSELECTION_START: - if (nNewPosX != nCol1 || nNewPosY != nRow1) + if (nNewPosX != nCol1 || nNewPosY != nRow1 || bWasEmpty) { pTabView->SetCursor(nNewPosX, nNewPosY); pTabView->DoneBlockMode(); @@ -1051,7 +1062,7 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) } break; case LOK_SETTEXTSELECTION_END: - if (nNewPosX != nCol2 || nNewPosY != nRow2) + if (nNewPosX != nCol2 || nNewPosY != nRow2 || bWasEmpty) { pTabView->SetCursor(nCol1, nRow1); pTabView->DoneBlockMode(); |