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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 21 12:59:51 UTC 2019


 sd/source/ui/view/drviewsf.cxx |   62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

New commits:
commit 94fbb1dafaf691e4582ca51426074da3aa469a65
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 21 12:59:17 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Nov 21 13:58:46 2019 +0100

    jsdialogs: send .uno:FillStyle updates in Impress
    
    Change-Id: I9b266d9134678e98a5540ec3681d24b3ea43506a
    Reviewed-on: https://gerrit.libreoffice.org/83382
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 5261ff37d6d2..07ba0a76df72 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -63,10 +63,68 @@
 #include <svx/nbdtmgfact.hxx>
 #include <svx/nbdtmg.hxx>
 #include <memory>
+#include <svx/xfillit0.hxx>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+using namespace com::sun::star::drawing;
 using namespace svx::sidebar;
 using namespace ::com::sun::star;
 
+namespace {
+    OUString lcl_fillStyleEnumToString(FillStyle eStyle)
+    {
+        switch (eStyle)
+        {
+            case FillStyle_NONE:
+                return "NONE";
+
+            case FillStyle_SOLID:
+                return "SOLID";
+
+            case FillStyle_GRADIENT:
+                return "GRADIENT";
+
+            case FillStyle_HATCH:
+                return "HATCH";
+
+            case FillStyle_BITMAP:
+                return "BITMAP";
+
+            default:
+                return "";
+        }
+    }
+
+    void lcl_sendAttrUpdatesForLOK(SfxViewShell* pShell, const SfxItemSet& rSet)
+    {
+        if (!pShell)
+            return;
+
+        OUString sPayload;
+        const SfxPoolItem* pItem = rSet.GetItem(SID_ATTR_FILL_STYLE);
+
+        if (pItem)
+        {
+            const XFillStyleItem* pFillStyleItem = static_cast<const XFillStyleItem*>(pItem);
+            FillStyle eStyle;
+            css::uno::Any aAny;
+
+            pFillStyleItem->QueryValue(aAny);
+            aAny >>= eStyle;
+            sPayload = ".uno:FillStyle=" + lcl_fillStyleEnumToString(eStyle);
+        }
+
+        if (!sPayload.isEmpty())
+        {
+            pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                OUStringToOString(sPayload, RTL_TEXTENCODING_ASCII_US).getStr());
+        }
+    }
+}
+
 namespace sd {
 
 /**
@@ -697,6 +755,10 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
                 }
                 nWhich = aNewIter.NextWhich();
             }
+
+            SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
+            if (pViewShell && comphelper::LibreOfficeKit::isActive())
+                lcl_sendAttrUpdatesForLOK( pViewShell, *pSet );
         }
 
         SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );


More information about the Libreoffice-commits mailing list