summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-07-24 11:33:46 -0400
committerAshod Nakashian <ash@collabora.com>2020-08-10 04:45:07 +0200
commitb7b81c68dc406cfa16d959f22417a3c3ed7888d5 (patch)
tree26134afd5402ac6bfb6c24b26d6a5133f7419050 /include
parent02cde0be4fec9f4c77f535e5053888ef1e37fad6 (diff)
sfx2: lok: refactor notifications and const correctness
This reduces the stringification and reuses the notificaiton helpers to reduce code duplication. Change-Id: Icf9f9c50f3eeee61a0ded741d39fed37cfcc8da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99972 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ash@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/sfx2/lokhelper.hxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 57aee1bb3a5d..e3c75b4191c3 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -51,7 +51,7 @@ public:
/// Set a view shell as current one.
static void setView(int nId);
/// Get the currently active view.
- static int getView(SfxViewShell* pViewShell = nullptr);
+ static int getView(const SfxViewShell* pViewShell = nullptr);
/// Get the number of views of the current object shell.
static std::size_t getViewsCount();
/// Get viewIds of views of the current object shell.
@@ -72,17 +72,24 @@ public:
static LOKDeviceFormFactor getDeviceFormFactor();
/// Set the device form factor that should be used for a new view.
static void setDeviceFormFactor(const OUString& rDeviceFormFactor);
+
/// Iterate over any view shell, except pThisViewShell, passing it to the f function.
template<typename ViewShellType, typename FunctionType>
static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType f);
+
/// Invoke the LOK callback of all other views showing the same document as pThisView, with a payload of rKey-rPayload.
- static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload);
+ static void notifyOtherViews(const SfxViewShell* pThisView, int nType, const OString& rKey,
+ const OString& rPayload);
/// Invoke the LOK callback of all views except pThisView, with a JSON payload created from the given property tree.
- static void notifyOtherViews(SfxViewShell* pThisView, int nType, const boost::property_tree::ptree& rTree);
+ static void notifyOtherViews(const SfxViewShell* pThisView, int nType,
+ const boost::property_tree::ptree& rTree);
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
- static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload);
+ static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView,
+ int nType, const OString& rKey, const OString& rPayload);
/// Same as notifyOtherViews(), the property-tree version, but works on a selected "other" view, not on all of them.
- static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const boost::property_tree::ptree& rTree);
+ static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView,
+ int nType, const boost::property_tree::ptree& rTree);
+
/// Emits a LOK_CALLBACK_STATE_CHANGED
static void sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem);
/// Emits a LOK_CALLBACK_WINDOW