svx/sdi/svx.sdi                     |    2 +-
 sw/source/uibase/shells/drawdlg.cxx |   31 ++++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 51f6b20a0c8c3b2830547e4400cf4c513e9d9c00
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Oct 31 07:45:40 2019 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Oct 31 11:00:44 2019 +0100

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

diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index acbee171bc2d..e51ca7732961 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -8860,7 +8860,7 @@ SvxWordLineModeItem WordMode SID_ATTR_CHAR_WORDLINEMODE
 
 
 XLineColorItem XLineColor SID_ATTR_LINE_COLOR
-
+(SfxStringItem Color SID_ATTR_COLOR_STR, XLineColorItem XLineColor 
SID_ATTR_LINE_COLOR)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
diff --git a/sw/source/uibase/shells/drawdlg.cxx 
b/sw/source/uibase/shells/drawdlg.cxx
index 6229cbd173d3..2c5a923e5983 100644
--- a/sw/source/uibase/shells/drawdlg.cxx
+++ b/sw/source/uibase/shells/drawdlg.cxx
@@ -34,6 +34,8 @@
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
 #include <memory>
+#include <svl/stritem.hxx>
+#include <svx/xlnclit.hxx>
 
 void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
 {
@@ -200,6 +202,29 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
             pDoc->SetChanged();
 }
 
+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));
+
+            XLineColorItem aLineColorItem(OUString(), aColor);
+            pArgs->Put(aLineColorItem);
+        }
+    }
+}
+
 void SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq)
 {
     SwWrtShell* pSh   = &GetShell();
@@ -213,7 +238,11 @@ void SwDrawShell::ExecDrawAttrArgs(SfxRequest const & rReq)
     if (pArgs)
     {
         if(pView->AreObjectsMarked())
-            pView->SetAttrToMarked(*rReq.GetArgs(), false);
+        {
+            std::unique_ptr<SfxItemSet> pNewArgs = pArgs->Clone();
+            lcl_convertStringArguments(pNewArgs);
+            pView->SetAttrToMarked(*pNewArgs, false);
+        }
         else
             pView->SetDefaultAttr(*rReq.GetArgs(), false);
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to