include/svx/tbxcolorupdate.hxx | 1 + svx/source/tbxctrls/tbcontrl.cxx | 2 +- svx/source/tbxctrls/tbxcolorupdate.cxx | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
New commits: commit f512f8818aec08a5b463c8acdf781e7ab27036f5 Author: Aditya <adityasahu1...@gmail.com> AuthorDate: Sat Apr 6 13:23:48 2019 +0530 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Tue Apr 9 03:54:41 2019 +0200 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: Jim Raykowski <rayk...@gmail.com> diff --git a/include/svx/tbxcolorupdate.hxx b/include/svx/tbxcolorupdate.hxx index 03b6a091a8eb..ec7639bac3c7 100644 --- a/include/svx/tbxcolorupdate.hxx +++ b/include/svx/tbxcolorupdate.hxx @@ -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; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 1843e0490fc6..0208ae8e335a 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -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); } diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 378f48721c7a..f7524c02bc1a 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -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: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits