diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-26 10:47:33 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2019-11-28 08:34:20 +0100 |
commit | ae9e1569e736ad63bf2a2e197441657283c3f344 (patch) | |
tree | afdf048444ff0a7836552735cd7f20d61673a5ed /sfx2 | |
parent | cc4dbe473b0b68dbe120065c1d6a64a087f41ba2 (diff) |
jsdialogs: share the commands updates sending code
Change-Id: I34c1e03a8f92efe0c0dd391d16ff907919e65b00
Reviewed-on: https://gerrit.libreoffice.org/83748
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 880ff26edff0f7dfdd0d5b74fd9d7026fd2d8523)
Reviewed-on: https://gerrit.libreoffice.org/83954
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 25 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 5 |
2 files changed, 30 insertions, 0 deletions
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 6dea1bc3d125..ee032c6f4977 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -183,6 +183,31 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS } } +void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet) +{ + if (!pShell || !pSet) + return; + + boost::property_tree::ptree aTree; + boost::property_tree::ptree anArray; + + for(int i = 0; i < pSet->Count(); i++) + { + sal_uInt16 nWhich = pSet->GetWhichByPos(i); + if (pSet->HasItem(nWhich) && SfxItemState::SET >= pSet->GetItemState(nWhich)) + { + boost::property_tree::ptree aItem = pSet->Get(nWhich).dumpAsJSON(); + if (!aItem.empty()) + anArray.push_back(std::make_pair("", aItem)); + } + } + aTree.add_child("items", anArray); + + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aStream.str().c_str()); +} + void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, vcl::LOKWindowId nLOKWindowId, const OUString& rAction, diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 0301bd2acd59..78f498143a57 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2015,6 +2015,11 @@ Reference< view::XRenderable > SfxViewShell::GetRenderable() return xRender; } +void SfxViewShell::sendUnoStatus(const SfxItemSet* pSet) const +{ + SfxLokHelper::sendUnoStatus(this, pSet); +} + void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload) const { SfxLokHelper::notifyWindow(this, nDialogId, rAction, rPayload); |