include/sfx2/unoctitm.hxx | 2 -- sfx2/source/control/unoctitm.cxx | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-)
New commits: commit c3d837739b2ff14213b420ea613ce2fe1730a2cc Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jun 10 09:04:47 2016 +0200 sfx2: implement per-view LOK_CALLBACK_STATE_CHANGED With this, bindings updates ("cursor moved into a bold area", etc) are correctly sent to (and only to) the matching view. Change-Id: If10ff46dd0243cfc2f1c5566c53a7e81efa635b4 Reviewed-on: https://gerrit.libreoffice.org/26145 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/include/sfx2/unoctitm.hxx b/include/sfx2/unoctitm.hxx index 235c815..c2e060e 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 fbbebfe..7168390 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: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits