From 0632f77ee8059f2d65ad72bf148da88901732dc2 Mon Sep 17 00:00:00 2001 From: Siqi Liu Date: Mon, 13 Apr 2015 16:23:32 +0200 Subject: LOK_STATE_CHANGED callback implemented with sfx events interception. --- include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 ++++++++- include/sfx2/objsh.hxx | 11 +++++++++++ include/sfx2/unoctitm.hxx | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index e8d2b59dec45..d4d1b4c4fc3b 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -102,7 +102,14 @@ typedef enum * User clicked on an hyperlink that should be handled by other * applications accordingly. */ - LOK_CALLBACK_HYPERLINK_CLICKED + LOK_CALLBACK_HYPERLINK_CLICKED, + + /** + * Emit state update to the client. + * For example, when cursor is on bold text, this callback is triggered + * with payload: ".uno:Bold=true" + */ + LOK_CALLBACK_STATE_CHANGED } LibreOfficeKitCallbackType; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 8b82d767e45a..7e235d99ef82 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -49,6 +49,9 @@ #include #include +#define LOK_USE_UNSTABLE_API +#include + class SbxValue; class SvxMacro; class SbxArray; @@ -708,6 +711,14 @@ public: SAL_DLLPRIVATE void CancelCheckOut( ); SAL_DLLPRIVATE void CheckIn( ); SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::document::CmisVersion > GetCmisVersions(); + + /** + * Interface shared by document shell. Allow LOK calls from sfx. + * Default behavior doesn't do anything. relevant SfxObjectShells should override + * the default behavior and implements LOK calls. + */ + virtual void libreOfficeKitCallback(int nType, const char* pPayload) const; + virtual bool isTiledRendering() const; }; #define SFX_GLOBAL_CLASSID \ diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx index 97d12dacf9fe..70122ee2d3d4 100644 --- a/include/sfx2/unoctitm.hxx +++ b/include/sfx2/unoctitm.hxx @@ -175,6 +175,8 @@ public: void UnBindController(); SfxDispatcher* GetDispatcher(); void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); + + void InterceptLOKStateChangeEvent(const SfxObjectShell* objSh, const ::com::sun::star::frame::FeatureStateEvent& aEvent) const; }; #endif -- cgit