xref: /core/svx/source/dialog/hdft.cxx (revision 981654f6)
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 #include <svtools/unitconv.hxx>
30 
31 #include <svx/hdft.hxx>
32 #include <svx/pageitem.hxx>
33 
34 #include <svx/dlgutil.hxx>
35 #include <sfx2/htmlmode.hxx>
36 
37 #include <editeng/brushitem.hxx>
38 #include <editeng/lrspitem.hxx>
39 #include <editeng/ulspitem.hxx>
40 #include <editeng/shaditem.hxx>
41 #include <editeng/sizeitem.hxx>
42 #include <editeng/boxitem.hxx>
43 
44 #include <svx/svxdlg.hxx>
45 #include <memory>
46 
47 #include <svx/xdef.hxx>
48 #include <svx/xenum.hxx>
49 #include <svx/xfillit0.hxx>
50 #include <svx/unobrushitemhelper.hxx>
51 #include <sfx2/request.hxx>
52 
53 using namespace com::sun::star;
54 
55 // Word 97 incompatibility (#i19922#)
56 // #i19922# - tdf#126051 see cui/source/tabpages/page.cxx and sw/source/uibase/sidebar/PageMarginControl.hxx
57 static const long MINBODY = 56;  // 1mm in twips rounded
58 
59 // default distance to Header or footer
60 static const long DEF_DIST_WRITER = 500;    // 5mm (Writer)
61 static const long DEF_DIST_CALC = 250;      // 2.5mm (Calc)
62 
63 const sal_uInt16 SvxHFPage::pRanges[] =
64 {
65     SID_ATTR_BRUSH,          SID_ATTR_BRUSH,
66 
67     // Support DrawingLayer FillStyles (no real call to below GetRanges()
68     // detected, still do the complete transition)
69     XATTR_FILL_FIRST,        XATTR_FILL_LAST,
70 
71     SID_ATTR_BORDER_OUTER,   SID_ATTR_BORDER_OUTER,
72     SID_ATTR_BORDER_INNER,   SID_ATTR_BORDER_INNER,
73     SID_ATTR_BORDER_SHADOW,  SID_ATTR_BORDER_SHADOW,
74     SID_ATTR_LRSPACE,        SID_ATTR_LRSPACE,
75     SID_ATTR_ULSPACE,        SID_ATTR_ULSPACE,
76     SID_ATTR_PAGE_SIZE,      SID_ATTR_PAGE_SIZE,
77     SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
78     SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
79     SID_ATTR_PAGE_ON,        SID_ATTR_PAGE_ON,
80     SID_ATTR_PAGE_DYNAMIC,   SID_ATTR_PAGE_DYNAMIC,
81     SID_ATTR_PAGE_SHARED,    SID_ATTR_PAGE_SHARED,
82     SID_ATTR_PAGE_SHARED_FIRST,    SID_ATTR_PAGE_SHARED_FIRST,
83     SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
84     0
85 };
86 
87 namespace svx {
88 
89     bool ShowBorderBackgroundDlg(weld::Window* pParent, SfxItemSet* pBBSet)
90     {
91         bool bRes = false;
92         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
93         ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg(pParent, *pBBSet, true /*bEnableDrawingLayerFillStyles*/));
94         if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
95         {
96             SfxItemIter aIter( *pDlg->GetOutputItemSet() );
97 
98             for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
99             {
100                 if ( !IsInvalidItem( pItem ) )
101                     pBBSet->Put( *pItem );
102             }
103             bRes = true;
104         }
105         return bRes;
106     }
107 }
108 
109 std::unique_ptr<SfxTabPage> SvxHeaderPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
110 {
111     return std::make_unique<SvxHeaderPage>( pPage, pController, *rSet );
112 }
113 
114 std::unique_ptr<SfxTabPage> SvxFooterPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
115 {
116     return std::make_unique<SvxFooterPage>( pPage, pController, *rSet );
117 }
118 
119 SvxHeaderPage::SvxHeaderPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttr)
120     : SvxHFPage( pPage, pController, rAttr, SID_ATTR_PAGE_HEADERSET )
121 {
122 }
123 
124 SvxFooterPage::SvxFooterPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttr)
125     : SvxHFPage( pPage, pController, rAttr, SID_ATTR_PAGE_FOOTERSET )
126 {
127 }
128 
129 SvxHFPage::SvxHFPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet, sal_uInt16 nSetId)
130     : SfxTabPage(pPage, pController, "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(std::move(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->set_visible(!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 = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
439         if (nHtmlMode & HTMLMODE_ON)
440         {
441             m_xCntSharedBox->hide();
442             m_xBackgroundBtn->hide();
443         }
444     }
445 
446 }
447 
448 void SvxHFPage::InitHandler()
449 {
450     m_xTurnOnBox->connect_toggled(LINK(this, SvxHFPage, TurnOnHdl));
451     m_xDistEdit->connect_value_changed(LINK(this, SvxHFPage, ValueChangeHdl));
452     m_xHeightEdit->connect_value_changed(LINK(this,SvxHFPage,ValueChangeHdl));
453 
454     m_xLMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
455     m_xRMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
456     m_xBackgroundBtn->connect_clicked(LINK(this,SvxHFPage, BackgroundHdl));
457 }
458 
459 void SvxHFPage::TurnOn(const weld::ToggleButton* pBox)
460 {
461     if (m_xTurnOnBox->get_active())
462     {
463         m_xDistFT->set_sensitive(true);
464         m_xDistEdit->set_sensitive(true);
465         m_xDynSpacingCB->set_sensitive(true);
466         m_xHeightFT->set_sensitive(true);
467         m_xHeightEdit->set_sensitive(true);
468         m_xHeightDynBtn->set_sensitive(true);
469         m_xLMLbl->set_sensitive(true);
470         m_xLMEdit->set_sensitive(true);
471         m_xRMLbl->set_sensitive(true);
472         m_xRMEdit->set_sensitive(true);
473 
474         SvxPageUsage nUsage = m_aBspWin.GetUsage();
475 
476         if( nUsage == SvxPageUsage::Right || nUsage == SvxPageUsage::Left )
477             m_xCntSharedBox->set_sensitive(false);
478         else
479         {
480             m_xCntSharedBox->set_sensitive(true);
481             m_xCntSharedFirstBox->set_sensitive(true);
482         }
483         m_xBackgroundBtn->set_sensitive(true);
484     }
485     else
486     {
487         bool bDelete = true;
488 
489         if (!mbDisableQueryBox && pBox && m_xTurnOnBox->get_saved_state() == TRISTATE_TRUE)
490         {
491             short nResult;
492             if (nId == SID_ATTR_PAGE_HEADERSET)
493             {
494                 DeleteHeaderDialog aDlg(GetFrameWeld());
495                 nResult = aDlg.run();
496             }
497             else
498             {
499                 DeleteFooterDialog aDlg(GetFrameWeld());
500                 nResult = aDlg.run();
501             }
502             bDelete = nResult == RET_YES;
503         }
504 
505         if ( bDelete )
506         {
507             m_xDistFT->set_sensitive(false);
508             m_xDistEdit->set_sensitive(false);
509             m_xDynSpacingCB->set_sensitive(false);
510             m_xHeightFT->set_sensitive(false);
511             m_xHeightEdit->set_sensitive(false);
512             m_xHeightDynBtn->set_sensitive(false);
513 
514             m_xLMLbl->set_sensitive(false);
515             m_xLMEdit->set_sensitive(false);
516             m_xRMLbl->set_sensitive(false);
517             m_xRMEdit->set_sensitive(false);
518 
519             m_xCntSharedBox->set_sensitive(false);
520             m_xBackgroundBtn->set_sensitive(false);
521             m_xCntSharedFirstBox->set_sensitive(false);
522         }
523         else
524             m_xTurnOnBox->set_active(true);
525     }
526     UpdateExample();
527 }
528 
529 IMPL_LINK(SvxHFPage, TurnOnHdl, weld::ToggleButton&, rBox, void)
530 {
531     TurnOn(&rBox);
532 }
533 
534 IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, weld::Button&, void)
535 {
536     if(!pBBSet)
537     {
538         // Use only the necessary items for border and background
539         const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER));
540         const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, false));
541         const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW));
542 
543         if(mbEnableDrawingLayerFillStyles)
544         {
545             pBBSet.reset(new SfxItemSet(
546                 *GetItemSet().GetPool(),
547                 {{XATTR_FILL_FIRST, XATTR_FILL_LAST},  // DrawingLayer FillStyle definitions
548                 {SID_COLOR_TABLE, SID_PATTERN_LIST},   // XPropertyLists for Color, Gradient, Hatch and Graphic fills
549                 {nOuter, nOuter},
550                 {nInner, nInner},
551                 {nShadow, nShadow}}));
552 
553             // copy items for XPropertyList entries from the DrawModel so that
554             // the Area TabPage can access them
555             static const sal_uInt16 nCopyFlags[] = {
556                 SID_COLOR_TABLE,
557                 SID_GRADIENT_LIST,
558                 SID_HATCH_LIST,
559                 SID_BITMAP_LIST,
560                 SID_PATTERN_LIST,
561                 0
562             };
563 
564             for(sal_uInt16 a(0); nCopyFlags[a]; a++)
565             {
566                 const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]);
567 
568                 if(pItem)
569                 {
570                     pBBSet->Put(*pItem);
571                 }
572                 else
573                 {
574                     OSL_ENSURE(false, "XPropertyList missing (!)");
575                 }
576             }
577         }
578         else
579         {
580             const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH));
581 
582             pBBSet.reset( new SfxItemSet(
583                 *GetItemSet().GetPool(),
584                 {{XATTR_FILL_FIRST, XATTR_FILL_LAST},
585                 {nBrush, nBrush},
586                 {nOuter, nOuter},
587                 {nInner, nInner},
588                 {nShadow, nShadow}}) );
589         }
590 
591         const SfxPoolItem* pItem;
592 
593         if(SfxItemState::SET == GetItemSet().GetItemState(GetWhich(nId), false, &pItem))
594         {
595             // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or
596             // SID_ATTR_PAGE_FOOTERSET exists, use its content
597             pBBSet->Put(static_cast<const SvxSetItem*>(pItem)->GetItemSet());
598         }
599         else
600         {
601             if(mbEnableDrawingLayerFillStyles)
602             {
603                 // The style for header/footer is not yet created, need to reset
604                 // XFillStyleItem to drawing::FillStyle_NONE which is the same as in the style
605                 // initialization. This needs to be done since the pool default for
606                 // XFillStyleItem is drawing::FillStyle_SOLID
607                 pBBSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
608             }
609         }
610 
611         if(SfxItemState::SET == GetItemSet().GetItemState(nInner, false, &pItem))
612         {
613             // The set InfoItem is always required
614             pBBSet->Put(*pItem);
615         }
616     }
617 
618     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
619 
620     ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxBorderBackgroundDlg(
621         GetFrameWeld(),
622         *pBBSet,
623         mbEnableDrawingLayerFillStyles));
624 
625     if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet())
626     {
627         SfxItemIter aIter(*pDlg->GetOutputItemSet());
628 
629         for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
630         {
631             if(!IsInvalidItem(pItem))
632             {
633                 pBBSet->Put(*pItem);
634             }
635         }
636 
637         {
638             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
639 
640             if(mbEnableDrawingLayerFillStyles)
641             {
642                 // create FillAttributes directly from DrawingLayer FillStyle entries
643                 aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet));
644             }
645             else
646             {
647                 const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);
648 
649                 if(pBBSet->GetItemState(nWhich) == SfxItemState::SET)
650                 {
651                     // create FillAttributes from SvxBrushItem
652                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich));
653                     SfxItemSet aTempSet(*pBBSet->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
654 
655                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
656                     aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
657                 }
658             }
659 
660             if(SID_ATTR_PAGE_HEADERSET == nId)
661             {
662                 //m_aBspWin.SetHdColor(rItem.GetColor());
663                 m_aBspWin.setHeaderFillAttributes(aFillAttributes);
664             }
665             else
666             {
667                 //m_aBspWin.SetFtColor(rItem.GetColor());
668                 m_aBspWin.setFooterFillAttributes(aFillAttributes);
669             }
670         }
671 
672     }
673 
674     UpdateExample();
675 }
676 
677 void SvxHFPage::UpdateExample()
678 {
679     if ( nId == SID_ATTR_PAGE_HEADERSET )
680     {
681         m_aBspWin.SetHeader( m_xTurnOnBox->get_active() );
682         m_aBspWin.SetHdHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
683         m_aBspWin.SetHdDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
684         m_aBspWin.SetHdLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
685         m_aBspWin.SetHdRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
686     }
687     else
688     {
689         m_aBspWin.SetFooter( m_xTurnOnBox->get_active() );
690         m_aBspWin.SetFtHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
691         m_aBspWin.SetFtDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
692         m_aBspWin.SetFtLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
693         m_aBspWin.SetFtRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
694     }
695     m_aBspWin.Invalidate();
696 }
697 
698 void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
699 {
700     sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET));
701 
702     if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
703     {
704         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
705         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
706         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
707 
708         if(rOn.GetValue())
709         {
710             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes;
711 
712             if(mbEnableDrawingLayerFillStyles)
713             {
714                 // create FillAttributes directly from DrawingLayer FillStyle entries
715                 aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
716             }
717             else
718             {
719                 nWhich = GetWhich(SID_ATTR_BRUSH);
720 
721                 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
722                 {
723                     // create FillAttributes from SvxBrushItem
724                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
725                     SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
726 
727                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
728                     aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
729                 }
730             }
731 
732             m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
733         }
734     }
735 
736     nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET);
737 
738     if (SfxItemState::SET == rSet.GetItemState(nWhich, false))
739     {
740         const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, false));
741         const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
742         const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
743 
744         if(rOn.GetValue())
745         {
746             drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes;
747 
748             if(mbEnableDrawingLayerFillStyles)
749             {
750                 // create FillAttributes directly from DrawingLayer FillStyle entries
751                 aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet));
752             }
753             else
754             {
755                 nWhich = GetWhich(SID_ATTR_BRUSH);
756 
757                 if(SfxItemState::SET == rTmpSet.GetItemState(nWhich))
758                 {
759                     // create FillAttributes from SvxBrushItem
760                     const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich));
761                     SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
762 
763                     setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
764                     aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
765                 }
766             }
767 
768             m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
769         }
770     }
771 
772     drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes;
773 
774     if(mbEnableDrawingLayerFillStyles)
775     {
776         // create FillAttributes directly from DrawingLayer FillStyle entries
777         aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet));
778     }
779     else
780     {
781         nWhich = GetWhich(SID_ATTR_BRUSH);
782 
783         if(rSet.GetItemState(nWhich) >= SfxItemState::DEFAULT)
784         {
785             // create FillAttributes from SvxBrushItem
786             const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich));
787             SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{});
788 
789             setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
790             aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet));
791         }
792     }
793 
794     m_aBspWin.setPageFillAttributes(aPageFillAttributes);
795 }
796 
797 void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
798 {
799     const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
800 
801     if ( pItem )
802     {
803         // Set left and right margins
804         const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
805 
806         m_aBspWin.SetLeft( rLRSpace.GetLeft() );
807         m_aBspWin.SetRight( rLRSpace.GetRight() );
808     }
809     else
810     {
811         m_aBspWin.SetLeft( 0 );
812         m_aBspWin.SetRight( 0 );
813     }
814 
815     pItem = GetItem( rSet, SID_ATTR_ULSPACE );
816 
817     if ( pItem )
818     {
819         // Set top and bottom margins
820         const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
821 
822         m_aBspWin.SetTop( rULSpace.GetUpper() );
823         m_aBspWin.SetBottom( rULSpace.GetLower() );
824     }
825     else
826     {
827         m_aBspWin.SetTop( 0 );
828         m_aBspWin.SetBottom( 0 );
829     }
830 
831     SvxPageUsage nUsage = SvxPageUsage::All;
832     pItem = GetItem( rSet, SID_ATTR_PAGE );
833 
834     if ( pItem )
835         nUsage = static_cast<const SvxPageItem*>(pItem)->GetPageUsage();
836 
837     m_aBspWin.SetUsage( nUsage );
838 
839     if ( SvxPageUsage::Right == nUsage || SvxPageUsage::Left == nUsage )
840         m_xCntSharedBox->set_sensitive(false);
841     else
842     {
843         m_xCntSharedBox->set_sensitive(true);
844         m_xCntSharedFirstBox->set_sensitive(true);
845     }
846     pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
847 
848     if ( pItem )
849     {
850         // Orientation and Size from the PageItem
851         const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(*pItem);
852         // if the size is already swapped (Landscape)
853         m_aBspWin.SetSize( rSize.GetSize() );
854     }
855 
856     // Evaluate Header attribute
857     const SvxSetItem* pSetItem = nullptr;
858 
859     if ( SfxItemState::SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
860                                             false,
861                                             reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
862     {
863         const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
864         const SfxBoolItem& rHeaderOn =
865             static_cast<const SfxBoolItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
866 
867         if ( rHeaderOn.GetValue() )
868         {
869             const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
870                 rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
871             const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
872                 rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) ));
873             const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
874                 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
875             long nDist = rUL.GetLower();
876 
877             m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
878             m_aBspWin.SetHdDist( nDist );
879             m_aBspWin.SetHdLeft( rLR.GetLeft() );
880             m_aBspWin.SetHdRight( rLR.GetRight() );
881             m_aBspWin.SetHeader( true );
882         }
883         else
884             pSetItem = nullptr;
885     }
886 
887     if ( !pSetItem )
888     {
889         m_aBspWin.SetHeader( false );
890 
891         if ( SID_ATTR_PAGE_HEADERSET == nId )
892         {
893             m_xCntSharedBox->set_sensitive(false);
894             m_xCntSharedFirstBox->set_sensitive(false);
895         }
896     }
897     pSetItem = nullptr;
898 
899     if ( SfxItemState::SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
900                                             false,
901                                             reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
902     {
903         const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
904         const SfxBoolItem& rFooterOn =
905             static_cast<const SfxBoolItem&>(rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ));
906 
907         if ( rFooterOn.GetValue() )
908         {
909             const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(
910                 rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ));
911             const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
912                 rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
913             const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
914                 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
915             long nDist = rUL.GetUpper();
916 
917             m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
918             m_aBspWin.SetFtDist( nDist );
919             m_aBspWin.SetFtLeft( rLR.GetLeft() );
920             m_aBspWin.SetFtRight( rLR.GetRight() );
921             m_aBspWin.SetFooter( true );
922         }
923         else
924             pSetItem = nullptr;
925     }
926 
927     if ( !pSetItem )
928     {
929         m_aBspWin.SetFooter( false );
930 
931         if ( SID_ATTR_PAGE_FOOTERSET == nId )
932         {
933             m_xCntSharedBox->set_sensitive(false);
934             m_xCntSharedFirstBox->set_sensitive(false);
935         }
936     }
937 
938     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
939 
940     if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
941     {
942         m_aBspWin.SetTable( true );
943         m_aBspWin.SetHorz( pBoolItem->GetValue() );
944     }
945 
946     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
947 
948     if ( auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
949     {
950         m_aBspWin.SetTable( true );
951         m_aBspWin.SetVert( pBoolItem->GetValue() );
952     }
953     ResetBackground_Impl( rSet );
954     RangeHdl();
955 }
956 
957 DeactivateRC SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
958 {
959     if ( _pSet )
960         FillItemSet( _pSet );
961     return DeactivateRC::LeavePage;
962 }
963 
964 IMPL_LINK_NOARG(SvxHFPage, ValueChangeHdl, weld::MetricSpinButton&, void)
965 {
966     UpdateExample();
967     RangeHdl();
968 }
969 
970 void SvxHFPage::RangeHdl()
971 {
972     long nHHeight = m_aBspWin.GetHdHeight();
973     long nHDist   = m_aBspWin.GetHdDist();
974 
975     long nFHeight = m_aBspWin.GetFtHeight();
976     long nFDist   = m_aBspWin.GetFtDist();
977 
978     long nHeight = std::max(long(MINBODY),
979         static_cast<long>(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FieldUnit::TWIP))));
980     long nDist   = m_xTurnOnBox->get_active() ?
981         static_cast<long>(m_xDistEdit->denormalize(m_xDistEdit->get_value(FieldUnit::TWIP))) : 0;
982 
983     long nMin;
984     long nMax;
985 
986     if ( nId == SID_ATTR_PAGE_HEADERSET )
987     {
988         nHHeight = nHeight;
989         nHDist   = nDist;
990     }
991     else
992     {
993         nFHeight = nHeight;
994         nFDist   = nDist;
995     }
996 
997     // Current values of the side edges
998     long nBT = m_aBspWin.GetTop();
999     long nBB = m_aBspWin.GetBottom();
1000     long nBL = m_aBspWin.GetLeft();
1001     long nBR = m_aBspWin.GetRight();
1002 
1003     long nH  = m_aBspWin.GetSize().Height();
1004     long nW  = m_aBspWin.GetSize().Width();
1005 
1006     // Borders
1007     if ( nId == SID_ATTR_PAGE_HEADERSET )
1008     {
1009         // Header
1010         nMin = ( nH - nBB - nBT ) / 5; // 20%
1011         nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1012                     nMin );
1013         m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FieldUnit::TWIP);
1014         nMin = ( nH - nBB - nBT ) / 5; // 20%
1015         nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1016                      long(0) );
1017         m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FieldUnit::TWIP);
1018     }
1019     else
1020     {
1021         // Footer
1022         nMin = ( nH - nBT - nBB ) / 5; // 20%
1023         nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1024                     nMin );
1025         m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FieldUnit::TWIP);
1026         nMin = ( nH - nBT - nBB ) / 5; // 20%
1027         nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1028                      long(0) );
1029         m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FieldUnit::TWIP);
1030     }
1031 
1032     // Limit Indentation
1033     nMax = nW - nBL - nBR -
1034            static_cast<long>(m_xRMEdit->denormalize(m_xRMEdit->get_value(FieldUnit::TWIP))) - MINBODY;
1035     m_xLMEdit->set_max(m_xLMEdit->normalize(nMax), FieldUnit::TWIP);
1036 
1037     nMax = nW - nBL - nBR -
1038            static_cast<long>(m_xLMEdit->denormalize(m_xLMEdit->get_value(FieldUnit::TWIP))) - MINBODY;
1039     m_xRMEdit->set_max(m_xLMEdit->normalize(nMax), FieldUnit::TWIP);
1040 }
1041 
1042 void SvxHFPage::EnableDynamicSpacing()
1043 {
1044     m_xDynSpacingCB->show();
1045 }
1046 
1047 void SvxHFPage::PageCreated(const SfxAllItemSet &rSet)
1048 {
1049     const SfxBoolItem* pSupportDrawingLayerFillStyleItem = rSet.GetItem<SfxBoolItem>(SID_DRAWINGLAYER_FILLSTYLES, false);
1050 
1051     if (pSupportDrawingLayerFillStyleItem)
1052     {
1053         const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
1054 
1055         mbEnableDrawingLayerFillStyles = bNew;
1056     }
1057 }
1058 
1059 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1060