summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-07-24 11:33:46 -0400
committerTor Lillqvist <tml@collabora.com>2020-11-20 14:34:00 +0100
commit44f6329330e8c8f000cb310b04ac13777e8bfff3 (patch)
tree50013427b3da0d5144ef19e4b93c6d47b5d23aba /include
parent7032be2e9edd82dad2d67f1582aaa57676bda4a1 (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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106221 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@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 79052a0d6e04..2aad968681b8 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