[Libreoffice-commits] core.git: include/svx svx/source

Maxim Monastirsky momonasmon at gmail.com
Sun Oct 8 17:58:49 UTC 2017


 include/svx/tbxcolorupdate.hxx         |    5 ++---
 svx/source/tbxctrls/tbcontrl.cxx       |    2 +-
 svx/source/tbxctrls/tbxcolorupdate.cxx |    7 ++++---
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 0112fa78b7867f0592e3bb2fb3babd76b91594ae
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Oct 8 00:15:56 2017 +0300

    tdf#106642 Wide color buttons are only for the sidebar
    
    Change-Id: I3c75495b0f450ccf0eb8f9de715c7c7befc7bbe6
    Reviewed-on: https://gerrit.libreoffice.org/43238
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/include/svx/tbxcolorupdate.hxx b/include/svx/tbxcolorupdate.hxx
index 4dc21b9b45ce..5fad1c3dc759 100644
--- a/include/svx/tbxcolorupdate.hxx
+++ b/include/svx/tbxcolorupdate.hxx
@@ -43,9 +43,7 @@ namespace svx
     class SVX_DLLPUBLIC ToolboxButtonColorUpdater
     {
     public:
-                    ToolboxButtonColorUpdater( sal_uInt16   nSlotId,
-                                               sal_uInt16   nTbxBtnId,
-                                               ToolBox*     ptrTbx);
+                    ToolboxButtonColorUpdater( sal_uInt16 nSlotId, sal_uInt16 nTbxBtnId, ToolBox* ptrTbx, bool bWideButton = false);
                     ~ToolboxButtonColorUpdater();
 
         void        Update( const Color& rColor, bool bForceUpdate = false );
@@ -55,6 +53,7 @@ namespace svx
         ToolboxButtonColorUpdater(ToolboxButtonColorUpdater &) = delete;
         void operator =(ToolboxButtonColorUpdater) = delete;
 
+        bool            mbWideButton;
         sal_uInt16      mnBtnId;
         sal_uInt16      mnSlotId;
         VclPtr<ToolBox> mpTbx;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 08333b13c2cf..fe75a925220c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2810,7 +2810,7 @@ void SvxColorToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>
         // Sidebar uses wide buttons for those.
         m_bSplitButton = typeid( *pToolBox ) != typeid( sfx2::sidebar::SidebarToolBox );
 
-    m_xBtnUpdater.reset( new svx::ToolboxButtonColorUpdater( m_nSlotId, nId, pToolBox ) );
+    m_xBtnUpdater.reset( new svx::ToolboxButtonColorUpdater( m_nSlotId, nId, pToolBox, !m_bSplitButton ) );
     pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
 }
 
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 7c89b1edd6f2..698f334de723 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -30,8 +30,9 @@
 namespace svx
 {
     ToolboxButtonColorUpdater::ToolboxButtonColorUpdater(
-        sal_uInt16 nId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox)
-        : mnBtnId(nTbxBtnId)
+        sal_uInt16 nId, sal_uInt16 nTbxBtnId, ToolBox* pToolBox, bool bWideButton)
+        : mbWideButton(bWideButton)
+        , mnBtnId(nTbxBtnId)
         , mnSlotId(nId)
         , mpTbx(pToolBox)
         , maCurColor(COL_TRANSPARENT)
@@ -69,7 +70,7 @@ namespace svx
     void ToolboxButtonColorUpdater::Update(const Color& rColor, bool bForceUpdate)
     {
         Image aImage(mpTbx->GetItemImage(mnBtnId));
-        Size aItemSize(mpTbx->GetItemContentSize(mnBtnId));
+        Size aItemSize(mbWideButton ? mpTbx->GetItemContentSize(mnBtnId) : aImage.GetSizePixel());
 
         const bool bSizeChanged = (maBmpSize != aItemSize);
         const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode());


More information about the Libreoffice-commits mailing list