Kaydet (Commit) f512f881 authored tarafından Aditya's avatar Aditya Kaydeden (comit) Jim Raykowski

tdf#124247: Fix tooltip message when color added to recent colors

Presently, the tool tip text in recent colors is shown in its
 hexadecimal representation when the split color button is clicked.
 Change the hexadecimal representation of the colors in 'recent
 colors' to its actual color name.

Change-Id: I59636eb124b75a9397337c9560bfff72804424ae
Reviewed-on: https://gerrit.libreoffice.org/70337
Tested-by: Jenkins
Reviewed-by: 's avatarJim Raykowski <raykowj@gmail.com>
üst 6c50ee33
......@@ -52,6 +52,7 @@ namespace svx
void Update( const NamedColor& rNamedColor );
void Update( const Color& rColor, bool bForceUpdate = false );
Color const & GetCurrentColor() const { return maCurColor; }
OUString GetCurrentColorName();
private:
ToolboxButtonColorUpdater(ToolboxButtonColorUpdater const &) = delete;
......
......@@ -3507,7 +3507,7 @@ void SvxColorToolBoxControl::execute(sal_Int16 /*nSelectModifier*/)
dispatchCommand( aCommand, aArgs );
EnsurePaletteManager();
OUString sColorName = "#" + aColor.AsRGBHexString().toAsciiUpperCase();
OUString sColorName = m_xBtnUpdater->GetCurrentColorName();
m_xPaletteManager->AddRecentColor(aColor, sColorName);
}
......
......@@ -142,6 +142,19 @@ namespace svx
mpTbx->SetItemOverlayImage(mnBtnId, Image(pVirDev->GetBitmapEx(Point(0,0), aItemSize)));
}
OUString ToolboxButtonColorUpdater::GetCurrentColorName()
{
OUString sColorName = mpTbx->GetQuickHelpText(mnBtnId);
// The obtained string is of format: color context (color name)
// Generate a substring which contains only the color name
sal_Int32 nStart = sColorName.indexOf('(');
sColorName = sColorName.copy( nStart + 1 );
sal_Int32 nLength = sColorName.getLength();
if(nLength > 0)
sColorName = sColorName.copy( 0, nLength - 1);
return sColorName;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment