Kaydet (Commit) ecc7308e authored tarafından Katarina Behrens's avatar Katarina Behrens

tdf#88276: New text background tab in char formatting dialog

Change-Id: I81880456d398e8bffd363626bac17ff9d54e7796
Reviewed-on: https://gerrit.libreoffice.org/19697Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
Tested-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst be1b03a4
...@@ -46,6 +46,7 @@ SdCharDlg::SdCharDlg( vcl::Window* pParent, const SfxItemSet* pAttr, ...@@ -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 ); 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 ); 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 ); 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 ) void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
...@@ -62,6 +63,11 @@ void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ...@@ -62,6 +63,11 @@ void SdCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
{ {
rPage.PageCreated(aSet); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <editeng/editdata.hxx> #include <editeng/editdata.hxx>
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <editeng/eeitem.hxx> #include <editeng/eeitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/brushitem.hxx>
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/request.hxx> #include <sfx2/request.hxx>
...@@ -66,10 +68,33 @@ void FuChar::DoExecute( SfxRequest& rReq ) ...@@ -66,10 +68,33 @@ void FuChar::DoExecute( SfxRequest& rReq )
SfxItemSet aEditAttr( mpDoc->GetPool() ); SfxItemSet aEditAttr( mpDoc->GetPool() );
mpView->GetAttributes( aEditAttr ); 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(), SfxItemSet aNewAttr( mpViewShell->GetPool(),
EE_ITEMS_START, EE_ITEMS_END ); aRanges );
aNewAttr.Put( aEditAttr, false ); 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(); SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0); std::unique_ptr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0);
sal_uInt16 nResult = RET_CANCEL; sal_uInt16 nResult = RET_CANCEL;
...@@ -84,7 +109,20 @@ void FuChar::DoExecute( SfxRequest& rReq ) ...@@ -84,7 +109,20 @@ void FuChar::DoExecute( SfxRequest& rReq )
if( nResult == RET_OK ) 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(); pArgs = rReq.GetArgs();
} }
} }
...@@ -105,6 +143,7 @@ void FuChar::DoExecute( SfxRequest& rReq ) ...@@ -105,6 +143,7 @@ void FuChar::DoExecute( SfxRequest& rReq )
SID_ATTR_CHAR_UNDERLINE, SID_ATTR_CHAR_UNDERLINE,
SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_FONTHEIGHT,
SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_COLOR,
SID_ATTR_CHAR_BACK_COLOR,
SID_ATTR_CHAR_KERNING, SID_ATTR_CHAR_KERNING,
SID_ATTR_CHAR_CASEMAP, SID_ATTR_CHAR_CASEMAP,
SID_SET_SUPER_SCRIPT, SID_SET_SUPER_SCRIPT,
......
...@@ -34,6 +34,7 @@ private: ...@@ -34,6 +34,7 @@ private:
sal_uInt16 mnCharName; sal_uInt16 mnCharName;
sal_uInt16 mnCharEffects; sal_uInt16 mnCharEffects;
sal_uInt16 mnCharPosition; sal_uInt16 mnCharPosition;
sal_uInt16 mnCharBackground;
const SfxObjectShell& rDocShell; const SfxObjectShell& rDocShell;
......
...@@ -130,6 +130,20 @@ ...@@ -130,6 +130,20 @@
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </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> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment