diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2018-02-20 21:32:34 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-02-21 16:48:41 +0100 |
commit | f2d3192e8a4ae743fcaab27ab6d829d57ae8fb60 (patch) | |
tree | 3a304dbb36956f10a2a27d19f571e30aae0f0481 /sd | |
parent | 58f2da6af5e772bd01f75a00753a42cfd70af917 (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 'sd')
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 4933b87742f9..30971a584e49 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2374,6 +2374,12 @@ VclPtr<vcl::Window> SdXImpressDocument::getDocWindow() VclPtr<vcl::Window> pWindow; if (pViewShell) pWindow = pViewShell->GetActiveWindow(); + + LokChartHelper aChartHelper(pViewShell->GetViewShell()); + VclPtr<vcl::Window> pChartWindow = aChartHelper.GetWindow(); + if (pChartWindow) + pWindow = pChartWindow; + return pWindow; } @@ -2496,30 +2502,18 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - DrawViewShell* pViewShell = GetViewShell(); - if (!pViewShell) - return; - - vcl::Window* pWindow = pViewShell->GetActiveWindow(); + VclPtr<vcl::Window> pWindow = getDocWindow(); if (!pWindow) return; - LokChartHelper aChartHelper(pViewShell->GetViewShell()); - vcl::Window* pChartWindow = aChartHelper.GetWindow(); - if (pChartWindow) - { - pWindow = pChartWindow; - } - KeyEvent aEvent(nCharCode, nKeyCode, 0); - 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); |