sw/source/uibase/shells/drwtxtex.cxx |   49 ++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

New commits:
commit 9a1525f93dfce425a8416f83ca7361cb5783d36b
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Nov 8 17:13:05 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Nov 8 17:55:06 2019 +0100

    jsdialogs: apply .uno:Color and CharBackColor to floating text frames
    
    Change-Id: I1a6b997f1a857524c7a48434321ca10d97f5e5db
    Reviewed-on: https://gerrit.libreoffice.org/82311
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index 7e0a8c0ead75..e1073389879c 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -92,12 +92,51 @@
 #include <viewopt.hxx>
 #include <wrtsh.hxx>
 #include <wview.hxx>
+#include <svl/stritem.hxx>
+#include <svx/chrtitem.hxx>
 
 #include <swabstdlg.hxx>
 #include <memory>
 
 using namespace ::com::sun::star;
 
+namespace
+{
+    void lcl_convertStringArguments(sal_uInt16 nSlot, 
std::unique_ptr<SfxItemSet>& pArgs)
+    {
+        Color aColor;
+        OUString sColor;
+        const SfxPoolItem* pItem = nullptr;
+
+        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, 
false, &pItem))
+        {
+            sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
+
+            if (sColor == "transparent")
+                aColor = COL_TRANSPARENT;
+            else
+                aColor = Color(sColor.toInt32(16));
+
+            switch (nSlot)
+            {
+                case SID_ATTR_CHAR_COLOR:
+                {
+                    SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
+                    pArgs->Put(aColorItem);
+                    break;
+                }
+
+                case SID_ATTR_CHAR_BACK_COLOR:
+                {
+                    SvxBackgroundColorItem pBackgroundItem(aColor, 
EE_CHAR_BKGCOLOR);
+                    pArgs->Put(pBackgroundItem);
+                    break;
+                }
+            }
+        }
+    }
+}
+
 void SwDrawTextShell::Execute( SfxRequest &rReq )
 {
     SwWrtShell &rSh = GetShell();
@@ -565,13 +604,17 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
             assert(false && "wrong dispatcher");
             return;
     }
+
+    std::unique_ptr<SfxItemSet> pNewArgs = pNewAttrs->Clone();
+    lcl_convertStringArguments(nSlot, pNewArgs);
+
     if(nEEWhich && pNewAttrs)
     {
-        std::unique_ptr<SfxPoolItem> 
pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
-        aNewAttr.Put(*pNewItem);
+        std::unique_ptr<SfxPoolItem> 
pNewItem(pNewArgs->Get(nWhich).CloneSetWhich(nEEWhich));
+        pNewArgs->Put(*pNewItem);
     }
 
-    SetAttrToMarked(aNewAttr);
+    SetAttrToMarked(*pNewArgs);
 
     GetView().GetViewFrame()->GetBindings().InvalidateAll(false);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to