summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-04-07 23:09:50 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-08 00:04:07 +0200
commit3a864cdb556a583ad4cec2bbeef9c7959d56dd91 (patch)
treecee952d30d09fca532ca970cd6d8f0ff0a970aad
parent25d3fd0b729423251b242b22e6a324983f0c6b39 (diff)
sc tiled editing: Allow turning the text selection into cell selection.
When moving the handle outside of the cell editeng, we want to turn the text selection into the cell selection. This patch includes work by Henry Castro - thanks! Change-Id: I081480b7d8b0fde8276f63c261d91bb9f2dc3b96
-rw-r--r--sc/source/ui/unoobj/docuno.cxx46
1 files changed, 31 insertions, 15 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e3ead3d7d19b..1df53bb5c960 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -612,6 +612,8 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
// update the aLogicMode in ScViewData to something predictable
pViewData->SetZoom(Fraction(1, 1), Fraction(1, 1), true);
+ bool bHandled = false;
+
if (pInputHandler && pInputHandler->IsInputMode())
{
// forwarding to editeng - we are editing the cell content
@@ -619,20 +621,32 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
assert(pTableView);
Point aPoint(convertTwipToMm100(nX), convertTwipToMm100(nY));
- switch (nType)
+
+ if (!pTableView->GetOutputArea().IsInside(aPoint))
{
- case LOK_SETTEXTSELECTION_START:
- pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
- break;
- case LOK_SETTEXTSELECTION_END:
- pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
- break;
- case LOK_SETTEXTSELECTION_RESET:
- pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
- break;
- default:
- assert(false);
- break;
+ // 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
+ {
+ switch (nType)
+ {
+ case LOK_SETTEXTSELECTION_START:
+ pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/false, /*bClearMark=*/false);
+ break;
+ case LOK_SETTEXTSELECTION_END:
+ pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/false);
+ break;
+ case LOK_SETTEXTSELECTION_RESET:
+ pTableView->SetCursorLogicPosition(aPoint, /*bPoint=*/true, /*bClearMark=*/true);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ bHandled = true;
}
}
else if (pDrawView && pDrawView->IsTextEdit())
@@ -657,10 +671,12 @@ void ScModelObj::setTextSelection(int nType, int nX, int nY)
assert(false);
break;
}
+ bHandled = true;
}
- else
+
+ if (!bHandled)
{
- // just updating the cell selection
+ // just update the cell selection
ScGridWindow* pGridWindow = pViewData->GetActiveWin();
if (!pGridWindow)
return;