summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2018-02-20 21:32:34 +0530
committerJan Holesovsky <kendy@collabora.com>2018-02-21 16:48:41 +0100
commitf2d3192e8a4ae743fcaab27ab6d829d57ae8fb60 (patch)
tree3a304dbb36956f10a2a27d19f571e30aae0f0481 /sc
parent58f2da6af5e772bd01f75a00753a42cfd70af917 (diff)
lok: Factor out the code for finding vcl::Window of a document
This should also help with IME input on charts Change-Id: Ie513790a5d0c87397c39301a328a44b59d394a45 Reviewed-on: https://gerrit.libreoffice.org/50094 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx28
1 files changed, 12 insertions, 16 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 63a7b757bf9a..7df255a31ebd 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -549,10 +549,19 @@ OUString ScModelObj::getPartHash( int nPart )
VclPtr<vcl::Window> ScModelObj::getDocWindow()
{
SolarMutexGuard aGuard;
+
+ // There seems to be no clear way of getting the grid window for this
+ // particular document, hence we need to hope we get the right window.
ScViewData* pViewData = ScDocShell::GetViewData();
VclPtr<vcl::Window> pWindow;
if (pViewData)
pWindow = pViewData->GetActiveWin();
+
+ LokChartHelper aChartHelper(pViewData->GetViewShell());
+ vcl::Window* pChartWindow = aChartHelper.GetWindow();
+ if (pChartWindow)
+ pWindow = pChartWindow;
+
return pWindow;
}
@@ -594,31 +603,18 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
- // There seems to be no clear way of getting the grid window for this
- // particular document, hence we need to hope we get the right window.
- ScViewData* pViewData = ScDocShell::GetViewData();
- vcl::Window* pWindow = pViewData->GetActiveWin();
-
+ VclPtr<vcl::Window> pWindow = getDocWindow();
if (!pWindow)
return;
KeyEvent aEvent(nCharCode, nKeyCode, 0);
-
- ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
- LokChartHelper aChartHelper(pTabViewShell);
- vcl::Window* pChartWindow = aChartHelper.GetWindow();
- if (pChartWindow)
- {
- pWindow = pChartWindow;
- }
-
switch (nType)
{
case LOK_KEYEVENT_KEYINPUT:
- pWindow->KeyInput(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, &aEvent);
break;
case LOK_KEYEVENT_KEYUP:
- pWindow->KeyUp(aEvent);
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, &aEvent);
break;
default:
assert(false);