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

Maxim Monastirsky momonasmon at gmail.com
Wed Oct 22 13:26:37 PDT 2014


 include/svx/dialogs.hrc                            |    5 -
 include/svx/tbcontrl.hxx                           |    1 
 svx/inc/helpid.hrc                                 |    1 
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |   93 ---------------------
 svx/source/sidebar/paragraph/ParaPropertyPanel.hrc |    4 
 svx/source/sidebar/paragraph/ParaPropertyPanel.hxx |   16 ---
 svx/source/sidebar/paragraph/ParaPropertyPanel.src |   23 -----
 svx/source/tbxctrls/tbcontrl.cxx                   |   32 +++++++
 svx/uiconfig/ui/sidebarparagraph.ui                |    2 
 9 files changed, 36 insertions(+), 141 deletions(-)

New commits:
commit 9f06a0988d39dddcd14c9424dd48e2990cf8351f
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Oct 22 22:11:31 2014 +0300

    fdo#84844 Sidebar: Use SvxColorToolBoxControl for paragraph color
    
    Change-Id: I0231a52288ca9a8a2a5e5cdb13fdff772b989640

diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 60e134f..0698052 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -26,7 +26,7 @@
 // Resource-Id's ------------------------------------------------------------
 
 // !!! IMPORTANT: consider and update FIRSTFREE when introducing new RIDs !!! (not for RIDs for Strings - they have there own)
-#define RID_SVX_FIRSTFREE                   334
+#define RID_SVX_FIRSTFREE                   333
 
 // some strings also used in CUI
 #define RID_SVXERRCTX                       (RID_SVX_START + 351)
@@ -221,9 +221,8 @@
 #define RID_POPUPPANEL_PARAPAGE_LINESPACING (RID_SVX_START + 329)
 #define RID_POPUPPANEL_PARAPAGE_BULLETS     (RID_SVX_START + 330)
 #define RID_POPUPPANEL_PARAPAGE_NUMBERING   (RID_SVX_START + 331)
-#define RID_POPUPPANEL_PARAPAGE_BACK_COLOR  (RID_SVX_START + 332)
 
-#define RID_SIDEBAR_INSERT_PANEL            (RID_SVX_START + 333)
+#define RID_SIDEBAR_INSERT_PANEL            (RID_SVX_START + 332)
 
 // !!! IMPORTANT: consider and update RID_SVX_FIRSTFREE when introducing new RIDs !!! (see above)
 
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index 5021cb8..6de49da 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -113,7 +113,6 @@
 #define HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND "SVX_HID_PPROPERTYPANEL_AREA_BTN_LEFT_SECOND"
 #define HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST "SVX_HID_PPROPERTYPANEL_AREA_BTN_RIGHT_FIRST"
 #define HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS "SVX_HID_PPROPERTYPANEL_TEXT_UNDERLINE_VS"
-#define HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS "SVX_HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS"
 #define HID_PPROPERTYPANEL_LINE_VS_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_VS_WIDTH"
 #define HID_PPROPERTYPANEL_LINE_MTR_WIDTH "SVX_HID_PPROPERTYPANEL_LINE_MTR_WIDTH"
 #define HID_PPROPERTYPANEL_LINE_VS_COLOR "SVX_HID_PPROPERTYPANEL_LINE_VS_COLOR"
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 017800c..d90aa65 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -16,8 +16,6 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#include <svx/sidebar/ColorControl.hxx>
-
 #include "ParaPropertyPanel.hxx"
 #include "ParaPropertyPanel.hrc"
 
@@ -31,8 +29,6 @@
 #include <sfx2/sidebar/Tools.hxx>
 #include <svx/sidebar/PopupContainer.hxx>
 #include <sfx2/dispatch.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/brushitem.hxx>
 #include <editeng/lrspitem.hxx>
 #include <editeng/ulspitem.hxx>
 #include <vcl/toolbox.hxx>
@@ -51,8 +47,6 @@ using namespace css::uno;
 const char UNO_DEFAULTBULLET[]    = ".uno:DefaultBullet";
 const char UNO_DEFAULTNUMBERING[] = ".uno:DefaultNumbering";
 
-const char UNO_PARABACKCOLOR[]    = ".uno:BackgroundColor";
-
 const char UNO_INCREMENTINDENT[]  = ".uno:IncrementIndent";
 const char UNO_DECREMENTINDENT[]  = ".uno:DecrementIndent";
 const char UNO_HANGINGINDENT[]    = ".uno:HangingIndent";
@@ -280,18 +274,6 @@ void ParaPropertyPanel::InitToolBoxIndent()
     m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
 }
 
-void ParaPropertyPanel::InitToolBoxBGColor()
-{
-    const sal_uInt16 nIdBackColor = mpTBxBackColor->GetItemId(UNO_PARABACKCOLOR);
-
-    mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(0 /* not defined, default is transparent */, nIdBackColor, mpTBxBackColor));
-    mpTBxBackColor->SetItemBits( nIdBackColor, mpTBxBackColor->GetItemBits( nIdBackColor ) | ToolBoxItemBits::DROPDOWNONLY );
-
-    Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
-    mpTBxBackColor->SetDropdownClickHdl ( aLink );
-    mpTBxBackColor->SetSelectHdl ( aLink );
-}
-
 void ParaPropertyPanel::InitToolBoxBulletsNumbering()
 {
     const sal_uInt16 nIdBullet = mpTBxNumBullet->GetItemId(UNO_DEFAULTBULLET);
@@ -347,7 +329,6 @@ void ParaPropertyPanel::initial()
 {
     //toolbox
     InitToolBoxIndent();
-    InitToolBoxBGColor();
     InitToolBoxBulletsNumbering();
     InitToolBoxSpacing();
     InitToolBoxLineSpacing();
@@ -396,47 +377,6 @@ IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
     return 0;
 }
 
-// for Background color
-IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
-{
-    const sal_uInt16 nId = pToolBox->GetCurItemId();
-    const OUString aCommand(pToolBox->GetItemCommand(nId));
-
-    if(aCommand == UNO_PARABACKCOLOR)
-    {
-        pToolBox->SetItemDown( nId, true );
-        maBGColorPopup.Show(*pToolBox);
-        maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
-    }
-    return 0;
-}
-
-void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState)
-{
-    if( eState >= SfxItemState::DEFAULT && pState->ISA(SvxColorItem))
-    {
-        const SvxColorItem* pItem = static_cast<const SvxColorItem*>(pState);
-        maColor = pItem->GetValue();
-        mbColorAvailable = true;
-        mpColorUpdater->Update(maColor);
-    }
-    else
-    {
-        mbColorAvailable = false;
-        maColor.SetColor(COL_AUTO);
-        mpColorUpdater->Update(maColor);
-    }
-}
-
-void ParaPropertyPanel::SetBGColor (
-    const OUString& /*rsColorName*/,
-    const Color aColor)
-{
-    SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
-    mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SfxCallMode::RECORD, &aColorItem, 0L);
-    maColor = aColor;
-}
-
 // for Paragraph Indent
 IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl)
 {
@@ -690,10 +630,6 @@ void ParaPropertyPanel::NotifyItemUpdate(
     case FN_NUM_NUM_RULE_INDEX:
         StateChangeBulletNumRuleImpl( nSID, eState, pState );
         break;
-
-    case SID_BACKGROUND_COLOR:
-        ParaBKGStateChanged(nSID, eState, pState);
-        break;
     }
 }
 
@@ -1049,37 +985,12 @@ PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pP
     return new ParaNumberingControl(pParent, *this);
 }
 
-namespace
-{
-    Color GetNoBackgroundColor(void)
-    {
-        return COL_TRANSPARENT;
-    }
-} // end of anonymous namespace
-
-PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
-{
-    const ResId aResId(SVX_RES(STR_NOFILL));
-
-    return new ColorControl(
-        pParent,
-        mpBindings,
-        SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
-        SVX_RES(VS_FONT_COLOR),
-        ::boost::bind(GetNoBackgroundColor),
-        ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
-        pParent,
-        &aResId);
-}
-
-
 ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
     const css::uno::Reference<css::frame::XFrame>& rxFrame,
     SfxBindings* pBindings,
     const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
     : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui", rxFrame),
 
-      mpColorUpdater (),
       maSpace3 (SVX_RES(IMG_SPACE3)),
       maIndHang (SVX_RES(IMG_INDENT_HANG)),
       maNumBImageList (SVX_RES(IL_NUM_BULLET)),
@@ -1093,8 +1004,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
       maLower (0),
       mnBulletTypeIndex ((sal_uInt16)0xFFFF),
       mnNumTypeIndex ((sal_uInt16)0xFFFF),
-      maColor (COL_AUTO),
-      mbColorAvailable (true),
       m_eMetricUnit(FUNIT_NONE),
       m_last_eMetricUnit(FUNIT_NONE),
       m_eLRSpaceUnit(),
@@ -1108,7 +1017,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
       maIncIndentControl(SID_INC_INDENT, *pBindings,*this, OUString("IncrementIndent"), rxFrame),
       maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, OUString("DefaultBullet"), rxFrame),
       maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, OUString("DefaultNumbering"), rxFrame),
-      maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this),
       m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
       maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
       maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
@@ -1118,7 +1026,6 @@ ParaPropertyPanel::ParaPropertyPanel(vcl::Window* pParent,
       maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
       maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
       maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
-      maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
       mxSidebar(rxSidebar)
 {
     //Alignment
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc
index 25eda69..3b76ca4 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hrc
@@ -22,7 +22,7 @@
 //for numbering and bullet
 #define IID_BULLET          1
 #define IID_NUMBER          2
-//============================== popup bullet and numbering & back color =========================
+//============================== popup bullet and numbering =========================
 #define VS_VALUES           1
 #define CB_BULLET_MORE      4
 #define BMP_BULLET_MORE     5
@@ -30,8 +30,6 @@
 #define VS_NUMBERING        10
 #define CB_NUMBERING_MORE   12
 #define BMP_NUMERING_MORE   13
-#define VS_FONT_COLOR       1
-#define STR_NOFILL          2
 
 //============================== line space popup page ==============================
 
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index db00d8f..b305b53 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -25,7 +25,6 @@
 #include <editeng/lspcitem.hxx>
 #include <svtools/ctrlbox.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
-#include <svx/tbxcolorupdate.hxx>
 #include <svx/relfld.hxx>
 #include <editeng/svxenum.hxx>
 #include <editeng/fhgtitem.hxx>
@@ -33,9 +32,6 @@
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/ui/XSidebar.hpp>
 
-#include <boost/scoped_ptr.hpp>
-
-#include <svx/sidebar/ColorPopup.hxx>
 #include <vcl/vclenum.hxx>
 #include <vcl/fixed.hxx>
 #include <svl/poolitem.hxx>
@@ -104,8 +100,6 @@ private:
     SvxRelativeField*   mpRightIndent;
     SvxRelativeField*   mpFLineIndent;
 
-    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
-
     // Resources
     Image  maSpace3;
     Image  maIndHang;
@@ -125,8 +119,6 @@ private:
 
     sal_uInt16          mnBulletTypeIndex;
     sal_uInt16          mnNumTypeIndex;
-    Color               maColor;
-    bool                    mbColorAvailable;
     FieldUnit                       m_eMetricUnit;
     FieldUnit                       m_last_eMetricUnit;
     SfxMapUnit                      m_eLRSpaceUnit;
@@ -141,7 +133,6 @@ private:
     ::sfx2::sidebar::ControllerItem  maIncIndentControl;
     ::sfx2::sidebar::ControllerItem  maBulletOnOff;
     ::sfx2::sidebar::ControllerItem  maNumberOnOff;
-    ::sfx2::sidebar::ControllerItem  maBackColorControl;
     ::sfx2::sidebar::ControllerItem  m_aMetricCtl;
     ::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
     ::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
@@ -152,7 +143,6 @@ private:
     ParaLineSpacingPopup maLineSpacePopup;
     ParaBulletsPopup maBulletsPopup;
     ParaNumberingPopup maNumberingPopup;
-    ColorPopup maBGColorPopup;
     css::uno::Reference<css::ui::XSidebar> mxSidebar;
 
 
@@ -170,7 +160,6 @@ private:
     DECL_LINK(ULSpaceHdl_Impl, void*);
     DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
 
-    void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
     void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
     void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
     void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
@@ -189,18 +178,13 @@ private:
     PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
     PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
     PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
-    PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
     DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
     DECL_LINK(NumBTbxDDHandler, ToolBox*);
-    DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
 
     void InitToolBoxIndent();
-    void InitToolBoxBGColor();
     void InitToolBoxBulletsNumbering();
     void InitToolBoxSpacing();
     void InitToolBoxLineSpacing();
-
-    void SetBGColor (const OUString& rsColorName, const Color aColor);
 };
 
 } } // end of namespace ::svx::sidebar
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.src b/svx/source/sidebar/paragraph/ParaPropertyPanel.src
index 677ade5..21a3fdc 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.src
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.src
@@ -60,29 +60,6 @@ ImageList IL_NUM_BULLET_RTL
     SVX_PROPERTYPANEL_PARA_NUMBULLET_IDLIST_RTL
 };
 
-//===========================================Back color page==============================
-Control RID_POPUPPANEL_PARAPAGE_BACK_COLOR
-{
-    OutputSize = TRUE;
-    DialogControl = TRUE;
-    Border = FALSE;
-    Size = MAP_APPFONT(  POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT  );
-
-    Control VS_FONT_COLOR
-    {
-        HelpID = HID_PPROPERTYPANEL_PARA_BACK_COLOR_VS ;
-        Hide = TRUE ;
-        Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y );
-        Size = MAP_APPFONT (  POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2);
-        TabStop = TRUE ;
-        Text = "Color Picker";
-    };
-    String STR_NOFILL
-    {
-        Text [ en-US ] = "No Color";
-    };
-};
-
 //===========================================Bullet popup page==============================
 Control RID_POPUPPANEL_PARAPAGE_BULLETS
 {
diff --git a/svx/uiconfig/ui/sidebarparagraph.ui b/svx/uiconfig/ui/sidebarparagraph.ui
index 286d12a..cc58e51 100644
--- a/svx/uiconfig/ui/sidebarparagraph.ui
+++ b/svx/uiconfig/ui/sidebarparagraph.ui
@@ -68,7 +68,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToolbar" id="backgroundcolor">
+          <object class="sfxlo-SidebarToolBox" id="backgroundcolor">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="has_tooltip">True</property>
commit e2b84636b3baf344cbc8f709478714ddea7caced
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Oct 22 21:44:45 2014 +0300

    Related: fdo#84844 Support of Sidebar wide buttons in SvxColorToolBoxControl
    
    The end goal is to convert the Sidebar to use
    SvxColorToolBoxControl, and get rid of the Sidebar
    specific color popup, so we don't need to maintain
    two popups.
    
    Change-Id: I42e5bcb611acae25f16dfe9623d19727fc39ea07

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 36426da..22b7bd0 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -220,6 +220,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
 
     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
     PaletteManager                      mPaletteManager;
+    bool bSidebarType;
     DECL_LINK( SelectedHdl, Color* );
 public:
     SFX_DECL_TOOLBOX_CONTROL();
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 83d3609..293d8a0 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -59,6 +59,7 @@
 #include "helpid.hrc"
 #include <sfx2/htmlmode.hxx>
 #include <sfx2/sidebar/Sidebar.hxx>
+#include <sfx2/sidebar/SidebarToolBox.hxx>
 #include <svx/xtable.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
@@ -2330,7 +2331,10 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
     ToolBox& rTbx ) :
     SfxToolBoxControl( nSlotId, nId, rTbx )
 {
-    rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
+    if ( dynamic_cast< sfx2::sidebar::SidebarToolBox* >(&rTbx) )
+        bSidebarType = true;
+    else
+        bSidebarType = false;
 
     // The following commands are available at the various modules
     switch( nSlotId )
@@ -2338,11 +2342,13 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
         case SID_ATTR_CHAR_COLOR:
             addStatusListener( OUString( ".uno:Color" ));
             mPaletteManager.SetLastColor( COL_RED );
+            bSidebarType = false;
             break;
 
         case SID_ATTR_CHAR_COLOR2:
             addStatusListener( OUString( ".uno:CharColorExt" ));
             mPaletteManager.SetLastColor( COL_RED );
+            bSidebarType = false;
             break;
 
         case SID_BACKGROUND_COLOR:
@@ -2353,6 +2359,7 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
         case SID_ATTR_CHAR_COLOR_BACKGROUND:
             addStatusListener( OUString( ".uno:CharBackgroundExt" ));
             mPaletteManager.SetLastColor( COL_YELLOW );
+            bSidebarType = false;
             break;
 
         case SID_FRAME_LINECOLOR:
@@ -2370,6 +2377,11 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
             break;
     }
 
+    if ( bSidebarType )
+        rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+    else
+        rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) );
+
     pBtnUpdater.reset( new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) );
     mPaletteManager.SetBtnUpdater( pBtnUpdater.get() );
 }
@@ -2448,10 +2460,28 @@ void SvxColorToolBoxControl::StateChanged(
             rTbx.CheckItem( nId, pBool && pBool->GetValue() );
         }
     }
+    else if ( bSidebarType && SfxItemState::DEFAULT <= eState )
+    {
+        Color aColor;
+        if ( pState->ISA( SvxColorItem ) )
+            aColor = static_cast< const SvxColorItem* >(pState)->GetValue();
+        else if ( pState->ISA( XLineColorItem ) )
+            aColor = static_cast< const XLineColorItem* >(pState)->GetColorValue();
+        pBtnUpdater->Update( aColor );
+    }
 }
 
 void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
 {
+    if ( bSidebarType )
+    {
+        // Open the popup also when Enter key is pressed.
+        css::uno::Reference< css::awt::XWindow > xWin = createPopupWindow();
+        if ( xWin.is() )
+            xWin->setFocus();
+        return;
+    }
+
     OUString aCommand;
     OUString aParamName;
 


More information about the Libreoffice-commits mailing list