diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-21 11:29:49 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-21 11:17:10 +0000 |
commit | 9f66db9c474f71f43d7a3667230241fd4fa4183f (patch) | |
tree | 858e2948669d573d3c54352ae5dcc3e6c217cb0f /sfx2 | |
parent | 46bf504e0384d7491b9543604e594228c64318a1 (diff) |
sw lok: add LOK_CALLBACK_TEXT_VIEW_SELECTION
So a view can be aware where selections of other views are.
Change-Id: I5026b1ff2b99a4eedfd0bde32a05ceb8e2f424bc
Reviewed-on: https://gerrit.libreoffice.org/26542
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index c994877e9540..b44392c9dfef 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -8,6 +8,9 @@ */ #include <sfx2/lokhelper.hxx> + +#include <boost/property_tree/json_parser.hpp> + #include <sfx2/viewsh.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> @@ -86,4 +89,26 @@ std::size_t SfxLokHelper::getViews() return nRet; } +void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload) +{ + if (SfxLokHelper::getViews() <= 1) + return; + + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + if (pViewShell != pThisView) + { + boost::property_tree::ptree aTree; + aTree.put("viewId", SfxLokHelper::getView(pThisView)); + aTree.put(rKey.getStr(), rPayload.getStr()); + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + OString aPayload = aStream.str().c_str(); + pViewShell->libreOfficeKitViewCallback(nType, aPayload.getStr()); + } + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |