diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-09-15 10:54:46 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-09-15 10:57:30 +0200 |
commit | c95d90199397b529de1a9979c065a7f35e52a188 (patch) | |
tree | 0d09b69bc627a184716e8d436f4e3403fa6b7938 /svx/source/dialog/hdft.cxx | |
parent | 8081794d91884f471494a0bbf41e69f5ec80e247 (diff) |
Header/Footer: add the Border and Background... menu item
Diffstat (limited to 'svx/source/dialog/hdft.cxx')
-rw-r--r-- | svx/source/dialog/hdft.cxx | 92 |
1 files changed, 53 insertions, 39 deletions
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 90438e867974..245c939cf339 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -89,6 +89,36 @@ static sal_uInt16 pRanges[] = 0 }; +namespace svx { + + bool ShowBorderBackgroundDlg( Window* pParent, SfxItemSet* pBBSet, + bool bEnableBackgroundSelector ) + { + bool bRes = false; + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if(pFact) + { + SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( pParent, *pBBSet, bEnableBackgroundSelector ); + DBG_ASSERT(pDlg, "Dialogdiet fail!"); + if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() ) + { + SfxItemIter aIter( *pDlg->GetOutputItemSet() ); + const SfxPoolItem* pItem = aIter.FirstItem(); + + while ( pItem ) + { + if ( !IsInvalidItem( pItem ) ) + pBBSet->Put( *pItem ); + pItem = aIter.NextItem(); + } + bRes = true; + } + delete pDlg; + } + return bRes; + } +} + // returns the Which values to the range @@ -531,54 +561,38 @@ IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG ) pBBSet->Put( *pItem ); } - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) + if ( svx::ShowBorderBackgroundDlg( this, pBBSet, bEnableBackgroundSelector ) ) { - SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() ) - { - SfxItemIter aIter( *pDlg->GetOutputItemSet() ); - const SfxPoolItem* pItem = aIter.FirstItem(); - - while ( pItem ) - { - if ( !IsInvalidItem( pItem ) ) - pBBSet->Put( *pItem ); - pItem = aIter.NextItem(); - } + //---------------------------------------------------------------- - //---------------------------------------------------------------- - - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich ); - if ( nId == SID_ATTR_PAGE_HEADERSET ) - aBspWin.SetHdColor( rItem.GetColor() ); - else - aBspWin.SetFtColor( rItem.GetColor() ); - } + sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); - //---------------------------------------------------------------- + if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) + { + const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich ); + if ( nId == SID_ATTR_PAGE_HEADERSET ) + aBspWin.SetHdColor( rItem.GetColor() ); + else + aBspWin.SetFtColor( rItem.GetColor() ); + } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + //---------------------------------------------------------------- - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich ); + nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - if ( nId == SID_ATTR_PAGE_HEADERSET ) - aBspWin.SetHdBorder( rItem ); - else - aBspWin.SetFtBorder( rItem ); - } + if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) + { + const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich ); - UpdateExample(); + if ( nId == SID_ATTR_PAGE_HEADERSET ) + aBspWin.SetHdBorder( rItem ); + else + aBspWin.SetFtBorder( rItem ); } - delete pDlg; + + UpdateExample(); } + return 0; } |