Kaydet (Commit) ba040aa0 authored tarafından Miklos Vajna's avatar Miklos Vajna

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.

(cherry picked from commit 1ba9d7fd)

Conflicts:
	sw/inc/PostItMgr.hxx
	sw/inc/SidebarWin.hxx
	sw/source/core/view/viewsh.cxx
	sw/source/uibase/docvw/SidebarTxtControl.hxx
	sw/source/uibase/docvw/edtwin.cxx

Change-Id: I4489941512197880940e20cbaeb0b47a7a6f26fc
üst 2f678408
......@@ -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;
......@@ -291,6 +293,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
......
......@@ -178,6 +178,7 @@ class SwSidebarWin : public vcl::Window
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE;
virtual void KeyInput(const KeyEvent& rKeyEvt) SAL_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);
......
......@@ -120,6 +120,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
......
......@@ -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");
......
......@@ -40,7 +40,6 @@ class SidebarTextControl : public Control
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
......@@ -61,6 +60,7 @@ class SidebarTextControl : public Control
virtual void dispose() SAL_OVERRIDE;
virtual void GetFocus() SAL_OVERRIDE;
virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
OutlinerView* GetTextView() const;
......
......@@ -355,6 +355,12 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, s
}
}
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)
{
......
......@@ -145,6 +145,7 @@
#include <xmloff/odffields.hxx>
#include <PostItMgr.hxx>
#include <SidebarWin.hxx>
#include <algorithm>
#include <vector>
......@@ -1324,6 +1325,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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment