diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-06-02 11:55:40 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-06-03 17:25:53 +0000 |
commit | c0e07bc592b7fe270514ae392eacb6ebde3df879 (patch) | |
tree | 37bfdb135cfa3e836682ba36c5cdfb206f534e81 /svx | |
parent | 7695e2eb2e4f62cb09e06512ffc44796dc975fe4 (diff) |
tdf#88276: toolbar|sidebar button for text background colour
Change-Id: I547a562384d30b95b744673feb284ccbcf50a614
Reviewed-on: https://gerrit.libreoffice.org/16030
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Yousuf Philips <philipz85@hotmail.com>
Reviewed-by: Philippe Jung <phil.jung@free.fr>
Reviewed-by: Yousuf Philips <philipz85@hotmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/sdi/svx.sdi | 25 | ||||
-rw-r--r-- | svx/sdi/svxitems.sdi | 1 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.cxx | 19 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextPropertyPanel.hxx | 1 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 18 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.src | 5 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebartextpanel.ui | 33 |
7 files changed, 93 insertions, 9 deletions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 91f08bf8ba60..941f3e8d1966 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -2169,6 +2169,31 @@ SvxColorItem Color SID_ATTR_CHAR_COLOR GroupId = GID_FORMAT; ] +SvxBackgroundColorItem CharBackColor SID_ATTR_CHAR_BACK_COLOR + +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + Readonly = FALSE, + + /* config: */ + AccelConfig = FALSE, + MenuConfig = FALSE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_FORMAT; +] SfxBoolItem ColorControl SID_COLOR_CONTROL diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index b8d771160d06..6887062ebdfb 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -320,6 +320,7 @@ item INT16 SvxCharReliefItem; item BOOL SvxBlinkItem; item BOOL SvxAutoKernItem; item INT32 SvxColorItem; +item INT32 SvxBackgroundColorItem; item BOOL SvxContourItem; item INT16 SvxFormatBreakItem; // enum item BOOL SvxFormatKeepItem; diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx index 5e4f48a4b293..01661366285f 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -97,8 +97,9 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Ref get(mpToolBoxFont, "fonteffects"); get(mpToolBoxIncDec, "fontadjust"); get(mpToolBoxSpacing, "spacingbar"); - get(mpToolBoxFontColorSw, "colorbar"); - get(mpToolBoxFontColor, "colorsingle"); + get(mpToolBoxFontColorSw, "colorbar_writer"); + get(mpToolBoxFontColor, "colorbar_others"); + get(mpToolBoxBackgroundColor, "colorbar_background"); //toolbox SetupToolboxItems(); @@ -144,15 +145,20 @@ void TextPropertyPanel::HandleContextChange ( mpToolBoxIncDec->Show(maContext.GetApplication_DI() != sfx2::sidebar::EnumContext::Application_Calc); bool bWriterText = false; + bool bDrawText = false; + bool bNeedTextSpacing = false; + switch (maContext.GetCombinedContext_DI()) { case CombinedEnumContext(Application_Calc, Context_Cell): case CombinedEnumContext(Application_Calc, Context_Pivot): - mpToolBoxSpacing->Disable(); + // bNeedTextSpacing = false; break; case CombinedEnumContext(Application_Calc, Context_EditCell): case CombinedEnumContext(Application_Calc, Context_DrawText): + bNeedTextSpacing = true; + case CombinedEnumContext(Application_WriterVariants, Context_DrawText): case CombinedEnumContext(Application_WriterVariants, Context_Annotation): case CombinedEnumContext(Application_DrawImpress, Context_DrawText): @@ -162,12 +168,13 @@ void TextPropertyPanel::HandleContextChange ( case CombinedEnumContext(Application_DrawImpress, Context_Draw): case CombinedEnumContext(Application_DrawImpress, Context_TextObject): case CombinedEnumContext(Application_DrawImpress, Context_Graphic): - mpToolBoxSpacing->Enable(); + bNeedTextSpacing = true; + bDrawText = true; break; case CombinedEnumContext(Application_WriterVariants, Context_Text): case CombinedEnumContext(Application_WriterVariants, Context_Table): - mpToolBoxSpacing->Enable(); + bNeedTextSpacing = true; bWriterText = true; break; @@ -175,8 +182,10 @@ void TextPropertyPanel::HandleContextChange ( break; } + mpToolBoxSpacing->Enable(bNeedTextSpacing); mpToolBoxFontColor->Show(!bWriterText); mpToolBoxFontColorSw->Show(bWriterText); + mpToolBoxBackgroundColor->Show(bDrawText); } void TextPropertyPanel::DataChanged (const DataChangedEvent& /*rEvent*/) diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx index 7ea19a69d754..30e494b164ca 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.hxx +++ b/svx/source/sidebar/text/TextPropertyPanel.hxx @@ -87,6 +87,7 @@ private: VclPtr<ToolBox> mpToolBoxSpacing; VclPtr<ToolBox> mpToolBoxFontColorSw; VclPtr<ToolBox> mpToolBoxFontColor; + VclPtr<ToolBox> mpToolBoxBackgroundColor; //control items ::sfx2::sidebar::ControllerItem maFontSizeControl; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 2e962cc93946..50f20ee29959 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1436,6 +1436,8 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co aColor = static_cast<const XLineColorItem*>(pState)->GetColorValue(); else if ( pState->ISA( XFillColorItem ) ) aColor = static_cast<const XFillColorItem*>(pState)->GetColorValue(); + else if ( pState->ISA( SvxBackgroundColorItem ) ) + aColor = static_cast<const SvxBackgroundColorItem*>(pState)->GetValue(); } if ( aColor == COL_TRANSPARENT ) @@ -2553,6 +2555,11 @@ SvxColorToolBoxControl::SvxColorToolBoxControl( bSidebarType = false; break; + case SID_ATTR_CHAR_BACK_COLOR: + addStatusListener( OUString( ".uno:CharBackColor" )); + mPaletteManager.SetLastColor( COL_YELLOW ); + break; + case SID_FRAME_LINECOLOR: addStatusListener( OUString( ".uno:FrameLineColor" )); addStatusListener( OUString( ".uno:BorderTLBR" )); @@ -2616,6 +2623,10 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) ); break; + case SID_ATTR_CHAR_BACK_COLOR : + pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_CHAR_BACK_COLOR ) ); + break; + case SID_FRAME_LINECOLOR: pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) ); break; @@ -2714,6 +2725,11 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/) aParamName = "BackColor"; break; + case SID_ATTR_CHAR_BACK_COLOR : + aCommand = ".uno:CharBackColor"; + aParamName = "CharBackColor"; + break; + case SID_FRAME_LINECOLOR : aCommand = ".uno:FrameLineColor"; aParamName = "FrameLineColor"; @@ -2752,6 +2768,8 @@ void SvxColorToolBoxControl::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(XLineColorItem), nSlotId ) ); else if ( nSlotId == SID_ATTR_FILL_COLOR ) SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(XFillColorItem), nSlotId ) ); + else if ( nSlotId == SID_ATTR_CHAR_BACK_COLOR ) + SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(SvxBackgroundColorItem), nSlotId ) ); else SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(SvxColorItem), nSlotId ) ); } diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 6e0add7d9ae8..f6cd74635dc8 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -125,6 +125,11 @@ String RID_SVXSTR_EXTRAS_CHARBACKGROUND Text [ en-US ] = "Highlighting" ; }; +String RID_SVXSTR_CHAR_BACK_COLOR +{ + Text [ en-US ] = "Text Background Color" ; +}; + String RID_SVXSTR_BACKGROUND { Text [ en-US ] = "Background"; diff --git a/svx/uiconfig/ui/sidebartextpanel.ui b/svx/uiconfig/ui/sidebartextpanel.ui index 91930e9b0df5..eb962bad41d5 100644 --- a/svx/uiconfig/ui/sidebartextpanel.ui +++ b/svx/uiconfig/ui/sidebartextpanel.ui @@ -215,7 +215,7 @@ <property name="can_focus">False</property> <property name="spacing">12</property> <child> - <object class="sfxlo-SidebarToolBox" id="colorbar"> + <object class="sfxlo-SidebarToolBox" id="colorbar_writer"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="show_arrow">False</property> @@ -255,7 +255,7 @@ </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="colorsingle"> + <object class="sfxlo-SidebarToolBox" id="colorbar_others"> <property name="visible">True</property> <property name="can_focus">False</property> <child> @@ -280,6 +280,31 @@ </packing> </child> <child> + <object class="sfxlo-SidebarToolBox" id="colorbar_background"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuToolButton" id="backgroundcolor"> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="is_important">True</property> + <property name="action_name">.uno:CharBackColor</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> <object class="sfxlo-SidebarToolBox" id="position"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -315,7 +340,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">end</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -341,7 +366,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">end</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> |