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 /sw | |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/pch/precompiled_sw.hxx | 1 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 18 | ||||
-rw-r--r-- | sw/source/core/uibase/app/swmodule.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/uibase/docvw/edtwin.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/uibase/shells/textsh1.cxx | 63 | ||||
-rw-r--r-- | sw/uiconfig/sglobal/toolbar/extrusionobjectbar.xml | 2 | ||||
-rw-r--r-- | sw/uiconfig/sweb/toolbar/extrusionobjectbar.xml | 2 | ||||
-rw-r--r-- | sw/uiconfig/swform/toolbar/extrusionobjectbar.xml | 2 | ||||
-rw-r--r-- | sw/uiconfig/swreport/toolbar/extrusionobjectbar.xml | 2 | ||||
-rw-r--r-- | sw/uiconfig/swriter/toolbar/extrusionobjectbar.xml | 2 | ||||
-rw-r--r-- | sw/uiconfig/swxform/toolbar/extrusionobjectbar.xml | 2 |
11 files changed, 61 insertions, 52 deletions
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 |