[Libreoffice-commits] core.git: extensions/source include/svx svx/source

Caolán McNamara caolanm at redhat.com
Mon May 22 11:55:44 UTC 2017


 extensions/source/propctrlr/standardcontrol.cxx |   36 +++++-------------------
 include/svx/dialogs.hrc                         |    1 
 svx/source/tbxctrls/tbcontrl.cxx                |    9 ++++++
 svx/source/tbxctrls/tbcontrl.src                |    5 +++
 4 files changed, 23 insertions(+), 28 deletions(-)

New commits:
commit 7539c77fd49889015ad3a952009e33fac5324df6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon May 22 12:05:17 2017 +0100

    Resolves: tdf#107981 SID_FM_CTL_PROPERTIES colorbox needs a 'default' entry
    
    we don't need MakeHexStr either, the colorbox will do that on its own
    
    Change-Id: Ifad523092c0f15cd51d0d829790c0cec1c96bb53
    Reviewed-on: https://gerrit.libreoffice.org/37898
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 4fdecfc2dd67..242074428e10 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -643,47 +643,27 @@ namespace pcr
 
     #define LB_DEFAULT_COUNT 20
 
-    OUString MakeHexStr(sal_uInt32 nVal, sal_Int32 nLength)
-    {
-        OUStringBuffer aStr;
-        while (nVal>0)
-        {
-            char c = char(nVal & 0x000F);
-            nVal >>= 4;
-            if (c<=9) c += '0';
-            else c += 'A' - 10;
-            aStr.insert(0, c);
-        }
-        while (aStr.getLength() < nLength) aStr.insert(0, '0');
-        return aStr.makeStringAndClear();
-    }
-
     OColorControl::OColorControl(vcl::Window* pParent, WinBits nWinStyle)
         : OColorControl_Base(PropertyControlType::ColorListBox, pParent, nWinStyle)
     {
+        getTypedControlWindow()->SetSlotId(SID_FM_CTL_PROPERTIES);
     }
 
     void SAL_CALL OColorControl::setValue( const Any& _rValue )
     {
-        if ( _rValue.hasValue() )
-        {
-            css::util::Color nColor = COL_TRANSPARENT;
+        css::util::Color nColor = COL_TRANSPARENT;
+        if (_rValue.hasValue())
             _rValue >>= nColor;
-            ::Color aRgbCol((ColorData)nColor);
-           getTypedControlWindow()->SelectEntry(std::make_pair(aRgbCol, MakeHexStr(nColor, 8)));
-        }
-        else
-            getTypedControlWindow()->SetNoSelection();
+        getTypedControlWindow()->SelectEntry(::Color((ColorData)nColor));
     }
 
     Any SAL_CALL OColorControl::getValue()
     {
         Any aPropValue;
-        if (!getTypedControlWindow()->IsNoSelection())
-        {
-            ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor();
-            aPropValue <<= (css::util::Color)aRgbCol.GetColor();
-        }
+        ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor();
+        if (aRgbCol == COL_TRANSPARENT)
+            return aPropValue;
+        aPropValue <<= (css::util::Color)aRgbCol.GetColor();
         return aPropValue;
     }
 
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 536e4b35dba2..38680a96750c 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -34,6 +34,7 @@
 #define RID_SVXSTR_NOFILL                   (RID_SVX_START + 190)
 #define RID_SVXSTR_BY_AUTHOR                (RID_SVX_START + 842)
 #define RID_SVXSTR_TRANSPARENT              (RID_SVX_START + 843)
+#define RID_SVXSTR_DEFAULT                  (RID_SVX_START + 844)
 #define RID_SVXSTR_INVISIBLE                (RID_SVX_START + 178)
 #define RID_SVXSTR_NONE                     (RID_SVX_START + 183)
 #define RID_SVXSTR_SOLID                    (RID_SVX_START + 160)
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 50af48d13d1a..b90927a7326e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1306,6 +1306,11 @@ SvxColorWindow::SvxColorWindow(const OUString&            rCommand,
             mpButtonAutoColor->SetText(EditResId::GetString(RID_SVXSTR_AUTOMATIC));
             break;
         }
+        case SID_FM_CTL_PROPERTIES:
+        {
+            mpButtonAutoColor->SetText( SvxResId( RID_SVXSTR_DEFAULT ) );
+            break;
+        }
         default:
         {
             mpButtonAutoColor->Hide();
@@ -1415,6 +1420,10 @@ namespace
                 aColor = COL_TRANSPARENT;
                 sColorName = SvxResId(RID_SVXSTR_TRANSPARENT);
                 break;
+            case SID_FM_CTL_PROPERTIES:
+                aColor = COL_TRANSPARENT;
+                sColorName = SvxResId(RID_SVXSTR_DEFAULT);
+                break;
             case SID_ATTR_CHAR_COLOR:
             case SID_ATTR_CHAR_COLOR2:
             case SID_EXTRUSION_3D_COLOR:
diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src
index 5b8e14e06640..61d72cc2b5a2 100644
--- a/svx/source/tbxctrls/tbcontrl.src
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -30,6 +30,11 @@ String RID_SVXSTR_TRANSPARENT
     Text [ en-US ] = "Transparent";
 };
 
+String RID_SVXSTR_DEFAULT
+{
+    Text [ en-US ] = "Default";
+};
+
 String RID_SVXSTR_FRAME
 {
     Text [ en-US ] = "Borders" ;


More information about the Libreoffice-commits mailing list