xref: /core/svx/source/dialog/hdft.cxx (revision 55042cb5)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <svl/itemiter.hxx>
21 #include <sfx2/app.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sfx2/module.hxx>
24 #include <vcl/graph.hxx>
25 #include <sfx2/sfxsids.hrc>
26 #include <svx/svxids.hrc>
27 
28 #include <svl/intitem.hxx>
29 
30 #include <svx/hdft.hxx>
31 #include <svx/pageitem.hxx>
32 
33 #include <svx/dlgutil.hxx>
34 #include <sfx2/htmlmode.hxx>
35 
36 #include <editeng/brushitem.hxx>
37 #include <editeng/lrspitem.hxx>
38 #include <editeng/ulspitem.hxx>
39 #include <editeng/shaditem.hxx>
40 #include <editeng/sizeitem.hxx>
41 #include <editeng/boxitem.hxx>
42 
43 #include <svx/svxdlg.hxx>
44 #include <memory>
45 
46 #include <svx/xdef.hxx>
47 #include <svx/xenum.hxx>
48 #include <svx/xfillit0.hxx>
49 #include <svx/unobrushitemhelper.hxx>
50 #include <sfx2/request.hxx>
51 
52 using namespace com::sun::star;
53 
54 // Word 97 incompatibility (#i19922#)
55 static const long MINBODY = 56;  // 1mm in twips rounded
56 
57 // default distance to Header or footer
58 static const long DEF_DIST_WRITER = 500;    // 5mm (Writer)
59 static const long DEF_DIST_CALC = 250;      // 2.5mm (Calc)
60 
61 const sal_uInt16 SvxHFPage::pRanges[] =
62 {
63     SID_ATTR_BRUSH,          SID_ATTR_BRUSH,
64 
65     // Support DrawingLayer FillStyles (no real call to below GetRanges()
66     // detected, still do the complete transition)
67     XATTR_FILL_FIRST,        XATTR_FILL_LAST,
68 
69     SID_ATTR_BORDER_OUTER,   SID_ATTR_BORDER_OUTER,
70     SID_ATTR_BORDER_INNER,   SID_ATTR_BORDER_INNER,
71     SID_ATTR_BORDER_SHADOW,  SID_ATTR_BORDER_SHADOW,
72     SID_ATTR_LRSPACE,        SID_ATTR_LRSPACE,
73     SID_ATTR_ULSPACE,        SID_ATTR_ULSPACE,
74     SID_ATTR_PAGE_SIZE,      SID_ATTR_PAGE_SIZE,
75     SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
76     SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
77     SID_ATTR_PAGE_ON,        SID_ATTR_PAGE_ON,
78     SID_ATTR_PAGE_DYNAMIC,   SID_ATTR_PAGE_DYNAMIC,
79     SID_ATTR_PAGE_SHARED,    SID_ATTR_PAGE_SHARED,
80     SID_ATTR_PAGE_SHARED_FIRST,    SID_ATTR_PAGE_SHARED_FIRST,
81     SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
82     0
83 };
84 
85 namespace svx {
86 
87     bool ShowBorderBackgroundDlg(weld::Window* pParent, SfxItemSet* pBBSet)
88     {
89         bool bRes = false;
90         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
91         ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg(pParent, *pBBSet, true /*bEnableDrawingLayerFillStyles*/));
92         if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
93         {
94             SfxItemIter aIter( *pDlg->GetOutputItemSet() );
95             const SfxPoolItem* pItem = aIter.FirstItem();
96 
97             while ( pItem )
98             {
99                 if ( !IsInvalidItem( pItem ) )
100                     pBBSet->Put( *pItem );
101                 pItem = aIter.NextItem();
102             }
103             bRes = true;
104         }
105         return bRes;
106     }
107 }
108 
109 VclPtr<SfxTabPage> SvxHeaderPage::Create( TabPageParent pParent, const SfxItemSet* rSet )
110 {
111     return VclPtr<SvxHeaderPage>::Create( pParent, *rSet );
112 }
113 
114 VclPtr<SfxTabPage> SvxFooterPage::Create( TabPageParent pParent, const SfxItemSet* rSet )
115 {
116     return VclPtr<SvxFooterPage>::Create( pParent, *rSet );
117 }
118 
119 SvxHeaderPage::SvxHeaderPage(TabPageParent pParent, const SfxItemSet& rAttr)
120     : SvxHFPage( pParent, rAttr, SID_ATTR_PAGE_HEADERSET )
121 {
122 }
123 
124 SvxFooterPage::SvxFooterPage(TabPageParent pParent, const SfxItemSet& rAttr)
125     : SvxHFPage( pParent, rAttr, SID_ATTR_PAGE_FOOTERSET )
126 {
127 }
128 
129 SvxHFPage::SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId)
130     : SfxTabPage(pParent, "svx/ui/headfootformatpage.ui", "HFFormatPage", &rSet)
131     , nId(nSetId)
132     , mbDisableQueryBox(false)
133     , mbEnableDrawingLayerFillStyles(false)
134     , m_xCntSharedBox(m_xBuilder->weld_check_button("checkSameLR"))
135     , m_xCntSharedFirstBox(m_xBuilder->weld_check_button("checkSameFP"))
136     , m_xLMLbl(m_xBuilder->weld_label("labelLeftMarg"))
137     , m_xLMEdit(m_xBuilder->weld_metric_spin_button("spinMargLeft", FieldUnit::CM))
138     , m_xRMLbl(m_xBuilder->weld_label("labelRightMarg"))
139     , m_xRMEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", FieldUnit::CM))
140     , m_xDistFT(m_xBuilder->weld_label("labelSpacing"))
141     , m_xDistEdit(m_xBuilder->weld_metric_spin_button("spinSpacing", FieldUnit::CM))
142     , m_xDynSpacingCB(m_xBuilder->weld_check_button("checkDynSpacing"))
143     , m_xHeightFT(m_xBuilder->weld_label("labelHeight"))
144     , m_xHeightEdit(m_xBuilder->weld_metric_spin_button("spinHeight", FieldUnit::CM))
145     , m_xHeightDynBtn(m_xBuilder->weld_check_button("checkAutofit"))
146     , m_xBackgroundBtn(m_xBuilder->weld_button("buttonMore"))
147     , m_xBspWin(new weld::CustomWeld(*m_xBuilder, "drawingareaPageHF", m_aBspWin))
148 {
149     //swap header <-> footer in UI
150     if (nId == SID_ATTR_PAGE_FOOTERSET)
151     {
152         m_xPageLbl = m_xBuilder->weld_label("labelFooterFormat");
153         m_xTurnOnBox = m_xBuilder->weld_check_button("checkFooterOn");
154 
155         /* Set custom HIDs for the Footer help page (shared/01/05040400.xhp)
156         otherwise it would display the same extended help
157         on both the Header and Footer tabs */
158         m_xCntSharedBox->set_help_id( "SVX_HID_FOOTER_CHECKSAMELR" );
159         m_xCntSharedFirstBox->set_help_id( "SVX_HID_FOOTER_CHECKSAMEFP" );
160         m_xLMEdit->set_help_id( "SVX_HID_FOOTER_SPINMARGLEFT" );
161         m_xRMEdit->set_help_id( "SVX_HID_FOOTER_SPINMARGRIGHT" );
162         m_xDistEdit->set_help_id( "SVX_HID_FOOTER_SPINSPACING" );
163         m_xDynSpacingCB->set_help_id( "SVX_HID_FOOTER_CHECKDYNSPACING" );
164         m_xHeightEdit->set_help_id( "SVX_HID_FOOTER_SPINHEIGHT" );
165         m_xHeightDynBtn->set_help_id( "SVX_HID_FOOTER_CHECKAUTOFIT" );
166         m_xBackgroundBtn->set_help_id( "SVX_HID_FOOTER_BUTTONMORE" );
167     }
168     else //Header
169     {
170         m_xPageLbl = m_xBuilder->weld_label("labelHeaderFormat");
171         m_xTurnOnBox = m_xBuilder->weld_check_button("checkHeaderOn");
172     }
173     m_xTurnOnBox->show();
174     m_xPageLbl->show();
175 
176     InitHandler();
177     m_aBspWin.EnableRTL(false);
178 
179     // This Page needs ExchangeSupport
180     SetExchangeSupport();
181 
182     // Set metrics
183     FieldUnit eFUnit = GetModuleFieldUnit( rSet );
184     SetFieldUnit( *m_xDistEdit, eFUnit );
185     SetFieldUnit( *m_xHeightEdit, eFUnit );
186     SetFieldUnit( *m_xLMEdit, eFUnit );
187     SetFieldUnit( *m_xRMEdit, eFUnit );
188 }
189 
190 SvxHFPage::~SvxHFPage()
191 {
192 }
193 
194 bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
195 {
196     const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE);
197     const sal_uInt16 nWLRSpace = GetWhich(SID_ATTR_LRSPACE);
198     const sal_uInt16 nWULSpace = GetWhich(SID_ATTR_ULSPACE);
199     const sal_uInt16 nWOn = GetWhich(SID_ATTR_PAGE_ON);
200     const sal_uInt16 nWDynamic = GetWhich(SID_ATTR_PAGE_DYNAMIC);
201     const sal_uInt16 nWDynSpacing = GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING);
202     const sal_uInt16 nWShared = GetWhich(SID_ATTR_PAGE_SHARED);
203     const sal_uInt16 nWSharedFirst = GetWhich( SID_ATTR_PAGE_SHARED_FIRST );
204     const sal_uInt16 nWBrush = GetWhich(SID_ATTR_BRUSH);
205     const sal_uInt16 nWBox = GetWhich(SID_ATTR_BORDER_OUTER);
206     const sal_uInt16 nWBoxInfo = GetWhich(SID_ATTR_BORDER_INNER);
207     const sal_uInt16 nWShadow = GetWhich(SID_ATTR_BORDER_SHADOW);
208 
209     const sal_uInt16 aWhichTab[] = {
210         nWSize, nWSize,
211         nWLRSpace, nWLRSpace,
212         nWULSpace, nWULSpace,
213         nWOn, nWOn,
214         nWDynamic, nWDynamic,
215         nWShared, nWShared,
216         nWSharedFirst, nWSharedFirst,
217         nWBrush, nWBrush,
218         nWBoxInfo, nWBoxInfo,
219         nWBox, nWBox,
220         nWShadow, nWShadow,
221         nWDynSpacing, nWDynSpacing,
222 
223         // take over DrawingLayer FillStyles
224         XATTR_FILL_FIRST, XATTR_FILL_LAST,                // [1014
225 
226         0, 0};
227 
228     const SfxItemSet& rOldSet = GetItemSet();
229     SfxItemPool* pPool = rOldSet.GetPool();
230     DBG_ASSERT(pPool,"no pool :-(");
231     MapUnit eUnit = pPool->GetMetric(nWSize);
232     SfxItemSet aSet(*pPool,aWhichTab);
233 
234     if(mbEnableDrawingLayerFillStyles)
235     {
236         // When using the XATTR_FILLSTYLE DrawingLayer FillStyle definition
237         // extra action has to be done here since the pool default is drawing::FillStyle_SOLID
238         // instead of drawing::FillStyle_NONE (to have the default blue fill color at start).
239         aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
240     }
241 
242     aSet.Put( SfxBoolItem( nWOn,      m_xTurnOnBox->get_active() ) );
243     aSet.Put( SfxBoolItem( nWDynamic, m_xHeightDynBtn->get_active() ) );
244     aSet.Put( SfxBoolItem( nWShared,  m_xCntSharedBox->get_active() ) );
245     if(m_xCntSharedFirstBox->get_visible())
246         aSet.Put(SfxBoolItem(nWSharedFirst,  m_xCntSharedFirstBox->get_active()));
247     if (m_xDynSpacingCB->get_visible() && SfxItemPool::IsWhich(nWDynSpacing))
248     {
249         std::unique_ptr<SfxBoolItem> pBoolItem(static_cast<SfxBoolItem*>(pPool->GetDefaultItem(nWDynSpacing).Clone()));
250         pBoolItem->SetValue(m_xDynSpacingCB->get_active());
251         aSet.Put(*pBoolItem);
252     }
253 
254     // Size
255     SvxSizeItem aSizeItem( static_cast<const SvxSizeItem&>(rOldSet.Get( nWSize )) );
256     Size        aSize( aSizeItem.GetSize() );
257     long        nDist = GetCoreValue( *m_xDistEdit, eUnit );
258     long        nH    = GetCoreValue( *m_xHeightEdit, eUnit );
259 
260     nH += nDist; // add distance
261     aSize.setHeight( nH );
262     aSizeItem.SetSize( aSize );
263     aSet.Put( aSizeItem );
264 
265     // Margins
266     SvxLRSpaceItem aLR( nWLRSpace );
267     aLR.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLMEdit, eUnit )) );
268     aLR.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRMEdit, eUnit )) );
269     aSet.Put( aLR );
270 
271     SvxULSpaceItem aUL( nWULSpace );
272     if ( nId == SID_ATTR_PAGE_HEADERSET )
273         aUL.SetLower( static_cast<sal_uInt16>(nDist) );
274     else
275         aUL.SetUpper( static_cast<sal_uInt16>(nDist) );
276     aSet.Put( aUL );
277 
278     // Background and border?
279     if (pBBSet)
280     {
281         aSet.Put(*pBBSet);
282     }
283     else
284     {
285         const SfxPoolItem* pItem;
286 
287         if(SfxItemState::SET == GetItemSet().GetItemState(GetWhich(nId), false, &pItem))
288         {
289             const SfxItemSet* _pSet = &(static_cast< const SvxSetItem* >(pItem)->GetItemSet());
290 
291             if(_pSet->GetItemState(nWBrush) == SfxItemState::SET)
292             {
293                 aSet.Put(_pSet->Get(nWBrush));
294             }
295 
296             if(_pSet->GetItemState(nWBoxInfo) == SfxItemState::SET)
297             {
298                 aSet.Put(_pSet->Get(nWBoxInfo));
299             }
300 
301             if(_pSet->GetItemState(nWBox) == SfxItemState::SET)
302             {
303                 aSet.Put(_pSet->Get(nWBox));
304             }
305 
306             if(_pSet->GetItemState(nWShadow) == SfxItemState::SET)
307             {
308                 aSet.Put(_pSet->Get(nWShadow));
309             }
310 
311             // take care of [XATTR_XATTR_FILL_FIRST .. XATTR_FILL_LAST]
312             for(sal_uInt16 nFillStyleId(XATTR_FILL_FIRST); nFillStyleId <= XATTR_FILL_LAST; nFillStyleId++)
313             {
314                 if(_pSet->GetItemState(nFillStyleId) == SfxItemState::SET)
315                 {
316                     aSet.Put(_pSet->Get(nFillStyleId));
317                 }
318             }
319         }
320     }
321 
322     // Flush the SetItem
323     SvxSetItem aSetItem( GetWhich( nId ), aSet );
324     rSet->Put( aSetItem );
325 
326     return true;
327 }
328 
329 
330 void SvxHFPage::Reset( const SfxItemSet* rSet )
331 {
332     ActivatePage( *rSet );
333     ResetBackground_Impl( *rSet );
334 
335     SfxItemPool* pPool = GetItemSet().GetPool();
336     DBG_ASSERT( pPool, "Where is the pool" );
337     MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
338 
339     //hide "same content on first page when this is calc
340     bool bIsCalc = false;
341     const SfxPoolItem* pExt1 = GetItem(*rSet, SID_ATTR_PAGE_EXT1);
342     const SfxPoolItem* pExt2 = GetItem(*rSet, SID_ATTR_PAGE_EXT2);
343     if (dynamic_cast<const SfxBoolItem*>(pExt1) && dynamic_cast<const SfxBoolItem*>(pExt2) )
344         bIsCalc = true;
345     m_xCntSharedFirstBox->show(!bIsCalc);
346 
347     // Evaluate header-/footer- attributes
348     const SvxSetItem* pSetItem = nullptr;
349 
350     if ( SfxItemState::SET == rSet->GetItemState( GetWhich(nId), false,
351                                             reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
352     {
353         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
354         const SfxBoolItem& rHeaderOn =
355             static_cast<const SfxBoolItem&>(rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
356 
357         m_xTurnOnBox->set_active(rHeaderOn.GetValue());
358 
359         if ( rHeaderOn.GetValue() )
360         {
361             const SfxBoolItem& rDynamic =
362                 static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) ));
363             const SfxBoolItem& rShared =
364                 static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) ));
365             const SfxBoolItem* pSharedFirst = nullptr;
366             if (rHeaderSet.HasItem(GetWhich(SID_ATTR_PAGE_SHARED_FIRST)))
367                 pSharedFirst = static_cast<const SfxBoolItem*>(&rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED_FIRST ) ));
368             const SvxSizeItem& rSize =
369                 static_cast<const SvxSizeItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
370             const SvxULSpaceItem& rUL =
371                 static_cast<const SvxULSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
372             const SvxLRSpaceItem& rLR =
373                 static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
374             if (m_xDynSpacingCB->get_visible())
375             {
376                 const SfxBoolItem& rDynSpacing =
377                     static_cast<const SfxBoolItem&>(rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING)));
378                 m_xDynSpacingCB->set_active(rDynSpacing.GetValue());
379             }
380 
381 
382             if ( nId == SID_ATTR_PAGE_HEADERSET )
383             {   // Header
384                 SetMetricValue( *m_xDistEdit, rUL.GetLower(), eUnit );
385                 SetMetricValue( *m_xHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
386             }
387             else
388             {   // Footer
389                 SetMetricValue( *m_xDistEdit, rUL.GetUpper(), eUnit );
390                 SetMetricValue( *m_xHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
391             }
392 
393             m_xHeightDynBtn->set_active(rDynamic.GetValue());
394             SetMetricValue( *m_xLMEdit, rLR.GetLeft(), eUnit );
395             SetMetricValue( *m_xRMEdit, rLR.GetRight(), eUnit );
396             m_xCntSharedBox->set_active(rShared.GetValue());
397             if (pSharedFirst)
398                 m_xCntSharedFirstBox->set_active(pSharedFirst->GetValue());
399             else
400                 m_xCntSharedFirstBox->hide();
401         }
402         else
403             pSetItem = nullptr;
404     }
405     else
406     {
407         // defaults for distance and height
408         long nDefaultDist = bIsCalc ? DEF_DIST_CALC : DEF_DIST_WRITER;
409         SetMetricValue( *m_xDistEdit, nDefaultDist, MapUnit::Map100thMM );
410         SetMetricValue( *m_xHeightEdit, 500, MapUnit::Map100thMM );
411     }
412 
413     if ( !pSetItem )
414     {
415         m_xTurnOnBox->set_active(false);
416         m_xHeightDynBtn->set_active(true);
417         m_xCntSharedBox->set_active(true);
418         m_xCntSharedFirstBox->set_active(true);
419     }
420 
421     TurnOn(nullptr);
422 
423     m_xTurnOnBox->save_state();
424     m_xDistEdit->save_value();
425     m_xHeightEdit->save_value();
426     m_xHeightDynBtn->save_state();
427     m_xLMEdit->save_value();
428     m_xRMEdit->save_value();
429     m_xCntSharedBox->save_state();
430     RangeHdl();
431 
432     const SfxPoolItem* pItem = nullptr;
433     SfxObjectShell* pShell;
434     if(SfxItemState::SET == rSet->GetItemState(SID_HTML_MODE, false, &pItem) ||
435         ( nullptr != (pShell = SfxObjectShell::Current()) &&
436                     nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
437     {
438         sal_uInt16 nHtmlMode = 0;
439         nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
440         if (nHtmlMode & HTMLMODE_ON)
441         {
442             m_xCntSharedBox->hide();
443             m_xBackgroundBtn->hide();
444         }
445     }
446 
447 }
448 
449 void SvxHFPage::InitHandler()
450 {
451     m_xTurnOnBox->connect_toggled(LINK(this, SvxHFPage, TurnOnHdl));
452     m_xDistEdit->connect_value_changed(LINK(this, SvxHFPage, ValueChangeHdl));
453     m_xHeightEdit->connect_value_changed(LINK(this,SvxHFPage,ValueChangeHdl));
454 
455     m_xLMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
456     m_xRMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
457     m_xBackgroundBtn->connect_clicked(LINK(this,SvxHFPage, BackgroundHdl));
458 }
459 
460 void SvxHFPage::TurnOn(const weld::ToggleButton* pBox)
461 {
462     if (m_xTurnOnBox->get_active())
463     {
464         m_xDistFT->set_sensitive(true);
465         m_xDistEdit->set_sensitive(true);
466         m_xDynSpacingCB->set_sensitive(true);
467         m_xHeightFT->set_sensitive(true);
468         m_xHeightEdit->set_sensitive(true);
469         m_xHeightDynBtn->set_sensitive(true);
470         m_xLMLbl->set_sensitive(true);
471         m_xLMEdit->set_sensitive(true);
472         m_xRMLbl->set_sensitive(true);
473         m_xRMEdit->set_sensitive(true);
474 
475         SvxPageUsage nUsage = m_aBspWin.GetUsage();
476 
477         if( nUsage == SvxPageUsage::Right || nUsage == SvxPageUsage::Left )
478             m_xCntSharedBox->set_sensitive(false);
479         else
480         {
481             m_xCntSharedBox->set_sensitive(true);
482             m_xCntSharedFirstBox->set_sensitive(true);
483         }
484         m_xBackgroundBtn->set_sensitive(true);
485     }
486     else
487     {
488         bool bDelete = true;
489 
490         if (!mbDisableQueryBox && pBox && m_xTurnOnBox->get_saved_state() == TRISTATE_TRUE)
491         {
492             short nResult;
493             if (nId == SID_ATTR_PAGE_HEADERSET)
494             {
495                 DeleteHeaderDialog aDlg(GetFrameWeld());
496                 nResult = aDlg.run();
497             }
498             else
499             {
500                 DeleteFooterDialog aDlg(GetFrameWeld());
501                 nResult = aDlg.run();
502             }
503             bDelete = nResult == RET_YES;
504         }
505 
506         if ( bDelete )
507         {
508             m_xDistFT->set_sensitive(false);
509             m_xDistEdit->set_sensitive(false);
510             m_xDynSpacingCB->set_sensitive(false);
511             m_xHeightFT->set_sensitive(false);
512             m_xHeightEdit->set_sensitive(false);
513             m_xHeightDynBtn->set_sensitive(false);
514 
515             m_xLMLbl->set_sensitive(false);
516             m_xLMEdit->set_sensitive(false);
517             m_xRMLbl->set_sensitive(false);
518             m_xRMEdit->set_sensitive(false);
519 
520             m_xCntSharedBox->set_sensitive(false);
521             m_xBackgroundBtn->set_sensitive(false);
522             m_xCntSharedFirstBox->set_sensitive(false);
523         }
524         else
525             m_xTurnOnBox->set_active(true);
526     }
527     UpdateExample();
528 }
529 
530 IMPL_LINK(SvxHFPage, TurnOnHdl, weld::ToggleButton&, rBox, void)
531 {
532     TurnOn(&rBox);
533 }
534 
535 IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, weld::Button&, void)
536 {
537     if(!pBBSet)
538     {
539         // Use only the necessary items for border and background
540         const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER));
541         const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, false));
542         const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW));
543 
544         if(mbEnableDrawingLayerFillStyles)
545         {
546             pBBSet.reset(new SfxItemSet(
547                 *GetItemSet().GetPool(),
548                 {{XATTR_FILL_FIRST, XATTR_FILL_LAST},  // DrawingLayer FillStyle definitions
549                 {SID_COLOR_TABLE, SID_PATTERN_LIST},   // XPropertyLists for Color, Gradient, Hatch and Graphic fills
550                 {nOuter, nOuter},
551                 {nInner, nInner},
552                 {nShadow, nShadow}}));
553 
554             // copy items for XPropertyList entries from the DrawModel so that
555             // the Area TabPage can access them
556             static const sal_uInt16 nCopyFlags[] = {
557                 SID_COLOR_TABLE,
558                 SID_GRADIENT_LIST,
559                 SID_HATCH_LIST,
560                 SID_BITMAP_LIST,
561                 SID_PATTERN_LIST,
562                 0
563             };
564 
565             for(sal_uInt16 a(0); nCopyFlags[a]; a++)
566             {
567                 const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]);
568 
569                 if(pItem)
570                 {
571                     pBBSet->Put(*pItem);
572                 }
573                 else
574                 {
575                     OSL_ENSURE(false, "XPropertyList missing (!)");
576                 }
577             }
578         }
579         else
580         {
581             const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH));
582 
583             pBBSet.reset( new SfxItemSet(
584                 *GetItemSet().GetPool(),
585                 {{XATTR_FILL_FIRST, XATTR_FILL_LAST},
586                 {nBrush, nBrush},
587                 {nOuter, nOuter},
588                 {nInner, nInner},
589                 {nShadow, nShadow}}) );
590         }
591 
592         const SfxPoolItem* pItem;
593 
594         if(SfxItemState::SET == GetItemSet().GetItemState(GetWhich(nId), false, &pItem))
595         {
596             // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or
597             // SID_ATTR_PAGE_FOOTERSET exists, use its content
598             pBBSet->Put(static_cast<const SvxSetItem*>(pItem)->GetItemSet());
599         }
600         else
601         {
602             if(mbEnableDrawingLayerFillStyles)
603             {
604                 // The style for header/footer is not yet created, need to reset
605                 // XFillStyleItem to drawing::FillStyle_NONE which is the same as in the style
606                 // initialization. This needs to be done since the pool default for
607                 // XFillStyleItem is drawing::FillStyle_SOLID
608                 pBBSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
609             }
610         }
611 
612         if(SfxItemState::SET == GetItemSet().GetItemState(nInner, false, &pItem))
613         {
614             // The set InfoItem is always required
615             pBBSet->Put(*pItem);
616         }
617     }
618 
619     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
620 
621     ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg(
622         GetDialogFrameWeld(),
623         *pBBSet,
624         mbEnableDrawingLayerFillStyles));
625 
626     if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet())
627     {
628         SfxItemIter aIter(*pDlg->GetOutputItemSet());
629         const SfxPoolItem* pItem = aIter.FirstItem();
630 
631         while(pItem)
632         {
633             if(!IsInvalidItem(pItem))
634             {
635                 pBBSet->Put(*pItem);
636             }
637 
638             pItem = aIter.NextItem();
639         }
640 
641         {
642             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
643 
644             if(mbEnableDrawingLayerFillStyles)
645             {
646                 // create FillAttributes directly from DrawingLayer FillStyle entries
647                 aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet));
648             }
649             else
650             {
651                 const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);
652 
653                 if(pBBSet->GetItemState(nWhich) == SfxItemState::SET)
654                 {
655                     // create FillAttributes from SvxBrushItem
656                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich));
657                     SfxItemSet aTempSet(*pBBSet->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
658 
659                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
660                     aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
661                 }
662             }
663 
664             if(SID_ATTR_PAGE_HEADERSET == nId)
665             {
666                 //m_aBspWin.SetHdColor(rItem.GetColor());
667                 m_aBspWin.setHeaderFillAttributes(aFillAttributes);
668             }
669             else
670             {
671                 //m_aBspWin.SetFtColor(rItem.GetColor());
672                 m_aBspWin.setFooterFillAttributes(aFillAttributes);
673             }
674         }
675 
676     }
677 
678     UpdateExample();
679 }
680 
681 void SvxHFPage::UpdateExample()
682 {
683     if ( nId == SID_ATTR_PAGE_HEADERSET )
684     {
685         m_aBspWin.SetHeader( m_xTurnOnBox->get_active() );
686         m_aBspWin.SetHdHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
687         m_aBspWin.SetHdDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
688         m_aBspWin.SetHdLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
689         m_aBspWin.SetHdRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
690     }
691     else
692     {
693         m_aBspWin.SetFooter( m_xTurnOnBox->get_active() );
694         m_aBspWin.SetFtHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
695         m_aBspWin.SetFtDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
696         m_aBspWin.SetFtLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
697         m_aBspWin.SetFtRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
698     }
699     m_aBspWin.Invalidate();
700 }
701 
702 void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
703 {
704     sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
705 
706     if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
707     {
708         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
709         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
710         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
711 
712         if(rOn.GetValue())
713         {
714             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;
715 
716             if(mbEnableDrawingLayerFillStyles)
717             {
718                 // create FillAttributes directly from DrawingLayer FillStyle entries
719                 aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
720             }
721             else
722             {
723                 nWhich = GetWhich(SID_ATTR_BRUSH);
724 
725                 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
726                 {
727                     // create FillAttributes from SvxBrushItem
728                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
729                     SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
730 
731                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
732                     aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
733                 }
734             }
735 
736             m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
737         }
738     }
739 
740     nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
741 
742     if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
743     {
744         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
745         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
746         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
747 
748         if(rOn.GetValue())
749         {
750             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;
751 
752             if(mbEnableDrawingLayerFillStyles)
753             {
754                 // create FillAttributes directly from DrawingLayer FillStyle entries
755                 aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
756             }
757             else
758             {
759                 nWhich = GetWhich(SID_ATTR_BRUSH);
760 
761                 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
762                 {
763                     // create FillAttributes from SvxBrushItem
764                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
765                     SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
766 
767                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
768                     aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
769                 }
770             }
771 
772             m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
773         }
774     }
775 
776     drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
777 
778     if(mbEnableDrawingLayerFillStyles)
779     {
780         // create FillAttributes directly from DrawingLayer FillStyle entries
781         aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
782     }
783     else
784     {
785         nWhich = GetWhich(SID_ATTR_BRUSH);
786 
787         if(rSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
788         {
789             // create FillAttributes from SvxBrushItem
790             const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich));
791             SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
792 
793             setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
794             aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
795         }
796     }
797 
798     m_aBspWin.setPageFillAttributes(aPageFillAttributes);
799 }
800 
801 void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
802 {
803     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
804 
805     if ( pItem )
806     {
807         // Set left and right margins
808         const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
809 
810         m_aBspWin.SetLeft( rLRSpace.GetLeft() );
811         m_aBspWin.SetRight( rLRSpace.GetRight() );
812     }
813     else
814     {
815         m_aBspWin.SetLeft( 0 );
816         m_aBspWin.SetRight( 0 );
817     }
818 
819     pItem = GetItem( rSet, SID_ATTR_ULSPACE );
820 
821     if ( pItem )
822     {
823         // Set top and bottom margins
824         const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
825 
826         m_aBspWin.SetTop( rULSpace.GetUpper() );
827         m_aBspWin.SetBottom( rULSpace.GetLower() );
828     }
829     else
830     {
831         m_aBspWin.SetTop( 0 );
832         m_aBspWin.SetBottom( 0 );
833     }
834 
835     SvxPageUsage nUsage = SvxPageUsage::All;
836     pItem = GetItem( rSet, SID_ATTR_PAGE );
837 
838     if ( pItem )
839         nUsage = static_cast<const SvxPageItem*>(pItem)->GetPageUsage();
840 
841     m_aBspWin.SetUsage( nUsage );
842 
843     if ( SvxPageUsage::Right == nUsage || SvxPageUsage::Left == nUsage )
844         m_xCntSharedBox->set_sensitive(false);
845     else
846     {
847         m_xCntSharedBox->set_sensitive(true);
848         m_xCntSharedFirstBox->set_sensitive(true);
849     }
850     pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
851 
852     if ( pItem )
853     {
854         // Orientation and Size from the PageItem
855         const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(*pItem);
856         // if the size is already swapped (Landscape)
857         m_aBspWin.SetSize( rSize.GetSize() );
858     }
859 
860     // Evaluate Header attribute
861     const SvxSetItem* pSetItem = nullptr;
862 
863     if ( SfxItemState::SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
864                                             false,
865                                             reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
866     {
867         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
868         const SfxBoolItem& rHeaderOn =
869             static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
870 
871         if ( rHeaderOn.GetValue() )
872         {
873             const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
874                 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
875             const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
876                 rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) ));
877             const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
878                 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
879             long nDist = rUL.GetLower();
880 
881             m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
882             m_aBspWin.SetHdDist( nDist );
883             m_aBspWin.SetHdLeft( rLR.GetLeft() );
884             m_aBspWin.SetHdRight( rLR.GetRight() );
885             m_aBspWin.SetHeader( true );
886         }
887         else
888             pSetItem = nullptr;
889     }
890 
891     if ( !pSetItem )
892     {
893         m_aBspWin.SetHeader( false );
894 
895         if ( SID_ATTR_PAGE_HEADERSET == nId )
896         {
897             m_xCntSharedBox->set_sensitive(false);
898             m_xCntSharedFirstBox->set_sensitive(false);
899         }
900     }
901     pSetItem = nullptr;
902 
903     if ( SfxItemState::SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
904                                             false,
905                                             reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
906     {
907         const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
908         const SfxBoolItem& rFooterOn =
909             static_cast<const SfxBoolItem&>(rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
910 
911         if ( rFooterOn.GetValue() )
912         {
913             const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
914                 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
915             const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
916                 rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
917             const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
918                 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
919             long nDist = rUL.GetUpper();
920 
921             m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
922             m_aBspWin.SetFtDist( nDist );
923             m_aBspWin.SetFtLeft( rLR.GetLeft() );
924             m_aBspWin.SetFtRight( rLR.GetRight() );
925             m_aBspWin.SetFooter( true );
926         }
927         else
928             pSetItem = nullptr;
929     }
930 
931     if ( !pSetItem )
932     {
933         m_aBspWin.SetFooter( false );
934 
935         if ( SID_ATTR_PAGE_FOOTERSET == nId )
936         {
937             m_xCntSharedBox->set_sensitive(false);
938             m_xCntSharedFirstBox->set_sensitive(false);
939         }
940     }
941 
942     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
943 
944     if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
945     {
946         m_aBspWin.SetTable( true );
947         m_aBspWin.SetHorz( pBoolItem->GetValue() );
948     }
949 
950     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
951 
952     if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
953     {
954         m_aBspWin.SetTable( true );
955         m_aBspWin.SetVert( pBoolItem->GetValue() );
956     }
957     ResetBackground_Impl( rSet );
958     RangeHdl();
959 }
960 
961 DeactivateRC SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
962 {
963     if ( _pSet )
964         FillItemSet( _pSet );
965     return DeactivateRC::LeavePage;
966 }
967 
968 IMPL_LINK_NOARG(SvxHFPage, ValueChangeHdl, weld::MetricSpinButton&, void)
969 {
970     UpdateExample();
971     RangeHdl();
972 }
973 
974 void SvxHFPage::RangeHdl()
975 {
976     long nHHeight = m_aBspWin.GetHdHeight();
977     long nHDist   = m_aBspWin.GetHdDist();
978 
979     long nFHeight = m_aBspWin.GetFtHeight();
980     long nFDist   = m_aBspWin.GetFtDist();
981 
982     long nHeight = std::max(long(MINBODY),
983         static_cast<long>(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FieldUnit::TWIP))));
984     long nDist   = m_xTurnOnBox->get_active() ?
985         static_cast<long>(m_xDistEdit->denormalize(m_xDistEdit->get_value(FieldUnit::TWIP))) : 0;
986 
987     long nMin;
988     long nMax;
989 
990     if ( nId == SID_ATTR_PAGE_HEADERSET )
991     {
992         nHHeight = nHeight;
993         nHDist   = nDist;
994     }
995     else
996     {
997         nFHeight = nHeight;
998         nFDist   = nDist;
999     }
1000 
1001     // Current values of the side edges
1002     long nBT = m_aBspWin.GetTop();
1003     long nBB = m_aBspWin.GetBottom();
1004     long nBL = m_aBspWin.GetLeft();
1005     long nBR = m_aBspWin.GetRight();
1006 
1007     long nH  = m_aBspWin.GetSize().Height();
1008     long nW  = m_aBspWin.GetSize().Width();
1009 
1010     // Borders
1011     if ( nId == SID_ATTR_PAGE_HEADERSET )
1012     {
1013         // Header
1014         nMin = ( nH - nBB - nBT ) / 5; // 20%
1015         nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1016                     nMin );
1017         m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FieldUnit::TWIP);
1018         nMin = ( nH - nBB - nBT ) / 5; // 20%
1019         nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1020                      long(0) );
1021         m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FieldUnit::TWIP);
1022     }
1023     else
1024     {
1025         // Footer
1026         nMin = ( nH - nBT - nBB ) / 5; // 20%
1027         nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1028                     nMin );
1029         m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FieldUnit::TWIP);
1030         nMin = ( nH - nBT - nBB ) / 5; // 20%
1031         nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1032                      long(0) );
1033         m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FieldUnit::TWIP);
1034     }
1035 
1036     // Limit Indentation
1037     nMax = nW - nBL - nBR -
1038            static_cast<long>(m_xRMEdit->denormalize(m_xRMEdit->get_value(FieldUnit::TWIP))) - MINBODY;
1039     m_xLMEdit->set_max(m_xLMEdit->normalize(nMax), FieldUnit::TWIP);
1040 
1041     nMax = nW - nBL - nBR -
1042            static_cast<long>(m_xLMEdit->denormalize(m_xLMEdit->get_value(FieldUnit::TWIP))) - MINBODY;
1043     m_xRMEdit->set_max(m_xLMEdit->normalize(nMax), FieldUnit::TWIP);
1044 }
1045 
1046 void SvxHFPage::EnableDynamicSpacing()
1047 {
1048     m_xDynSpacingCB->show();
1049 }
1050 
1051 void SvxHFPage::PageCreated(const SfxAllItemSet &rSet)
1052 {
1053     const SfxBoolItem* pSupportDrawingLayerFillStyleItem = rSet.GetItem<SfxBoolItem>(SID_DRAWINGLAYER_FILLSTYLES, false);
1054 
1055     if (pSupportDrawingLayerFillStyleItem)
1056     {
1057         const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
1058 
1059         mbEnableDrawingLayerFillStyles = bNew;
1060     }
1061 }
1062 
1063 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1064