diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-10-30 16:13:27 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-11-02 12:36:03 +0000 |
commit | ecc7308efa973fd1f1985ff9a0a0f01414b73f2b (patch) | |
tree | fc822d5cdb3745228c5a3f00a640be1292ff2962 /sd | |
parent | be1b03a4b0f61b49a3aba8d6b78ae69be7295785 (diff) |
tdf#88276: New text background tab in char formatting dialog
Change-Id: I81880456d398e8bffd363626bac17ff9d54e7796
Reviewed-on: https://gerrit.libreoffice.org/19697
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Tested-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/dlgchar.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/func/fuchar.cxx | 43 | ||||
-rw-r--r-- | sd/source/ui/inc/dlg_char.hxx | 1 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/ui/drawchardialog.ui | 14 |
4 files changed, 62 insertions, 2 deletions
diff --git a/sd/source/ui/dlg/dlgchar.cxx b/sd/source/ui/dlg/dlgchar.cxx index 5e44899dce38..60db74563c1d 100644 --- a/sd/source/ui/dlg/dlgchar.cxx +++ b/sd/source/ui/dlg/dlgchar.cxx @@ -46,6 +46,7 @@ SdCharDlg::SdCharDlg( vcl::Window* pParent, const SfxItemSet* pAttr, mnCharName = AddTabPage( "RID_SVXPAGE_CHAR_NAME", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 ); mnCharEffects = AddTabPage( "RID_SVXPAGE_CHAR_EFFECTS", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 ); mnCharPosition = AddTabPage( "RID_SVXPAGE_CHAR_POSITION", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), 0 ); + mnCharBackground = AddTabPage( "RID_SVXPAGE_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); } void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) @@ -62,6 +63,11 @@ void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { rPage.PageCreated(aSet); } + else if (nId == mnCharBackground) + { + aSet.Put(SfxUInt32Item(SID_FLAG_TYPE,static_cast<sal_uInt32>(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING))); + rPage.PageCreated(aSet); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx index 5b5227ca77c5..705cb166ef51 100644 --- a/sd/source/ui/func/fuchar.cxx +++ b/sd/source/ui/func/fuchar.cxx @@ -24,6 +24,8 @@ #include <editeng/editdata.hxx> #include <svx/svxids.hrc> #include <editeng/eeitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> #include <vcl/msgbox.hxx> #include <sfx2/bindings.hxx> #include <sfx2/request.hxx> @@ -66,10 +68,33 @@ void FuChar::DoExecute( SfxRequest& rReq ) SfxItemSet aEditAttr( mpDoc->GetPool() ); mpView->GetAttributes( aEditAttr ); + static const sal_uInt16 aRanges[] = + { + EE_ITEMS_START, EE_ITEMS_END, + SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, + 0 + }; + SfxItemSet aNewAttr( mpViewShell->GetPool(), - EE_ITEMS_START, EE_ITEMS_END ); + aRanges ); aNewAttr.Put( aEditAttr, false ); + // EE_CHAR_BKGCOLOR is SvxBackgroundColorItem, but char background tabpage + // can only work with SvxBrushItems (it requires major undertaking to have + // it support anything else). Do the following then: + const SfxPoolItem* pItem; + if ( aNewAttr.GetItemState( EE_CHAR_BKGCOLOR, true, &pItem ) == SfxItemState::SET ) + { + // extract Color outta SvxBackColorItem + Color aBackColor = static_cast<const SvxBackgroundColorItem*>(pItem)->GetValue(); + // make new SvxBrushItem with this Color + SvxBrushItem aBrushItem( aBackColor, SID_ATTR_BRUSH_CHAR ); + + aNewAttr.ClearItem( EE_CHAR_BKGCOLOR ); + // and stick it into the set + aNewAttr.Put( aBrushItem ); + } + SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0); sal_uInt16 nResult = RET_CANCEL; @@ -84,7 +109,20 @@ void FuChar::DoExecute( SfxRequest& rReq ) if( nResult == RET_OK ) { - rReq.Done( *( pDlg->GetOutputItemSet() ) ); + const SfxItemSet* pOutputSet = pDlg->GetOutputItemSet(); + SfxItemSet pOtherSet( *pOutputSet ); + + // and now the reverse process + const SvxBrushItem* pBrushItem= static_cast<const SvxBrushItem*>(pOtherSet.GetItem( SID_ATTR_BRUSH_CHAR )); + + if ( pBrushItem ) + { + SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); + pOtherSet.ClearItem( SID_ATTR_BRUSH_CHAR ); + pOtherSet.Put( aBackColorItem ); + } + + rReq.Done( pOtherSet ); pArgs = rReq.GetArgs(); } } @@ -105,6 +143,7 @@ void FuChar::DoExecute( SfxRequest& rReq ) SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_BACK_COLOR, SID_ATTR_CHAR_KERNING, SID_ATTR_CHAR_CASEMAP, SID_SET_SUPER_SCRIPT, diff --git a/sd/source/ui/inc/dlg_char.hxx b/sd/source/ui/inc/dlg_char.hxx index 1075eed2fe14..361afd859756 100644 --- a/sd/source/ui/inc/dlg_char.hxx +++ b/sd/source/ui/inc/dlg_char.hxx @@ -34,6 +34,7 @@ private: sal_uInt16 mnCharName; sal_uInt16 mnCharEffects; sal_uInt16 mnCharPosition; + sal_uInt16 mnCharBackground; const SfxObjectShell& rDocShell; diff --git a/sd/uiconfig/sdraw/ui/drawchardialog.ui b/sd/uiconfig/sdraw/ui/drawchardialog.ui index 797a2e5affb4..424ffb471454 100644 --- a/sd/uiconfig/sdraw/ui/drawchardialog.ui +++ b/sd/uiconfig/sdraw/ui/drawchardialog.ui @@ -130,6 +130,20 @@ <property name="tab_fill">False</property> </packing> </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <object class="GtkLabel" id="RID_SVXPAGE_BACKGROUND"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Background</property> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> |