diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index e88203d3a641..70f393134b70 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -39,6 +39,8 @@ #include #include #include +#define LOK_USE_UNSTABLE_API +#include class SfxBaseController; class Size; @@ -315,6 +317,11 @@ public: SAL_DLLPRIVATE void TakeOwnership_Impl(); SAL_DLLPRIVATE void TakeFrameOwnership_Impl(); SAL_DLLPRIVATE bool ExecKey_Impl(const KeyEvent& aKey); + + /// The actual implementation of the lok::Document::registerViewCallback() API. + void registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); + /// Invokes the registered callback, if there are any. + void libreOfficeKitViewCallback(int nType, const char* pPayload) const; }; diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 49005931d2b1..b832b15ed4b6 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -64,6 +64,9 @@ struct SfxViewShell_Impl mutable SfxInPlaceClientList* mpIPClientList; + LibreOfficeKitCallback m_pLibreOfficeKitViewCallback; + void* m_pLibreOfficeKitViewData; + explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags); ~SfxViewShell_Impl(); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 62ed8bd485d8..2b9ac3dab401 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -309,6 +309,8 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags) , m_nFamily(0xFFFF) // undefined, default set by TemplateDialog , m_pController(0) , mpIPClientList(NULL) +, m_pLibreOfficeKitViewCallback(0) +, m_pLibreOfficeKitViewData(0) {} SfxViewShell_Impl::~SfxViewShell_Impl() @@ -1631,6 +1633,18 @@ bool SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) return pImp->m_xAccExec->execute(aKey.GetKeyCode()); } +void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + pImp->m_pLibreOfficeKitViewCallback = pCallback; + pImp->m_pLibreOfficeKitViewData = pData; +} + +void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const +{ + if (pImp->m_pLibreOfficeKitViewCallback) + pImp->m_pLibreOfficeKitViewCallback(nType, pPayload, pImp->m_pLibreOfficeKitViewData); +} + bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) /* [Description]