summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-15 10:54:46 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-15 10:57:30 +0200
commitc95d90199397b529de1a9979c065a7f35e52a188 (patch)
tree0d09b69bc627a184716e8d436f4e3403fa6b7938 /svx
parent8081794d91884f471494a0bbf41e69f5ec80e247 (diff)
Header/Footer: add the Border and Background... menu item
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/hdft.hxx6
-rw-r--r--svx/source/dialog/hdft.cxx92
2 files changed, 59 insertions, 39 deletions
diff --git a/svx/inc/svx/hdft.hxx b/svx/inc/svx/hdft.hxx
index b1dd6b82e58c..a196ee7870b5 100644
--- a/svx/inc/svx/hdft.hxx
+++ b/svx/inc/svx/hdft.hxx
@@ -40,6 +40,12 @@
#include <svx/pagectrl.hxx>
#include "svx/svxdllapi.h"
+namespace svx
+{
+ SVX_DLLPUBLIC bool ShowBorderBackgroundDlg( Window* pParent, SfxItemSet* pBBSet,
+ bool bEnableBackgroundSelector );
+}
+
// class SvxHFPage ------------------------------------------------------
class SVX_DLLPUBLIC SvxHFPage: public SfxTabPage
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;
}