sc/source/ui/drawfunc/drawsh2.cxx |   62 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

New commits:
commit 60b28f17ab9ce13a2975e1d726e24d9ea7089720
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Nov 21 13:31:35 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Nov 21 15:37:09 2019 +0100

    jsdialogs: send .uno:FillStyle updates in Calc
    
    Change-Id: I51682546a3c8fd4ee6d97cf8bf79d066e571addf
    Reviewed-on: https://gerrit.libreoffice.org/83386
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index 08cda1bac046..9e382d19aafc 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -49,9 +49,67 @@
 #include <gridwin.hxx>
 #include <svx/svdoole2.hxx>
 #include <svx/svdocapt.hxx>
+#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 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());
+        }
+    }
+}
+
 ScDrawShell::ScDrawShell( ScViewData* pData ) :
     SfxShell(pData->GetViewShell()),
     pViewData( pData ),
@@ -357,6 +415,10 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
                 rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
             }
         }
+
+        SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
+        if (pViewShell && comphelper::LibreOfficeKit::isActive())
+            lcl_sendAttrUpdatesForLOK( pViewShell, rSet );
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to