summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2019-11-26 15:02:48 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2019-11-28 11:00:10 +0100
commit255ee67072aefdd31265df1cc462821797ef76e5 (patch)
treea69e08e7ab779303ffaed86b7d60f06840706a9f /sfx2
parent4fdc90c51e6a1bbb83c1f1826ad5b90dc1ff0ad6 (diff)
jsdialogs: add generic commandName
Change-Id: Icefe02e7682cf47da0bcc5efdfc3ab1019c8abf3 Reviewed-on: https://gerrit.libreoffice.org/83772 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> (cherry picked from commit a1f1e5545dfcf73c8fcf286a9a1e14c0321e8330) Reviewed-on: https://gerrit.libreoffice.org/83964 Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokhelper.cxx26
1 files changed, 26 insertions, 0 deletions
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));
}