summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-11-06 11:20:27 +0100
committerJan Holesovsky <kendy@collabora.com>2018-11-07 11:10:37 +0100
commit4f605d49ba5a436730ceddaf739544b99c0812fe (patch)
treef8207291a3e6a4d166bc5802b669f40bc1695054 /sfx2
parent3fb90f6eab998d0fda07bd3f4a2ebf650e6b6a61 (diff)
lok: Notify about the current editing context.
Change-Id: I47e67b680a6abdb66020b295f55ee6a73b7b5608
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/ContextChangeBroadcaster.cxx10
-rw-r--r--sfx2/source/view/lokhelper.cxx9
2 files changed, 19 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
index bdbf62defb36..42aacef4591e 100644
--- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
+++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
@@ -22,7 +22,10 @@
#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <osl/diagnose.h>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
+#include <sfx2/lokhelper.hxx>
+#include <sfx2/viewsh.hxx>
using ::rtl::OUString;
using namespace css;
@@ -87,6 +90,13 @@ 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,
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index e6fb475846a8..475317158158 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -226,4 +226,13 @@ void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload)
}
}
+void SfxLokHelper::notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext)
+{
+ OStringBuffer aBuffer;
+ aBuffer.append(OUStringToOString(aApplication.replace(' ', '_'), RTL_TEXTENCODING_UTF8));
+ aBuffer.append(' ');
+ aBuffer.append(OUStringToOString(aContext.replace(' ', '_'), RTL_TEXTENCODING_UTF8));
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_CHANGED, aBuffer.makeStringAndClear().getStr());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */