diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-12 16:56:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-12 16:56:45 +0100 |
commit | 1ba9d7fd2a7a3e2b4f52ed0f5efdf7df867b9db3 (patch) | |
tree | f438c6aa734296e0c75d2408a820ca126a18526d | |
parent | 49f453755b72654ba454acc321210e8b040df714 (diff) |
sw lok: forward key events to annotation window if necessary
And to allow proper reaction by the annotation windows, inform them when
a LOK callback is registered.
With this, it's possible to modify the contents of annotations via LOK.
Change-Id: I4489941512197880940e20cbaeb0b47a7a6f26fc
-rw-r--r-- | sw/inc/PostItMgr.hxx | 4 | ||||
-rw-r--r-- | sw/inc/SidebarWin.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarTxtControl.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarWin.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 10 |
7 files changed, 37 insertions, 1 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 7427c7ad23e2..3c8324e3dd4d 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -34,6 +34,8 @@ #include <SidebarWindowsTypes.hxx> #include <svl/lstner.hxx> #include <vcl/vclptr.hxx> +#define LOK_USE_UNSTABLE_API +#include <LibreOfficeKit/LibreOfficeKitTypes.h> class OutputDevice; class SwWrtShell; @@ -288,6 +290,8 @@ class SwPostItMgr: public SfxListener void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage); void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect); + /// Informs already created annotations about a newly registered LOK callback. + void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData); }; #endif diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx index f42bcb38309f..9ddf14974f52 100644 --- a/sw/inc/SidebarWin.hxx +++ b/sw/inc/SidebarWin.hxx @@ -177,6 +177,7 @@ class SwSidebarWin : public vcl::Window virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override; + virtual void KeyInput(const KeyEvent& rKeyEvt) override; void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect); /// Get the matching sub-widget inside this sidebar widget for rPointLogic, if any. vcl::Window* IsHitWindow(const Point& rPointLogic); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c682566691fb..226b12325174 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -119,6 +119,8 @@ void SwViewShell::ToggleHeaderFooterEdit() void SwViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) { getIDocumentDrawModelAccess().GetDrawModel()->registerLibreOfficeKitCallback(pCallback, pData); + if (SwPostItMgr* pPostItMgr = GetPostItMgr()) + pPostItMgr->registerLibreOfficeKitCallback(pCallback, pData); } void SwViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 9feb6913f855..cba1999366d9 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -881,6 +881,19 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe } } +void SwPostItMgr::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + for (SwSidebarItem* pItem : mvPostItFields) + { + SwSidebarWin* pPostIt = pItem->pPostIt; + if (!pPostIt) + continue; + + pPostIt->GetOutlinerView()->setTiledRendering(mpWrtShell->isTiledRendering()); + pPostIt->GetOutlinerView()->registerLibreOfficeKitCallback(pCallback, pData); + } +} + void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage) { OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value"); diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx index 51243ed0eb14..1258412a1bdd 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.hxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx @@ -40,7 +40,6 @@ class SidebarTextControl : public Control protected: virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) override; - virtual void KeyInput( const KeyEvent& rKeyEvt ) override; virtual void MouseMove( const MouseEvent& rMEvt ) override; virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; @@ -61,6 +60,7 @@ class SidebarTextControl : public Control virtual void dispose() override; virtual void GetFocus() override; + virtual void KeyInput( const KeyEvent& rKeyEvt ) override; OutlinerView* GetTextView() const; diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index cdf68384a851..c2ffc0687229 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -355,6 +355,12 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, D } } +void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent) +{ + if (mpSidebarTextControl) + mpSidebarTextControl->KeyInput(rKeyEvent); +} + void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight, const SwRect& aAnchorRect, const long aPageBorder) { diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index a33257ce69d1..3e90227c3e72 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -145,6 +145,7 @@ #include <xmloff/odffields.hxx> #include <PostItMgr.hxx> +#include <SidebarWin.hxx> #include <FrameControlsManager.hxx> #include <algorithm> @@ -1332,6 +1333,15 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) { SwWrtShell &rSh = m_rView.GetWrtShell(); + if (comphelper::LibreOfficeKit::isActive() && m_rView.GetPostItMgr()) + { + if (vcl::Window* pWindow = m_rView.GetPostItMgr()->GetActiveSidebarWin()) + { + pWindow->KeyInput(rKEvt); + return; + } + } + if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE && m_pApplyTempl && m_pApplyTempl->m_pFormatClipboard ) { |