[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/source sd/source sw/source
Pranav Kant
pranavk at collabora.co.uk
Wed Feb 21 15:49:05 UTC 2018
sc/source/ui/unoobj/docuno.cxx | 28 ++++++++++++----------------
sd/source/ui/unoidl/unomodel.cxx | 24 +++++++++---------------
sw/source/uibase/uno/unotxdoc.cxx | 23 +++++++++++------------
3 files changed, 32 insertions(+), 43 deletions(-)
New commits:
commit f2d3192e8a4ae743fcaab27ab6d829d57ae8fb60
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Feb 20 21:32:34 2018 +0530
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 at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
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);
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);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 43101853987a..103ae13f9111 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3409,6 +3409,12 @@ VclPtr<vcl::Window> SwXTextDocument::getDocWindow()
SwView* pView = pDocShell->GetView();
if (pView)
pWindow = &(pView->GetEditWin());
+
+ LokChartHelper aChartHelper(pView);
+ VclPtr<vcl::Window> pChartWindow = aChartHelper.GetWindow();
+ if (pChartWindow)
+ pWindow = pChartWindow;
+
return pWindow;
}
@@ -3485,25 +3491,18 @@ void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
- vcl::Window* pWindow = &(pDocShell->GetView()->GetEditWin());
-
- SfxViewShell* pViewShell = pDocShell->GetView();
- LokChartHelper aChartHelper(pViewShell);
- vcl::Window* pChartWindow = aChartHelper.GetWindow();
- if (pChartWindow)
- {
- pWindow = pChartWindow;
- }
+ VclPtr<vcl::Window> pWindow = getDocWindow();
+ if (!pWindow)
+ return;
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);
More information about the Libreoffice-commits
mailing list