From 68c73b2cc26313de315e828cb9f8db53d9aeb6bf Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Sun, 14 Oct 2018 16:51:25 -0800 Subject: tdf#108751 Show currently selected color name in color button tooltip Based on Heiko Tietze's work in I26f0500527d2b86049948ca64e636e1ff566f262 Change-Id: I20541dd6ad155a39c0f87361088b44923406064f Reviewed-on: https://gerrit.libreoffice.org/61815 Tested-by: Jenkins Reviewed-by: Heiko Tietze Tested-by: Heiko Tietze --- reportdesign/source/ui/dlg/Condition.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'reportdesign/source/ui/dlg/Condition.cxx') diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index d3382478b766..5e8194fd7214 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -96,7 +96,7 @@ void ConditionColorWrapper::dispose() void ConditionColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rNamedColor) { - mxControl->ApplyCommand(mnSlotId, rNamedColor.first); + mxControl->ApplyCommand(mnSlotId, rNamedColor); } // = Condition @@ -161,9 +161,11 @@ Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction, m_nFontDialogId = m_pActions->GetItemId(".uno:FontDialog"); m_pBtnUpdaterBackgroundColor.reset( new svx::ToolboxButtonColorUpdater( - SID_BACKGROUND_COLOR, m_nBackgroundColorId, m_pActions ) ); + SID_BACKGROUND_COLOR, m_nBackgroundColorId, m_pActions, false, + m_pActions->GetItemText( m_nBackgroundColorId ) ) ); m_pBtnUpdaterFontColor.reset( new svx::ToolboxButtonColorUpdater( - SID_ATTR_CHAR_COLOR2, m_nFontColorId, m_pActions ) ); + SID_ATTR_CHAR_COLOR2, m_nFontColorId, m_pActions, false, + m_pActions->GetItemText( m_nFontColorId ) ) ); Show(); @@ -238,7 +240,8 @@ IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void) IMPL_LINK_NOARG( Condition, OnFormatAction, ToolBox*, void ) { - ApplyCommand(mapToolbarItemToSlotId(m_pActions->GetCurItemId()),COL_AUTO); + ApplyCommand(mapToolbarItemToSlotId(m_pActions->GetCurItemId()), + NamedColor(COL_AUTO, "#" + COL_AUTO.AsRGBHexString())); } IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton, void ) @@ -253,14 +256,14 @@ IMPL_LINK( Condition, OnConditionAction, Button*, _pClickedButton, void ) m_rAction.deleteCondition( getConditionIndex() ); } -void Condition::ApplyCommand( sal_uInt16 _nCommandId, const ::Color& _rColor) +void Condition::ApplyCommand( sal_uInt16 _nCommandId, const NamedColor& rNamedColor ) { if ( _nCommandId == SID_ATTR_CHAR_COLOR2 ) - m_pBtnUpdaterFontColor->Update( _rColor ); + m_pBtnUpdaterFontColor->Update( rNamedColor ); else if ( _nCommandId == SID_BACKGROUND_COLOR ) - m_pBtnUpdaterBackgroundColor->Update( _rColor ); + m_pBtnUpdaterBackgroundColor->Update( rNamedColor ); - m_rAction.applyCommand( m_nCondIndex, _nCommandId, _rColor ); + m_rAction.applyCommand( m_nCondIndex, _nCommandId, rNamedColor.first ); } void Condition::setImageList(sal_Int16 /*_eBitmapSet*/) -- cgit