[Libreoffice-commits] core.git: 2 commits - sc/source sd/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 27 08:23:02 UTC 2019


 sc/source/ui/drawfunc/drawsh2.cxx |   63 ++++++++++++++++++++++++++++++++++++++
 sd/source/ui/view/drviewsf.cxx    |   62 +++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+)

New commits:
commit 2269225b81c2c2ee176db91d25fe1533b40b5e5e
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: Wed Nov 27 09:21:36 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>
    Reviewed-on: https://gerrit.libreoffice.org/83778
    Tested-by: Jenkins

diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 565283ce1c3a..4943effb2416 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -60,10 +60,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 {
 
 /**
@@ -726,6 +784,10 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
                 rSet.DisableItem( nWhich );
             }
             nWhich = aNewIter.NextWhich();
+
+            SfxViewShell* pViewShell = GetDrawView()->GetSfxViewShell();
+            if (pViewShell && comphelper::LibreOfficeKit::isActive())
+                lcl_sendAttrUpdatesForLOK( pViewShell, *pSet );
         }
     }
 
commit aa5b9c86e20dddac55f73d241bb030b1ca51d786
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Nov 21 13:31:35 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Nov 27 09:21:31 2019 +0100

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

diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index a3da77fd7296..118412c24822 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -46,9 +46,68 @@
 #include <drtxtob.hxx>
 #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 ),
@@ -360,6 +419,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 );
     }
 }
 


More information about the Libreoffice-commits mailing list