summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-22 12:05:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-24 10:35:19 +0200
commitc05f35f4f56a1e65b92f4b1bc43b0fa6138d209c (patch)
tree19bffc1a0c61b2127bca77aca508ebf3454b08c3
parentdea663395aa4256b1b0270320d3023fcfd6b4a33 (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>
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx36
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx9
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: