sd/source/ui/view/drtxtob1.cxx |   29 ++++++++++++++++++++++++++++-
 svx/sdi/svx.sdi                |    2 +-
 2 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 780d83771af89e6b27b3618d9c033c3fb29ba803
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Nov 4 17:17:58 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Nov 5 09:46:16 2019 +0100

    jsdialogs: .uno:Color with string argument
    
    Change-Id: Ifdc95ff8c6a71340de3ed66cf58bc937e3730810
    Reviewed-on: https://gerrit.libreoffice.org/82038
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 4bdb32ecc627..d16a70e748ab 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -63,9 +63,34 @@
 #include <futempl.hxx>
 #include <DrawDocShell.hxx>
 #include <futext.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/colritem.hxx>
 
 #include <memory>
 
+namespace
+{
+    void lcl_convertStringArguments(std::unique_ptr<SfxItemSet>& pArgs)
+    {
+        Color aColor;
+        OUString sColor;
+        const SfxPoolItem* pColorStringItem = nullptr;
+
+        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, 
false, &pColorStringItem))
+        {
+            sColor = static_cast<const 
SfxStringItem*>(pColorStringItem)->GetValue();
+
+            if (sColor == "transparent")
+                aColor = COL_TRANSPARENT;
+            else
+                aColor = Color(sColor.toInt32(16));
+
+            SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
+            pArgs->Put(aColorItem);
+        }
+    }
+}
+
 namespace sd {
 
 /**
@@ -735,7 +760,9 @@ void TextObjectBar::Execute( SfxRequest &rReq )
                 pArgs = rReq.GetArgs();
             }
 
-            mpView->SetAttributes(*pArgs);
+            std::unique_ptr<SfxItemSet> pNewArgs = pArgs->Clone();
+            lcl_convertStringArguments(pNewArgs);
+            mpView->SetAttributes(*pNewArgs);
 
             // invalidate entire shell because of performance and
             // extension reasons
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index f3d5bd97af72..775dfa98309a 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -1506,7 +1506,7 @@ SfxVoidItem ClearOutline SID_OUTLINE_DELETEALL
 
 
 SvxColorItem Color SID_ATTR_CHAR_COLOR
-
+(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem Color 
SID_ATTR_CHAR_COLOR)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to