diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2014-05-11 02:21:23 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2014-05-14 12:39:42 +0300 |
commit | 584b415924bba22db23a4258062e54973de0ed7c (patch) | |
tree | 6c1ee8bbbca7f20c61193710a99a6d4399d26d90 | |
parent | 2a98a03904895b6dce7ec53042b0204dbb379d5b (diff) |
Keep only one class for toolbox color controls
instead of 5 (mostly identical) classes.
Also the following bugs were fixed:
* All pickers now use split buttons. (fdo#45671)
* Color palette now indicates the current color. (fdo#73891)
(Previous changes related to that bug are reverted as part
of this commit.)
* Selecting a color from a float panel now updates the
button. (fdo#77683)
* For Font color/background color in Writer, the color
that is shown on the button, is always the one that's
actually used. (Can be a different color after hiding
the toolbar.)
* For Font color/background color in Writer, the button
now indicates when we're in the format paintbrush mode.
(Removed in 085e8a07e61ef2d3a82e11094d8773ab17cfdb3c
for some reason.)
Change-Id: Idb4829552240c52fb0882aca627c8177bbe2f839
25 files changed, 187 insertions, 663 deletions
diff --git a/include/svx/extrusioncolorcontrol.hxx b/include/svx/extrusioncolorcontrol.hxx deleted file mode 100644 index 668b7109eadc..000000000000 --- a/include/svx/extrusioncolorcontrol.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SVX_EXTRUSIONCOLORCONTROL_HXX -#define INCLUDED_SVX_EXTRUSIONCOLORCONTROL_HXX - -#include <sfx2/tbxctrl.hxx> -#include <svx/svxdllapi.h> -#include <svx/tbxcolorupdate.hxx> - -namespace svx { - -class SVX_DLLPUBLIC ExtrusionColorControl : public SfxToolBoxControl -{ -private: - ToolboxButtonColorUpdater* mpBtnUpdater; - Color mLastColor; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - ExtrusionColorControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~ExtrusionColorControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; -}; - -} - -#endif // INCLUDED_SVX_EXTRUSIONCOLORCONTROL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx index 94868eaae8a3..e086b0ed274f 100644 --- a/include/svx/tbcontrl.hxx +++ b/include/svx/tbcontrl.hxx @@ -39,17 +39,8 @@ Additional information from DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST) - SvxFontColorToolBoxControl - -------------------------- - Item type: SvxFontColorItem - Execute-Id: SID_ATTR_CHAR_COLOR - -> SvxFontColorItem - Additional information - from DocShell: presently none - in future: color palette - - class SvxColorExtToolBoxControl - ----------------------------------- + SvxColorToolBoxControl + ---------------------- Item type: SvxColorItem and SfxBoolItem @@ -57,7 +48,8 @@ Execute-Id SID_ATTR_CHAR_COLOR2 and SID_ATTR_CHAR_COLOR_EXT - for cell color (calc) + for font color + (calc/impress/draw and writer drawing objects) Execute-Id SID_ATTR_CHAR_COLOR for character background color (writer) @@ -65,19 +57,14 @@ and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT for paragraph background color (writer) + and cell background color (calc) Execute-Id SID_BACKGROUND_COLOR - for cell background color (calc) - Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND - for table/cell border color (writer, calc) Execute-Id SID_FRAME_LINECOLOR - SvxColorToolBoxControl - -------------------------------- - Item type: SvxBrushItem - Execute-Id: SID_BACKGROUND_COLOR - -> SvxColorItem + for 3D extrusion + Execute-Id SID_EXTRUSION_3D_COLOR SvxPatternToolBoxControl ------------------------ @@ -119,14 +106,6 @@ Bemerkung: provides a SvxLineItem, which provides a SvxBorderLine without color information. - SvxFrameLineColorToolBoxControl - ------------------------------- - Item type: SvxColorItem - Execute-Id: SID_FRAME_LINECOLOR - -> SvxColorItem - Additional information - from DocShell: none - SvxStyleToolBoxControl ---------------------- Item type: SfxTemplateItem @@ -147,7 +126,7 @@ #include <sfx2/tbxctrl.hxx> #include <svx/strarray.hxx> #include <svx/svxdllapi.h> - +#include <boost/scoped_ptr.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> // important im tbxctrls.hxx created HeDaBu !!! @@ -164,7 +143,6 @@ namespace svx } - // class SvxStyleToolBoxControl ------------------------------------------ class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl @@ -218,8 +196,6 @@ friend class SfxStyleControllerItem_Impl; // class SvxFontNameToolBoxControl --------------------------------------- - - class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl { public: @@ -232,70 +208,17 @@ public: }; +// class SvxColorToolBoxControl -------------------------------------- - -// class SvxFontColorToolBoxControl -------------------------------------- - - - - -class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl -{ - ::svx::ToolboxButtonColorUpdater* pBtnUpdater; - Color mLastColor; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SvxFontColorToolBoxControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; -}; - - - - -// class SvxColorExtToolBoxControl -------------------------------------- - - - - -class SVX_DLLPUBLIC SvxColorExtToolBoxControl : public SfxToolBoxControl +class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl { using SfxToolBoxControl::StateChanged; - ::svx::ToolboxButtonColorUpdater* pBtnUpdater; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater; Color mLastColor; - bool bChoiceFromPalette; - + DECL_LINK( SelectedHdl, Color* ); public: SFX_DECL_TOOLBOX_CONTROL(); - SvxColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SvxColorExtToolBoxControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; - virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; -}; - - - - -// class SvxColorToolBoxControl ------------------------------------------ - - - -class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl -{ - ::svx::ToolboxButtonColorUpdater* pBtnUpdater; - Color mLastColor; - -public: SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); virtual ~SvxColorToolBoxControl(); @@ -303,15 +226,12 @@ public: const SfxPoolItem* pState ) SAL_OVERRIDE; virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; + virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE; }; - - // class SvxFrameToolBoxControl ------------------------------------------ - - class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl { public: @@ -326,12 +246,8 @@ public: }; - - // class SvxLineStyleToolBoxControl -------------------------------------- - - class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl { public: @@ -345,30 +261,6 @@ public: }; - - -// class SvxFrameLineColorToolBoxControl --------------------------------- - - - -class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl -{ - ::svx::ToolboxButtonColorUpdater* pBtnUpdater; - Color mLastColor; - -public: - SFX_DECL_TOOLBOX_CONTROL(); - SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ); - virtual ~SvxFrameLineColorToolBoxControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE; - virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE; -}; - class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl { private: diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx index ae10756972c5..492f64717580 100644 --- a/reportdesign/source/ui/misc/toolboxcontroller.cxx +++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx @@ -179,7 +179,7 @@ void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments { m_aStates.insert(TCommandState::value_type(OUString(".uno:FontColor"),sal_True)); m_aStates.insert(TCommandState::value_type(OUString(".uno:Color"),sal_True)); - m_pToolbarController = TToolbarHelper::createFromQuery(new SvxColorExtToolBoxControl(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox)); + m_pToolbarController = TToolbarHelper::createFromQuery(new SvxColorToolBoxControl(m_nSlotId = SID_ATTR_CHAR_COLOR2,m_nToolBoxId,*pToolBox)); } else { @@ -248,10 +248,7 @@ void SAL_CALL OToolboxController::statusChanged( const FeatureStateEvent& Event util::Color nColor(COL_TRANSPARENT); Event.State >>= nColor; SvxColorItem aColorItem(::Color(nColor), 1); - if ( SID_ATTR_CHAR_COLOR2 == m_nSlotId ) - static_cast<SvxColorExtToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem); - else - static_cast<SvxColorToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem); + static_cast<SvxColorToolBoxControl*>(m_pToolbarController.get())->StateChanged(m_nSlotId,Event.IsEnabled ? SFX_ITEM_SET : SFX_ITEM_DISABLED,&aColorItem); } break; case SID_ATTR_CHAR_FONT: diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index fec06222d76f..b1e0261b905b 100644 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -715,7 +715,6 @@ #include <svx/drawitem.hxx> #include <svx/extedit.hxx> #include <svx/extrusionbar.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/fillctrl.hxx> #include <svx/fmdpage.hxx> #include <svx/fmglob.hxx> diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 1a0cd616c873..d4cf75920965 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -34,7 +34,6 @@ #include <avmedia/mediaplayer.hxx> #include <avmedia/mediatoolbox.hxx> #include <comphelper/types.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/fontworkgallery.hxx> #include <svx/tbxcustomshapes.hxx> @@ -188,11 +187,11 @@ void ScDLL::Init() SvxLineEndToolBoxControl ::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod); SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod); SvxFontNameToolBoxControl ::RegisterControl(SID_ATTR_CHAR_FONT, pMod); - SvxColorExtToolBoxControl ::RegisterControl(SID_ATTR_CHAR_COLOR, pMod); - SvxColorExtToolBoxControl ::RegisterControl(SID_BACKGROUND_COLOR, pMod); + SvxColorToolBoxControl ::RegisterControl(SID_ATTR_CHAR_COLOR, pMod); + SvxColorToolBoxControl ::RegisterControl(SID_BACKGROUND_COLOR, pMod); SvxFrameToolBoxControl ::RegisterControl(SID_ATTR_BORDER, pMod); SvxFrameLineStyleToolBoxControl ::RegisterControl(SID_FRAME_LINESTYLE, pMod); - SvxColorExtToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR, pMod); + SvxColorToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR, pMod); SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod ); SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod ); SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod ); @@ -237,7 +236,7 @@ void ScDLL::Init() SvxFontSizeMenuControl ::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod); // CustomShape extrusion controller - svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); + SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); // Child Windows diff --git a/sc/uiconfig/scalc/toolbar/extrusionobjectbar.xml b/sc/uiconfig/scalc/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sc/uiconfig/scalc/toolbar/extrusionobjectbar.xml +++ b/sc/uiconfig/scalc/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 7defc5f4a2c9..60ca725942ae 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -634,7 +634,6 @@ #include <svx/e3dundo.hxx> #include <svx/extedit.hxx> #include <svx/extrusionbar.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/f3dchild.hxx> #include <svx/fillctrl.hxx> #include <svx/float3d.hxx> diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 26db281cb5e8..40dcb4a4eef6 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -65,7 +65,6 @@ #include <svx/svxids.hrc> #include <svx/bmpmask.hxx> #include <svx/clipboardctl.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/f3dchild.hxx> #include <svx/fillctrl.hxx> #include <svx/fntctl.hxx> @@ -218,7 +217,7 @@ void SdDLL::RegisterControllers() SvxStyleToolBoxControl::RegisterControl(0, pMod); SvxFontNameToolBoxControl::RegisterControl(0, pMod); - SvxFontColorToolBoxControl::RegisterControl(0, pMod); + SvxColorToolBoxControl::RegisterControl(0, pMod); SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod ); SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod ); @@ -262,7 +261,7 @@ void SdDLL::RegisterControllers() SvxClipBoardControl::RegisterControl( SID_PASTE, pMod ); SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod ); - svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); + SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod ); @@ -270,7 +269,7 @@ void SdDLL::RegisterControllers() SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod ); SvxTableToolBoxControl::RegisterControl(SID_INSERT_TABLE, pMod ); SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod ); - SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); + SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); SvxSubToolBoxControl::RegisterControl(SID_OPTIMIZE_TABLE, pMod); } diff --git a/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml b/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml +++ b/sd/uiconfig/sdraw/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml b/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml +++ b/sd/uiconfig/simpress/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index e099f1a6751b..3aad292a7071 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -42,7 +42,7 @@ private: const sal_uInt16 theSlotId; SvxColorValueSet aColorSet; OUString maCommand; - const Color mLastColor; + Link maSelectedLink; DECL_LINK( SelectHdl, void * ); @@ -55,8 +55,7 @@ public: sal_uInt16 nSlotId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rWndTitle, - Window* pParentWindow, - const Color rLastColor = COL_AUTO); + Window* pParentWindow); virtual ~SvxColorWindow_Impl(); void StartSelection(); @@ -64,6 +63,7 @@ public: virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE; virtual SfxPopupWindow* Clone() const SAL_OVERRIDE; + void SetSelectedHdl( const Link& rLink ) { maSelectedLink = rLink; } }; #endif diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index a4ac4362c87e..42dfaa55c440 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -36,7 +36,6 @@ #include <svx/svdtrans.hxx> #include <svx/sdasitm.hxx> #include <svx/dialmgr.hxx> -#include "svx/extrusioncolorcontrol.hxx" #include "coreservices.hxx" #include "helpid.hrc" @@ -956,75 +955,6 @@ Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames( return ExtrusionSurfaceControl_getSupportedServiceNames(); } - - -SFX_IMPL_TOOLBOX_CONTROL( ExtrusionColorControl, SvxColorItem ); - -ExtrusionColorControl::ExtrusionColorControl( - sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) -: SfxToolBoxControl ( nSlotId, nId, rTbx ), - mLastColor( COL_AUTO ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); - mpBtnUpdater = new ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ); -} - - - -ExtrusionColorControl::~ExtrusionColorControl() -{ - delete mpBtnUpdater; -} - - - -SfxPopupWindowType ExtrusionColorControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - - - -SfxPopupWindow* ExtrusionColorControl::CreatePopupWindow() -{ - SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( - OUString( ".uno:Extrusion3DColor" ), - SID_EXTRUSION_3D_COLOR, - m_xFrame, - SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ), - &GetToolBox(), - mLastColor ); - pColorWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF ); - pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); - return pColorWin; -} - - - -void ExtrusionColorControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - sal_uInt16 nId = GetId(); - ToolBox& rTbx = GetToolBox(); - - if( nSID == SID_EXTRUSION_3D_COLOR ) - { - const SvxColorItem* pItem = 0; - - if( SFX_ITEM_DONTCARE != eState ) - pItem = PTR_CAST( SvxColorItem, pState ); - - if ( pItem ) - { - mpBtnUpdater->Update( pItem->GetValue()); - mLastColor = pItem->GetValue(); - } - } - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 2c222941f25f..3bab63d04d6b 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -114,11 +114,9 @@ using namespace ::com::sun::star::lang; SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorToolBoxControl, SvxColorItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxColorExtToolBoxControl, SvxColorItem ); +SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem ); -SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineColorToolBoxControl, SvxColorItem ); SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem ); @@ -1079,15 +1077,13 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, sal_uInt16 nSlotId, const Reference< XFrame >& rFrame, const OUString& rWndTitle, - Window* pParentWindow, - const ::Color rLastColor ) : + Window* pParentWindow ): SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ), theSlotId( nSlotId ), aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ), - maCommand( rCommand ), - mLastColor( rLastColor ) + maCommand( rCommand ) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); @@ -1138,17 +1134,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); aColorSet.Clear(); aColorSet.addEntriesForXColorList(*pColorList); - - short i = 0; - long nCount = pColorList->Count(); - XColorEntry* pEntry = NULL; - - for ( i = 0; i < nCount; i++ ) - { - pEntry = pColorList->GetColor(i); - if( pEntry->GetColor() == mLastColor ) - aColorSet.SelectItem( i+1 ); - } } aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) ); @@ -1158,6 +1143,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, aColorSet.Show(); AddStatusListener( OUString( ".uno:ColorTableState" )); + AddStatusListener( maCommand ); } SvxColorWindow_Impl::~SvxColorWindow_Impl() @@ -1171,15 +1157,21 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt ) SfxPopupWindow* SvxColorWindow_Impl::Clone() const { - return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent(), mLastColor ); + return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent() ); } - - IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl) { sal_uInt16 nItemId = aColorSet.GetSelectItemId(); - SvxColorItem aColorItem( aColorSet.GetItemColor( nItemId ), theSlotId ); + Color aColor; + if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) ) + aColor = COL_TRANSPARENT; + else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) ) + aColor = COL_AUTO; + else + aColor = aColorSet.GetItemColor( nItemId ); + + SvxColorItem aColorItem( aColor, theSlotId ); /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ @@ -1188,86 +1180,68 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl) if ( IsInPopupMode() ) EndPopupMode(); - if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId ) ) - { - Sequence< PropertyValue > aArgs; - SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), - maCommand, - aArgs ); - } - else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) ) - { - SvxColorItem _aColorItem( COL_AUTO, theSlotId ); - INetURLObject aObj( maCommand ); + INetURLObject aObj( maCommand ); - Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - _aColorItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), - maCommand, - aArgs ); - } - else - { - INetURLObject aObj( maCommand ); + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = aObj.GetURLPath(); + aColorItem.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), + maCommand, + aArgs ); - Any a; - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = aObj.GetURLPath(); - aColorItem.QueryValue( a ); - aArgs[0].Value = a; - SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), - maCommand, - aArgs ); - aColorSet.SelectItem( nItemId ); - } + if ( maSelectedLink.IsSet() ) + maSelectedLink.Call(&aColor); return 0; } - - void SvxColorWindow_Impl::Resize() { lcl_ResizeValueSet( *this, aColorSet); } - - void SvxColorWindow_Impl::StartSelection() { aColorSet.StartSelection(); } - - bool SvxColorWindow_Impl::Close() { return SfxPopupWindow::Close(); } - - void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { if (( SFX_ITEM_DISABLED != eState ) && pState ) { if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem ))) { - if ( pState ) + XColorListRef pColorList = ((SvxColorListItem *)pState)->GetColorList(); + const long nColorCount(pColorList->Count()); + const Size aNewSize(aColorSet.layoutAllVisible(nColorCount)); + aColorSet.SetOutputSizePixel(aNewSize); + static sal_Int32 nAdd = 4; + + SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); + aColorSet.Clear(); + aColorSet.addEntriesForXColorList(*pColorList); + } + else if ((SFX_ITEM_DEFAULT <= eState ) && ( pState->ISA( SvxColorItem ))) + { + aColorSet.SetNoSelection(); + const Color rColor = ((const SvxColorItem*)pState)->GetValue(); + for ( size_t i = 1; i < aColorSet.GetItemCount(); i++ ) { - XColorListRef pColorList = ((SvxColorListItem *)pState)->GetColorList(); - const long nColorCount(pColorList->Count()); - const Size aNewSize(aColorSet.layoutAllVisible(nColorCount)); - aColorSet.SetOutputSizePixel(aNewSize); - static sal_Int32 nAdd = 4; - - SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd)); - aColorSet.Clear(); - aColorSet.addEntriesForXColorList(*pColorList); + if ( rColor == aColorSet.GetItemColor(i) ) + { + aColorSet.SelectItem(i); + return; + } } + if ( rColor == COL_AUTO || rColor == COL_TRANSPARENT ) + aColorSet.SelectItem(0); } } } @@ -2314,175 +2288,27 @@ Window* SvxFontNameToolBoxControl::CreateItemWindow( Window *pParent ) } -// class SvxFontColorToolBoxControl -------------------------------------- - - -SvxFontColorToolBoxControl::SvxFontColorToolBoxControl( - sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ) - - : SfxToolBoxControl( nSlotId, nId, rTbx ), - pBtnUpdater( new ::svx::ToolboxButtonColorUpdater( - nSlotId, nId, &GetToolBox() )), - mLastColor( COL_AUTO ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); -} - - - -SvxFontColorToolBoxControl::~SvxFontColorToolBoxControl() -{ - delete pBtnUpdater; -} - - - -SfxPopupWindowType SvxFontColorToolBoxControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - - - -SfxPopupWindow* SvxFontColorToolBoxControl::CreatePopupWindow() -{ - SvxColorWindow_Impl* pColorWin = - new SvxColorWindow_Impl( - OUString( ".uno:Color" ), - SID_ATTR_CHAR_COLOR, - m_xFrame, - SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), - &GetToolBox(), - mLastColor); - - pColorWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); - pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); - return pColorWin; -} - - - -void SvxFontColorToolBoxControl::StateChanged( - - sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) - -{ - sal_uInt16 nId = GetId(); - ToolBox& rTbx = GetToolBox(); - const SvxColorItem* pItem = 0; - - if ( SFX_ITEM_DONTCARE != eState ) - pItem = PTR_CAST( SvxColorItem, pState ); - - if ( pItem ) - { - pBtnUpdater->Update( pItem->GetValue() ); - mLastColor= pItem->GetValue(); - } - - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); -} - - -// class SvxColorToolBoxControl -------------------------------- - - -SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - - SfxToolBoxControl( nSlotId, nId, rTbx ), - mLastColor( COL_AUTO ) -{ - if ( nSlotId == SID_BACKGROUND_COLOR ) - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); - else - rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); - rTbx.Invalidate(); - pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ); -} - - - -SvxColorToolBoxControl::~SvxColorToolBoxControl() -{ - delete pBtnUpdater; -} - - - -SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - - -SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow() -{ - sal_uInt16 nResId = GetSlotId() == SID_BACKGROUND_COLOR ? - RID_SVXSTR_BACKGROUND : RID_SVXSTR_COLOR; - SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( - OUString( ".uno:BackgroundColor" ), - SID_BACKGROUND_COLOR, - m_xFrame, - SVX_RESSTR(nResId), - &GetToolBox(), - mLastColor); - - pColorWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); - pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); - return pColorWin; -} - - - -void SvxColorToolBoxControl::StateChanged( - sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) -{ - const SvxColorItem* pItem = 0; - if ( SFX_ITEM_DONTCARE != eState ) - pItem = PTR_CAST( SvxColorItem, pState ); - - if ( pItem ) { - pBtnUpdater->Update( pItem->GetValue() ); - mLastColor= pItem->GetValue(); - } - - sal_uInt16 nId = GetId(); - ToolBox& rTbx = GetToolBox(); - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); -} - - -// class SvxColorExtToolBoxControl ---------------------------------------- +// class SvxColorToolBoxControl ---------------------------------------- /* Note: The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) . The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx - (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl()) - and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx - (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor) + (SvxColorToolBoxControl::SvxColorToolBoxControl()) + and in case of writer for text(background)color also in /core/sw/source/core/uibase/docvw/edtwin.cxx + (SwEditWin::m_aTextBackColor and SwEditWin::m_aTextColor) */ -SvxColorExtToolBoxControl::SvxColorExtToolBoxControl( +SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : SfxToolBoxControl( nSlotId, nId, rTbx ), - pBtnUpdater(0), mLastColor( COL_AUTO ) { rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); - bChoiceFromPalette = false; // The following commands are available at the various modules switch( nSlotId ) @@ -2498,8 +2324,11 @@ SvxColorExtToolBoxControl::SvxColorExtToolBoxControl( break; case SID_BACKGROUND_COLOR: + addStatusListener( OUString( ".uno:BackgroundColor" )); + mLastColor = COL_YELLOW; + break; + case SID_ATTR_CHAR_COLOR_BACKGROUND: - default: addStatusListener( OUString( ".uno:CharBackgroundExt" )); mLastColor = COL_YELLOW; break; @@ -2508,28 +2337,25 @@ SvxColorExtToolBoxControl::SvxColorExtToolBoxControl( addStatusListener( OUString( ".uno:FrameLineColor" )); mLastColor = COL_BLUE; break; + + case SID_EXTRUSION_3D_COLOR: + addStatusListener( OUString( ".uno:Extrusion3DColor")); + break; } - pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ); + pBtnUpdater.reset( new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) ); } - - -SvxColorExtToolBoxControl::~SvxColorExtToolBoxControl() +SvxColorToolBoxControl::~SvxColorToolBoxControl() { - delete pBtnUpdater; } - - -SfxPopupWindowType SvxColorExtToolBoxControl::GetPopupWindowType() const +SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const { return SFX_POPUPWINDOW_ONTIMEOUT; } - - -SfxPopupWindow* SvxColorExtToolBoxControl::CreatePopupWindow() +SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow() { SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( @@ -2537,8 +2363,7 @@ SfxPopupWindow* SvxColorExtToolBoxControl::CreatePopupWindow() GetSlotId(), m_xFrame, SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ), - &GetToolBox(), - mLastColor ); + &GetToolBox() ); switch( GetSlotId() ) { @@ -2553,61 +2378,57 @@ SfxPopupWindow* SvxColorExtToolBoxControl::CreatePopupWindow() case SID_FRAME_LINECOLOR: pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) ); break; + + case SID_EXTRUSION_3D_COLOR: + pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ) ); + break; } pColorWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); pColorWin->StartSelection(); SetPopupWindow( pColorWin ); - bChoiceFromPalette = true; + pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) ); return pColorWin; } +IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, Color*, aColor) +{ + pBtnUpdater->Update( *aColor ); + mLastColor = *aColor; + return 0; +} - -void SvxColorExtToolBoxControl::StateChanged( +void SvxColorToolBoxControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { - if (nSID == GetSlotId()) - { - ToolBox& rTbx = GetToolBox(); - sal_uInt16 nId = GetId(); - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); + ToolBox& rTbx = GetToolBox(); + sal_uInt16 nId = GetId(); + rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); + rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); - if (bChoiceFromPalette) + if ( nSID == SID_ATTR_CHAR_COLOR_EXT || nSID == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) + { + if ( pState && SFX_ITEM_DONTCARE != eState ) { - bChoiceFromPalette = false; - - const SvxColorItem* pItem = 0; - if ( SFX_ITEM_DONTCARE != eState ) - pItem = PTR_CAST( SvxColorItem, pState ); - - if ( pItem ) - { - pBtnUpdater->Update( pItem->GetValue() ); - mLastColor = pItem->GetValue(); - } + const SfxBoolItem* pBool = static_cast< const SfxBoolItem* >( pState ); + rTbx.CheckItem( nId, pBool && pBool->GetValue() ); } } } - - -void SvxColorExtToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/) +void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/) { OUString aCommand; OUString aParamName; - bool bNoArgs = false; switch( GetSlotId() ) { case SID_ATTR_CHAR_COLOR2 : - bNoArgs = true; aCommand = ".uno:CharColorExt"; - aParamName = "CharColorExt"; + aParamName = "FontColor"; break; case SID_ATTR_CHAR_COLOR : @@ -2621,23 +2442,24 @@ void SvxColorExtToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/) break; case SID_ATTR_CHAR_COLOR_BACKGROUND : - bNoArgs = true; aCommand = ".uno:CharBackgroundExt"; - aParamName = "CharBackgroundExt"; + aParamName = "BackColor"; break; case SID_FRAME_LINECOLOR : aCommand = ".uno:FrameLineColor"; aParamName = "FrameLineColor"; break; + + case SID_EXTRUSION_3D_COLOR: + aCommand = ".uno:Extrusion3DColor"; + aParamName = "Extrusion3DColor"; + break; } Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = aParamName; - if ( bNoArgs ) - aArgs[0].Value = makeAny( GetToolBox().IsItemChecked( GetId() )); - else - aArgs[0].Value = makeAny( (sal_uInt32)( mLastColor.GetColor() )); + aArgs[0].Value = makeAny( (sal_uInt32)( mLastColor.GetColor() )); Dispatch( aCommand, aArgs ); } @@ -2746,78 +2568,6 @@ void SvxFrameLineStyleToolBoxControl::StateChanged( } -// class SvxFrameLineColorToolBoxControl --------------------------------- - - -SvxFrameLineColorToolBoxControl::SvxFrameLineColorToolBoxControl( - sal_uInt16 nSlotId, - sal_uInt16 nId, - ToolBox& rTbx ) : - - SfxToolBoxControl( nSlotId, nId, rTbx ), - pBtnUpdater(new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() )), - mLastColor( COL_AUTO ) -{ - rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); -} - - - -SvxFrameLineColorToolBoxControl::~SvxFrameLineColorToolBoxControl() -{ - - delete pBtnUpdater; -} - - - -SfxPopupWindowType SvxFrameLineColorToolBoxControl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONCLICK; -} - - - -SfxPopupWindow* SvxFrameLineColorToolBoxControl::CreatePopupWindow() -{ - SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl( - OUString( ".uno:FrameLineColor" ), - SID_FRAME_LINECOLOR, - m_xFrame, - SVX_RESSTR(RID_SVXSTR_FRAME_COLOR), - &GetToolBox(), - mLastColor); - - pColorWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); - pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); - return pColorWin; -} - - - -void SvxFrameLineColorToolBoxControl::StateChanged( - sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState ) -{ - sal_uInt16 nId = GetId(); - ToolBox& rTbx = GetToolBox(); - rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState ); - rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE ); - - const SvxColorItem* pItem = 0; - if ( SFX_ITEM_DONTCARE != eState ) - { - pItem = PTR_CAST( SvxColorItem, pState ); - if ( pItem ) - { - pBtnUpdater->Update( pItem->GetValue()); - mLastColor = pItem->GetValue(); - } - } -} - - // class SvxSimpleUndoRedoController ------------------------------------- diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index f57e61a95e79..6f1b86736a49 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -38,9 +38,9 @@ namespace svx The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) . The initial color used by the button is set in /core/svx/source/tbxctrls/tbcontrl.cxx - (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl()) - and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx - (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor) + (SvxColorToolBoxControl::SvxColorToolBoxControl()) + and in case of writer for text(background)color also in /core/sw/source/core/uibase/docvw/edtwin.cxx + (SwEditWin::m_aTextBackColor and SwEditWin::m_aTextColor) */ ToolboxButtonColorUpdater::ToolboxButtonColorUpdater( diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 3f70597d3b57..ed6a9eca3654 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -831,7 +831,6 @@ #include <svx/drawitem.hxx> #include <svx/extedit.hxx> #include <svx/extrusionbar.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/fillctrl.hxx> #include <svx/flagsdef.hxx> #include <svx/fmglob.hxx> diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 9bde88a4149a..eb66d884ce34 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -772,8 +772,8 @@ SfxVoidItem ChapterNumberingDialog FN_NUMBERING_OUTLINE_DLG GroupId = GID_OPTIONS; ] -SfxBoolItem CharBackgroundExt SID_ATTR_CHAR_COLOR_BACKGROUND_EXT - +SfxVoidItem CharBackgroundExt SID_ATTR_CHAR_COLOR_BACKGROUND_EXT +(SvxColorItem BackColor SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) [ /* flags: */ AutoUpdate = TRUE, @@ -782,13 +782,14 @@ SfxBoolItem CharBackgroundExt SID_ATTR_CHAR_COLOR_BACKGROUND_EXT HasCoreId = FALSE, HasDialog = FALSE, ReadOnlyDoc = FALSE, - Toggle = TRUE, + Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, RecordPerSet; Synchron; - Readonly = FALSE, + /* status: */ + SlotType = SfxBoolItem /* config: */ AccelConfig = FALSE, @@ -798,8 +799,8 @@ SfxBoolItem CharBackgroundExt SID_ATTR_CHAR_COLOR_BACKGROUND_EXT GroupId = GID_FORMAT; ] -SfxBoolItem CharColorExt SID_ATTR_CHAR_COLOR_EXT - +SfxVoidItem CharColorExt SID_ATTR_CHAR_COLOR_EXT +(SvxColorItem FontColor SID_ATTR_CHAR_COLOR_EXT) [ /* flags: */ AutoUpdate = TRUE, @@ -808,13 +809,14 @@ SfxBoolItem CharColorExt SID_ATTR_CHAR_COLOR_EXT HasCoreId = FALSE, HasDialog = FALSE, ReadOnlyDoc = FALSE, - Toggle = TRUE, + Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, RecordPerSet; Synchron; - Readonly = FALSE, + /* status: */ + SlotType = SfxBoolItem /* config: */ AccelConfig = FALSE, diff --git a/sw/source/core/uibase/app/swmodule.cxx b/sw/source/core/uibase/app/swmodule.cxx index d7038062fcd5..f2f33eed0209 100644 --- a/sw/source/core/uibase/app/swmodule.cxx +++ b/sw/source/core/uibase/app/swmodule.cxx @@ -51,7 +51,6 @@ #include <svx/imapdlg.hxx> #include <svx/srchdlg.hxx> #include <svx/hyperdlg.hxx> -#include <svx/extrusioncolorcontrol.hxx> #include <svx/fontworkgallery.hxx> #include <svx/modctrl.hxx> #include <com/sun/star/scanner/ScannerManager.hpp> @@ -311,7 +310,7 @@ void SwDLL::RegisterControls() SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod ); SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod ); - svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); + SvxColorToolBoxControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod ); svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod ); SvxClipBoardControl::RegisterControl(SID_PASTE, pMod ); @@ -326,14 +325,14 @@ void SwDLL::RegisterControls() SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod ); SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod ); - SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod ); - SvxColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod ); - SvxColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod ); + SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod ); + SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod ); + SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod ); SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod ); - SvxColorExtToolBoxControl::RegisterControl( SID_BACKGROUND_COLOR, pMod ); + SvxColorToolBoxControl::RegisterControl( SID_BACKGROUND_COLOR, pMod ); SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod ); - SvxColorExtToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); + SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod ); SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod ); diff --git a/sw/source/core/uibase/docvw/edtwin.cxx b/sw/source/core/uibase/docvw/edtwin.cxx index 10db4c642084..e76b3dc85ee5 100644 --- a/sw/source/core/uibase/docvw/edtwin.cxx +++ b/sw/source/core/uibase/docvw/edtwin.cxx @@ -177,9 +177,9 @@ long SwEditWin::m_nDDStartPosX = 0; * The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx * (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) . * The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx - * (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl()) - * and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx - * (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor) + * (SvxColorToolBoxControl::SvxColorToolBoxControl()) + * and in case of writer for text(background)color also in /core/sw/source/core/uibase/docvw/edtwin.cxx + * (SwEditWin::m_aTextBackColor and SwEditWin::m_aTextColor) */ Color SwEditWin::m_aTextBackColor(COL_YELLOW); Color SwEditWin::m_aTextColor(COL_RED); diff --git a/sw/source/core/uibase/shells/textsh1.cxx b/sw/source/core/uibase/shells/textsh1.cxx index d92c8fa1f110..8200cc0630a4 100644 --- a/sw/source/core/uibase/shells/textsh1.cxx +++ b/sw/source/core/uibase/shells/textsh1.cxx @@ -1161,44 +1161,47 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case SID_ATTR_CHAR_COLOR_BACKGROUND: { - SwEditWin& rEdtWin = GetView().GetEditWin(); - SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - Color aSet; if(pItem) { - aSet = ((const SvxColorItem*)pItem)->GetValue(); - rEdtWin.SetTextBackColor(aSet); //select last color - } - else - rEdtWin.SetTextBackColor(Color(COL_TRANSPARENT)); //if last was "no fill" - if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) - { - SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND); - if(pItem) - aBrushItem.SetColor(aSet); //set the selected color - else - aBrushItem.SetColor(Color(COL_TRANSPARENT));//set "no fill" color - rWrtSh.SetAttrItem( aBrushItem ); - } - else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) - { - GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT); - } + Color aSet = ((const SvxColorItem*)pItem)->GetValue(); + SwEditWin& rEdtWin = GetView().GetEditWin(); + rEdtWin.SetTextBackColor(aSet); + SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - rReq.Done(); + if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI())) + { + SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND); + aBrushItem.SetColor(aSet); + rWrtSh.SetAttrItem( aBrushItem ); + } + else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) + { + GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT); + } + rReq.Done(); + } } break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: case SID_ATTR_CHAR_COLOR_EXT: { SwEditWin& rEdtWin = GetView().GetEditWin(); + if (pItem) + { + // The reason we need this argument here is that when a toolbar is closed + // and reopened, its color resets, while SwEditWin still holds the old one. + Color aSet = ((const SvxColorItem*)pItem)->GetValue(); + if( nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) + rEdtWin.SetTextBackColor(aSet); + else + rEdtWin.SetTextColor(aSet); + } + SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); SwApplyTemplate aTempl; - bool bSelection = rWrtSh.HasSelection(); - if(bSelection) + if ( rWrtSh.HasSelection() ) { - if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT) { rWrtSh.SetAttrItem( @@ -1542,12 +1545,18 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_ATTR_CHAR_COLOR2: { - rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2)); + SfxItemSet aSet( GetPool() ); + rSh.GetCurAttr( aSet ); + const SvxColorItem& aColorItem = static_cast< const SvxColorItem& >( aSet.Get(RES_CHRATR_COLOR) ); + rSet.Put( aColorItem, SID_ATTR_CHAR_COLOR2 ); } break; case SID_ATTR_CHAR_COLOR_BACKGROUND: { - rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND)); + SfxItemSet aSet( GetPool() ); + rSh.GetCurAttr( aSet ); + const SvxColorItem& aColorItem = static_cast< const SvxColorItem& >( aSet.Get(RES_CHRATR_BACKGROUND) ); + rSet.Put( aColorItem, SID_ATTR_CHAR_COLOR_BACKGROUND ); } break; case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: diff --git a/sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml b/sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml b/sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sw/uiconfig/swform/toolbar/extrusionobjectbar.xml b/sw/uiconfig/swform/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/swform/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/swform/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml b/sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml b/sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file diff --git a/sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml b/sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml index 017f89e5db50..09e65341e7ab 100644 --- a/sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml +++ b/sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml @@ -29,5 +29,5 @@ <toolbar:toolbaritem xlink:href=".uno:ExtrusionDirectionFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionLightingFloater" toolbar:style="dropdownonly"/> <toolbar:toolbaritem xlink:href=".uno:ExtrusionSurfaceFloater" toolbar:style="dropdownonly"/> - <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdownonly"/> + <toolbar:toolbaritem xlink:href=".uno:Extrusion3DColor" toolbar:style="dropdown"/> </toolbar:toolbar>
\ No newline at end of file |