[Libreoffice-commits] core.git: include/LibreOfficeKit include/sfx2 sfx2/source svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 6 16:36:30 UTC 2018
include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 +++++++++
include/sfx2/lokhelper.hxx | 4 ++++
sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 10 ++++++++++
sfx2/source/view/lokhelper.cxx | 9 +++++++++
svx/source/sidebar/ContextChangeEventMultiplexer.cxx | 9 +++++++++
5 files changed, 41 insertions(+)
New commits:
commit df4f2b117d5925fa9e1fa4f9b3aec424022a583f
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 6 11:20:27 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue Nov 6 17:35:06 2018 +0100
lok: Notify about the current editing context.
Change-Id: I47e67b680a6abdb66020b295f55ee6a73b7b5608
Reviewed-on: https://gerrit.libreoffice.org/62956
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index c3ccc6aa0e10..e34efb3576ca 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -594,6 +594,15 @@ typedef enum
* convenience.
*/
LOK_CALLBACK_CLIPBOARD_CHANGED = 38,
+
+ /**
+ * When the (editing) context changes - like the user switches from
+ * editing textbox in Impress to editing a shape there.
+ *
+ * Payload is the application ID and context, delimited by space.
+ * Eg. com.sun.star.presentation.PresentationDocument TextObject
+ */
+ LOK_CALLBACK_CONTEXT_CHANGED = 39,
}
LibreOfficeKitCallbackType;
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index ef50a4bb5167..be68f2e91044 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -53,6 +53,10 @@ public:
static void notifyVisCursorInvalidation(OutlinerViewShell const* pThisView, const OString& rRectangle);
/// Notifies all views with the given type and payload.
static void notifyAllViews(int nType, const OString& rPayload);
+
+ /// Notify about the editing context change.
+ static void notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext);
+
/// A special value to signify 'infinity'.
/// This value is chosen such that sal_Int32 will not overflow when manipulated.
static const long MaxTwips = 1e9;
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx
index 716cb84fcfc4..3a182d14f368 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 namespace css;
using namespace css::uno;
@@ -86,6 +89,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 20481ac61e15..374abf900936 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -228,4 +228,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: */
diff --git a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
index 230ced107676..0c53ae140629 100644
--- a/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
+++ b/svx/source/sidebar/ContextChangeEventMultiplexer.cxx
@@ -23,7 +23,9 @@
#include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <comphelper/lok.hxx>
#include <comphelper/processfactory.hxx>
+#include <sfx2/lokhelper.hxx>
#include <sfx2/viewsh.hxx>
#include <tools/diagnose_ex.h>
@@ -37,6 +39,13 @@ void ContextChangeEventMultiplexer::NotifyContextChange (
{
if (rxController.is() && rxController->getFrame().is())
{
+ // notify the LOK too
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ if (SfxViewShell* pViewShell = SfxViewShell::Get(rxController))
+ SfxLokHelper::notifyContextChange(pViewShell, GetModuleName(rxController->getFrame()), vcl::EnumContext::GetContextName(eContext));
+ }
+
const css::ui::ContextChangeEventObject aEvent(
rxController,
GetModuleName(rxController->getFrame()),
More information about the Libreoffice-commits
mailing list