diff options
-rw-r--r-- | include/sfx2/unoctitm.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx index 235c815270ea..c2e060e0b2b6 100644 --- a/include/sfx2/unoctitm.hxx +++ b/include/sfx2/unoctitm.hxx @@ -147,8 +147,6 @@ public: void UnBindController(); SfxDispatcher* GetDispatcher(); void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); - - static void InterceptLOKStateChangeEvent(const SfxObjectShell* objSh, const css::frame::FeatureStateEvent& aEvent); }; #endif diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index fbbebfeb152a..7168390229e1 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -65,6 +65,7 @@ #include "statcach.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> #include <osl/file.hxx> #include <rtl/ustring.hxx> #include <unotools/pathoptions.hxx> @@ -107,6 +108,7 @@ const char* URLTypeNames[URLType_COUNT] = "double" }; +static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent); void SfxStatusDispatcher::ReleaseAll() { @@ -907,8 +909,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt if (pDispatcher && pDispatcher->GetFrame()) { - InterceptLOKStateChangeEvent( - pDispatcher->GetFrame()->GetObjectShell(), aEvent); + InterceptLOKStateChangeEvent(pDispatcher->GetFrame(), aEvent); } ::cppu::OInterfaceContainerHelper* pContnr = pDispatch->GetListeners().getContainer ( aDispatchURL.Complete ); @@ -934,7 +935,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt StateChanged( nSID, eState, pState, nullptr ); } -void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShell* objSh, const css::frame::FeatureStateEvent& aEvent) +static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent) { if (!comphelper::LibreOfficeKit::isActive()) return; @@ -1031,7 +1032,16 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe return; } OUString payload = aBuffer.makeStringAndClear(); - objSh->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + { + if (const SfxViewShell* pViewShell = pViewFrame->GetViewShell()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + } + else + { + const SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell(); + pObjectShell->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |