summaryrefslogtreecommitdiff
path: root/include/sfx2
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-09-28 12:20:10 +0200
committerMarco Cecchetti <mrcekets@gmail.com>2016-10-03 12:13:15 +0000
commit8ef20328866320cba9267027ea7284f8ec7edccf (patch)
treea5b8d1a16d2b5c991d17c7ca365f5e6d1cdc8a3c /include/sfx2
parentcae57d2e588a4b5a104171e022b00abcc1605775 (diff)
Calc: implemented parallel cell text editing
Change-Id: If8cc7a637cee6ba66813d55b25160fee13a2a219 Reviewed-on: https://gerrit.libreoffice.org/29410 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r--include/sfx2/lokhelper.hxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 6e25044f3691..0c118fbca896 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -11,8 +11,10 @@
#define INCLUDED_SFX2_LOKHELPER_HXX
#include <sfx2/dllapi.h>
+#include <sfx2/viewsh.hxx>
#include <cstddef>
#include <rtl/string.hxx>
+#include <comphelper/lok.hxx>
class SfxViewShell;
@@ -31,7 +33,9 @@ public:
static std::size_t getViewsCount();
/// Get viewIds of all existing views.
static bool getViewIds(int* pArray, size_t nSize);
-
+ /// 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 views except pThisView, with a payload of rKey-rPayload.
static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload);
/// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them.
@@ -40,6 +44,21 @@ public:
static void notifyInvalidation(SfxViewShell* pThisView, const OString& rPayload);
};
+template<typename ViewShellType, typename FunctionType>
+void SfxLokHelper::forEachOtherView(ViewShellType* pThisViewShell, FunctionType f)
+{
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ViewShellType* pOtherViewShell = dynamic_cast<ViewShellType*>(pViewShell);
+ if (pOtherViewShell != nullptr && pOtherViewShell != pThisViewShell)
+ {
+ f(pOtherViewShell);
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */