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>
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index af15abf..b99445c 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 95ec9f4..7b5a6cf 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: