xref: /AOO42X/main/svx/source/dialog/hdft.cxx (revision b1c5455db1639c48e26c568e4fa7ee78ca5d60ee)
1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_svx.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <tools/shl.hxx>
26cdf0e10cSrcweir #include <svl/itemiter.hxx>
27cdf0e10cSrcweir #include <sfx2/app.hxx>
28cdf0e10cSrcweir #include <sfx2/objsh.hxx>
29cdf0e10cSrcweir #include <sfx2/module.hxx>
30cdf0e10cSrcweir #include <vcl/msgbox.hxx>
31cdf0e10cSrcweir #include <vcl/graph.hxx>
32cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
33cdf0e10cSrcweir #include <svx/svxids.hrc>
34cdf0e10cSrcweir #include <svx/dialogs.hrc>
35cdf0e10cSrcweir #include "hdft.hrc"
36cdf0e10cSrcweir #include <svl/intitem.hxx>
37cdf0e10cSrcweir #define _SVX_HDFT_CXX
38cdf0e10cSrcweir #include <svx/hdft.hxx>
39cdf0e10cSrcweir #include <svx/pageitem.hxx>
40cdf0e10cSrcweir #include "svx/dlgutil.hxx"
41cdf0e10cSrcweir #include <svx/dialmgr.hxx>
42cdf0e10cSrcweir #include "svx/htmlmode.hxx"
43cdf0e10cSrcweir #include <editeng/brshitem.hxx>
44cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
45cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
46cdf0e10cSrcweir #include <editeng/shaditem.hxx>
47cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
48cdf0e10cSrcweir #include <editeng/boxitem.hxx>
49cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
50cdf0e10cSrcweir #include <svx/dialogs.hrc> //CHINA001
51*56b35d86SArmin Le Grand 
52*56b35d86SArmin Le Grand //UUUU
53*56b35d86SArmin Le Grand #include <svx/xdef.hxx>
54*56b35d86SArmin Le Grand #include <svx/xenum.hxx>
55*56b35d86SArmin Le Grand #include <svx/xfillit0.hxx>
56*56b35d86SArmin Le Grand #include <svx/unobrushitemhelper.hxx>
57*56b35d86SArmin Le Grand #include <sfx2/request.hxx>
58*56b35d86SArmin Le Grand 
59cdf0e10cSrcweir // static ----------------------------------------------------------------
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // --> OD 2004-06-18 #i19922#
62cdf0e10cSrcweir //static const long MINBODY = 284;            // 0,5cm in twips aufgerundet
63cdf0e10cSrcweir static const long MINBODY = 56;  // 1mm in twips rounded
64cdf0e10cSrcweir 
65cdf0e10cSrcweir // default distance to Header or footer
66cdf0e10cSrcweir static const long DEF_DIST_WRITER = 500;    // 5mm (Writer)
67cdf0e10cSrcweir static const long DEF_DIST_CALC = 250;      // 2,5mm (Calc)
68cdf0e10cSrcweir 
69cdf0e10cSrcweir static sal_uInt16 pRanges[] =
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     SID_ATTR_BRUSH,          SID_ATTR_BRUSH,
72*56b35d86SArmin Le Grand 
73*56b35d86SArmin Le Grand     //UUUU Support DrawingLayer FillStyles (no real call to below GetRanges()
74*56b35d86SArmin Le Grand     // detected, still do the complete transition)
75*56b35d86SArmin Le Grand     XATTR_FILL_FIRST,        XATTR_FILL_LAST,
76*56b35d86SArmin Le Grand 
77cdf0e10cSrcweir     SID_ATTR_BORDER_OUTER,   SID_ATTR_BORDER_OUTER,
78cdf0e10cSrcweir     SID_ATTR_BORDER_INNER,   SID_ATTR_BORDER_INNER,
79cdf0e10cSrcweir     SID_ATTR_BORDER_SHADOW,  SID_ATTR_BORDER_SHADOW,
80cdf0e10cSrcweir     SID_ATTR_LRSPACE,        SID_ATTR_LRSPACE,
81cdf0e10cSrcweir     SID_ATTR_ULSPACE,        SID_ATTR_ULSPACE,
82cdf0e10cSrcweir     SID_ATTR_PAGE_SIZE,      SID_ATTR_PAGE_SIZE,
83cdf0e10cSrcweir     SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
84cdf0e10cSrcweir     SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
85cdf0e10cSrcweir     SID_ATTR_PAGE_ON,        SID_ATTR_PAGE_ON,
86cdf0e10cSrcweir     SID_ATTR_PAGE_DYNAMIC,   SID_ATTR_PAGE_DYNAMIC,
87cdf0e10cSrcweir     SID_ATTR_PAGE_SHARED,    SID_ATTR_PAGE_SHARED,
88cdf0e10cSrcweir     SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
89cdf0e10cSrcweir     0
90cdf0e10cSrcweir };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /*--------------------------------------------------------------------
93cdf0e10cSrcweir     Beschreibung:
94cdf0e10cSrcweir  --------------------------------------------------------------------*/
95cdf0e10cSrcweir 
96cdf0e10cSrcweir // gibt den Bereich der Which-Werte zurueck
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 
GetRanges()99cdf0e10cSrcweir sal_uInt16* SvxHeaderPage::GetRanges()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     return pRanges;
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir //------------------------------------------------------------------------
105cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rSet)106cdf0e10cSrcweir SfxTabPage* SvxHeaderPage::Create( Window* pParent, const SfxItemSet& rSet )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir     return new SvxHeaderPage( pParent, rSet );
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir //------------------------------------------------------------------------
112cdf0e10cSrcweir 
GetRanges()113cdf0e10cSrcweir sal_uInt16* SvxFooterPage::GetRanges()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir     return pRanges;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // -----------------------------------------------------------------------
119cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rSet)120cdf0e10cSrcweir SfxTabPage* SvxFooterPage::Create( Window* pParent, const SfxItemSet& rSet )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     return new SvxFooterPage( pParent, rSet );
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir // -----------------------------------------------------------------------
126cdf0e10cSrcweir 
SvxHeaderPage(Window * pParent,const SfxItemSet & rAttr)127cdf0e10cSrcweir SvxHeaderPage::SvxHeaderPage( Window* pParent, const SfxItemSet& rAttr ) :
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     SvxHFPage( pParent, RID_SVXPAGE_HEADER, rAttr, SID_ATTR_PAGE_HEADERSET )
130cdf0e10cSrcweir 
131cdf0e10cSrcweir {
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir // -----------------------------------------------------------------------
135cdf0e10cSrcweir 
SvxFooterPage(Window * pParent,const SfxItemSet & rAttr)136cdf0e10cSrcweir SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     SvxHFPage( pParent, RID_SVXPAGE_FOOTER, rAttr, SID_ATTR_PAGE_FOOTERSET )
139cdf0e10cSrcweir 
140cdf0e10cSrcweir {
141cdf0e10cSrcweir }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // -----------------------------------------------------------------------
144cdf0e10cSrcweir 
SvxHFPage(Window * pParent,sal_uInt16 nResId,const SfxItemSet & rAttr,sal_uInt16 nSetId)145*56b35d86SArmin Le Grand SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId )
146*56b35d86SArmin Le Grand :   SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     aFrm            ( this, SVX_RES( FL_FRAME ) ),
149cdf0e10cSrcweir     aTurnOnBox      ( this, SVX_RES( CB_TURNON ) ),
150cdf0e10cSrcweir     aCntSharedBox   ( this, SVX_RES( CB_SHARED ) ),
151cdf0e10cSrcweir     aLMLbl          ( this, SVX_RES( FT_LMARGIN ) ),
152cdf0e10cSrcweir     aLMEdit         ( this, SVX_RES( ED_LMARGIN ) ),
153cdf0e10cSrcweir     aRMLbl          ( this, SVX_RES( FT_RMARGIN ) ),
154cdf0e10cSrcweir     aRMEdit         ( this, SVX_RES( ED_RMARGIN ) ),
155cdf0e10cSrcweir     aDistFT         ( this, SVX_RES( FT_DIST ) ),
156cdf0e10cSrcweir     aDistEdit       ( this, SVX_RES( ED_DIST ) ),
157cdf0e10cSrcweir     aDynSpacingCB   ( this, SVX_RES( CB_DYNSPACING ) ),
158cdf0e10cSrcweir     aHeightFT       ( this, SVX_RES( FT_HEIGHT ) ),
159cdf0e10cSrcweir     aHeightEdit     ( this, SVX_RES( ED_HEIGHT ) ),
160cdf0e10cSrcweir     aHeightDynBtn   ( this, SVX_RES( CB_HEIGHT_DYN ) ),
161cdf0e10cSrcweir     aBspWin         ( this, SVX_RES( WN_BSP ) ),
162cdf0e10cSrcweir     aBackgroundBtn  ( this, SVX_RES( BTN_EXTRAS ) ),
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     nId             ( nSetId ),
165cdf0e10cSrcweir     pBBSet          ( NULL ),
166cdf0e10cSrcweir 
167*56b35d86SArmin Le Grand     // bitfield
168*56b35d86SArmin Le Grand     mbDisableQueryBox(false),
169*56b35d86SArmin Le Grand     mbEnableBackgroundSelector(true),
170*56b35d86SArmin Le Grand     mbEnableDrawingLayerFillStyles(false)
171cdf0e10cSrcweir {
172cdf0e10cSrcweir     InitHandler();
173cdf0e10cSrcweir     aBspWin.EnableRTL( sal_False );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     // diese Page braucht ExchangeSupport
176cdf0e10cSrcweir     SetExchangeSupport();
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     FreeResource();
179cdf0e10cSrcweir 
180cdf0e10cSrcweir     // Metrik einstellen
181cdf0e10cSrcweir     FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
182cdf0e10cSrcweir     SetFieldUnit( aDistEdit, eFUnit );
183cdf0e10cSrcweir     SetFieldUnit( aHeightEdit, eFUnit );
184cdf0e10cSrcweir     SetFieldUnit( aLMEdit, eFUnit );
185cdf0e10cSrcweir     SetFieldUnit( aRMEdit, eFUnit );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     aTurnOnBox.SetAccessibleRelationMemberOf( &aFrm );
188cdf0e10cSrcweir     aCntSharedBox.SetAccessibleRelationMemberOf( &aFrm );
189cdf0e10cSrcweir     aLMLbl.SetAccessibleRelationMemberOf( &aFrm );
190cdf0e10cSrcweir     aLMEdit.SetAccessibleRelationMemberOf( &aFrm );
191cdf0e10cSrcweir     aRMLbl.SetAccessibleRelationMemberOf( &aFrm );
192cdf0e10cSrcweir     aRMEdit.SetAccessibleRelationMemberOf( &aFrm );
193cdf0e10cSrcweir     aDistFT.SetAccessibleRelationMemberOf( &aFrm );
194cdf0e10cSrcweir     aDistEdit.SetAccessibleRelationMemberOf( &aFrm );
195cdf0e10cSrcweir     aDynSpacingCB.SetAccessibleRelationMemberOf( &aFrm );
196cdf0e10cSrcweir     aHeightFT.SetAccessibleRelationMemberOf( &aFrm );
197cdf0e10cSrcweir     aHeightEdit.SetAccessibleRelationMemberOf( &aFrm );
198cdf0e10cSrcweir     aHeightDynBtn.SetAccessibleRelationMemberOf( &aFrm );
199cdf0e10cSrcweir     aBackgroundBtn.SetAccessibleRelationMemberOf(&aFrm);
200cdf0e10cSrcweir }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir // -----------------------------------------------------------------------
203cdf0e10cSrcweir 
~SvxHFPage()204cdf0e10cSrcweir SvxHFPage::~SvxHFPage()
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     delete pBBSet;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir // -----------------------------------------------------------------------
210cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rSet)211cdf0e10cSrcweir sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
212cdf0e10cSrcweir {
213cdf0e10cSrcweir     const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE);
214cdf0e10cSrcweir     const sal_uInt16 nWLRSpace = GetWhich(SID_ATTR_LRSPACE);
215cdf0e10cSrcweir     const sal_uInt16 nWULSpace = GetWhich(SID_ATTR_ULSPACE);
216cdf0e10cSrcweir     const sal_uInt16 nWOn = GetWhich(SID_ATTR_PAGE_ON);
217cdf0e10cSrcweir     const sal_uInt16 nWDynamic = GetWhich(SID_ATTR_PAGE_DYNAMIC);
218cdf0e10cSrcweir     const sal_uInt16 nWDynSpacing = GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING);
219cdf0e10cSrcweir     const sal_uInt16 nWShared = GetWhich(SID_ATTR_PAGE_SHARED);
220cdf0e10cSrcweir     const sal_uInt16 nWBrush = GetWhich(SID_ATTR_BRUSH);
221cdf0e10cSrcweir     const sal_uInt16 nWBox = GetWhich(SID_ATTR_BORDER_OUTER);
222cdf0e10cSrcweir     const sal_uInt16 nWBoxInfo = GetWhich(SID_ATTR_BORDER_INNER);
223cdf0e10cSrcweir     const sal_uInt16 nWShadow = GetWhich(SID_ATTR_BORDER_SHADOW);
224*56b35d86SArmin Le Grand 
225*56b35d86SArmin Le Grand     const sal_uInt16 aWhichTab[] = {
226*56b35d86SArmin Le Grand         nWSize, nWSize,
227cdf0e10cSrcweir         nWLRSpace, nWLRSpace,
228cdf0e10cSrcweir         nWULSpace, nWULSpace,
229cdf0e10cSrcweir         nWOn, nWOn,
230cdf0e10cSrcweir         nWDynamic, nWDynamic,
231cdf0e10cSrcweir         nWShared, nWShared,
232cdf0e10cSrcweir         nWBrush, nWBrush,
233cdf0e10cSrcweir         nWBoxInfo, nWBoxInfo,
234cdf0e10cSrcweir         nWBox, nWBox,
235cdf0e10cSrcweir         nWShadow, nWShadow,
236cdf0e10cSrcweir         nWDynSpacing, nWDynSpacing,
237*56b35d86SArmin Le Grand 
238*56b35d86SArmin Le Grand         //UUUU take over DrawingLayer FillStyles
239*56b35d86SArmin Le Grand         XATTR_FILL_FIRST, XATTR_FILL_LAST,                // [1014
240*56b35d86SArmin Le Grand 
241*56b35d86SArmin Le Grand         0, 0};
242*56b35d86SArmin Le Grand 
243cdf0e10cSrcweir     const SfxItemSet& rOldSet = GetItemSet();
244cdf0e10cSrcweir     SfxItemPool* pPool = rOldSet.GetPool();
245cdf0e10cSrcweir     DBG_ASSERT(pPool,"no pool :-(");
246cdf0e10cSrcweir     SfxMapUnit eUnit = pPool->GetMetric(nWSize);
247cdf0e10cSrcweir     SfxItemSet aSet(*pPool,aWhichTab);
248cdf0e10cSrcweir 
249*56b35d86SArmin Le Grand     if(mbEnableDrawingLayerFillStyles)
250*56b35d86SArmin Le Grand     {
251*56b35d86SArmin Le Grand         //UUUU When using the XATTR_FILLSTYLE DrawingLayer FillStyle definition
252*56b35d86SArmin Le Grand         // extra action has to be done here since the pool default is XFILL_SOLID
253*56b35d86SArmin Le Grand         // instead of XFILL_NONE (to have the default blue fill color at start).
254*56b35d86SArmin Le Grand         aSet.Put(XFillStyleItem(XFILL_NONE));
255*56b35d86SArmin Le Grand     }
256*56b35d86SArmin Le Grand 
257cdf0e10cSrcweir     //--------------------------------------------------------------------
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     aSet.Put( SfxBoolItem( nWOn,      aTurnOnBox.IsChecked() ) );
260cdf0e10cSrcweir     aSet.Put( SfxBoolItem( nWDynamic, aHeightDynBtn.IsChecked() ) );
261cdf0e10cSrcweir     aSet.Put( SfxBoolItem( nWShared,  aCntSharedBox.IsChecked() ) );
262cdf0e10cSrcweir     if(aDynSpacingCB.IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
263cdf0e10cSrcweir     {
264cdf0e10cSrcweir         SfxBoolItem* pBoolItem = (SfxBoolItem*)pPool->GetDefaultItem(nWDynSpacing).Clone();
265cdf0e10cSrcweir         pBoolItem->SetValue(aDynSpacingCB.IsChecked());
266cdf0e10cSrcweir         aSet.Put(*pBoolItem);
267cdf0e10cSrcweir         delete pBoolItem;
268cdf0e10cSrcweir     }
269cdf0e10cSrcweir 
270cdf0e10cSrcweir     // Groesse
271cdf0e10cSrcweir     SvxSizeItem aSizeItem( (const SvxSizeItem&)rOldSet.Get( nWSize ) );
272cdf0e10cSrcweir     Size        aSize( aSizeItem.GetSize() );
273cdf0e10cSrcweir     long        nDist = GetCoreValue( aDistEdit, eUnit );
274cdf0e10cSrcweir     long        nH    = GetCoreValue( aHeightEdit, eUnit );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     // fixe Hoehe?
277cdf0e10cSrcweir //  if ( !aHeightDynBtn.IsChecked() )
278cdf0e10cSrcweir         nH += nDist; // dann Abstand dazu addieren
279cdf0e10cSrcweir     aSize.Height() = nH;
280cdf0e10cSrcweir     aSizeItem.SetSize( aSize );
281cdf0e10cSrcweir     aSet.Put( aSizeItem );
282cdf0e10cSrcweir 
283cdf0e10cSrcweir     // Raender
284cdf0e10cSrcweir     SvxLRSpaceItem aLR( nWLRSpace );
285cdf0e10cSrcweir     aLR.SetLeft( (sal_uInt16)GetCoreValue( aLMEdit, eUnit ) );
286cdf0e10cSrcweir     aLR.SetRight( (sal_uInt16)GetCoreValue( aRMEdit, eUnit ) );
287cdf0e10cSrcweir     aSet.Put( aLR );
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     SvxULSpaceItem aUL( nWULSpace );
290cdf0e10cSrcweir     if ( nId == SID_ATTR_PAGE_HEADERSET )
291cdf0e10cSrcweir         aUL.SetLower( (sal_uInt16)nDist );
292cdf0e10cSrcweir     else
293cdf0e10cSrcweir         aUL.SetUpper( (sal_uInt16)nDist );
294cdf0e10cSrcweir     aSet.Put( aUL );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir     // Hintergrund und Umrandung?
297cdf0e10cSrcweir     if(pBBSet)
298*56b35d86SArmin Le Grand     {
299cdf0e10cSrcweir         aSet.Put(*pBBSet);
300*56b35d86SArmin Le Grand     }
301cdf0e10cSrcweir     else
302cdf0e10cSrcweir     {
303cdf0e10cSrcweir         const SfxItemSet* _pSet;
304cdf0e10cSrcweir         const SfxPoolItem* pItem;
305cdf0e10cSrcweir 
306*56b35d86SArmin Le Grand         if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem))
307cdf0e10cSrcweir         {
308*56b35d86SArmin Le Grand             _pSet = &(static_cast< const SvxSetItem* >(pItem)->GetItemSet());
309cdf0e10cSrcweir 
310cdf0e10cSrcweir             if(_pSet->GetItemState(nWBrush) == SFX_ITEM_SET)
311*56b35d86SArmin Le Grand             {
312*56b35d86SArmin Le Grand                 aSet.Put(_pSet->Get(nWBrush));
313*56b35d86SArmin Le Grand             }
314*56b35d86SArmin Le Grand 
315cdf0e10cSrcweir             if(_pSet->GetItemState(nWBoxInfo) == SFX_ITEM_SET)
316*56b35d86SArmin Le Grand             {
317*56b35d86SArmin Le Grand                 aSet.Put(_pSet->Get(nWBoxInfo));
318*56b35d86SArmin Le Grand             }
319*56b35d86SArmin Le Grand 
320cdf0e10cSrcweir             if(_pSet->GetItemState(nWBox) == SFX_ITEM_SET)
321*56b35d86SArmin Le Grand             {
322*56b35d86SArmin Le Grand                 aSet.Put(_pSet->Get(nWBox));
323*56b35d86SArmin Le Grand             }
324*56b35d86SArmin Le Grand 
325cdf0e10cSrcweir             if(_pSet->GetItemState(nWShadow) == SFX_ITEM_SET)
326*56b35d86SArmin Le Grand             {
327*56b35d86SArmin Le Grand                 aSet.Put(_pSet->Get(nWShadow));
328*56b35d86SArmin Le Grand             }
329*56b35d86SArmin Le Grand 
330*56b35d86SArmin Le Grand             //UUUU take care of [XATTR_XATTR_FILL_FIRST .. XATTR_FILL_LAST]
331*56b35d86SArmin Le Grand             for(sal_uInt16 nFillStyleId(XATTR_FILL_FIRST); nFillStyleId <= XATTR_FILL_LAST; nFillStyleId++)
332*56b35d86SArmin Le Grand             {
333*56b35d86SArmin Le Grand                 if(_pSet->GetItemState(nFillStyleId) == SFX_ITEM_SET)
334*56b35d86SArmin Le Grand                 {
335*56b35d86SArmin Le Grand                     aSet.Put(_pSet->Get(nFillStyleId));
336*56b35d86SArmin Le Grand                 }
337*56b35d86SArmin Le Grand             }
338cdf0e10cSrcweir         }
339cdf0e10cSrcweir     }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir     // Das SetItem wegschreiben
342cdf0e10cSrcweir     SvxSetItem aSetItem( GetWhich( nId ), aSet );
343cdf0e10cSrcweir     rSet.Put( aSetItem );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir     return sal_True;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir // -----------------------------------------------------------------------
Reset(const SfxItemSet & rSet)349cdf0e10cSrcweir void SvxHFPage::Reset( const SfxItemSet& rSet )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     ActivatePage( rSet );
352cdf0e10cSrcweir     ResetBackground_Impl( rSet );
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     SfxItemPool* pPool = GetItemSet().GetPool();
355cdf0e10cSrcweir     DBG_ASSERT( pPool, "Wo ist der Pool" );
356cdf0e10cSrcweir     SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
357cdf0e10cSrcweir 
358cdf0e10cSrcweir     // Kopf-/Fusszeilen-Attribute auswerten
359cdf0e10cSrcweir     //
360cdf0e10cSrcweir     const SvxSetItem* pSetItem = 0;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich(nId), sal_False,
363cdf0e10cSrcweir                                             (const SfxPoolItem**)&pSetItem ) )
364cdf0e10cSrcweir     {
365cdf0e10cSrcweir         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
366cdf0e10cSrcweir         const SfxBoolItem& rHeaderOn =
367cdf0e10cSrcweir             (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON));
368cdf0e10cSrcweir 
369cdf0e10cSrcweir         aTurnOnBox.Check(rHeaderOn.GetValue());
370cdf0e10cSrcweir 
371cdf0e10cSrcweir         if ( rHeaderOn.GetValue() )
372cdf0e10cSrcweir         {
373cdf0e10cSrcweir             const SfxBoolItem& rDynamic =
374cdf0e10cSrcweir                 (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
375cdf0e10cSrcweir             const SfxBoolItem& rShared =
376cdf0e10cSrcweir                 (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) );
377cdf0e10cSrcweir             const SvxSizeItem& rSize =
378cdf0e10cSrcweir                 (const SvxSizeItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
379cdf0e10cSrcweir             const SvxULSpaceItem& rUL =
380cdf0e10cSrcweir                 (const SvxULSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
381cdf0e10cSrcweir             const SvxLRSpaceItem& rLR =
382cdf0e10cSrcweir                 (const SvxLRSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
383cdf0e10cSrcweir             if(aDynSpacingCB.IsVisible())
384cdf0e10cSrcweir             {
385cdf0e10cSrcweir                 const SfxBoolItem& rDynSpacing =
386cdf0e10cSrcweir                     (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING));
387cdf0e10cSrcweir                 aDynSpacingCB.Check(rDynSpacing.GetValue());
388cdf0e10cSrcweir             }
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 
391cdf0e10cSrcweir             if ( nId == SID_ATTR_PAGE_HEADERSET )
392cdf0e10cSrcweir             {   // Kopfzeile
393cdf0e10cSrcweir                 SetMetricValue( aDistEdit, rUL.GetLower(), eUnit );
394cdf0e10cSrcweir                 SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
395cdf0e10cSrcweir             }
396cdf0e10cSrcweir             else
397cdf0e10cSrcweir             {   // Fusszeile
398cdf0e10cSrcweir                 SetMetricValue( aDistEdit, rUL.GetUpper(), eUnit );
399cdf0e10cSrcweir                 SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
400cdf0e10cSrcweir             }
401cdf0e10cSrcweir 
402cdf0e10cSrcweir             aHeightDynBtn.Check(rDynamic.GetValue());
403cdf0e10cSrcweir             SetMetricValue( aLMEdit, rLR.GetLeft(), eUnit );
404cdf0e10cSrcweir             SetMetricValue( aRMEdit, rLR.GetRight(), eUnit );
405cdf0e10cSrcweir             aCntSharedBox.Check(rShared.GetValue());
406cdf0e10cSrcweir         }
407cdf0e10cSrcweir         else
408cdf0e10cSrcweir             pSetItem = 0;
409cdf0e10cSrcweir     }
410cdf0e10cSrcweir     else
411cdf0e10cSrcweir     {
412cdf0e10cSrcweir         // defaults for distance and height
413cdf0e10cSrcweir         long nDefaultDist = DEF_DIST_WRITER;
414cdf0e10cSrcweir         const SfxPoolItem* pExt1 = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
415cdf0e10cSrcweir         const SfxPoolItem* pExt2 = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
416cdf0e10cSrcweir 
417cdf0e10cSrcweir         if ( pExt1 && pExt1->ISA(SfxBoolItem) && pExt2 && pExt2->ISA(SfxBoolItem) )
418cdf0e10cSrcweir             nDefaultDist = DEF_DIST_CALC;
419cdf0e10cSrcweir 
420cdf0e10cSrcweir         SetMetricValue( aDistEdit, nDefaultDist, SFX_MAPUNIT_100TH_MM );
421cdf0e10cSrcweir         SetMetricValue( aHeightEdit, 500, SFX_MAPUNIT_100TH_MM );
422cdf0e10cSrcweir     }
423cdf0e10cSrcweir 
424cdf0e10cSrcweir     if ( !pSetItem )
425cdf0e10cSrcweir     {
426cdf0e10cSrcweir         aTurnOnBox.Check( sal_False );
427cdf0e10cSrcweir         aHeightDynBtn.Check( sal_True );
428cdf0e10cSrcweir         aCntSharedBox.Check( sal_True );
429cdf0e10cSrcweir     }
430cdf0e10cSrcweir 
431cdf0e10cSrcweir     TurnOnHdl(0);
432cdf0e10cSrcweir 
433cdf0e10cSrcweir     aTurnOnBox.SaveValue();
434cdf0e10cSrcweir     aDistEdit.SaveValue();
435cdf0e10cSrcweir     aHeightEdit.SaveValue();
436cdf0e10cSrcweir     aHeightDynBtn.SaveValue();
437cdf0e10cSrcweir     aLMEdit.SaveValue();
438cdf0e10cSrcweir     aRMEdit.SaveValue();
439cdf0e10cSrcweir     aCntSharedBox.SaveValue();
440cdf0e10cSrcweir     RangeHdl( 0 );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     sal_uInt16 nHtmlMode = 0;
443cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
444cdf0e10cSrcweir     SfxObjectShell* pShell;
445cdf0e10cSrcweir     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
446cdf0e10cSrcweir         ( 0 != (pShell = SfxObjectShell::Current()) &&
447cdf0e10cSrcweir                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
448cdf0e10cSrcweir     {
449cdf0e10cSrcweir         nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
450d3eac994SHerbert Dürr         if(nHtmlMode & HTMLMODE_ON)
451cdf0e10cSrcweir         {
452cdf0e10cSrcweir             aCntSharedBox.Hide();
453cdf0e10cSrcweir             aBackgroundBtn.Hide();
454cdf0e10cSrcweir         }
455cdf0e10cSrcweir     }
456cdf0e10cSrcweir 
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir /*--------------------------------------------------------------------
460cdf0e10cSrcweir     Beschreibung:   Handler initialisieren
461cdf0e10cSrcweir  --------------------------------------------------------------------*/
462cdf0e10cSrcweir 
InitHandler()463cdf0e10cSrcweir void SvxHFPage::InitHandler()
464cdf0e10cSrcweir {
465cdf0e10cSrcweir     aTurnOnBox.SetClickHdl(LINK(this,   SvxHFPage, TurnOnHdl));
466cdf0e10cSrcweir     aDistEdit.SetModifyHdl(LINK(this,   SvxHFPage, DistModify));
467cdf0e10cSrcweir     aDistEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     aHeightEdit.SetModifyHdl(LINK(this,     SvxHFPage, HeightModify));
470cdf0e10cSrcweir     aHeightEdit.SetLoseFocusHdl(LINK(this,SvxHFPage,RangeHdl));
471cdf0e10cSrcweir 
472cdf0e10cSrcweir     aLMEdit.SetModifyHdl(LINK(this,         SvxHFPage, BorderModify));
473cdf0e10cSrcweir     aLMEdit.SetLoseFocusHdl(LINK(this,  SvxHFPage, RangeHdl));
474cdf0e10cSrcweir     aRMEdit.SetModifyHdl(LINK(this,         SvxHFPage, BorderModify));
475cdf0e10cSrcweir     aRMEdit.SetLoseFocusHdl(LINK(this,  SvxHFPage, RangeHdl));
476cdf0e10cSrcweir     aBackgroundBtn.SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
477cdf0e10cSrcweir }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir /*--------------------------------------------------------------------
480cdf0e10cSrcweir     Beschreibung:   Ein/aus
481cdf0e10cSrcweir  --------------------------------------------------------------------*/
482cdf0e10cSrcweir 
IMPL_LINK(SvxHFPage,TurnOnHdl,CheckBox *,pBox)483cdf0e10cSrcweir IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
484cdf0e10cSrcweir {
485cdf0e10cSrcweir     if ( aTurnOnBox.IsChecked() )
486cdf0e10cSrcweir     {
487cdf0e10cSrcweir         aDistFT.Enable();
488cdf0e10cSrcweir         aDistEdit.Enable();
489cdf0e10cSrcweir         aDynSpacingCB.Enable();
490cdf0e10cSrcweir         aHeightFT.Enable();
491cdf0e10cSrcweir         aHeightEdit.Enable();
492cdf0e10cSrcweir         aHeightDynBtn.Enable();
493cdf0e10cSrcweir         aLMLbl.Enable();
494cdf0e10cSrcweir         aLMEdit.Enable();
495cdf0e10cSrcweir         aRMLbl.Enable();
496cdf0e10cSrcweir         aRMEdit.Enable();
497cdf0e10cSrcweir 
498cdf0e10cSrcweir         sal_uInt16 nUsage = aBspWin.GetUsage();
499cdf0e10cSrcweir 
500cdf0e10cSrcweir         if( nUsage == SVX_PAGE_RIGHT || nUsage == SVX_PAGE_LEFT )
501cdf0e10cSrcweir             aCntSharedBox.Disable();
502cdf0e10cSrcweir         else
503cdf0e10cSrcweir             aCntSharedBox.Enable();
504cdf0e10cSrcweir         aBackgroundBtn.Enable();
505cdf0e10cSrcweir     }
506cdf0e10cSrcweir     else
507cdf0e10cSrcweir     {
508cdf0e10cSrcweir         sal_Bool bDelete = sal_True;
509cdf0e10cSrcweir 
510*56b35d86SArmin Le Grand         if ( !mbDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
511cdf0e10cSrcweir             bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );
512cdf0e10cSrcweir 
513cdf0e10cSrcweir         if ( bDelete )
514cdf0e10cSrcweir         {
515cdf0e10cSrcweir             aDistFT.Disable();
516cdf0e10cSrcweir             aDistEdit.Disable();
517cdf0e10cSrcweir             aDynSpacingCB.Enable(sal_False);
518cdf0e10cSrcweir             aHeightFT.Disable();
519cdf0e10cSrcweir             aHeightEdit.Disable();
520cdf0e10cSrcweir             aHeightDynBtn.Disable();
521cdf0e10cSrcweir 
522cdf0e10cSrcweir             aLMLbl.Disable();
523cdf0e10cSrcweir             aLMEdit.Disable();
524cdf0e10cSrcweir             aRMLbl.Disable();
525cdf0e10cSrcweir             aRMEdit.Disable();
526cdf0e10cSrcweir 
527cdf0e10cSrcweir             aCntSharedBox.Disable();
528cdf0e10cSrcweir             aBackgroundBtn.Disable();
529cdf0e10cSrcweir         }
530cdf0e10cSrcweir         else
531cdf0e10cSrcweir             aTurnOnBox.Check();
532cdf0e10cSrcweir     }
533cdf0e10cSrcweir     UpdateExample();
534cdf0e10cSrcweir     return 0;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir /*--------------------------------------------------------------------
538cdf0e10cSrcweir     Beschreibung:   Abstand im Bsp Modifizieren
539cdf0e10cSrcweir  --------------------------------------------------------------------*/
540cdf0e10cSrcweir 
IMPL_LINK_INLINE_START(SvxHFPage,DistModify,MetricField *,EMPTYARG)541cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, DistModify, MetricField *, EMPTYARG )
542cdf0e10cSrcweir {
543cdf0e10cSrcweir     UpdateExample();
544cdf0e10cSrcweir     return 0;
545cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxHFPage,DistModify,MetricField *,EMPTYARG)546cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, DistModify, MetricField *, EMPTYARG )
547cdf0e10cSrcweir 
548cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
549cdf0e10cSrcweir {
550cdf0e10cSrcweir     UpdateExample();
551cdf0e10cSrcweir 
552cdf0e10cSrcweir     return 0;
553cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxHFPage,HeightModify,MetricField *,EMPTYARG)554cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
555cdf0e10cSrcweir 
556cdf0e10cSrcweir /*--------------------------------------------------------------------
557cdf0e10cSrcweir     Beschreibung: Raender einstellen
558cdf0e10cSrcweir  --------------------------------------------------------------------*/
559cdf0e10cSrcweir 
560cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir     UpdateExample();
563cdf0e10cSrcweir     return 0;
564cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxHFPage,BorderModify,MetricField *,EMPTYARG)565cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
566cdf0e10cSrcweir 
567cdf0e10cSrcweir /*--------------------------------------------------------------------
568cdf0e10cSrcweir     Beschreibung:   Hintergrund
569cdf0e10cSrcweir  --------------------------------------------------------------------*/
570cdf0e10cSrcweir 
571cdf0e10cSrcweir IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG )
572cdf0e10cSrcweir {
573cdf0e10cSrcweir     if(!pBBSet)
574cdf0e10cSrcweir     {
575cdf0e10cSrcweir         // nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen
576*56b35d86SArmin Le Grand         const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER));
577*56b35d86SArmin Le Grand         const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, sal_False));
578*56b35d86SArmin Le Grand         const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW));
579cdf0e10cSrcweir 
580*56b35d86SArmin Le Grand         if(mbEnableDrawingLayerFillStyles)
581*56b35d86SArmin Le Grand         {
582*56b35d86SArmin Le Grand             pBBSet = new SfxItemSet(
583*56b35d86SArmin Le Grand                 *GetItemSet().GetPool(),
584*56b35d86SArmin Le Grand                 XATTR_FILL_FIRST, XATTR_FILL_LAST,  // DrawingLayer FillStyle definitions
585*56b35d86SArmin Le Grand                 SID_COLOR_TABLE, SID_BITMAP_LIST,   // XPropertyLists for Color, Gradient, Hatch and Graphic fills
586*56b35d86SArmin Le Grand                 nOuter, nOuter,
587*56b35d86SArmin Le Grand                 nInner, nInner,
588*56b35d86SArmin Le Grand                 nShadow, nShadow,
589*56b35d86SArmin Le Grand                 0, 0);
590*56b35d86SArmin Le Grand 
591*56b35d86SArmin Le Grand             //UUUU copy items for XPropertyList entries from the DrawModel so that
592*56b35d86SArmin Le Grand             // the Area TabPage can access them
593*56b35d86SArmin Le Grand             static const sal_uInt16 nCopyFlags[] = {
594*56b35d86SArmin Le Grand                 SID_COLOR_TABLE,
595*56b35d86SArmin Le Grand                 SID_GRADIENT_LIST,
596*56b35d86SArmin Le Grand                 SID_HATCH_LIST,
597*56b35d86SArmin Le Grand                 SID_BITMAP_LIST,
598*56b35d86SArmin Le Grand                 0
599*56b35d86SArmin Le Grand             };
600*56b35d86SArmin Le Grand 
601*56b35d86SArmin Le Grand             for(sal_uInt16 a(0); nCopyFlags[a]; a++)
602*56b35d86SArmin Le Grand             {
603*56b35d86SArmin Le Grand                 const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]);
604*56b35d86SArmin Le Grand 
605*56b35d86SArmin Le Grand                 if(pItem)
606*56b35d86SArmin Le Grand                 {
607*56b35d86SArmin Le Grand                     pBBSet->Put(*pItem);
608*56b35d86SArmin Le Grand                 }
609*56b35d86SArmin Le Grand                 else
610*56b35d86SArmin Le Grand                 {
611*56b35d86SArmin Le Grand                     OSL_ENSURE(false, "XPropertyList missing (!)");
612*56b35d86SArmin Le Grand                 }
613*56b35d86SArmin Le Grand             }
614*56b35d86SArmin Le Grand         }
615*56b35d86SArmin Le Grand         else
616*56b35d86SArmin Le Grand         {
617*56b35d86SArmin Le Grand             const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH));
618*56b35d86SArmin Le Grand 
619*56b35d86SArmin Le Grand             pBBSet = new SfxItemSet(
620*56b35d86SArmin Le Grand                 *GetItemSet().GetPool(),
621*56b35d86SArmin Le Grand                 nBrush, nBrush,
622*56b35d86SArmin Le Grand                 nOuter, nOuter,
623*56b35d86SArmin Le Grand                 nInner, nInner,
624*56b35d86SArmin Le Grand                 nShadow, nShadow,
625*56b35d86SArmin Le Grand                 0, 0);
626*56b35d86SArmin Le Grand         }
627*56b35d86SArmin Le Grand 
628cdf0e10cSrcweir         const SfxPoolItem* pItem;
629cdf0e10cSrcweir 
630*56b35d86SArmin Le Grand         if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem))
631*56b35d86SArmin Le Grand         {
632*56b35d86SArmin Le Grand             // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or
633*56b35d86SArmin Le Grand             // SID_ATTR_PAGE_FOOTERSET exists, use it's content
634cdf0e10cSrcweir             pBBSet->Put(((SvxSetItem*)pItem)->GetItemSet());
635*56b35d86SArmin Le Grand         }
636*56b35d86SArmin Le Grand         else
637*56b35d86SArmin Le Grand         {
638*56b35d86SArmin Le Grand             if(mbEnableDrawingLayerFillStyles)
639*56b35d86SArmin Le Grand             {
640*56b35d86SArmin Le Grand                 //UUUU The style for header/footer is not yet created, need to reset
641*56b35d86SArmin Le Grand                 // XFillStyleItem to XFILL_NONE which is the same as in the style
642*56b35d86SArmin Le Grand                 // initialization. This needs to be done since the pool default for
643*56b35d86SArmin Le Grand                 // XFillStyleItem is XFILL_SOLID
644*56b35d86SArmin Le Grand                 pBBSet->Put(XFillStyleItem(XFILL_NONE));
645*56b35d86SArmin Le Grand             }
646*56b35d86SArmin Le Grand         }
647cdf0e10cSrcweir 
648*56b35d86SArmin Le Grand         if(SFX_ITEM_SET == GetItemSet().GetItemState(nInner, sal_False, &pItem))
649*56b35d86SArmin Le Grand         {
650cdf0e10cSrcweir             // das gesetze InfoItem wird immer ben"otigt
651cdf0e10cSrcweir             pBBSet->Put(*pItem);
652cdf0e10cSrcweir         }
653*56b35d86SArmin Le Grand     }
654cdf0e10cSrcweir 
655cdf0e10cSrcweir     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
656*56b35d86SArmin Le Grand 
657cdf0e10cSrcweir     if(pFact)
658cdf0e10cSrcweir     {
659*56b35d86SArmin Le Grand         //UUUU
660*56b35d86SArmin Le Grand         SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg(
661*56b35d86SArmin Le Grand             this,
662*56b35d86SArmin Le Grand             *pBBSet,
663*56b35d86SArmin Le Grand             mbEnableBackgroundSelector,
664*56b35d86SArmin Le Grand             mbEnableDrawingLayerFillStyles);
665*56b35d86SArmin Le Grand 
666cdf0e10cSrcweir         DBG_ASSERT(pDlg,"Dialogdiet fail!");//CHINA001
667*56b35d86SArmin Le Grand         if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet())
668cdf0e10cSrcweir         {
669cdf0e10cSrcweir             SfxItemIter aIter(*pDlg->GetOutputItemSet());
670cdf0e10cSrcweir             const SfxPoolItem* pItem = aIter.FirstItem();
671cdf0e10cSrcweir 
672cdf0e10cSrcweir             while(pItem)
673cdf0e10cSrcweir             {
674cdf0e10cSrcweir                 if(!IsInvalidItem(pItem))
675*56b35d86SArmin Le Grand                 {
676cdf0e10cSrcweir                     pBBSet->Put(*pItem);
677*56b35d86SArmin Le Grand                 }
678*56b35d86SArmin Le Grand 
679cdf0e10cSrcweir                 pItem = aIter.NextItem();
680cdf0e10cSrcweir             }
681cdf0e10cSrcweir 
682cdf0e10cSrcweir             //----------------------------------------------------------------
683*56b35d86SArmin Le Grand             {
684*56b35d86SArmin Le Grand                 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
685cdf0e10cSrcweir 
686*56b35d86SArmin Le Grand                 if(mbEnableDrawingLayerFillStyles)
687*56b35d86SArmin Le Grand                 {
688*56b35d86SArmin Le Grand                     //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
689*56b35d86SArmin Le Grand                     aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet));
690*56b35d86SArmin Le Grand                 }
691*56b35d86SArmin Le Grand                 else
692*56b35d86SArmin Le Grand                 {
693*56b35d86SArmin Le Grand                     const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);
694cdf0e10cSrcweir 
695cdf0e10cSrcweir                     if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET)
696cdf0e10cSrcweir                     {
697*56b35d86SArmin Le Grand                         //UUUU create FillAttributes from SvxBrushItem
698*56b35d86SArmin Le Grand                         const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich));
699*56b35d86SArmin Le Grand                         SfxItemSet aTempSet(*pBBSet->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
700*56b35d86SArmin Le Grand 
701*56b35d86SArmin Le Grand                         setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
702*56b35d86SArmin Le Grand                         aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
703*56b35d86SArmin Le Grand                     }
704*56b35d86SArmin Le Grand                 }
705*56b35d86SArmin Le Grand 
706*56b35d86SArmin Le Grand                 if(SID_ATTR_PAGE_HEADERSET == nId)
707*56b35d86SArmin Le Grand                 {
708*56b35d86SArmin Le Grand                     //aBspWin.SetHdColor(rItem.GetColor());
709*56b35d86SArmin Le Grand                     aBspWin.setHeaderFillAttributes(aFillAttributes);
710*56b35d86SArmin Le Grand                 }
711cdf0e10cSrcweir                 else
712*56b35d86SArmin Le Grand                 {
713*56b35d86SArmin Le Grand                     //aBspWin.SetFtColor(rItem.GetColor());
714*56b35d86SArmin Le Grand                     aBspWin.setFooterFillAttributes(aFillAttributes);
715*56b35d86SArmin Le Grand                 }
716cdf0e10cSrcweir             }
717cdf0e10cSrcweir 
718cdf0e10cSrcweir             //----------------------------------------------------------------
719*56b35d86SArmin Le Grand             {
720*56b35d86SArmin Le Grand                 const sal_uInt16 nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
721cdf0e10cSrcweir 
722cdf0e10cSrcweir                 if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET)
723cdf0e10cSrcweir                 {
724cdf0e10cSrcweir                     const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get(nWhich);
725cdf0e10cSrcweir 
726cdf0e10cSrcweir                     if(nId == SID_ATTR_PAGE_HEADERSET)
727cdf0e10cSrcweir                         aBspWin.SetHdBorder(rItem);
728cdf0e10cSrcweir                     else
729cdf0e10cSrcweir                         aBspWin.SetFtBorder(rItem);
730cdf0e10cSrcweir                 }
731*56b35d86SArmin Le Grand             }
732cdf0e10cSrcweir 
733cdf0e10cSrcweir             UpdateExample();
734cdf0e10cSrcweir         }
735cdf0e10cSrcweir         delete pDlg;
736cdf0e10cSrcweir     }
737cdf0e10cSrcweir     return 0;
738cdf0e10cSrcweir }
739cdf0e10cSrcweir 
740cdf0e10cSrcweir /*--------------------------------------------------------------------
741cdf0e10cSrcweir     Beschreibung:   Bsp
742cdf0e10cSrcweir  --------------------------------------------------------------------*/
743cdf0e10cSrcweir 
UpdateExample()744cdf0e10cSrcweir void SvxHFPage::UpdateExample()
745cdf0e10cSrcweir {
746cdf0e10cSrcweir     if ( nId == SID_ATTR_PAGE_HEADERSET )
747cdf0e10cSrcweir     {
748cdf0e10cSrcweir         aBspWin.SetHeader( aTurnOnBox.IsChecked() );
749cdf0e10cSrcweir         aBspWin.SetHdHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
750cdf0e10cSrcweir         aBspWin.SetHdDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
751cdf0e10cSrcweir         aBspWin.SetHdLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
752cdf0e10cSrcweir         aBspWin.SetHdRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
753cdf0e10cSrcweir     }
754cdf0e10cSrcweir     else
755cdf0e10cSrcweir     {
756cdf0e10cSrcweir         aBspWin.SetFooter( aTurnOnBox.IsChecked() );
757cdf0e10cSrcweir         aBspWin.SetFtHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
758cdf0e10cSrcweir         aBspWin.SetFtDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
759cdf0e10cSrcweir         aBspWin.SetFtLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
760cdf0e10cSrcweir         aBspWin.SetFtRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
761cdf0e10cSrcweir     }
762cdf0e10cSrcweir     aBspWin.Invalidate();
763cdf0e10cSrcweir }
764cdf0e10cSrcweir 
765cdf0e10cSrcweir /*--------------------------------------------------------------------
766cdf0e10cSrcweir     Beschreibung: Hintergrund im Beispiel setzen
767cdf0e10cSrcweir  --------------------------------------------------------------------*/
768cdf0e10cSrcweir 
ResetBackground_Impl(const SfxItemSet & rSet)769cdf0e10cSrcweir void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
770cdf0e10cSrcweir {
771*56b35d86SArmin Le Grand     sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
772cdf0e10cSrcweir 
773*56b35d86SArmin Le Grand     if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
774cdf0e10cSrcweir     {
775*56b35d86SArmin Le Grand         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
776cdf0e10cSrcweir         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
777*56b35d86SArmin Le Grand         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
778cdf0e10cSrcweir 
779cdf0e10cSrcweir         if(rOn.GetValue())
780cdf0e10cSrcweir         {
781*56b35d86SArmin Le Grand             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;
782*56b35d86SArmin Le Grand 
783*56b35d86SArmin Le Grand             if(mbEnableDrawingLayerFillStyles)
784*56b35d86SArmin Le Grand             {
785*56b35d86SArmin Le Grand                 //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
786*56b35d86SArmin Le Grand                 aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
787*56b35d86SArmin Le Grand             }
788*56b35d86SArmin Le Grand             else
789*56b35d86SArmin Le Grand             {
790cdf0e10cSrcweir                 nWhich = GetWhich(SID_ATTR_BRUSH);
791cdf0e10cSrcweir 
792*56b35d86SArmin Le Grand                 if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
793cdf0e10cSrcweir                 {
794*56b35d86SArmin Le Grand                     //UUUU create FillAttributes from SvxBrushItem
795*56b35d86SArmin Le Grand                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
796*56b35d86SArmin Le Grand                     SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
797*56b35d86SArmin Le Grand 
798*56b35d86SArmin Le Grand                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
799*56b35d86SArmin Le Grand                     aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
800cdf0e10cSrcweir                 }
801*56b35d86SArmin Le Grand             }
802*56b35d86SArmin Le Grand 
803*56b35d86SArmin Le Grand             aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
804cdf0e10cSrcweir             nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
805cdf0e10cSrcweir 
806cdf0e10cSrcweir             if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
807cdf0e10cSrcweir             {
808cdf0e10cSrcweir                 const SvxBoxItem& rItem =
809cdf0e10cSrcweir                     (const SvxBoxItem&)rTmpSet.Get(nWhich);
810cdf0e10cSrcweir                 aBspWin.SetHdBorder(rItem);
811cdf0e10cSrcweir             }
812cdf0e10cSrcweir         }
813cdf0e10cSrcweir     }
814cdf0e10cSrcweir 
815cdf0e10cSrcweir     nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
816cdf0e10cSrcweir 
817*56b35d86SArmin Le Grand     if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False))
818cdf0e10cSrcweir     {
819*56b35d86SArmin Le Grand         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False));
820cdf0e10cSrcweir         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
821*56b35d86SArmin Le Grand         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
822cdf0e10cSrcweir 
823cdf0e10cSrcweir         if(rOn.GetValue())
824cdf0e10cSrcweir         {
825*56b35d86SArmin Le Grand             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;
826*56b35d86SArmin Le Grand 
827*56b35d86SArmin Le Grand             if(mbEnableDrawingLayerFillStyles)
828*56b35d86SArmin Le Grand             {
829*56b35d86SArmin Le Grand                 //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
830*56b35d86SArmin Le Grand                 aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
831*56b35d86SArmin Le Grand             }
832*56b35d86SArmin Le Grand             else
833*56b35d86SArmin Le Grand             {
834cdf0e10cSrcweir                 nWhich = GetWhich(SID_ATTR_BRUSH);
835cdf0e10cSrcweir 
836*56b35d86SArmin Le Grand                 if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich))
837cdf0e10cSrcweir                 {
838*56b35d86SArmin Le Grand                     //UUUU create FillAttributes from SvxBrushItem
839*56b35d86SArmin Le Grand                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
840*56b35d86SArmin Le Grand                     SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
841*56b35d86SArmin Le Grand 
842*56b35d86SArmin Le Grand                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
843*56b35d86SArmin Le Grand                     aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
844cdf0e10cSrcweir                 }
845*56b35d86SArmin Le Grand             }
846*56b35d86SArmin Le Grand 
847*56b35d86SArmin Le Grand             aBspWin.setFooterFillAttributes(aFooterFillAttributes);
848cdf0e10cSrcweir             nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
849cdf0e10cSrcweir 
850cdf0e10cSrcweir             if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET)
851cdf0e10cSrcweir             {
852*56b35d86SArmin Le Grand                 const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich));
853cdf0e10cSrcweir                 aBspWin.SetFtBorder(rItem);
854cdf0e10cSrcweir             }
855cdf0e10cSrcweir         }
856cdf0e10cSrcweir     }
857*56b35d86SArmin Le Grand 
858*56b35d86SArmin Le Grand     drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
859*56b35d86SArmin Le Grand 
860*56b35d86SArmin Le Grand     if(mbEnableDrawingLayerFillStyles)
861*56b35d86SArmin Le Grand     {
862*56b35d86SArmin Le Grand         //UUUU create FillAttributes directly from DrawingLayer FillStyle entries
863*56b35d86SArmin Le Grand         aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
864*56b35d86SArmin Le Grand     }
865*56b35d86SArmin Le Grand     else
866*56b35d86SArmin Le Grand     {
867cdf0e10cSrcweir         nWhich = GetWhich(SID_ATTR_BRUSH);
868cdf0e10cSrcweir 
869cdf0e10cSrcweir         if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
870cdf0e10cSrcweir         {
871*56b35d86SArmin Le Grand             //UUUU create FillAttributes from SvxBrushItem
872*56b35d86SArmin Le Grand             const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich));
873*56b35d86SArmin Le Grand             SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
874cdf0e10cSrcweir 
875*56b35d86SArmin Le Grand             setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
876*56b35d86SArmin Le Grand             aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
877cdf0e10cSrcweir         }
878cdf0e10cSrcweir     }
879*56b35d86SArmin Le Grand 
880*56b35d86SArmin Le Grand     aBspWin.setPageFillAttributes(aPageFillAttributes);
881cdf0e10cSrcweir     nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
882cdf0e10cSrcweir 
883cdf0e10cSrcweir     if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE)
884cdf0e10cSrcweir     {
885*56b35d86SArmin Le Grand         const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rSet.Get(nWhich));
886cdf0e10cSrcweir         aBspWin.SetBorder(rItem);
887cdf0e10cSrcweir     }
888cdf0e10cSrcweir }
889cdf0e10cSrcweir 
890cdf0e10cSrcweir /*--------------------------------------------------------------------
891cdf0e10cSrcweir     Beschreibung:
892cdf0e10cSrcweir  --------------------------------------------------------------------*/
893cdf0e10cSrcweir 
ActivatePage(const SfxItemSet & rSet)894cdf0e10cSrcweir void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
895cdf0e10cSrcweir {
896cdf0e10cSrcweir     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     if ( pItem )
899cdf0e10cSrcweir     {
900cdf0e10cSrcweir         // linken und rechten Rand einstellen
901cdf0e10cSrcweir         const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
902cdf0e10cSrcweir 
903cdf0e10cSrcweir         aBspWin.SetLeft( rLRSpace.GetLeft() );
904cdf0e10cSrcweir         aBspWin.SetRight( rLRSpace.GetRight() );
905cdf0e10cSrcweir     }
906cdf0e10cSrcweir     else
907cdf0e10cSrcweir     {
908cdf0e10cSrcweir         aBspWin.SetLeft( 0 );
909cdf0e10cSrcweir         aBspWin.SetRight( 0 );
910cdf0e10cSrcweir     }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir     pItem = GetItem( rSet, SID_ATTR_ULSPACE );
913cdf0e10cSrcweir 
914cdf0e10cSrcweir     if ( pItem )
915cdf0e10cSrcweir     {
916cdf0e10cSrcweir         // oberen und unteren Rand einstellen
917cdf0e10cSrcweir         const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
918cdf0e10cSrcweir 
919cdf0e10cSrcweir         aBspWin.SetTop( rULSpace.GetUpper() );
920cdf0e10cSrcweir         aBspWin.SetBottom( rULSpace.GetLower() );
921cdf0e10cSrcweir     }
922cdf0e10cSrcweir     else
923cdf0e10cSrcweir     {
924cdf0e10cSrcweir         aBspWin.SetTop( 0 );
925cdf0e10cSrcweir         aBspWin.SetBottom( 0 );
926cdf0e10cSrcweir     }
927cdf0e10cSrcweir 
928cdf0e10cSrcweir     sal_uInt16 nUsage = SVX_PAGE_ALL;
929cdf0e10cSrcweir     pItem = GetItem( rSet, SID_ATTR_PAGE );
930cdf0e10cSrcweir 
931cdf0e10cSrcweir     if ( pItem )
932cdf0e10cSrcweir         nUsage = ( (const SvxPageItem*)pItem )->GetPageUsage();
933cdf0e10cSrcweir 
934cdf0e10cSrcweir     aBspWin.SetUsage( nUsage );
935cdf0e10cSrcweir 
936cdf0e10cSrcweir     if ( SVX_PAGE_RIGHT == nUsage || SVX_PAGE_LEFT == nUsage )
937cdf0e10cSrcweir         aCntSharedBox.Disable();
938cdf0e10cSrcweir     else
939cdf0e10cSrcweir         aCntSharedBox.Enable();
940cdf0e10cSrcweir     pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
941cdf0e10cSrcweir 
942cdf0e10cSrcweir     if ( pItem )
943cdf0e10cSrcweir     {
944cdf0e10cSrcweir         // Orientation und Size aus dem PageItem
945cdf0e10cSrcweir         const SvxSizeItem& rSize = (const SvxSizeItem&)*pItem;
946cdf0e10cSrcweir         // die Groesse ist ggf. schon geswappt (Querformat)
947cdf0e10cSrcweir         aBspWin.SetSize( rSize.GetSize() );
948cdf0e10cSrcweir     }
949cdf0e10cSrcweir 
950cdf0e10cSrcweir     // Kopfzeilen-Attribute auswerten
951cdf0e10cSrcweir     const SvxSetItem* pSetItem = 0;
952cdf0e10cSrcweir 
953cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
954cdf0e10cSrcweir                                             sal_False,
955cdf0e10cSrcweir                                             (const SfxPoolItem**)&pSetItem ) )
956cdf0e10cSrcweir     {
957cdf0e10cSrcweir         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
958cdf0e10cSrcweir         const SfxBoolItem& rHeaderOn =
959cdf0e10cSrcweir             (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
960cdf0e10cSrcweir 
961cdf0e10cSrcweir         if ( rHeaderOn.GetValue() )
962cdf0e10cSrcweir         {
963cdf0e10cSrcweir             const SvxSizeItem& rSize = (const SvxSizeItem&)
964cdf0e10cSrcweir                 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
965cdf0e10cSrcweir             const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
966cdf0e10cSrcweir                 rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
967cdf0e10cSrcweir             const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
968cdf0e10cSrcweir                 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
969cdf0e10cSrcweir             long nDist = rUL.GetLower();
970cdf0e10cSrcweir 
971cdf0e10cSrcweir             aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
972cdf0e10cSrcweir             aBspWin.SetHdDist( nDist );
973cdf0e10cSrcweir             aBspWin.SetHdLeft( rLR.GetLeft() );
974cdf0e10cSrcweir             aBspWin.SetHdRight( rLR.GetRight() );
975cdf0e10cSrcweir             aBspWin.SetHeader( sal_True );
976cdf0e10cSrcweir         }
977cdf0e10cSrcweir         else
978cdf0e10cSrcweir             pSetItem = 0;
979cdf0e10cSrcweir     }
980cdf0e10cSrcweir 
981cdf0e10cSrcweir     if ( !pSetItem )
982cdf0e10cSrcweir     {
983cdf0e10cSrcweir         aBspWin.SetHeader( sal_False );
984cdf0e10cSrcweir 
985cdf0e10cSrcweir         if ( SID_ATTR_PAGE_HEADERSET == nId )
986cdf0e10cSrcweir             aCntSharedBox.Disable();
987cdf0e10cSrcweir     }
988cdf0e10cSrcweir     pSetItem = 0;
989cdf0e10cSrcweir 
990cdf0e10cSrcweir     if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
991cdf0e10cSrcweir                                             sal_False,
992cdf0e10cSrcweir                                             (const SfxPoolItem**)&pSetItem ) )
993cdf0e10cSrcweir     {
994cdf0e10cSrcweir         const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
995cdf0e10cSrcweir         const SfxBoolItem& rFooterOn =
996cdf0e10cSrcweir             (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
997cdf0e10cSrcweir 
998cdf0e10cSrcweir         if ( rFooterOn.GetValue() )
999cdf0e10cSrcweir         {
1000cdf0e10cSrcweir             const SvxSizeItem& rSize = (const SvxSizeItem&)
1001cdf0e10cSrcweir                 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
1002cdf0e10cSrcweir             const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
1003cdf0e10cSrcweir                 rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
1004cdf0e10cSrcweir             const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
1005cdf0e10cSrcweir                 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
1006cdf0e10cSrcweir             long nDist = rUL.GetUpper();
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir             aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
1009cdf0e10cSrcweir             aBspWin.SetFtDist( nDist );
1010cdf0e10cSrcweir             aBspWin.SetFtLeft( rLR.GetLeft() );
1011cdf0e10cSrcweir             aBspWin.SetFtRight( rLR.GetRight() );
1012cdf0e10cSrcweir             aBspWin.SetFooter( sal_True );
1013cdf0e10cSrcweir         }
1014cdf0e10cSrcweir         else
1015cdf0e10cSrcweir             pSetItem = 0;
1016cdf0e10cSrcweir     }
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir     if ( !pSetItem )
1019cdf0e10cSrcweir     {
1020cdf0e10cSrcweir         aBspWin.SetFooter( sal_False );
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir         if ( SID_ATTR_PAGE_FOOTERSET == nId )
1023cdf0e10cSrcweir             aCntSharedBox.Disable();
1024cdf0e10cSrcweir     }
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
1027cdf0e10cSrcweir 
1028cdf0e10cSrcweir     if ( pItem && pItem->ISA(SfxBoolItem) )
1029cdf0e10cSrcweir     {
1030cdf0e10cSrcweir         aBspWin.SetTable( sal_True );
1031cdf0e10cSrcweir         aBspWin.SetHorz( ( (SfxBoolItem*)pItem )->GetValue() );
1032cdf0e10cSrcweir     }
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir     if ( pItem && pItem->ISA(SfxBoolItem) )
1037cdf0e10cSrcweir     {
1038cdf0e10cSrcweir         aBspWin.SetTable( sal_True );
1039cdf0e10cSrcweir         aBspWin.SetVert( ( (SfxBoolItem*)pItem )->GetValue() );
1040cdf0e10cSrcweir     }
1041cdf0e10cSrcweir     ResetBackground_Impl( rSet );
1042cdf0e10cSrcweir     RangeHdl( 0 );
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir /*--------------------------------------------------------------------
1046cdf0e10cSrcweir     Beschreibung:
1047cdf0e10cSrcweir  --------------------------------------------------------------------*/
1048cdf0e10cSrcweir 
DeactivatePage(SfxItemSet * _pSet)1049cdf0e10cSrcweir int SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir     if ( _pSet )
1052cdf0e10cSrcweir         FillItemSet( *_pSet );
1053cdf0e10cSrcweir     return LEAVE_PAGE;
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir /*--------------------------------------------------------------------
1057cdf0e10cSrcweir     Beschreibung:   Berech
1058cdf0e10cSrcweir  --------------------------------------------------------------------*/
1059cdf0e10cSrcweir 
IMPL_LINK(SvxHFPage,RangeHdl,Edit *,EMPTYARG)1060cdf0e10cSrcweir IMPL_LINK( SvxHFPage, RangeHdl, Edit *, EMPTYARG )
1061cdf0e10cSrcweir {
1062cdf0e10cSrcweir     long nHHeight = aBspWin.GetHdHeight();
1063cdf0e10cSrcweir     long nHDist   = aBspWin.GetHdDist();
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir     long nFHeight = aBspWin.GetFtHeight();
1066cdf0e10cSrcweir     long nFDist   = aBspWin.GetFtDist();
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir     long nHeight = Max( (long)MINBODY,
1069cdf0e10cSrcweir         static_cast<long>(aHeightEdit.Denormalize( aHeightEdit.GetValue( FUNIT_TWIP ) ) ) );
1070cdf0e10cSrcweir     long nDist   = aTurnOnBox.IsChecked() ?
1071cdf0e10cSrcweir         static_cast<long>(aDistEdit.Denormalize( aDistEdit.GetValue( FUNIT_TWIP ) )) : 0;
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir     long nMin;
1074cdf0e10cSrcweir     long nMax;
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir     if ( nId == SID_ATTR_PAGE_HEADERSET )
1077cdf0e10cSrcweir     {
1078cdf0e10cSrcweir         nHHeight = nHeight;
1079cdf0e10cSrcweir         nHDist   = nDist;
1080cdf0e10cSrcweir     }
1081cdf0e10cSrcweir     else
1082cdf0e10cSrcweir     {
1083cdf0e10cSrcweir         nFHeight = nHeight;
1084cdf0e10cSrcweir         nFDist   = nDist;
1085cdf0e10cSrcweir     }
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir     // Aktuelle Werte der Seitenraender
1088cdf0e10cSrcweir     long nBT = aBspWin.GetTop();
1089cdf0e10cSrcweir     long nBB = aBspWin.GetBottom();
1090cdf0e10cSrcweir     long nBL = aBspWin.GetLeft();
1091cdf0e10cSrcweir     long nBR = aBspWin.GetRight();
1092cdf0e10cSrcweir 
1093cdf0e10cSrcweir     long nH  = aBspWin.GetSize().Height();
1094cdf0e10cSrcweir     long nW  = aBspWin.GetSize().Width();
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir     // Grenzen
1097cdf0e10cSrcweir     if ( nId == SID_ATTR_PAGE_HEADERSET )
1098cdf0e10cSrcweir     {
1099cdf0e10cSrcweir         // Header
1100cdf0e10cSrcweir         nMin = ( nH - nBB - nBT ) / 5; // 20%
1101cdf0e10cSrcweir         nMax = Max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1102cdf0e10cSrcweir                     nMin );
1103cdf0e10cSrcweir         aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
1104cdf0e10cSrcweir         nMin = ( nH - nBB - nBT ) / 5; // 20%
1105cdf0e10cSrcweir         nDist = Max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1106cdf0e10cSrcweir                      long(0) );
1107cdf0e10cSrcweir         aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
1108cdf0e10cSrcweir     }
1109cdf0e10cSrcweir     else
1110cdf0e10cSrcweir     {
1111cdf0e10cSrcweir         // Footer
1112cdf0e10cSrcweir         nMin = ( nH - nBT - nBB ) / 5; // 20%
1113cdf0e10cSrcweir         nMax = Max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1114cdf0e10cSrcweir                     nMin );
1115cdf0e10cSrcweir         aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
1116cdf0e10cSrcweir         nMin = ( nH - nBT - nBB ) / 5; // 20%
1117cdf0e10cSrcweir         nDist = Max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1118cdf0e10cSrcweir                      long(0) );
1119cdf0e10cSrcweir         aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
1120cdf0e10cSrcweir     }
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir     // Einzuege beschraenken
1123cdf0e10cSrcweir     nMax = nW - nBL - nBR -
1124cdf0e10cSrcweir            static_cast<long>(aRMEdit.Denormalize( aRMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
1125cdf0e10cSrcweir     aLMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
1126cdf0e10cSrcweir 
1127cdf0e10cSrcweir     nMax = nW - nBL - nBR -
1128cdf0e10cSrcweir            static_cast<long>(aLMEdit.Denormalize( aLMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
1129cdf0e10cSrcweir     aRMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
1130cdf0e10cSrcweir     return 0;
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir /* -----------------------------26.08.2002 12:49------------------------------
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
lcl_Move(Window & rWin,sal_Int32 nDiff)1135cdf0e10cSrcweir void lcl_Move(Window& rWin, sal_Int32 nDiff)
1136cdf0e10cSrcweir {
1137cdf0e10cSrcweir     Point aPos(rWin.GetPosPixel());
1138cdf0e10cSrcweir     aPos.Y() -= nDiff;
1139cdf0e10cSrcweir     rWin.SetPosPixel(aPos);
1140cdf0e10cSrcweir }
1141*56b35d86SArmin Le Grand 
EnableDynamicSpacing()1142cdf0e10cSrcweir void SvxHFPage::EnableDynamicSpacing()
1143cdf0e10cSrcweir {
1144cdf0e10cSrcweir     aDynSpacingCB.Show();
1145cdf0e10cSrcweir     //move all following controls
1146cdf0e10cSrcweir     Window* aMoveWindows[] =
1147cdf0e10cSrcweir     {
1148cdf0e10cSrcweir         &aHeightFT,
1149cdf0e10cSrcweir         &aHeightEdit,
1150cdf0e10cSrcweir         &aHeightDynBtn,
1151cdf0e10cSrcweir         &aBackgroundBtn,
1152cdf0e10cSrcweir         0
1153cdf0e10cSrcweir     };
1154cdf0e10cSrcweir     sal_Int32 nOffset = aTurnOnBox.GetPosPixel().Y() - aCntSharedBox.GetPosPixel().Y();
1155cdf0e10cSrcweir     sal_Int32 nIdx = 0;
1156cdf0e10cSrcweir     while(aMoveWindows[nIdx])
1157cdf0e10cSrcweir         lcl_Move(*aMoveWindows[nIdx++], nOffset);
1158cdf0e10cSrcweir }
1159cdf0e10cSrcweir 
PageCreated(SfxAllItemSet aSet)1160*56b35d86SArmin Le Grand void SvxHFPage::PageCreated(SfxAllItemSet aSet)
1161*56b35d86SArmin Le Grand {
1162*56b35d86SArmin Le Grand     //UUUU
1163*56b35d86SArmin Le Grand     SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, sal_False);
1164*56b35d86SArmin Le Grand 
1165*56b35d86SArmin Le Grand     if(pSupportDrawingLayerFillStyleItem)
1166*56b35d86SArmin Le Grand     {
1167*56b35d86SArmin Le Grand         const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
1168*56b35d86SArmin Le Grand 
1169*56b35d86SArmin Le Grand         EnableDrawingLayerFillStyles(bNew);
1170*56b35d86SArmin Le Grand     }
1171*56b35d86SArmin Le Grand }
1172*56b35d86SArmin Le Grand 
1173*56b35d86SArmin Le Grand //eof
1174