cui/source/dialogs/colorpicker.cxx | 21 ++++++++------------- cui/source/tabpages/tpcolor.cxx | 2 +- include/svx/hexcolorcontrol.hxx | 7 ++++--- include/svx/xdef.hxx | 4 ++-- svx/source/dialog/hexcolorcontrol.cxx | 8 ++++---- 5 files changed, 19 insertions(+), 23 deletions(-)
New commits: commit 06ed7cd89b8cbbdfd64b474a5c0555a1047a96db Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Mar 1 15:38:06 2018 +0200 use more Color in HexColorControl Change-Id: I889fa9f2a8711e95f24336718e35d11d0945dec1 Reviewed-on: https://gerrit.libreoffice.org/50573 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 21d46383d5ac..fae025ce55d0 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -1227,22 +1227,17 @@ IMPL_LINK(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void) } else if (&rEdit == mpEDHex) { - sal_Int32 nColor = mpEDHex->GetColor(); + Color aColor = mpEDHex->GetColor(); - if (nColor != -1) + if (aColor != Color(0xffffffff) && aColor != GetColor()) { - Color aColor(nColor); + mdRed = static_cast<double>(aColor.GetRed()) / 255.0; + mdGreen = static_cast<double>(aColor.GetGreen()) / 255.0; + mdBlue = static_cast<double>(aColor.GetBlue()) / 255.0; - if (aColor != GetColor()) - { - mdRed = static_cast<double>(aColor.GetRed()) / 255.0; - mdGreen = static_cast<double>(aColor.GetGreen()) / 255.0; - mdBlue = static_cast<double>(aColor.GetBlue()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - n = UpdateFlags::All & ~UpdateFlags::Hex; - } + RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); + RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); + n = UpdateFlags::All & ~UpdateFlags::Hex; } } diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index d33173d9b83b..cffd860f785e 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -321,7 +321,7 @@ IMPL_LINK(SvxColorTabPage, ModifiedHdl_Impl, Edit&, rEdit, void) { // read current MtrFields, if cmyk, then k-value as transparency if(&rEdit == m_pHexcustom) - aCurrentColor = Color(m_pHexcustom->GetColor()); + aCurrentColor = m_pHexcustom->GetColor(); else { aCurrentColor = Color( static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pRcustom->GetValue()) )), diff --git a/include/svx/hexcolorcontrol.hxx b/include/svx/hexcolorcontrol.hxx index a9f9661e5e40..22d7cf2df540 100644 --- a/include/svx/hexcolorcontrol.hxx +++ b/include/svx/hexcolorcontrol.hxx @@ -29,6 +29,7 @@ #include <sot/exchange.hxx> #include <sax/tools/converter.hxx> #include <svx/svxdllapi.h> +#include <tools/color.hxx> class SVX_DLLPUBLIC HexColorControl : public Edit { @@ -38,8 +39,8 @@ public: virtual bool PreNotify( NotifyEvent& rNEvt ) override; virtual void Paste() override; - void SetColor( sal_Int32 nColor ); - sal_Int32 GetColor(); + void SetColor( ::Color nColor ); + ::Color GetColor(); private: static bool ImplProcessKeyInput( const KeyEvent& rKEv ); @@ -47,4 +48,4 @@ private: #endif // INCLUDED_SVX_HEXCOLOR_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/xdef.hxx b/include/svx/xdef.hxx index af2aba56d2ac..75ea49bc8c3a 100644 --- a/include/svx/xdef.hxx +++ b/include/svx/xdef.hxx @@ -78,8 +78,8 @@ class XLineTransparenceItem; class XLineWidthItem; class XSecondaryFillColorItem; -#define COL_DEFAULT_SHAPE_FILLING 0x729fcf -#define COL_DEFAULT_SHAPE_STROKE 0x3465a4 +#define COL_DEFAULT_SHAPE_FILLING ::Color(0x729fcf) +#define COL_DEFAULT_SHAPE_STROKE ::Color(0x3465a4) #define XATTR_START 1000 diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/svx/source/dialog/hexcolorcontrol.cxx index 884340980708..69032b1551fe 100644 --- a/svx/source/dialog/hexcolorcontrol.cxx +++ b/svx/source/dialog/hexcolorcontrol.cxx @@ -27,14 +27,14 @@ HexColorControl::HexColorControl( vcl::Window* pParent, WinBits nStyle ) VCL_BUILDER_FACTORY_ARGS(HexColorControl, WB_BORDER) -void HexColorControl::SetColor(sal_Int32 nColor) +void HexColorControl::SetColor(Color nColor) { OUStringBuffer aBuffer; - sax::Converter::convertColor(aBuffer, nColor); + sax::Converter::convertColor(aBuffer, sal_Int32(nColor)); SetText(aBuffer.makeStringAndClear().copy(1)); } -sal_Int32 HexColorControl::GetColor() +Color HexColorControl::GetColor() { sal_Int32 nColor = -1; @@ -55,7 +55,7 @@ sal_Int32 HexColorControl::GetColor() else SetControlBackground(); - return nColor; + return Color(nColor); } bool HexColorControl::PreNotify( NotifyEvent& rNEvt ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits