xref: /AOO41X/main/svx/source/dialog/hdft.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir #include <tools/shl.hxx>
33*cdf0e10cSrcweir #include <svl/itemiter.hxx>
34*cdf0e10cSrcweir #include <sfx2/app.hxx>
35*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
36*cdf0e10cSrcweir #include <sfx2/module.hxx>
37*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
38*cdf0e10cSrcweir #include <vcl/graph.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
41*cdf0e10cSrcweir #include <svx/svxids.hrc>
42*cdf0e10cSrcweir #include <svx/dialogs.hrc>
43*cdf0e10cSrcweir #include "hdft.hrc"
44*cdf0e10cSrcweir #include <svl/intitem.hxx>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #define _SVX_HDFT_CXX
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <svx/hdft.hxx>
49*cdf0e10cSrcweir #include <svx/pageitem.hxx>
50*cdf0e10cSrcweir //CHINA001 #include "bbdlg.hxx"
51*cdf0e10cSrcweir #include "svx/dlgutil.hxx"
52*cdf0e10cSrcweir #include <svx/dialmgr.hxx>
53*cdf0e10cSrcweir #include "svx/htmlmode.hxx"
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #include <editeng/brshitem.hxx>
56*cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
57*cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
58*cdf0e10cSrcweir #include <editeng/shaditem.hxx>
59*cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
60*cdf0e10cSrcweir #include <editeng/boxitem.hxx>
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
63*cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
64*cdf0e10cSrcweir // static ----------------------------------------------------------------
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir // --> OD 2004-06-18 #i19922#
67*cdf0e10cSrcweir //static const long MINBODY = 284;            // 0,5cm in twips aufgerundet
68*cdf0e10cSrcweir static const long MINBODY = 56;  // 1mm in twips rounded
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir // default distance to Header or footer
71*cdf0e10cSrcweir static const long DEF_DIST_WRITER = 500;	// 5mm (Writer)
72*cdf0e10cSrcweir static const long DEF_DIST_CALC = 250;		// 2,5mm (Calc)
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir static sal_uInt16 pRanges[] =
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir 	SID_ATTR_BRUSH,			 SID_ATTR_BRUSH,
77*cdf0e10cSrcweir 	SID_ATTR_BORDER_OUTER,	 SID_ATTR_BORDER_OUTER,
78*cdf0e10cSrcweir 	SID_ATTR_BORDER_INNER,	 SID_ATTR_BORDER_INNER,
79*cdf0e10cSrcweir 	SID_ATTR_BORDER_SHADOW,	 SID_ATTR_BORDER_SHADOW,
80*cdf0e10cSrcweir 	SID_ATTR_LRSPACE,		 SID_ATTR_LRSPACE,
81*cdf0e10cSrcweir 	SID_ATTR_ULSPACE,		 SID_ATTR_ULSPACE,
82*cdf0e10cSrcweir 	SID_ATTR_PAGE_SIZE,		 SID_ATTR_PAGE_SIZE,
83*cdf0e10cSrcweir 	SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
84*cdf0e10cSrcweir 	SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
85*cdf0e10cSrcweir 	SID_ATTR_PAGE_ON,		 SID_ATTR_PAGE_ON,
86*cdf0e10cSrcweir 	SID_ATTR_PAGE_DYNAMIC,	 SID_ATTR_PAGE_DYNAMIC,
87*cdf0e10cSrcweir 	SID_ATTR_PAGE_SHARED,	 SID_ATTR_PAGE_SHARED,
88*cdf0e10cSrcweir     SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
89*cdf0e10cSrcweir 	0
90*cdf0e10cSrcweir };
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir /*--------------------------------------------------------------------
93*cdf0e10cSrcweir 	Beschreibung:
94*cdf0e10cSrcweir  --------------------------------------------------------------------*/
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir // gibt den Bereich der Which-Werte zurueck
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir sal_uInt16* SvxHeaderPage::GetRanges()
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir 	return pRanges;
102*cdf0e10cSrcweir }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir //------------------------------------------------------------------------
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir SfxTabPage* SvxHeaderPage::Create( Window* pParent, const SfxItemSet& rSet )
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir 	return new SvxHeaderPage( pParent, rSet );
109*cdf0e10cSrcweir }
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir //------------------------------------------------------------------------
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir sal_uInt16* SvxFooterPage::GetRanges()
114*cdf0e10cSrcweir {
115*cdf0e10cSrcweir 	return pRanges;
116*cdf0e10cSrcweir }
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir // -----------------------------------------------------------------------
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir SfxTabPage* SvxFooterPage::Create( Window* pParent, const SfxItemSet& rSet )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir 	return new SvxFooterPage( pParent, rSet );
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir // -----------------------------------------------------------------------
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir SvxHeaderPage::SvxHeaderPage( Window* pParent, const SfxItemSet& rAttr ) :
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 	SvxHFPage( pParent, RID_SVXPAGE_HEADER, rAttr, SID_ATTR_PAGE_HEADERSET )
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir // -----------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	SvxHFPage( pParent, RID_SVXPAGE_FOOTER, rAttr, SID_ATTR_PAGE_FOOTERSET )
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir {
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir // -----------------------------------------------------------------------
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) :
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 	SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     aFrm            ( this, SVX_RES( FL_FRAME ) ),
150*cdf0e10cSrcweir 	aTurnOnBox		( this, SVX_RES( CB_TURNON ) ),
151*cdf0e10cSrcweir     aCntSharedBox   ( this, SVX_RES( CB_SHARED ) ),
152*cdf0e10cSrcweir     aLMLbl          ( this, SVX_RES( FT_LMARGIN ) ),
153*cdf0e10cSrcweir     aLMEdit         ( this, SVX_RES( ED_LMARGIN ) ),
154*cdf0e10cSrcweir     aRMLbl          ( this, SVX_RES( FT_RMARGIN ) ),
155*cdf0e10cSrcweir     aRMEdit         ( this, SVX_RES( ED_RMARGIN ) ),
156*cdf0e10cSrcweir     aDistFT         ( this, SVX_RES( FT_DIST ) ),
157*cdf0e10cSrcweir 	aDistEdit		( this, SVX_RES( ED_DIST ) ),
158*cdf0e10cSrcweir     aDynSpacingCB   ( this, SVX_RES( CB_DYNSPACING ) ),
159*cdf0e10cSrcweir     aHeightFT       ( this, SVX_RES( FT_HEIGHT ) ),
160*cdf0e10cSrcweir 	aHeightEdit		( this, SVX_RES( ED_HEIGHT ) ),
161*cdf0e10cSrcweir 	aHeightDynBtn	( this, SVX_RES( CB_HEIGHT_DYN ) ),
162*cdf0e10cSrcweir 	aBspWin			( this, SVX_RES( WN_BSP ) ),
163*cdf0e10cSrcweir 	aBackgroundBtn	( this, SVX_RES( BTN_EXTRAS ) ),
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     nId                         ( nSetId ),
166*cdf0e10cSrcweir     pBBSet                      ( NULL ),
167*cdf0e10cSrcweir     bDisableQueryBox            ( sal_False ),
168*cdf0e10cSrcweir 	bEnableBackgroundSelector	( sal_True )
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir {
171*cdf0e10cSrcweir 	InitHandler();
172*cdf0e10cSrcweir     aBspWin.EnableRTL( sal_False );
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	// diese Page braucht ExchangeSupport
175*cdf0e10cSrcweir 	SetExchangeSupport();
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 	FreeResource();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	// Metrik einstellen
180*cdf0e10cSrcweir 	FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
181*cdf0e10cSrcweir 	SetFieldUnit( aDistEdit, eFUnit );
182*cdf0e10cSrcweir 	SetFieldUnit( aHeightEdit, eFUnit );
183*cdf0e10cSrcweir 	SetFieldUnit( aLMEdit, eFUnit );
184*cdf0e10cSrcweir 	SetFieldUnit( aRMEdit, eFUnit );
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 	aTurnOnBox.SetAccessibleRelationMemberOf( &aFrm );
187*cdf0e10cSrcweir 	aCntSharedBox.SetAccessibleRelationMemberOf( &aFrm );
188*cdf0e10cSrcweir 	aLMLbl.SetAccessibleRelationMemberOf( &aFrm );
189*cdf0e10cSrcweir 	aLMEdit.SetAccessibleRelationMemberOf( &aFrm );
190*cdf0e10cSrcweir 	aRMLbl.SetAccessibleRelationMemberOf( &aFrm );
191*cdf0e10cSrcweir 	aRMEdit.SetAccessibleRelationMemberOf( &aFrm );
192*cdf0e10cSrcweir 	aDistFT.SetAccessibleRelationMemberOf( &aFrm );
193*cdf0e10cSrcweir 	aDistEdit.SetAccessibleRelationMemberOf( &aFrm );
194*cdf0e10cSrcweir 	aDynSpacingCB.SetAccessibleRelationMemberOf( &aFrm );
195*cdf0e10cSrcweir 	aHeightFT.SetAccessibleRelationMemberOf( &aFrm );
196*cdf0e10cSrcweir 	aHeightEdit.SetAccessibleRelationMemberOf( &aFrm );
197*cdf0e10cSrcweir 	aHeightDynBtn.SetAccessibleRelationMemberOf( &aFrm );
198*cdf0e10cSrcweir 	aBackgroundBtn.SetAccessibleRelationMemberOf(&aFrm);
199*cdf0e10cSrcweir }
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir // -----------------------------------------------------------------------
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir SvxHFPage::~SvxHFPage()
204*cdf0e10cSrcweir {
205*cdf0e10cSrcweir 	delete pBBSet;
206*cdf0e10cSrcweir }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir // -----------------------------------------------------------------------
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
211*cdf0e10cSrcweir {
212*cdf0e10cSrcweir 	const sal_uInt16		nWSize		= GetWhich( SID_ATTR_PAGE_SIZE );
213*cdf0e10cSrcweir 	const sal_uInt16		nWLRSpace	= GetWhich( SID_ATTR_LRSPACE );
214*cdf0e10cSrcweir 	const sal_uInt16		nWULSpace	= GetWhich( SID_ATTR_ULSPACE );
215*cdf0e10cSrcweir 	const sal_uInt16		nWOn		= GetWhich( SID_ATTR_PAGE_ON );
216*cdf0e10cSrcweir 	const sal_uInt16		nWDynamic	= GetWhich( SID_ATTR_PAGE_DYNAMIC );
217*cdf0e10cSrcweir     const sal_uInt16        nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING );
218*cdf0e10cSrcweir 	const sal_uInt16		nWShared	= GetWhich( SID_ATTR_PAGE_SHARED );
219*cdf0e10cSrcweir 	const sal_uInt16		nWBrush		= GetWhich( SID_ATTR_BRUSH );
220*cdf0e10cSrcweir 	const sal_uInt16		nWBox		= GetWhich( SID_ATTR_BORDER_OUTER );
221*cdf0e10cSrcweir 	const sal_uInt16		nWBoxInfo	= GetWhich( SID_ATTR_BORDER_INNER );
222*cdf0e10cSrcweir 	const sal_uInt16		nWShadow	= GetWhich( SID_ATTR_BORDER_SHADOW );
223*cdf0e10cSrcweir 	const sal_uInt16		aWhichTab[] = { nWSize,		nWSize,
224*cdf0e10cSrcweir 										nWLRSpace,	nWLRSpace,
225*cdf0e10cSrcweir 										nWULSpace,	nWULSpace,
226*cdf0e10cSrcweir 										nWOn,		nWOn,
227*cdf0e10cSrcweir 										nWDynamic,	nWDynamic,
228*cdf0e10cSrcweir 										nWShared,	nWShared,
229*cdf0e10cSrcweir 										nWBrush,	nWBrush,
230*cdf0e10cSrcweir 										nWBoxInfo,	nWBoxInfo,
231*cdf0e10cSrcweir 										nWBox,		nWBox,
232*cdf0e10cSrcweir 										nWShadow,	nWShadow,
233*cdf0e10cSrcweir                                         nWDynSpacing, nWDynSpacing,
234*cdf0e10cSrcweir 										0 };
235*cdf0e10cSrcweir 	const SfxItemSet&	rOldSet		= GetItemSet();
236*cdf0e10cSrcweir 	SfxItemPool*		pPool		= rOldSet.GetPool();
237*cdf0e10cSrcweir 	DBG_ASSERT( pPool, "no pool :-(" );
238*cdf0e10cSrcweir 	SfxMapUnit			eUnit		= pPool->GetMetric( nWSize );
239*cdf0e10cSrcweir 	SfxItemSet			aSet		( *pPool, aWhichTab );
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 	//--------------------------------------------------------------------
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	aSet.Put( SfxBoolItem( nWOn,	  aTurnOnBox.IsChecked() ) );
244*cdf0e10cSrcweir 	aSet.Put( SfxBoolItem( nWDynamic, aHeightDynBtn.IsChecked() ) );
245*cdf0e10cSrcweir 	aSet.Put( SfxBoolItem( nWShared,  aCntSharedBox.IsChecked() ) );
246*cdf0e10cSrcweir     if(aDynSpacingCB.IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
247*cdf0e10cSrcweir     {
248*cdf0e10cSrcweir         SfxBoolItem* pBoolItem = (SfxBoolItem*)pPool->GetDefaultItem(nWDynSpacing).Clone();
249*cdf0e10cSrcweir         pBoolItem->SetValue(aDynSpacingCB.IsChecked());
250*cdf0e10cSrcweir         aSet.Put(*pBoolItem);
251*cdf0e10cSrcweir         delete pBoolItem;
252*cdf0e10cSrcweir     }
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 	// Groesse
255*cdf0e10cSrcweir 	SvxSizeItem aSizeItem( (const SvxSizeItem&)rOldSet.Get( nWSize ) );
256*cdf0e10cSrcweir 	Size		aSize( aSizeItem.GetSize() );
257*cdf0e10cSrcweir 	long		nDist = GetCoreValue( aDistEdit, eUnit );
258*cdf0e10cSrcweir 	long		nH	  = GetCoreValue( aHeightEdit, eUnit );
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 	// fixe Hoehe?
261*cdf0e10cSrcweir //	if ( !aHeightDynBtn.IsChecked() )
262*cdf0e10cSrcweir 		nH += nDist; // dann Abstand dazu addieren
263*cdf0e10cSrcweir 	aSize.Height() = nH;
264*cdf0e10cSrcweir 	aSizeItem.SetSize( aSize );
265*cdf0e10cSrcweir 	aSet.Put( aSizeItem );
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 	// Raender
268*cdf0e10cSrcweir 	SvxLRSpaceItem aLR( nWLRSpace );
269*cdf0e10cSrcweir 	aLR.SetLeft( (sal_uInt16)GetCoreValue( aLMEdit, eUnit ) );
270*cdf0e10cSrcweir 	aLR.SetRight( (sal_uInt16)GetCoreValue( aRMEdit, eUnit ) );
271*cdf0e10cSrcweir 	aSet.Put( aLR );
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 	SvxULSpaceItem aUL( nWULSpace );
274*cdf0e10cSrcweir 	if ( nId == SID_ATTR_PAGE_HEADERSET )
275*cdf0e10cSrcweir 		aUL.SetLower( (sal_uInt16)nDist );
276*cdf0e10cSrcweir 	else
277*cdf0e10cSrcweir 		aUL.SetUpper( (sal_uInt16)nDist );
278*cdf0e10cSrcweir 	aSet.Put( aUL );
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	// Hintergrund und Umrandung?
281*cdf0e10cSrcweir 	if ( pBBSet )
282*cdf0e10cSrcweir 		aSet.Put( *pBBSet );
283*cdf0e10cSrcweir 	else
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir         const SfxItemSet* _pSet;
286*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 		if ( SFX_ITEM_SET ==
289*cdf0e10cSrcweir 			 GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
290*cdf0e10cSrcweir 		{
291*cdf0e10cSrcweir             _pSet = &( (SvxSetItem*)pItem )->GetItemSet();
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir             if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
294*cdf0e10cSrcweir                 aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) );
295*cdf0e10cSrcweir             if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET )
296*cdf0e10cSrcweir                 aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) );
297*cdf0e10cSrcweir             if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET )
298*cdf0e10cSrcweir                 aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) );
299*cdf0e10cSrcweir             if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET )
300*cdf0e10cSrcweir                 aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) );
301*cdf0e10cSrcweir 		}
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 	// Das SetItem wegschreiben
305*cdf0e10cSrcweir 	SvxSetItem aSetItem( GetWhich( nId ), aSet );
306*cdf0e10cSrcweir 	rSet.Put( aSetItem );
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir 	return sal_True;
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir // -----------------------------------------------------------------------
312*cdf0e10cSrcweir void SvxHFPage::Reset( const SfxItemSet& rSet )
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir 	ActivatePage( rSet );
315*cdf0e10cSrcweir 	ResetBackground_Impl( rSet );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 	SfxItemPool* pPool = GetItemSet().GetPool();
318*cdf0e10cSrcweir 	DBG_ASSERT( pPool, "Wo ist der Pool" );
319*cdf0e10cSrcweir 	SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 	// Kopf-/Fusszeilen-Attribute auswerten
322*cdf0e10cSrcweir 	//
323*cdf0e10cSrcweir 	const SvxSetItem* pSetItem = 0;
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich(nId), sal_False,
326*cdf0e10cSrcweir 											(const SfxPoolItem**)&pSetItem ) )
327*cdf0e10cSrcweir 	{
328*cdf0e10cSrcweir 		const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
329*cdf0e10cSrcweir 		const SfxBoolItem& rHeaderOn =
330*cdf0e10cSrcweir 			(const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON));
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 		aTurnOnBox.Check(rHeaderOn.GetValue());
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 		if ( rHeaderOn.GetValue() )
335*cdf0e10cSrcweir 		{
336*cdf0e10cSrcweir 			const SfxBoolItem& rDynamic =
337*cdf0e10cSrcweir 				(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
338*cdf0e10cSrcweir 			const SfxBoolItem& rShared =
339*cdf0e10cSrcweir 				(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) );
340*cdf0e10cSrcweir 			const SvxSizeItem& rSize =
341*cdf0e10cSrcweir 				(const SvxSizeItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
342*cdf0e10cSrcweir 			const SvxULSpaceItem& rUL =
343*cdf0e10cSrcweir 				(const SvxULSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
344*cdf0e10cSrcweir 			const SvxLRSpaceItem& rLR =
345*cdf0e10cSrcweir 				(const SvxLRSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
346*cdf0e10cSrcweir             if(aDynSpacingCB.IsVisible())
347*cdf0e10cSrcweir             {
348*cdf0e10cSrcweir                 const SfxBoolItem& rDynSpacing =
349*cdf0e10cSrcweir                     (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING));
350*cdf0e10cSrcweir                 aDynSpacingCB.Check(rDynSpacing.GetValue());
351*cdf0e10cSrcweir             }
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir             if ( nId == SID_ATTR_PAGE_HEADERSET )
355*cdf0e10cSrcweir 			{	// Kopfzeile
356*cdf0e10cSrcweir 				SetMetricValue( aDistEdit, rUL.GetLower(), eUnit );
357*cdf0e10cSrcweir 				SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
358*cdf0e10cSrcweir 			}
359*cdf0e10cSrcweir 			else
360*cdf0e10cSrcweir 			{	// Fusszeile
361*cdf0e10cSrcweir 				SetMetricValue( aDistEdit, rUL.GetUpper(), eUnit );
362*cdf0e10cSrcweir 				SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
363*cdf0e10cSrcweir 			}
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 			aHeightDynBtn.Check(rDynamic.GetValue());
366*cdf0e10cSrcweir 			SetMetricValue( aLMEdit, rLR.GetLeft(), eUnit );
367*cdf0e10cSrcweir 			SetMetricValue( aRMEdit, rLR.GetRight(), eUnit );
368*cdf0e10cSrcweir 			aCntSharedBox.Check(rShared.GetValue());
369*cdf0e10cSrcweir 		}
370*cdf0e10cSrcweir 		else
371*cdf0e10cSrcweir 			pSetItem = 0;
372*cdf0e10cSrcweir 	}
373*cdf0e10cSrcweir 	else
374*cdf0e10cSrcweir 	{
375*cdf0e10cSrcweir 		// defaults for distance and height
376*cdf0e10cSrcweir 		long nDefaultDist = DEF_DIST_WRITER;
377*cdf0e10cSrcweir 		const SfxPoolItem* pExt1 = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
378*cdf0e10cSrcweir 		const SfxPoolItem* pExt2 = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 		if ( pExt1 && pExt1->ISA(SfxBoolItem) && pExt2 && pExt2->ISA(SfxBoolItem) )
381*cdf0e10cSrcweir 			nDefaultDist = DEF_DIST_CALC;
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 		SetMetricValue( aDistEdit, nDefaultDist, SFX_MAPUNIT_100TH_MM );
384*cdf0e10cSrcweir 		SetMetricValue( aHeightEdit, 500, SFX_MAPUNIT_100TH_MM );
385*cdf0e10cSrcweir 	}
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 	if ( !pSetItem )
388*cdf0e10cSrcweir 	{
389*cdf0e10cSrcweir 		aTurnOnBox.Check( sal_False );
390*cdf0e10cSrcweir 		aHeightDynBtn.Check( sal_True );
391*cdf0e10cSrcweir 		aCntSharedBox.Check( sal_True );
392*cdf0e10cSrcweir 	}
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 	TurnOnHdl(0);
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 	aTurnOnBox.SaveValue();
397*cdf0e10cSrcweir 	aDistEdit.SaveValue();
398*cdf0e10cSrcweir 	aHeightEdit.SaveValue();
399*cdf0e10cSrcweir 	aHeightDynBtn.SaveValue();
400*cdf0e10cSrcweir 	aLMEdit.SaveValue();
401*cdf0e10cSrcweir 	aRMEdit.SaveValue();
402*cdf0e10cSrcweir 	aCntSharedBox.SaveValue();
403*cdf0e10cSrcweir 	RangeHdl( 0 );
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir 	sal_uInt16 nHtmlMode = 0;
406*cdf0e10cSrcweir 	const SfxPoolItem* pItem = 0;
407*cdf0e10cSrcweir 	SfxObjectShell* pShell;
408*cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
409*cdf0e10cSrcweir 		( 0 != (pShell = SfxObjectShell::Current()) &&
410*cdf0e10cSrcweir 					0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
411*cdf0e10cSrcweir 	{
412*cdf0e10cSrcweir 		nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
413*cdf0e10cSrcweir 		if(nHtmlMode && HTMLMODE_ON)
414*cdf0e10cSrcweir 		{
415*cdf0e10cSrcweir 			aCntSharedBox.Hide();
416*cdf0e10cSrcweir 			aBackgroundBtn.Hide();
417*cdf0e10cSrcweir 		}
418*cdf0e10cSrcweir 	}
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir }
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir /*--------------------------------------------------------------------
423*cdf0e10cSrcweir 	Beschreibung:	Handler initialisieren
424*cdf0e10cSrcweir  --------------------------------------------------------------------*/
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir void SvxHFPage::InitHandler()
427*cdf0e10cSrcweir {
428*cdf0e10cSrcweir 	aTurnOnBox.SetClickHdl(LINK(this, 	SvxHFPage, TurnOnHdl));
429*cdf0e10cSrcweir 	aDistEdit.SetModifyHdl(LINK(this, 	SvxHFPage, DistModify));
430*cdf0e10cSrcweir 	aDistEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir 	aHeightEdit.SetModifyHdl(LINK(this, 	SvxHFPage, HeightModify));
433*cdf0e10cSrcweir 	aHeightEdit.SetLoseFocusHdl(LINK(this,SvxHFPage,RangeHdl));
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 	aLMEdit.SetModifyHdl(LINK(this, 		SvxHFPage, BorderModify));
436*cdf0e10cSrcweir 	aLMEdit.SetLoseFocusHdl(LINK(this,	SvxHFPage, RangeHdl));
437*cdf0e10cSrcweir 	aRMEdit.SetModifyHdl(LINK(this, 		SvxHFPage, BorderModify));
438*cdf0e10cSrcweir 	aRMEdit.SetLoseFocusHdl(LINK(this,	SvxHFPage, RangeHdl));
439*cdf0e10cSrcweir 	aBackgroundBtn.SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
440*cdf0e10cSrcweir }
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir /*--------------------------------------------------------------------
443*cdf0e10cSrcweir 	Beschreibung:	Ein/aus
444*cdf0e10cSrcweir  --------------------------------------------------------------------*/
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir 	if ( aTurnOnBox.IsChecked() )
449*cdf0e10cSrcweir 	{
450*cdf0e10cSrcweir 		aDistFT.Enable();
451*cdf0e10cSrcweir 		aDistEdit.Enable();
452*cdf0e10cSrcweir         aDynSpacingCB.Enable();
453*cdf0e10cSrcweir 		aHeightFT.Enable();
454*cdf0e10cSrcweir 		aHeightEdit.Enable();
455*cdf0e10cSrcweir 		aHeightDynBtn.Enable();
456*cdf0e10cSrcweir 		aLMLbl.Enable();
457*cdf0e10cSrcweir 		aLMEdit.Enable();
458*cdf0e10cSrcweir 		aRMLbl.Enable();
459*cdf0e10cSrcweir 		aRMEdit.Enable();
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 		sal_uInt16 nUsage = aBspWin.GetUsage();
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 		if( nUsage == SVX_PAGE_RIGHT || nUsage == SVX_PAGE_LEFT )
464*cdf0e10cSrcweir 			aCntSharedBox.Disable();
465*cdf0e10cSrcweir 		else
466*cdf0e10cSrcweir 			aCntSharedBox.Enable();
467*cdf0e10cSrcweir 		aBackgroundBtn.Enable();
468*cdf0e10cSrcweir 	}
469*cdf0e10cSrcweir 	else
470*cdf0e10cSrcweir 	{
471*cdf0e10cSrcweir 		sal_Bool bDelete = sal_True;
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 		if ( !bDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
474*cdf0e10cSrcweir 			bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 		if ( bDelete )
477*cdf0e10cSrcweir 		{
478*cdf0e10cSrcweir 			aDistFT.Disable();
479*cdf0e10cSrcweir 			aDistEdit.Disable();
480*cdf0e10cSrcweir             aDynSpacingCB.Enable(sal_False);
481*cdf0e10cSrcweir             aHeightFT.Disable();
482*cdf0e10cSrcweir 			aHeightEdit.Disable();
483*cdf0e10cSrcweir 			aHeightDynBtn.Disable();
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir 			aLMLbl.Disable();
486*cdf0e10cSrcweir 			aLMEdit.Disable();
487*cdf0e10cSrcweir 			aRMLbl.Disable();
488*cdf0e10cSrcweir 			aRMEdit.Disable();
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 			aCntSharedBox.Disable();
491*cdf0e10cSrcweir 			aBackgroundBtn.Disable();
492*cdf0e10cSrcweir 		}
493*cdf0e10cSrcweir 		else
494*cdf0e10cSrcweir 			aTurnOnBox.Check();
495*cdf0e10cSrcweir 	}
496*cdf0e10cSrcweir 	UpdateExample();
497*cdf0e10cSrcweir 	return 0;
498*cdf0e10cSrcweir }
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir /*--------------------------------------------------------------------
501*cdf0e10cSrcweir 	Beschreibung:	Abstand im Bsp Modifizieren
502*cdf0e10cSrcweir  --------------------------------------------------------------------*/
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, DistModify, MetricField *, EMPTYARG )
505*cdf0e10cSrcweir {
506*cdf0e10cSrcweir 	UpdateExample();
507*cdf0e10cSrcweir 	return 0;
508*cdf0e10cSrcweir }
509*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, DistModify, MetricField *, EMPTYARG )
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
512*cdf0e10cSrcweir {
513*cdf0e10cSrcweir 	UpdateExample();
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir 	return 0;
516*cdf0e10cSrcweir }
517*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir /*--------------------------------------------------------------------
520*cdf0e10cSrcweir 	Beschreibung: Raender einstellen
521*cdf0e10cSrcweir  --------------------------------------------------------------------*/
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
524*cdf0e10cSrcweir {
525*cdf0e10cSrcweir 	UpdateExample();
526*cdf0e10cSrcweir 	return 0;
527*cdf0e10cSrcweir }
528*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir /*--------------------------------------------------------------------
531*cdf0e10cSrcweir 	Beschreibung:	Hintergrund
532*cdf0e10cSrcweir  --------------------------------------------------------------------*/
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG )
535*cdf0e10cSrcweir {
536*cdf0e10cSrcweir 	if ( !pBBSet )
537*cdf0e10cSrcweir 	{
538*cdf0e10cSrcweir 		// nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen
539*cdf0e10cSrcweir 		sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH );
540*cdf0e10cSrcweir 		sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER );
541*cdf0e10cSrcweir 		sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
542*cdf0e10cSrcweir 		sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir 		// einen leeren Set erzeugenc
545*cdf0e10cSrcweir 		pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush,
546*cdf0e10cSrcweir 								 nOuter, nOuter, nInner, nInner,
547*cdf0e10cSrcweir 								 nShadow, nShadow, 0 );
548*cdf0e10cSrcweir 		const SfxPoolItem* pItem;
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir 		if ( SFX_ITEM_SET ==
551*cdf0e10cSrcweir 			 GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
552*cdf0e10cSrcweir 			// wenn es schon einen gesetzen Set gibt, dann diesen benutzen
553*cdf0e10cSrcweir 			pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() );
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir 		if ( SFX_ITEM_SET ==
556*cdf0e10cSrcweir 			 GetItemSet().GetItemState( nInner, sal_False, &pItem ) )
557*cdf0e10cSrcweir 			// das gesetze InfoItem wird immer ben"otigt
558*cdf0e10cSrcweir 			pBBSet->Put( *pItem );
559*cdf0e10cSrcweir 	}
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir 	//CHINA001 SvxBorderBackgroundDlg* pDlg =
562*cdf0e10cSrcweir //CHINA001 		new SvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
563*cdf0e10cSrcweir 	SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
564*cdf0e10cSrcweir 	if(pFact)
565*cdf0e10cSrcweir 	{
566*cdf0e10cSrcweir 		SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
567*cdf0e10cSrcweir 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
568*cdf0e10cSrcweir 		if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
569*cdf0e10cSrcweir 		{
570*cdf0e10cSrcweir 			SfxItemIter aIter( *pDlg->GetOutputItemSet() );
571*cdf0e10cSrcweir 			const SfxPoolItem* pItem = aIter.FirstItem();
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir 			while ( pItem )
574*cdf0e10cSrcweir 			{
575*cdf0e10cSrcweir 				if ( !IsInvalidItem( pItem ) )
576*cdf0e10cSrcweir 					pBBSet->Put( *pItem );
577*cdf0e10cSrcweir 				pItem = aIter.NextItem();
578*cdf0e10cSrcweir 			}
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 			//----------------------------------------------------------------
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 			sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir 			if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
585*cdf0e10cSrcweir 			{
586*cdf0e10cSrcweir 				const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich );
587*cdf0e10cSrcweir 				if ( nId == SID_ATTR_PAGE_HEADERSET )
588*cdf0e10cSrcweir 					aBspWin.SetHdColor( rItem.GetColor() );
589*cdf0e10cSrcweir 				else
590*cdf0e10cSrcweir 					aBspWin.SetFtColor( rItem.GetColor() );
591*cdf0e10cSrcweir 			}
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir 			//----------------------------------------------------------------
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir 			nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir 			if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
598*cdf0e10cSrcweir 			{
599*cdf0e10cSrcweir 				const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich );
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir 				if ( nId == SID_ATTR_PAGE_HEADERSET )
602*cdf0e10cSrcweir 					aBspWin.SetHdBorder( rItem );
603*cdf0e10cSrcweir 				else
604*cdf0e10cSrcweir 					aBspWin.SetFtBorder( rItem );
605*cdf0e10cSrcweir 			}
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 			UpdateExample();
608*cdf0e10cSrcweir 		}
609*cdf0e10cSrcweir 	delete pDlg;
610*cdf0e10cSrcweir 	}
611*cdf0e10cSrcweir 	return 0;
612*cdf0e10cSrcweir }
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir /*--------------------------------------------------------------------
615*cdf0e10cSrcweir 	Beschreibung:	Bsp
616*cdf0e10cSrcweir  --------------------------------------------------------------------*/
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir void SvxHFPage::UpdateExample()
619*cdf0e10cSrcweir {
620*cdf0e10cSrcweir 	if ( nId == SID_ATTR_PAGE_HEADERSET )
621*cdf0e10cSrcweir 	{
622*cdf0e10cSrcweir 		aBspWin.SetHeader( aTurnOnBox.IsChecked() );
623*cdf0e10cSrcweir 		aBspWin.SetHdHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
624*cdf0e10cSrcweir 		aBspWin.SetHdDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
625*cdf0e10cSrcweir 		aBspWin.SetHdLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
626*cdf0e10cSrcweir 		aBspWin.SetHdRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
627*cdf0e10cSrcweir 	}
628*cdf0e10cSrcweir 	else
629*cdf0e10cSrcweir 	{
630*cdf0e10cSrcweir 		aBspWin.SetFooter( aTurnOnBox.IsChecked() );
631*cdf0e10cSrcweir 		aBspWin.SetFtHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
632*cdf0e10cSrcweir 		aBspWin.SetFtDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
633*cdf0e10cSrcweir 		aBspWin.SetFtLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
634*cdf0e10cSrcweir 		aBspWin.SetFtRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
635*cdf0e10cSrcweir 	}
636*cdf0e10cSrcweir 	aBspWin.Invalidate();
637*cdf0e10cSrcweir }
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir /*--------------------------------------------------------------------
640*cdf0e10cSrcweir 	Beschreibung: Hintergrund im Beispiel setzen
641*cdf0e10cSrcweir  --------------------------------------------------------------------*/
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
644*cdf0e10cSrcweir {
645*cdf0e10cSrcweir 	sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
648*cdf0e10cSrcweir 	{
649*cdf0e10cSrcweir 		const SvxSetItem& rSetItem =
650*cdf0e10cSrcweir 			(const SvxSetItem&)rSet.Get( nWhich, sal_False );
651*cdf0e10cSrcweir 		const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
652*cdf0e10cSrcweir 		const SfxBoolItem& rOn =
653*cdf0e10cSrcweir 			(const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 		if ( rOn.GetValue() )
656*cdf0e10cSrcweir 		{
657*cdf0e10cSrcweir 			nWhich = GetWhich( SID_ATTR_BRUSH );
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir 			if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
660*cdf0e10cSrcweir 			{
661*cdf0e10cSrcweir 				const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
662*cdf0e10cSrcweir 				aBspWin.SetHdColor( rItem.GetColor() );
663*cdf0e10cSrcweir 			}
664*cdf0e10cSrcweir 			nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir 			if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
667*cdf0e10cSrcweir 			{
668*cdf0e10cSrcweir 				const SvxBoxItem& rItem =
669*cdf0e10cSrcweir 					(const SvxBoxItem&)rTmpSet.Get( nWhich );
670*cdf0e10cSrcweir 				aBspWin.SetHdBorder( rItem );
671*cdf0e10cSrcweir 			}
672*cdf0e10cSrcweir 		}
673*cdf0e10cSrcweir 	}
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir 	nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir 	if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
678*cdf0e10cSrcweir 	{
679*cdf0e10cSrcweir 		const SvxSetItem& rSetItem =
680*cdf0e10cSrcweir 			(const SvxSetItem&)rSet.Get( nWhich, sal_False );
681*cdf0e10cSrcweir 		const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
682*cdf0e10cSrcweir 		const SfxBoolItem& rOn =
683*cdf0e10cSrcweir 			(const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 		if ( rOn.GetValue() )
686*cdf0e10cSrcweir 		{
687*cdf0e10cSrcweir 			nWhich = GetWhich( SID_ATTR_BRUSH );
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 			if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
690*cdf0e10cSrcweir 			{
691*cdf0e10cSrcweir 				const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
692*cdf0e10cSrcweir 				aBspWin.SetFtColor( rItem.GetColor() );
693*cdf0e10cSrcweir 			}
694*cdf0e10cSrcweir 			nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 			if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
697*cdf0e10cSrcweir 			{
698*cdf0e10cSrcweir 				const SvxBoxItem& rItem =
699*cdf0e10cSrcweir 					(const SvxBoxItem&)rTmpSet.Get( nWhich );
700*cdf0e10cSrcweir 				aBspWin.SetFtBorder( rItem );
701*cdf0e10cSrcweir 			}
702*cdf0e10cSrcweir 		}
703*cdf0e10cSrcweir 	}
704*cdf0e10cSrcweir 	nWhich = GetWhich( SID_ATTR_BRUSH );
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir 	if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
707*cdf0e10cSrcweir 	{
708*cdf0e10cSrcweir 		const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich );
709*cdf0e10cSrcweir 		aBspWin.SetColor( rItem.GetColor() );
710*cdf0e10cSrcweir 		const Graphic* pGrf = rItem.GetGraphic();
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir 		if ( pGrf )
713*cdf0e10cSrcweir 		{
714*cdf0e10cSrcweir 			Bitmap aBitmap = pGrf->GetBitmap();
715*cdf0e10cSrcweir 			aBspWin.SetBitmap( &aBitmap );
716*cdf0e10cSrcweir 		}
717*cdf0e10cSrcweir 		else
718*cdf0e10cSrcweir 			aBspWin.SetBitmap( NULL );
719*cdf0e10cSrcweir 	}
720*cdf0e10cSrcweir 	nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir 	if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
723*cdf0e10cSrcweir 	{
724*cdf0e10cSrcweir 		const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich );
725*cdf0e10cSrcweir 		aBspWin.SetBorder( rItem );
726*cdf0e10cSrcweir 	}
727*cdf0e10cSrcweir }
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir /*--------------------------------------------------------------------
730*cdf0e10cSrcweir 	Beschreibung:
731*cdf0e10cSrcweir  --------------------------------------------------------------------*/
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
734*cdf0e10cSrcweir {
735*cdf0e10cSrcweir 	const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 	if ( pItem )
738*cdf0e10cSrcweir 	{
739*cdf0e10cSrcweir 		// linken und rechten Rand einstellen
740*cdf0e10cSrcweir 		const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir 		aBspWin.SetLeft( rLRSpace.GetLeft() );
743*cdf0e10cSrcweir 		aBspWin.SetRight( rLRSpace.GetRight() );
744*cdf0e10cSrcweir 	}
745*cdf0e10cSrcweir 	else
746*cdf0e10cSrcweir 	{
747*cdf0e10cSrcweir 		aBspWin.SetLeft( 0 );
748*cdf0e10cSrcweir 		aBspWin.SetRight( 0 );
749*cdf0e10cSrcweir 	}
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_ULSPACE );
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir 	if ( pItem )
754*cdf0e10cSrcweir 	{
755*cdf0e10cSrcweir 		// oberen und unteren Rand einstellen
756*cdf0e10cSrcweir 		const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 		aBspWin.SetTop( rULSpace.GetUpper() );
759*cdf0e10cSrcweir 		aBspWin.SetBottom( rULSpace.GetLower() );
760*cdf0e10cSrcweir 	}
761*cdf0e10cSrcweir 	else
762*cdf0e10cSrcweir 	{
763*cdf0e10cSrcweir 		aBspWin.SetTop( 0 );
764*cdf0e10cSrcweir 		aBspWin.SetBottom( 0 );
765*cdf0e10cSrcweir 	}
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 	sal_uInt16 nUsage = SVX_PAGE_ALL;
768*cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_PAGE );
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir 	if ( pItem )
771*cdf0e10cSrcweir 		nUsage = ( (const SvxPageItem*)pItem )->GetPageUsage();
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir 	aBspWin.SetUsage( nUsage );
774*cdf0e10cSrcweir 
775*cdf0e10cSrcweir 	if ( SVX_PAGE_RIGHT == nUsage || SVX_PAGE_LEFT == nUsage )
776*cdf0e10cSrcweir 		aCntSharedBox.Disable();
777*cdf0e10cSrcweir 	else
778*cdf0e10cSrcweir 		aCntSharedBox.Enable();
779*cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir 	if ( pItem )
782*cdf0e10cSrcweir 	{
783*cdf0e10cSrcweir 		// Orientation und Size aus dem PageItem
784*cdf0e10cSrcweir 		const SvxSizeItem& rSize = (const SvxSizeItem&)*pItem;
785*cdf0e10cSrcweir 		// die Groesse ist ggf. schon geswappt (Querformat)
786*cdf0e10cSrcweir 		aBspWin.SetSize( rSize.GetSize() );
787*cdf0e10cSrcweir 	}
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir 	// Kopfzeilen-Attribute auswerten
790*cdf0e10cSrcweir 	const SvxSetItem* pSetItem = 0;
791*cdf0e10cSrcweir 
792*cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
793*cdf0e10cSrcweir 											sal_False,
794*cdf0e10cSrcweir 											(const SfxPoolItem**)&pSetItem ) )
795*cdf0e10cSrcweir 	{
796*cdf0e10cSrcweir 		const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
797*cdf0e10cSrcweir 		const SfxBoolItem& rHeaderOn =
798*cdf0e10cSrcweir 			(const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir 		if ( rHeaderOn.GetValue() )
801*cdf0e10cSrcweir 		{
802*cdf0e10cSrcweir 			const SvxSizeItem& rSize = (const SvxSizeItem&)
803*cdf0e10cSrcweir 				rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
804*cdf0e10cSrcweir 			const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
805*cdf0e10cSrcweir 				rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
806*cdf0e10cSrcweir 			const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
807*cdf0e10cSrcweir 				rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
808*cdf0e10cSrcweir 			long nDist = rUL.GetLower();
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir 			aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
811*cdf0e10cSrcweir 			aBspWin.SetHdDist( nDist );
812*cdf0e10cSrcweir 			aBspWin.SetHdLeft( rLR.GetLeft() );
813*cdf0e10cSrcweir 			aBspWin.SetHdRight( rLR.GetRight() );
814*cdf0e10cSrcweir 			aBspWin.SetHeader( sal_True );
815*cdf0e10cSrcweir 		}
816*cdf0e10cSrcweir 		else
817*cdf0e10cSrcweir 			pSetItem = 0;
818*cdf0e10cSrcweir 	}
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir 	if ( !pSetItem )
821*cdf0e10cSrcweir 	{
822*cdf0e10cSrcweir 		aBspWin.SetHeader( sal_False );
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir 		if ( SID_ATTR_PAGE_HEADERSET == nId )
825*cdf0e10cSrcweir 			aCntSharedBox.Disable();
826*cdf0e10cSrcweir 	}
827*cdf0e10cSrcweir 	pSetItem = 0;
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir 	if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
830*cdf0e10cSrcweir 											sal_False,
831*cdf0e10cSrcweir 											(const SfxPoolItem**)&pSetItem ) )
832*cdf0e10cSrcweir 	{
833*cdf0e10cSrcweir 		const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
834*cdf0e10cSrcweir 		const SfxBoolItem& rFooterOn =
835*cdf0e10cSrcweir 			(const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
836*cdf0e10cSrcweir 
837*cdf0e10cSrcweir 		if ( rFooterOn.GetValue() )
838*cdf0e10cSrcweir 		{
839*cdf0e10cSrcweir 			const SvxSizeItem& rSize = (const SvxSizeItem&)
840*cdf0e10cSrcweir 				rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
841*cdf0e10cSrcweir 			const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
842*cdf0e10cSrcweir 				rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
843*cdf0e10cSrcweir 			const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
844*cdf0e10cSrcweir 				rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
845*cdf0e10cSrcweir 			long nDist = rUL.GetUpper();
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir 			aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
848*cdf0e10cSrcweir 			aBspWin.SetFtDist( nDist );
849*cdf0e10cSrcweir 			aBspWin.SetFtLeft( rLR.GetLeft() );
850*cdf0e10cSrcweir 			aBspWin.SetFtRight( rLR.GetRight() );
851*cdf0e10cSrcweir 			aBspWin.SetFooter( sal_True );
852*cdf0e10cSrcweir 		}
853*cdf0e10cSrcweir 		else
854*cdf0e10cSrcweir 			pSetItem = 0;
855*cdf0e10cSrcweir 	}
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir 	if ( !pSetItem )
858*cdf0e10cSrcweir 	{
859*cdf0e10cSrcweir 		aBspWin.SetFooter( sal_False );
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir 		if ( SID_ATTR_PAGE_FOOTERSET == nId )
862*cdf0e10cSrcweir 			aCntSharedBox.Disable();
863*cdf0e10cSrcweir 	}
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 	if ( pItem && pItem->ISA(SfxBoolItem) )
868*cdf0e10cSrcweir 	{
869*cdf0e10cSrcweir 		aBspWin.SetTable( sal_True );
870*cdf0e10cSrcweir 		aBspWin.SetHorz( ( (SfxBoolItem*)pItem )->GetValue() );
871*cdf0e10cSrcweir 	}
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir 	pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
874*cdf0e10cSrcweir 
875*cdf0e10cSrcweir 	if ( pItem && pItem->ISA(SfxBoolItem) )
876*cdf0e10cSrcweir 	{
877*cdf0e10cSrcweir 		aBspWin.SetTable( sal_True );
878*cdf0e10cSrcweir 		aBspWin.SetVert( ( (SfxBoolItem*)pItem )->GetValue() );
879*cdf0e10cSrcweir 	}
880*cdf0e10cSrcweir 	ResetBackground_Impl( rSet );
881*cdf0e10cSrcweir 	RangeHdl( 0 );
882*cdf0e10cSrcweir }
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir /*--------------------------------------------------------------------
885*cdf0e10cSrcweir 	Beschreibung:
886*cdf0e10cSrcweir  --------------------------------------------------------------------*/
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir int SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
889*cdf0e10cSrcweir {
890*cdf0e10cSrcweir     if ( _pSet )
891*cdf0e10cSrcweir         FillItemSet( *_pSet );
892*cdf0e10cSrcweir 	return LEAVE_PAGE;
893*cdf0e10cSrcweir }
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir /*--------------------------------------------------------------------
896*cdf0e10cSrcweir 	Beschreibung:	Berech
897*cdf0e10cSrcweir  --------------------------------------------------------------------*/
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir IMPL_LINK( SvxHFPage, RangeHdl, Edit *, EMPTYARG )
900*cdf0e10cSrcweir {
901*cdf0e10cSrcweir 	long nHHeight = aBspWin.GetHdHeight();
902*cdf0e10cSrcweir 	long nHDist   = aBspWin.GetHdDist();
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir 	long nFHeight = aBspWin.GetFtHeight();
905*cdf0e10cSrcweir 	long nFDist   = aBspWin.GetFtDist();
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir 	long nHeight = Max( (long)MINBODY,
908*cdf0e10cSrcweir 		static_cast<long>(aHeightEdit.Denormalize( aHeightEdit.GetValue( FUNIT_TWIP ) ) ) );
909*cdf0e10cSrcweir 	long nDist   = aTurnOnBox.IsChecked() ?
910*cdf0e10cSrcweir 		static_cast<long>(aDistEdit.Denormalize( aDistEdit.GetValue( FUNIT_TWIP ) )) : 0;
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir 	long nMin;
913*cdf0e10cSrcweir 	long nMax;
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 	if ( nId == SID_ATTR_PAGE_HEADERSET )
916*cdf0e10cSrcweir 	{
917*cdf0e10cSrcweir 		nHHeight = nHeight;
918*cdf0e10cSrcweir 		nHDist   = nDist;
919*cdf0e10cSrcweir 	}
920*cdf0e10cSrcweir 	else
921*cdf0e10cSrcweir 	{
922*cdf0e10cSrcweir 		nFHeight = nHeight;
923*cdf0e10cSrcweir 		nFDist 	 = nDist;
924*cdf0e10cSrcweir 	}
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 	// Aktuelle Werte der Seitenraender
927*cdf0e10cSrcweir 	long nBT = aBspWin.GetTop();
928*cdf0e10cSrcweir 	long nBB = aBspWin.GetBottom();
929*cdf0e10cSrcweir 	long nBL = aBspWin.GetLeft();
930*cdf0e10cSrcweir 	long nBR = aBspWin.GetRight();
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir 	long nH  = aBspWin.GetSize().Height();
933*cdf0e10cSrcweir 	long nW  = aBspWin.GetSize().Width();
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir 	// Grenzen
936*cdf0e10cSrcweir 	if ( nId == SID_ATTR_PAGE_HEADERSET )
937*cdf0e10cSrcweir 	{
938*cdf0e10cSrcweir 		// Header
939*cdf0e10cSrcweir 		nMin = ( nH - nBB - nBT ) / 5; // 20%
940*cdf0e10cSrcweir 		nMax = Max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
941*cdf0e10cSrcweir 					nMin );
942*cdf0e10cSrcweir 		aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
943*cdf0e10cSrcweir 		nMin = ( nH - nBB - nBT ) / 5; // 20%
944*cdf0e10cSrcweir 		nDist = Max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
945*cdf0e10cSrcweir 					 long(0) );
946*cdf0e10cSrcweir 		aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
947*cdf0e10cSrcweir 	}
948*cdf0e10cSrcweir 	else
949*cdf0e10cSrcweir 	{
950*cdf0e10cSrcweir 		// Footer
951*cdf0e10cSrcweir 		nMin = ( nH - nBT - nBB ) / 5; // 20%
952*cdf0e10cSrcweir 		nMax = Max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
953*cdf0e10cSrcweir 					nMin );
954*cdf0e10cSrcweir 		aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
955*cdf0e10cSrcweir         nMin = ( nH - nBT - nBB ) / 5; // 20%
956*cdf0e10cSrcweir 		nDist = Max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
957*cdf0e10cSrcweir 					 long(0) );
958*cdf0e10cSrcweir 		aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
959*cdf0e10cSrcweir 	}
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir 	// Einzuege beschraenken
962*cdf0e10cSrcweir 	nMax = nW - nBL - nBR -
963*cdf0e10cSrcweir 		   static_cast<long>(aRMEdit.Denormalize( aRMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
964*cdf0e10cSrcweir 	aLMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
965*cdf0e10cSrcweir 
966*cdf0e10cSrcweir 	nMax = nW - nBL - nBR -
967*cdf0e10cSrcweir 		   static_cast<long>(aLMEdit.Denormalize( aLMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
968*cdf0e10cSrcweir 	aRMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
969*cdf0e10cSrcweir 	return 0;
970*cdf0e10cSrcweir }
971*cdf0e10cSrcweir /* -----------------------------26.08.2002 12:49------------------------------
972*cdf0e10cSrcweir 
973*cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
974*cdf0e10cSrcweir void lcl_Move(Window& rWin, sal_Int32 nDiff)
975*cdf0e10cSrcweir {
976*cdf0e10cSrcweir 	Point aPos(rWin.GetPosPixel());
977*cdf0e10cSrcweir 	aPos.Y() -= nDiff;
978*cdf0e10cSrcweir 	rWin.SetPosPixel(aPos);
979*cdf0e10cSrcweir }
980*cdf0e10cSrcweir void SvxHFPage::EnableDynamicSpacing()
981*cdf0e10cSrcweir {
982*cdf0e10cSrcweir     aDynSpacingCB.Show();
983*cdf0e10cSrcweir     //move all following controls
984*cdf0e10cSrcweir     Window* aMoveWindows[] =
985*cdf0e10cSrcweir     {
986*cdf0e10cSrcweir         &aHeightFT,
987*cdf0e10cSrcweir         &aHeightEdit,
988*cdf0e10cSrcweir         &aHeightDynBtn,
989*cdf0e10cSrcweir         &aBackgroundBtn,
990*cdf0e10cSrcweir         0
991*cdf0e10cSrcweir     };
992*cdf0e10cSrcweir     sal_Int32 nOffset = aTurnOnBox.GetPosPixel().Y() - aCntSharedBox.GetPosPixel().Y();
993*cdf0e10cSrcweir     sal_Int32 nIdx = 0;
994*cdf0e10cSrcweir     while(aMoveWindows[nIdx])
995*cdf0e10cSrcweir         lcl_Move(*aMoveWindows[nIdx++], nOffset);
996*cdf0e10cSrcweir }
997*cdf0e10cSrcweir 
998