diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 21 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 7 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/inc/Window.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 28 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/edtwin.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 21 |
11 files changed, 101 insertions, 17 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 450757a8351f..94c95edc515e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -688,23 +688,16 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, pDoc->registerCallback(pCallback, pData); } -static void doc_postKeyEvent(LibreOfficeKitDocument* /*pThis*/, int nType, int nCharCode, int nKeyCode) +static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) { -#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) - if (SalFrame *pFocus = GetSvpFocusFrameForLibreOfficeKit()) + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) { - KeyEvent aEvent(nCharCode, nKeyCode, 0); - switch (nType) - { - case LOK_KEYEVENT_KEYINPUT: - Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, GetSalFrameWindowForLibreOfficeKit(pFocus), &aEvent); - break; - case LOK_KEYEVENT_KEYUP: - Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, GetSalFrameWindowForLibreOfficeKit(pFocus), &aEvent); - break; - } + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; } -#endif + + pDoc->postKeyEvent(nType, nCharCode, nKeyCode); } static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* pCommand) diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index a10e44884756..5cac9b63a0c9 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -101,6 +101,13 @@ public: virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) = 0; /** + * Posts a keyboard event on the document. + * + * @see lok::Document::postKeyEvent(). + */ + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) = 0; + + /** * Posts a mouse event on the document. * * @see lok::Document::postMouseEvent(). diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 56425694d42e..0e5808787469 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -394,6 +394,9 @@ public: /// @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postMouseEvent(). virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 9d8965d052fb..259844ebfd35 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -287,7 +287,6 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou protected: virtual void PrePaint() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; @@ -304,6 +303,7 @@ public: ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ); virtual ~ScGridWindow(); + virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; // #i70788# flush and get overlay rtl::Reference<sdr::overlay::OverlayManager> getOverlayManager(); void flushOverlayManager(); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 47f1e4124013..92dc6e16633b 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -528,6 +528,34 @@ void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData) pDocShell->GetDocument().GetDrawLayer()->registerLibreOfficeKitCallback(pCallback, pData); } +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(); + ScGridWindow* pGridWindow = pViewData->GetActiveWin(); + + if (!pGridWindow) + return; + + KeyEvent aEvent(nCharCode, nKeyCode, 0); + + switch (nType) + { + case LOK_KEYEVENT_KEYINPUT: + pGridWindow->KeyInput(aEvent); + break; + case LOK_KEYEVENT_KEYUP: + pGridWindow->KeyUp(aEvent); + break; + default: + assert(false); + break; + } +} + void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) { SolarMutexGuard aGuard; diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx index be2bb1af4e11..dca72fbdc519 100644 --- a/sd/source/ui/inc/Window.hxx +++ b/sd/source/ui/inc/Window.hxx @@ -147,6 +147,7 @@ public: */ void SetUseDropScroll (bool bUseDropScroll); void DropScroll (const Point& rMousePos); + virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; protected: ::sd::Window* mpShareWin; Point maWinPos; @@ -171,7 +172,6 @@ protected: virtual void Resize() SAL_OVERRIDE; virtual void PrePaint() SAL_OVERRIDE; virtual void Paint(const Rectangle& rRect) SAL_OVERRIDE; - virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index bb840f2b1983..b9c17ac4ba4e 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -245,6 +245,8 @@ public: virtual void initializeForTiledRendering() SAL_OVERRIDE; /// @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 9cb8df9acd93..e2ab4f8bde16 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2378,6 +2378,34 @@ void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void mpDoc->registerLibreOfficeKitCallback(pCallback, pData); } +void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) +{ + SolarMutexGuard aGuard; + + DrawViewShell* pViewShell = GetViewShell(); + if (!pViewShell) + return; + + sd::Window* pWindow = pViewShell->GetActiveWindow(); + if (!pWindow) + return; + + KeyEvent aEvent(nCharCode, nKeyCode, 0); + + switch (nType) + { + case LOK_KEYEVENT_KEYINPUT: + pWindow->KeyInput(aEvent); + break; + case LOK_KEYEVENT_KEYUP: + pWindow->KeyUp(aEvent); + break; + default: + assert(false); + break; + } +} + void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) { SolarMutexGuard aGuard; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 720256288216..22375eb3cebe 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -409,6 +409,8 @@ public: virtual void initializeForTiledRendering() SAL_OVERRIDE; /// @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + /// @see vcl::ITiledRenderable::postKeyEvent(). + virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). diff --git a/sw/source/uibase/inc/edtwin.hxx b/sw/source/uibase/inc/edtwin.hxx index 5a4cf7aa7198..e8c2e5e99d17 100644 --- a/sw/source/uibase/inc/edtwin.hxx +++ b/sw/source/uibase/inc/edtwin.hxx @@ -189,7 +189,6 @@ protected: virtual void DataChanged( const DataChangedEvent& ) SAL_OVERRIDE; virtual void PrePaint() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; - virtual void KeyInput(const KeyEvent &rKEvt) SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; @@ -218,6 +217,7 @@ protected: bool IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const; public: + virtual void KeyInput(const KeyEvent &rKEvt) SAL_OVERRIDE; void UpdatePointer(const Point &, sal_uInt16 nButtons = 0); bool IsDrawSelMode(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index f34f83b75181..5feadbf3b6af 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3183,6 +3183,27 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p pViewShell->registerLibreOfficeKitCallback(pCallback, pData); } +void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) +{ + SolarMutexGuard aGuard; + + SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); + KeyEvent aEvent(nCharCode, nKeyCode, 0); + + switch (nType) + { + case LOK_KEYEVENT_KEYINPUT: + rEditWin.KeyInput(aEvent); + break; + case LOK_KEYEVENT_KEYUP: + rEditWin.KeyUp(aEvent); + break; + default: + assert(false); + break; + } +} + void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount) { SolarMutexGuard aGuard; |