From 190a44fe052f034368e254d263fca21fc000d6ce Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Tue, 20 Feb 2018 21:39:15 +0530 Subject: 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/50091 Tested-by: Jenkins Reviewed-by: pranavk --- sd/source/ui/unoidl/unomodel.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 2ff6f93c0680..3dc5e2839c74 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2344,6 +2344,12 @@ VclPtr SdXImpressDocument::getDocWindow() VclPtr pWindow; if (pViewShell) pWindow = pViewShell->GetActiveWindow(); + + LokChartHelper aChartHelper(pViewShell->GetViewShell()); + VclPtr pChartWindow = aChartHelper.GetWindow(); + if (pChartWindow) + pWindow = pChartWindow; + return pWindow; } @@ -2466,23 +2472,11 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - DrawViewShell* pViewShell = GetViewShell(); - if (!pViewShell) - return; - - vcl::Window* pWindow = pViewShell->GetActiveWindow(); + VclPtr 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: -- cgit