summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-10 09:04:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-10 07:56:13 +0000
commitc3d837739b2ff14213b420ea613ce2fe1730a2cc (patch)
tree7940e4800a8d63d2b6d64086534d5975f2d1dc3a /sfx2
parent6d9d932b77f84c66df0dcd2d2f3c8d71b12287af (diff)
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 <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/unoctitm.cxx18
1 files changed, 14 insertions, 4 deletions
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: */