summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/docuno.cxx
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2018-02-20 21:39:15 +0530
committerpranavk <pranavk@collabora.co.uk>2018-02-23 08:43:31 +0100
commit190a44fe052f034368e254d263fca21fc000d6ce (patch)
treed4eebf9d476d5a1263bf1056cad2e9bfd5de373b /sc/source/ui/unoobj/docuno.cxx
parentce43b10ccac41d352bcbf3a40e36360c3d0483c2 (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/50091 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/docuno.cxx')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx24
1 files changed, 10 insertions, 14 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b64645dfe667..cd56f7c5872e 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -552,10 +552,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;
}
@@ -597,24 +606,11 @@ 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: