diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-10 09:04:47 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-12 22:06:21 -0400 |
commit | 798d6327002adbb9c22a92c85e0a98223f7bfe11 (patch) | |
tree | 322a0e11c65666b977fa71b8596f6177ca9ba4f3 /sfx2 | |
parent | 1cab85f2d3d7f309df525b3bdec4d4ae477d4c95 (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.
Reviewed-on: https://gerrit.libreoffice.org/26145
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit c3d837739b2ff14213b420ea613ce2fe1730a2cc)
Change-Id: If10ff46dd0243cfc2f1c5566c53a7e81efa635b4
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index f4e01010f252..2508688bbbff 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -66,6 +66,11 @@ #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> +#include <osl/time.h> #include <iostream> #include <map> @@ -73,6 +78,7 @@ #include <sal/log.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <comphelper/lok.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -260,6 +266,8 @@ void SfxUnoControllerItem::ReleaseBindings() pBindings = nullptr; } +static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const css::frame::FeatureStateEvent& aEvent); + void SfxStatusDispatcher::ReleaseAll() { css::lang::EventObject aObject; @@ -1060,8 +1068,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 ); @@ -1087,9 +1094,9 @@ 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 (!objSh || !objSh->isTiledRendering()) + if (!comphelper::LibreOfficeKit::isActive()) return; OUStringBuffer aBuffer; @@ -1242,7 +1249,16 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe } 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: */ |