diff options
Diffstat (limited to 'svx/source/tbxctrls/tbxcolorupdate.cxx')
-rw-r--r-- | svx/source/tbxctrls/tbxcolorupdate.cxx | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index eb877795c3ae..45558e51b533 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -28,14 +28,18 @@ #include <vcl/settings.hxx> #include <tools/debug.hxx> +#include <svx/strings.hrc> +#include <svx/dialmgr.hxx> + namespace svx { ToolboxButtonColorUpdater::ToolboxButtonColorUpdater( - sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox, bool bWideButton) + sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox, bool bWideButton, const OUString& rCommandLabel) : mbWideButton(bWideButton) , mnBtnId(nTbxBtnId) , mpTbx(pToolBox) , maCurColor(COL_TRANSPARENT) + , maCommandLabel(rCommandLabel) { DBG_ASSERT(pToolBox, "ToolBox not found :-("); mbWasHiContrastMode = pToolBox && pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode(); @@ -43,21 +47,21 @@ namespace svx { case SID_ATTR_CHAR_COLOR: case SID_ATTR_CHAR_COLOR2: - Update(COL_RED_FONTCOLOR); + Update(NamedColor(COL_DEFAULT_FONT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FONT))); break; case SID_FRAME_LINECOLOR: - Update(COL_BLUE); + Update(NamedColor(COL_DEFAULT_FRAMELINE, SvxResId(RID_SVXSTR_COLOR_DEFAULT_FRAMELINE))); break; case SID_ATTR_CHAR_COLOR_BACKGROUND: case SID_ATTR_CHAR_BACK_COLOR: case SID_BACKGROUND_COLOR: - Update(COL_YELLOW_HIGHLIGHT); + Update(NamedColor(COL_DEFAULT_HIGHLIGHT, SvxResId(RID_SVXSTR_COLOR_DEFAULT_HIGHLIGHT))); break; case SID_ATTR_LINE_COLOR: - Update(COL_DEFAULT_SHAPE_STROKE); + Update(NamedColor(COL_DEFAULT_SHAPE_STROKE, SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_STROKE))); break; case SID_ATTR_FILL_COLOR: - Update(COL_DEFAULT_SHAPE_FILLING); + Update(NamedColor(COL_DEFAULT_SHAPE_FILLING, SvxResId(RID_SVXSTR_COLOR_DEFAULT_SHAPE_FILLING))); break; default: Update(COL_TRANSPARENT); @@ -67,6 +71,20 @@ namespace svx ToolboxButtonColorUpdater::~ToolboxButtonColorUpdater() {} + void ToolboxButtonColorUpdater::Update(const NamedColor &rNamedColor) + { + Update(rNamedColor.first); + if (!mbWideButton && !rNamedColor.second.isEmpty()) + { + // Also show the current color as QuickHelpText + OUString colorSuffix = " (%1)"; + colorSuffix = colorSuffix.replaceFirst("%1", rNamedColor.second); + OUString colorHelpText = maCommandLabel + colorSuffix; + + mpTbx->SetQuickHelpText(mnBtnId, colorHelpText); + } + } + void ToolboxButtonColorUpdater::Update(const Color& rColor, bool bForceUpdate) { Image aImage(mpTbx->GetItemImage(mnBtnId)); |