diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-22 12:05:17 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-05-30 09:41:22 +0200 |
commit | 00b4da9c833c7763f03b9b1de6e55760b0a2c234 (patch) | |
tree | 779032588df1778487db483ec7e7cdd9f5493535 | |
parent | 56392a6821f2ea3358430a0cbc204efc33e6285d (diff) |
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
Reviewed-on: https://gerrit.libreoffice.org/37898
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 7539c77fd49889015ad3a952009e33fac5324df6)
Change-Id: Ifad523092c0f15cd51d0d829790c0cec1c96bb53
Reviewed-on: https://gerrit.libreoffice.org/37905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit c05f35f4f56a1e65b92f4b1bc43b0fa6138d209c)
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 36 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 9 |
2 files changed, 17 insertions, 28 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index af15abfb508e..b99445c6e315 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -642,47 +642,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 ) throw (IllegalTypeException, RuntimeException, std::exception) { - 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() throw (RuntimeException, std::exception) { 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/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 95ec9f400143..7b5a6cfd7843 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1300,6 +1300,11 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); break; } + case SID_FM_CTL_PROPERTIES: + { + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); + break; + } default: { mpButtonAutoColor->Hide(); @@ -1499,6 +1504,10 @@ namespace aColor = COL_TRANSPARENT; sColorName = SVX_RESSTR(RID_SVXSTR_TRANSPARENT); break; + case SID_FM_CTL_PROPERTIES: + aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_AUTOMATIC); + break; case SID_ATTR_CHAR_COLOR: case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: |