diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 11 |
2 files changed, 14 insertions, 10 deletions
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx index 0350929eedf1..d2d55b700fbc 100644 --- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -86,18 +86,17 @@ void ContextChangeBroadcaster::BroadcastContextChange ( return; } - // notify the LOK too - if (comphelper::LibreOfficeKit::isActive()) - { - if (SfxViewShell* pViewShell = SfxViewShell::Get(rxFrame->getController())) - SfxLokHelper::notifyContextChange(pViewShell, rsModuleName, rsContextName); - } - const css::ui::ContextChangeEventObject aEvent( rxFrame->getController(), rsModuleName, rsContextName); + // notify the LOK too + if (comphelper::LibreOfficeKit::isActive()) + { + SfxLokHelper::notifyContextChange(aEvent); + } + css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer ( css::ui::ContextChangeEventMultiplexer::get( ::comphelper::getProcessComponentContext())); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 1d39838bfbf8..aa38c5dbee98 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -14,6 +14,7 @@ #include <sfx2/lokhelper.hxx> #include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/ui/ContextChangeEventObject.hpp> #include <comphelper/processfactory.hxx> #include <rtl/strbuf.hxx> @@ -608,15 +609,19 @@ void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload) } } -void SfxLokHelper::notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext) +void SfxLokHelper::notifyContextChange(const css::ui::ContextChangeEventObject& rEvent) { if (DisableCallbacks::disabled()) return; + SfxViewShell* pViewShell = SfxViewShell::Get({ rEvent.Source, css::uno::UNO_QUERY }); + if (!pViewShell) + return; + OString aBuffer = - OUStringToOString(aApplication.replace(' ', '_'), RTL_TEXTENCODING_UTF8) + + OUStringToOString(rEvent.ApplicationName.replace(' ', '_'), RTL_TEXTENCODING_UTF8) + " " + - OUStringToOString(aContext.replace(' ', '_'), RTL_TEXTENCODING_UTF8); + OUStringToOString(rEvent.ContextName.replace(' ', '_'), RTL_TEXTENCODING_UTF8); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_CHANGED, aBuffer.getStr()); } |