[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sfx2/source svx/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 28 07:36:16 UTC 2019


 sfx2/source/view/lokhelper.cxx |   26 ++++++++++++++++++++++++++
 svx/source/xoutdev/xattr.cxx   |    8 ++++----
 2 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit a1f1e5545dfcf73c8fcf286a9a1e14c0321e8330
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 26 15:02:48 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Nov 28 08:35:41 2019 +0100

    jsdialogs: add generic commandName
    
    Change-Id: Icefe02e7682cf47da0bcc5efdfc3ab1019c8abf3
    Reviewed-on: https://gerrit.libreoffice.org/83772
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 4571d74c7059..e9c7248941fd 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -22,6 +22,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>
 
@@ -181,6 +184,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)
@@ -195,6 +216,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 a3e7bbafdcb1..e083aa5ed5a4 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1840,7 +1840,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;
 
@@ -1864,7 +1864,7 @@ boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
         default: break;
     }
 
-    aTree.put("data", sValue);
+    aTree.put("state", sValue);
 
     return aTree;
 }
@@ -2356,9 +2356,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;
 }


More information about the Libreoffice-commits mailing list