sfx2/source/view/lokhelper.cxx | 26 ++++++++++++++++++++++++++ svx/source/xoutdev/xattr.cxx | 8 ++++---- 2 files changed, 30 insertions(+), 4 deletions(-)
New commits: commit 255ee67072aefdd31265df1cc462821797ef76e5 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Nov 26 15:02:48 2019 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Thu Nov 28 11:00:10 2019 +0100 jsdialogs: add generic commandName Change-Id: Icefe02e7682cf47da0bcc5efdfc3ab1019c8abf3 Reviewed-on: https://gerrit.libreoffice.org/83772 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> (cherry picked from commit a1f1e5545dfcf73c8fcf286a9a1e14c0321e8330) Reviewed-on: https://gerrit.libreoffice.org/83964 Tested-by: Jenkins diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index ee032c6f4977..acb4fea6f49a 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -24,6 +24,9 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> #include <editeng/outliner.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/objface.hxx> +#include <sfx2/msgpool.hxx> #include <shellimpl.hxx> @@ -183,6 +186,24 @@ void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OS } } +namespace { + OUString lcl_getNameForSlot(const SfxViewShell* pShell, sal_uInt16 nWhich) + { + if (pShell->GetFrame()) + { + const SfxSlot* pSlot = SfxSlotPool::GetSlotPool(pShell->GetFrame()).GetSlot(nWhich); + if (pSlot) + { + OUStringBuffer sUnoCommand(".uno:"); + sUnoCommand.append(OStringToOUString(pSlot->GetUnoName(), RTL_TEXTENCODING_ASCII_US)); + return sUnoCommand.makeStringAndClear(); + } + } + + return ""; + } +} + void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* pSet) { if (!pShell || !pSet) @@ -197,6 +218,11 @@ void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxItemSet* p if (pSet->HasItem(nWhich) && SfxItemState::SET >= pSet->GetItemState(nWhich)) { boost::property_tree::ptree aItem = pSet->Get(nWhich).dumpAsJSON(); + + OUString sCommand = lcl_getNameForSlot(pShell, nWhich); + if (!sCommand.isEmpty()) + aItem.put("commandName", sCommand); + if (!aItem.empty()) anArray.push_back(std::make_pair("", aItem)); } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 48eb70474e28..327321bbc7dc 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -1839,7 +1839,7 @@ boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON(); if (Which() == XATTR_FILLSTYLE) - aTree.put("which", ".uno:FillStyle"); + aTree.put("commandName", ".uno:FillStyle"); OUString sValue; @@ -1863,7 +1863,7 @@ boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const default: break; } - aTree.put("data", sValue); + aTree.put("state", sValue); return aTree; } @@ -2342,9 +2342,9 @@ boost::property_tree::ptree XFillGradientItem::dumpAsJSON() const boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON(); if (Which() == XATTR_FILLGRADIENT) - aTree.put("which", ".uno:FillGradient"); + aTree.put("commandName", ".uno:FillGradient"); - aTree.push_back(std::make_pair("data", GetGradientValue().dumpAsJSON())); + aTree.push_back(std::make_pair("state", GetGradientValue().dumpAsJSON())); return aTree; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits