[Libreoffice-commits] core.git: include/svx sc/source svx/source svx/uiconfig

Caolán McNamara caolanm at redhat.com
Sat Jun 16 18:17:03 UTC 2018


 include/svx/hdft.hxx                  |   49 +--
 include/svx/pagectrl.hxx              |  123 ++++++++
 sc/source/ui/inc/tphf.hxx             |   10 
 sc/source/ui/pagedlg/tphf.cxx         |   49 +--
 svx/source/dialog/hdft.cxx            |  473 ++++++++++++++--------------------
 svx/source/dialog/pagectrl.cxx        |  375 ++++++++++++++++++++++++++
 svx/uiconfig/ui/headfootformatpage.ui |   89 ++----
 7 files changed, 791 insertions(+), 377 deletions(-)

New commits:
commit 0af04819bc0352f58b45a945fbb1451e3f8ba605
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 15 12:34:40 2018 +0100

    weld SvxHFPage
    
    Change-Id: I9e39e276c64da4fca01ff79ebbb42d6f342f0379
    Reviewed-on: https://gerrit.libreoffice.org/55863
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index 2e6d14dc7cce..d7d910c772ba 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -21,6 +21,7 @@
 
 #include <sfx2/tabdlg.hxx>
 
+#include <vcl/customweld.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/field.hxx>
 #include <vcl/group.hxx>
@@ -47,7 +48,6 @@ public:
     virtual void    Reset( const SfxItemSet* rSet ) override;
 
     virtual         ~SvxHFPage() override;
-    virtual void    dispose() override;
 
     void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
 
@@ -61,37 +61,36 @@ protected:
     virtual void    ActivatePage( const SfxItemSet& rSet ) override;
     virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
 
-    SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId );
-
-    VclPtr<FixedText>       m_pPageLbl;
-    VclPtr<CheckBox>        m_pTurnOnBox;
-    VclPtr<CheckBox>        m_pCntSharedBox;
-    VclPtr<CheckBox>        m_pCntSharedFirstBox;
-    VclPtr<FixedText>       m_pLMLbl;
-    VclPtr<MetricField>     m_pLMEdit;
-    VclPtr<FixedText>       m_pRMLbl;
-    VclPtr<MetricField>     m_pRMEdit;
-    VclPtr<FixedText>       m_pDistFT;
-    VclPtr<MetricField>     m_pDistEdit;
-    VclPtr<CheckBox>        m_pDynSpacingCB;
-    VclPtr<FixedText>       m_pHeightFT;
-    VclPtr<MetricField>     m_pHeightEdit;
-    VclPtr<CheckBox>        m_pHeightDynBtn;
-    VclPtr<SvxPageWindow>   m_pBspWin;
-    VclPtr<PushButton>      m_pBackgroundBtn;
+    SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId);
 
     sal_uInt16       nId;
     std::unique_ptr<SfxItemSet> pBBSet;
     bool            mbDisableQueryBox : 1;
     bool            mbEnableDrawingLayerFillStyles : 1;
 
+    PageWindow m_aBspWin;
+    std::unique_ptr<weld::Label> m_xPageLbl;
+    std::unique_ptr<weld::CheckButton> m_xTurnOnBox;
+    std::unique_ptr<weld::CheckButton> m_xCntSharedBox;
+    std::unique_ptr<weld::CheckButton> m_xCntSharedFirstBox;
+    std::unique_ptr<weld::Label> m_xLMLbl;
+    std::unique_ptr<weld::MetricSpinButton>m_xLMEdit;
+    std::unique_ptr<weld::Label> m_xRMLbl;
+    std::unique_ptr<weld::MetricSpinButton> m_xRMEdit;
+    std::unique_ptr<weld::Label> m_xDistFT;
+    std::unique_ptr<weld::MetricSpinButton> m_xDistEdit;
+    std::unique_ptr<weld::CheckButton> m_xDynSpacingCB;
+    std::unique_ptr<weld::Label> m_xHeightFT;
+    std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit;
+    std::unique_ptr<weld::CheckButton> m_xHeightDynBtn;
+    std::unique_ptr<weld::Button> m_xBackgroundBtn;
+    std::unique_ptr<weld::CustomWeld> m_xBspWin;
+
     void            InitHandler();
-    DECL_LINK(TurnOnHdl, Button*, void);
-    DECL_LINK(DistModify, Edit&, void);
-    DECL_LINK(HeightModify, Edit&, void);
-    DECL_LINK(BorderModify, Edit&, void);
-    DECL_LINK(BackgroundHdl, Button*, void);
-    DECL_LINK(RangeFocusHdl, Control&, void);
+    void TurnOn(weld::ToggleButton* pButton);
+    DECL_LINK(TurnOnHdl, weld::ToggleButton&, void);
+    DECL_LINK(BackgroundHdl, weld::Button&, void);
+    DECL_LINK(ValueChangeHdl, weld::MetricSpinButton&, void);
     void RangeHdl();
     void            UpdateExample();
 
diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx
index cf2065cc4f38..8f1dc24192e8 100644
--- a/include/svx/pagectrl.hxx
+++ b/include/svx/pagectrl.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_SVX_PAGECTRL_HXX
 #define INCLUDED_SVX_PAGECTRL_HXX
 
+#include <vcl/customweld.hxx>
 #include <vcl/window.hxx>
 #include <svx/svxdllapi.h>
 #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
@@ -152,6 +153,128 @@ public:
     virtual Size GetOptimalSize() const override;
 };
 
+class SVX_DLLPUBLIC PageWindow : public weld::CustomWidgetController
+{
+private:
+    Size aWinSize;
+    Size aSize;
+
+    long nTop;
+    long nBottom;
+    long nLeft;
+    long nRight;
+
+    bool bResetBackground;
+    bool bFrameDirection;
+    SvxFrameDirection nFrameDirection;
+
+    long nHdLeft;
+    long nHdRight;
+    long nHdDist;
+    long nHdHeight;
+
+    long nFtLeft;
+    long nFtRight;
+    long nFtDist;
+    long nFtHeight;
+
+    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maHeaderFillAttributes;
+    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maFooterFillAttributes;
+    drawinglayer::attribute::SdrAllFillAttributesHelperPtr  maPageFillAttributes;
+
+    bool bFooter : 1;
+    bool bHeader : 1;
+    bool bTable : 1;
+    bool bHorz : 1;
+    bool bVert : 1;
+
+    SvxPageUsage eUsage;
+
+protected:
+    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+    virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint,
+                          const bool bSecond, const bool bEnabled);
+
+    void drawFillAttributes(vcl::RenderContext& rRenderContext,
+                            const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
+                            const tools::Rectangle& rPaintRange, const tools::Rectangle& rDefineRange);
+
+public:
+    PageWindow();
+    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+    virtual ~PageWindow() override;
+
+    void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+    {
+        maHeaderFillAttributes = rFillAttributes;
+    }
+    void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+    {
+        maFooterFillAttributes = rFillAttributes;
+    }
+    void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
+    {
+        maPageFillAttributes = rFillAttributes;
+    }
+    const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const
+    {
+        return maPageFillAttributes;
+    }
+    void SetSize(const Size& rSize)
+    {
+        aSize = rSize;
+    }
+    const Size& GetSize() const
+    {
+        return aSize;
+    }
+
+    void SetTop(long nNew) { nTop = nNew; }
+    void SetBottom(long nNew) { nBottom = nNew; }
+    void SetLeft(long nNew) { nLeft = nNew; }
+    void SetRight(long nNew) { nRight = nNew; }
+
+    long GetTop() const { return nTop; }
+    long GetBottom() const { return nBottom; }
+    long GetLeft() const { return nLeft; }
+    long GetRight() const { return nRight; }
+
+    void SetHdLeft(long nNew) { nHdLeft = nNew; }
+    void SetHdRight(long nNew) { nHdRight = nNew; }
+    void SetHdDist(long nNew) { nHdDist = nNew; }
+    void SetHdHeight(long nNew) { nHdHeight = nNew; }
+
+    long GetHdLeft() const { return nHdLeft; }
+    long GetHdRight() const { return nHdRight; }
+    long GetHdDist() const { return nHdDist; }
+    long GetHdHeight() const { return nHdHeight; }
+
+    void SetFtLeft(long nNew) { nFtLeft = nNew; }
+    void SetFtRight(long nNew) { nFtRight = nNew; }
+    void SetFtDist(long nNew) { nFtDist = nNew; }
+    void SetFtHeight(long nNew) { nFtHeight = nNew; }
+
+    long GetFtLeft() const { return nFtLeft; }
+    long GetFtRight() const { return nFtRight; }
+    long GetFtDist() const { return nFtDist; }
+    long GetFtHeight() const { return nFtHeight; }
+
+    void SetUsage(SvxPageUsage eU) { eUsage = eU; }
+    SvxPageUsage GetUsage() const { return eUsage; }
+
+    void SetHeader( bool bNew ) { bHeader = bNew; }
+    void SetFooter( bool bNew ) { bFooter = bNew; }
+    void SetTable( bool bNew ) { bTable = bNew; }
+    void SetHorz( bool bNew ) { bHorz = bNew; }
+    void SetVert( bool bNew ) { bVert = bNew; }
+
+    void EnableFrameDirection(bool bEnable);
+    void SetFrameDirection(SvxFrameDirection nDirection);
+
+    void ResetBackground();
+};
+
 #endif // INCLUDED_SVX_PAGECTRL_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tphf.hxx b/sc/source/ui/inc/tphf.hxx
index 9fd7324a398d..f5e5723aa1ba 100644
--- a/sc/source/ui/inc/tphf.hxx
+++ b/sc/source/ui/inc/tphf.hxx
@@ -37,9 +37,7 @@ public:
     void            SetStyleDlg ( ScStyleDlg* pDlg ) { pStyleDlg = pDlg; }
 
 protected:
-                    ScHFPage( vcl::Window* pParent,
-                              const SfxItemSet& rSet,
-                              sal_uInt16 nSetId );
+    ScHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId);
 
     virtual void    ActivatePage() override;
     virtual void    DeactivatePage() override;
@@ -47,15 +45,15 @@ protected:
     virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
 
 private:
-    VclPtr<PushButton>   m_pBtnEdit;
     SfxItemSet           aDataSet;
     OUString             aStrPageStyle;
     SvxPageUsage         nPageUsage;
     VclPtr<ScStyleDlg>   pStyleDlg;
+    std::unique_ptr<weld::Button> m_xBtnEdit;
 
-    DECL_LINK( BtnHdl, Button*, void );
+    DECL_LINK(BtnHdl, weld::Button&, void);
     DECL_LINK( HFEditHdl, void*, void );
-    DECL_LINK( TurnOnHdl, Button*, void );
+    DECL_LINK(TurnOnHdl, weld::ToggleButton&, void);
 };
 
 class ScHeaderPage : public ScHFPage
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index cf5aa5e36a01..571a650a679a 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -41,24 +41,18 @@
 
 // class ScHFPage
 
-ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId )
-
-    :   SvxHFPage   ( pParent, rSet, nSetId ),
-        aDataSet(
-            *rSet.GetPool(),
-            svl::Items<
-                ATTR_PAGE, ATTR_PAGE,
-                ATTR_PAGE_HEADERLEFT, ATTR_PAGE_FOOTERRIGHT>{}),
-        nPageUsage  ( SvxPageUsage::All ),
-        pStyleDlg   ( nullptr )
+ScHFPage::ScHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId)
+    : SvxHFPage(pParent, rSet, nSetId)
+    , aDataSet(*rSet.GetPool(), svl::Items<ATTR_PAGE, ATTR_PAGE, ATTR_PAGE_HEADERLEFT, ATTR_PAGE_FOOTERRIGHT>{})
+    , nPageUsage(SvxPageUsage::All)
+    , pStyleDlg(nullptr)
+    , m_xBtnEdit(m_xBuilder->weld_button("buttonEdit"))
 {
-    get(m_pBtnEdit, "buttonEdit");
-
     SetExchangeSupport();
 
     SfxViewShell*   pSh = SfxViewShell::Current();
     ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( pSh );
-    m_pBtnEdit->Show();
+    m_xBtnEdit->show();
 
     aDataSet.Put( rSet );
 
@@ -70,13 +64,13 @@ ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSe
         aStrPageStyle = pDoc->GetPageStyle( rViewData.GetTabNo() );
     }
 
-    m_pBtnEdit->SetClickHdl    ( LINK( this, ScHFPage, BtnHdl ) );
-    m_pTurnOnBox->SetClickHdl  ( LINK( this, ScHFPage, TurnOnHdl ) );
+    m_xBtnEdit->connect_clicked(LINK(this, ScHFPage, BtnHdl));
+    m_xTurnOnBox->connect_toggled(LINK(this, ScHFPage, TurnOnHdl));
 
     if ( nId == SID_ATTR_PAGE_HEADERSET )
-        m_pBtnEdit->SetHelpId( HID_SC_HEADER_EDIT );
+        m_xBtnEdit->set_help_id(HID_SC_HEADER_EDIT);
     else
-        m_pBtnEdit->SetHelpId( HID_SC_FOOTER_EDIT );
+        m_xBtnEdit->set_help_id(HID_SC_FOOTER_EDIT);
 }
 
 ScHFPage::~ScHFPage()
@@ -86,7 +80,6 @@ ScHFPage::~ScHFPage()
 
 void ScHFPage::dispose()
 {
-    m_pBtnEdit.clear();
     pStyleDlg.clear();
     SvxHFPage::dispose();
 }
@@ -94,7 +87,7 @@ void ScHFPage::dispose()
 void ScHFPage::Reset( const SfxItemSet* rSet )
 {
     SvxHFPage::Reset( rSet );
-    TurnOnHdl( nullptr );
+    TurnOnHdl(*m_xTurnOnBox);
 }
 
 bool ScHFPage::FillItemSet( SfxItemSet* rOutSet )
@@ -150,17 +143,17 @@ void ScHFPage::DeactivatePage()
 
 // Handler:
 
-IMPL_LINK_NOARG(ScHFPage, TurnOnHdl, Button*, void)
+IMPL_LINK_NOARG(ScHFPage, TurnOnHdl, weld::ToggleButton&, void)
 {
-    SvxHFPage::TurnOnHdl( m_pTurnOnBox );
+    SvxHFPage::TurnOnHdl(*m_xTurnOnBox);
 
-    if ( m_pTurnOnBox->IsChecked() )
-        m_pBtnEdit->Enable();
+    if (m_xTurnOnBox->get_active())
+        m_xBtnEdit->set_sensitive(true);
     else
-        m_pBtnEdit->Disable();
+        m_xBtnEdit->set_sensitive(false);
 }
 
-IMPL_LINK_NOARG(ScHFPage, BtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScHFPage, BtnHdl, weld::Button&, void)
 {
     // When the Edit-Dialog is directly called from the Button's Click-Handler,
     // the GrabFocus from the Edit-Dialog under OS/2 doesn't work.(Bug #41805#).
@@ -179,8 +172,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
         return;
     }
 
-    if (   m_pCntSharedBox->IsEnabled()
-        && !m_pCntSharedBox->IsChecked() )
+    if (m_xCntSharedBox->get_sensitive() && !m_xCntSharedBox->get_active())
     {
         sal_uInt16 nResId = ( nId == SID_ATTR_PAGE_HEADERSET )
                             ? RID_SCDLG_HFED_HEADER
@@ -200,8 +192,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
     {
         OUString  aText;
         VclPtrInstance< SfxSingleTabDialog > pDlg(this, aDataSet);
-        bool bRightPage =   m_pCntSharedBox->IsChecked()
-                         || ( SvxPageUsage::Left != nPageUsage );
+        bool bRightPage = m_xCntSharedBox->get_active() || (SvxPageUsage::Left != nPageUsage);
 
         if ( nId == SID_ATTR_PAGE_HEADERSET )
         {
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 88d8067c1c8e..d23ad52bc89e 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -130,99 +130,72 @@ SvxFooterPage::SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rAttr ) :
 {
 }
 
-SvxHFPage::SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId ) :
-    SfxTabPage(pParent, "HFFormatPage", "svx/ui/headfootformatpage.ui", &rSet),
-    nId(nSetId),
-    pBBSet(nullptr),
-    mbDisableQueryBox(false),
-    mbEnableDrawingLayerFillStyles(false)
+SvxHFPage::SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId)
+    : SfxTabPage(pParent, "svx/ui/headfootformatpage.ui", "HFFormatPage", &rSet)
+    , nId(nSetId)
+    , pBBSet(nullptr)
+    , mbDisableQueryBox(false)
+    , mbEnableDrawingLayerFillStyles(false)
+    , m_xCntSharedBox(m_xBuilder->weld_check_button("checkSameLR"))
+    , m_xCntSharedFirstBox(m_xBuilder->weld_check_button("checkSameFP"))
+    , m_xLMLbl(m_xBuilder->weld_label("labelLeftMarg"))
+    , m_xLMEdit(m_xBuilder->weld_metric_spin_button("spinMargLeft", FUNIT_CM))
+    , m_xRMLbl(m_xBuilder->weld_label("labelRightMarg"))
+    , m_xRMEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", FUNIT_CM))
+    , m_xDistFT(m_xBuilder->weld_label("labelSpacing"))
+    , m_xDistEdit(m_xBuilder->weld_metric_spin_button("spinSpacing", FUNIT_CM))
+    , m_xDynSpacingCB(m_xBuilder->weld_check_button("checkDynSpacing"))
+    , m_xHeightFT(m_xBuilder->weld_label("labelHeight"))
+    , m_xHeightEdit(m_xBuilder->weld_metric_spin_button("spinHeight", FUNIT_CM))
+    , m_xHeightDynBtn(m_xBuilder->weld_check_button("checkAutofit"))
+    , m_xBackgroundBtn(m_xBuilder->weld_button("buttonMore"))
+    , m_xBspWin(new weld::CustomWeld(*m_xBuilder, "drawingareaPageHF", m_aBspWin))
 {
-    get(m_pCntSharedBox,"checkSameLR");
-    get(m_pCntSharedFirstBox,"checkSameFP");
-    get(m_pLMEdit,"spinMargLeft");
-    get(m_pLMLbl,"labelLeftMarg");
-    get(m_pRMEdit,"spinMargRight");
-    get(m_pRMLbl,"labelRightMarg");
-    get(m_pDistEdit,"spinSpacing");
-    get(m_pDistFT,"labelSpacing");
-    get(m_pDynSpacingCB,"checkDynSpacing");
-    get(m_pHeightFT,"labelHeight");
-    get(m_pHeightEdit,"spinHeight");
-    get(m_pHeightDynBtn,"checkAutofit");
-    get(m_pBspWin,"drawingareaPageHF");
-    get(m_pBackgroundBtn,"buttonMore");
-
     //swap header <-> footer in UI
-    if(nId == SID_ATTR_PAGE_FOOTERSET)
+    if (nId == SID_ATTR_PAGE_FOOTERSET)
     {
-        get(m_pPageLbl,"labelFooterFormat");
-        get(m_pTurnOnBox, "checkFooterOn");
+        m_xPageLbl.reset(m_xBuilder->weld_label("labelFooterFormat"));
+        m_xTurnOnBox.reset(m_xBuilder->weld_check_button("checkFooterOn"));
 
         /* Set custom HIDs for the Footer help page (shared/01/05040400.xhp)
         otherwise it would display the same extended help
         on both the Header and Footer tabs */
-        m_pCntSharedBox->SetHelpId( "SVX_HID_FOOTER_CHECKSAMELR" );
-        m_pCntSharedFirstBox->SetHelpId( "SVX_HID_FOOTER_CHECKSAMEFP" );
-        m_pLMEdit->SetHelpId( "SVX_HID_FOOTER_SPINMARGLEFT" );
-        m_pRMEdit->SetHelpId( "SVX_HID_FOOTER_SPINMARGRIGHT" );
-        m_pDistEdit->SetHelpId( "SVX_HID_FOOTER_SPINSPACING" );
-        m_pDynSpacingCB->SetHelpId( "SVX_HID_FOOTER_CHECKDYNSPACING" );
-        m_pHeightEdit->SetHelpId( "SVX_HID_FOOTER_SPINHEIGHT" );
-        m_pHeightDynBtn->SetHelpId( "SVX_HID_FOOTER_CHECKAUTOFIT" );
-        m_pBackgroundBtn->SetHelpId( "SVX_HID_FOOTER_BUTTONMORE" );
+        m_xCntSharedBox->set_help_id( "SVX_HID_FOOTER_CHECKSAMELR" );
+        m_xCntSharedFirstBox->set_help_id( "SVX_HID_FOOTER_CHECKSAMEFP" );
+        m_xLMEdit->set_help_id( "SVX_HID_FOOTER_SPINMARGLEFT" );
+        m_xRMEdit->set_help_id( "SVX_HID_FOOTER_SPINMARGRIGHT" );
+        m_xDistEdit->set_help_id( "SVX_HID_FOOTER_SPINSPACING" );
+        m_xDynSpacingCB->set_help_id( "SVX_HID_FOOTER_CHECKDYNSPACING" );
+        m_xHeightEdit->set_help_id( "SVX_HID_FOOTER_SPINHEIGHT" );
+        m_xHeightDynBtn->set_help_id( "SVX_HID_FOOTER_CHECKAUTOFIT" );
+        m_xBackgroundBtn->set_help_id( "SVX_HID_FOOTER_BUTTONMORE" );
     }
     else //Header
     {
-        get(m_pPageLbl,"labelHeaderFormat");
-        get(m_pTurnOnBox, "checkHeaderOn");
+        m_xPageLbl.reset(m_xBuilder->weld_label("labelHeaderFormat"));
+        m_xTurnOnBox.reset(m_xBuilder->weld_check_button("checkHeaderOn"));
     }
-    m_pTurnOnBox->Show();
-    m_pPageLbl->Show();
+    m_xTurnOnBox->show();
+    m_xPageLbl->show();
 
     InitHandler();
-    m_pBspWin->EnableRTL( false );
+    m_aBspWin.EnableRTL(false);
 
     // This Page needs ExchangeSupport
     SetExchangeSupport();
 
-
     // Set metrics
     FieldUnit eFUnit = GetModuleFieldUnit( rSet );
-    SetFieldUnit( *m_pDistEdit, eFUnit );
-    SetFieldUnit( *m_pHeightEdit, eFUnit );
-    SetFieldUnit( *m_pLMEdit, eFUnit );
-    SetFieldUnit( *m_pRMEdit, eFUnit );
+    SetFieldUnit( *m_xDistEdit, eFUnit );
+    SetFieldUnit( *m_xHeightEdit, eFUnit );
+    SetFieldUnit( *m_xLMEdit, eFUnit );
+    SetFieldUnit( *m_xRMEdit, eFUnit );
 }
 
-
 SvxHFPage::~SvxHFPage()
 {
-    disposeOnce();
-}
-
-void SvxHFPage::dispose()
-{
-    pBBSet.reset();
-    m_pPageLbl.clear();
-    m_pTurnOnBox.clear();
-    m_pCntSharedBox.clear();
-    m_pCntSharedFirstBox.clear();
-    m_pLMLbl.clear();
-    m_pLMEdit.clear();
-    m_pRMLbl.clear();
-    m_pRMEdit.clear();
-    m_pDistFT.clear();
-    m_pDistEdit.clear();
-    m_pDynSpacingCB.clear();
-    m_pHeightFT.clear();
-    m_pHeightEdit.clear();
-    m_pHeightDynBtn.clear();
-    m_pBspWin.clear();
-    m_pBackgroundBtn.clear();
-    SfxTabPage::dispose();
 }
 
-
 bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
 {
     const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE);
@@ -271,23 +244,23 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
         aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
     }
 
-    aSet.Put( SfxBoolItem( nWOn,      m_pTurnOnBox->IsChecked() ) );
-    aSet.Put( SfxBoolItem( nWDynamic, m_pHeightDynBtn->IsChecked() ) );
-    aSet.Put( SfxBoolItem( nWShared,  m_pCntSharedBox->IsChecked() ) );
-    if(m_pCntSharedFirstBox->IsVisible())
-        aSet.Put( SfxBoolItem( nWSharedFirst,  m_pCntSharedFirstBox->IsChecked() ) );
-    if (m_pDynSpacingCB->IsVisible() && SfxItemPool::IsWhich(nWDynSpacing))
+    aSet.Put( SfxBoolItem( nWOn,      m_xTurnOnBox->get_active() ) );
+    aSet.Put( SfxBoolItem( nWDynamic, m_xHeightDynBtn->get_active() ) );
+    aSet.Put( SfxBoolItem( nWShared,  m_xCntSharedBox->get_active() ) );
+    if(m_xCntSharedFirstBox->get_visible())
+        aSet.Put(SfxBoolItem(nWSharedFirst,  m_xCntSharedFirstBox->get_active()));
+    if (m_xDynSpacingCB->get_visible() && SfxItemPool::IsWhich(nWDynSpacing))
     {
         std::unique_ptr<SfxBoolItem> pBoolItem(static_cast<SfxBoolItem*>(pPool->GetDefaultItem(nWDynSpacing).Clone()));
-        pBoolItem->SetValue(m_pDynSpacingCB->IsChecked());
+        pBoolItem->SetValue(m_xDynSpacingCB->get_active());
         aSet.Put(*pBoolItem);
     }
 
     // Size
     SvxSizeItem aSizeItem( static_cast<const SvxSizeItem&>(rOldSet.Get( nWSize )) );
     Size        aSize( aSizeItem.GetSize() );
-    long        nDist = GetCoreValue( *m_pDistEdit, eUnit );
-    long        nH    = GetCoreValue( *m_pHeightEdit, eUnit );
+    long        nDist = GetCoreValue( *m_xDistEdit, eUnit );
+    long        nH    = GetCoreValue( *m_xHeightEdit, eUnit );
 
     nH += nDist; // add distance
     aSize.setHeight( nH );
@@ -296,8 +269,8 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet )
 
     // Margins
     SvxLRSpaceItem aLR( nWLRSpace );
-    aLR.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_pLMEdit, eUnit )) );
-    aLR.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_pRMEdit, eUnit )) );
+    aLR.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_xLMEdit, eUnit )) );
+    aLR.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_xRMEdit, eUnit )) );
     aSet.Put( aLR );
 
     SvxULSpaceItem aUL( nWULSpace );
@@ -374,7 +347,7 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
     const SfxPoolItem* pExt2 = GetItem(*rSet, SID_ATTR_PAGE_EXT2);
     if (pExt1 && dynamic_cast<const SfxBoolItem*>(pExt1) != nullptr && pExt2 && dynamic_cast<const SfxBoolItem*>(pExt2) != nullptr )
         bIsCalc = true;
-    m_pCntSharedFirstBox->Show(!bIsCalc);
+    m_xCntSharedFirstBox->show(!bIsCalc);
 
     // Evaluate header-/footer- attributes
     const SvxSetItem* pSetItem = nullptr;
@@ -386,7 +359,7 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
         const SfxBoolItem& rHeaderOn =
             static_cast<const SfxBoolItem&>(rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON)));
 
-        m_pTurnOnBox->Check(rHeaderOn.GetValue());
+        m_xTurnOnBox->set_active(rHeaderOn.GetValue());
 
         if ( rHeaderOn.GetValue() )
         {
@@ -403,33 +376,33 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
                 static_cast<const SvxULSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
             const SvxLRSpaceItem& rLR =
                 static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
-            if(m_pDynSpacingCB->IsVisible())
+            if (m_xDynSpacingCB->get_visible())
             {
                 const SfxBoolItem& rDynSpacing =
                     static_cast<const SfxBoolItem&>(rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING)));
-                m_pDynSpacingCB->Check(rDynSpacing.GetValue());
+                m_xDynSpacingCB->set_active(rDynSpacing.GetValue());
             }
 
 
             if ( nId == SID_ATTR_PAGE_HEADERSET )
             {   // Header
-                SetMetricValue( *m_pDistEdit, rUL.GetLower(), eUnit );
-                SetMetricValue( *m_pHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
+                SetMetricValue( *m_xDistEdit, rUL.GetLower(), eUnit );
+                SetMetricValue( *m_xHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
             }
             else
             {   // Footer
-                SetMetricValue( *m_pDistEdit, rUL.GetUpper(), eUnit );
-                SetMetricValue( *m_pHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
+                SetMetricValue( *m_xDistEdit, rUL.GetUpper(), eUnit );
+                SetMetricValue( *m_xHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
             }
 
-            m_pHeightDynBtn->Check(rDynamic.GetValue());
-            SetMetricValue( *m_pLMEdit, rLR.GetLeft(), eUnit );
-            SetMetricValue( *m_pRMEdit, rLR.GetRight(), eUnit );
-            m_pCntSharedBox->Check(rShared.GetValue());
+            m_xHeightDynBtn->set_active(rDynamic.GetValue());
+            SetMetricValue( *m_xLMEdit, rLR.GetLeft(), eUnit );
+            SetMetricValue( *m_xRMEdit, rLR.GetRight(), eUnit );
+            m_xCntSharedBox->set_active(rShared.GetValue());
             if (pSharedFirst)
-                m_pCntSharedFirstBox->Check(pSharedFirst->GetValue());
+                m_xCntSharedFirstBox->set_active(pSharedFirst->GetValue());
             else
-                m_pCntSharedFirstBox->Hide();
+                m_xCntSharedFirstBox->hide();
         }
         else
             pSetItem = nullptr;
@@ -438,27 +411,27 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
     {
         // defaults for distance and height
         long nDefaultDist = bIsCalc ? DEF_DIST_CALC : DEF_DIST_WRITER;
-        SetMetricValue( *m_pDistEdit, nDefaultDist, MapUnit::Map100thMM );
-        SetMetricValue( *m_pHeightEdit, 500, MapUnit::Map100thMM );
+        SetMetricValue( *m_xDistEdit, nDefaultDist, MapUnit::Map100thMM );
+        SetMetricValue( *m_xHeightEdit, 500, MapUnit::Map100thMM );
     }
 
     if ( !pSetItem )
     {
-        m_pTurnOnBox->Check( false );
-        m_pHeightDynBtn->Check();
-        m_pCntSharedBox->Check();
-        m_pCntSharedFirstBox->Check();
+        m_xTurnOnBox->set_active(false);
+        m_xHeightDynBtn->set_active(true);
+        m_xCntSharedBox->set_active(true);
+        m_xCntSharedFirstBox->set_active(true);
     }
 
-    TurnOnHdl(nullptr);
+    TurnOn(nullptr);
 
-    m_pTurnOnBox->SaveValue();
-    m_pDistEdit->SaveValue();
-    m_pHeightEdit->SaveValue();
-    m_pHeightDynBtn->SaveValue();
-    m_pLMEdit->SaveValue();
-    m_pRMEdit->SaveValue();
-    m_pCntSharedBox->SaveValue();
+    m_xTurnOnBox->save_state();
+    m_xDistEdit->save_value();
+    m_xHeightEdit->save_value();
+    m_xHeightDynBtn->save_state();
+    m_xLMEdit->save_value();
+    m_xRMEdit->save_value();
+    m_xCntSharedBox->save_state();
     RangeHdl();
 
     const SfxPoolItem* pItem = nullptr;
@@ -469,10 +442,10 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
     {
         sal_uInt16 nHtmlMode = 0;
         nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
-        if(nHtmlMode & HTMLMODE_ON)
+        if (nHtmlMode & HTMLMODE_ON)
         {
-            m_pCntSharedBox->Hide();
-            m_pBackgroundBtn->Hide();
+            m_xCntSharedBox->hide();
+            m_xBackgroundBtn->hide();
         }
     }
 
@@ -480,52 +453,46 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
 
 void SvxHFPage::InitHandler()
 {
-    m_pTurnOnBox->SetClickHdl(LINK(this,   SvxHFPage, TurnOnHdl));
-    m_pDistEdit->SetModifyHdl(LINK(this,   SvxHFPage, DistModify));
-    m_pDistEdit->SetLoseFocusHdl(LINK(this, SvxHFPage, RangeFocusHdl));
-
-    m_pHeightEdit->SetModifyHdl(LINK(this,     SvxHFPage, HeightModify));
-    m_pHeightEdit->SetLoseFocusHdl(LINK(this,SvxHFPage,RangeFocusHdl));
-
-    m_pLMEdit->SetModifyHdl(LINK(this,         SvxHFPage, BorderModify));
-    m_pLMEdit->SetLoseFocusHdl(LINK(this,  SvxHFPage, RangeFocusHdl));
-    m_pRMEdit->SetModifyHdl(LINK(this,         SvxHFPage, BorderModify));
-    m_pRMEdit->SetLoseFocusHdl(LINK(this,  SvxHFPage, RangeFocusHdl));
-    m_pBackgroundBtn->SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
+    m_xTurnOnBox->connect_toggled(LINK(this, SvxHFPage, TurnOnHdl));
+    m_xDistEdit->connect_value_changed(LINK(this, SvxHFPage, ValueChangeHdl));
+    m_xHeightEdit->connect_value_changed(LINK(this,SvxHFPage,ValueChangeHdl));
+
+    m_xLMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
+    m_xRMEdit->connect_value_changed(LINK(this,  SvxHFPage, ValueChangeHdl));
+    m_xBackgroundBtn->connect_clicked(LINK(this,SvxHFPage, BackgroundHdl));
 }
 
-IMPL_LINK( SvxHFPage, TurnOnHdl, Button *, pButton, void )
+void SvxHFPage::TurnOn(weld::ToggleButton* pBox)
 {
-    CheckBox* pBox = static_cast<CheckBox*>(pButton);
-    if ( m_pTurnOnBox->IsChecked() )
+    if (m_xTurnOnBox->get_active())
     {
-        m_pDistFT->Enable();
-        m_pDistEdit->Enable();
-        m_pDynSpacingCB->Enable();
-        m_pHeightFT->Enable();
-        m_pHeightEdit->Enable();
-        m_pHeightDynBtn->Enable();
-        m_pLMLbl->Enable();
-        m_pLMEdit->Enable();
-        m_pRMLbl->Enable();
-        m_pRMEdit->Enable();
-
-        SvxPageUsage nUsage = m_pBspWin->GetUsage();
+        m_xDistFT->set_sensitive(true);
+        m_xDistEdit->set_sensitive(true);
+        m_xDynSpacingCB->set_sensitive(true);
+        m_xHeightFT->set_sensitive(true);
+        m_xHeightEdit->set_sensitive(true);
+        m_xHeightDynBtn->set_sensitive(true);
+        m_xLMLbl->set_sensitive(true);
+        m_xLMEdit->set_sensitive(true);
+        m_xRMLbl->set_sensitive(true);
+        m_xRMEdit->set_sensitive(true);
+
+        SvxPageUsage nUsage = m_aBspWin.GetUsage();
 
         if( nUsage == SvxPageUsage::Right || nUsage == SvxPageUsage::Left )
-            m_pCntSharedBox->Disable();
+            m_xCntSharedBox->set_sensitive(false);
         else
         {
-            m_pCntSharedBox->Enable();
-            m_pCntSharedFirstBox->Enable();
+            m_xCntSharedBox->set_sensitive(true);
+            m_xCntSharedFirstBox->set_sensitive(true);
         }
-        m_pBackgroundBtn->Enable();
+        m_xBackgroundBtn->set_sensitive(true);
     }
     else
     {
         bool bDelete = true;
 
-        if ( !mbDisableQueryBox && pBox && m_pTurnOnBox->GetSavedValue() == TRISTATE_TRUE )
+        if (!mbDisableQueryBox && pBox && m_xTurnOnBox->get_saved_state() == TRISTATE_TRUE)
         {
             short nResult;
             if (nId == SID_ATTR_PAGE_HEADERSET)
@@ -543,44 +510,34 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, Button *, pButton, void )
 
         if ( bDelete )
         {
-            m_pDistFT->Disable();
-            m_pDistEdit->Disable();
-            m_pDynSpacingCB->Enable(false);
-            m_pHeightFT->Disable();
-            m_pHeightEdit->Disable();
-            m_pHeightDynBtn->Disable();
-
-            m_pLMLbl->Disable();
-            m_pLMEdit->Disable();
-            m_pRMLbl->Disable();
-            m_pRMEdit->Disable();
-
-            m_pCntSharedBox->Disable();
-            m_pBackgroundBtn->Disable();
-            m_pCntSharedFirstBox->Disable();
+            m_xDistFT->set_sensitive(false);
+            m_xDistEdit->set_sensitive(false);
+            m_xDynSpacingCB->set_sensitive(false);
+            m_xHeightFT->set_sensitive(false);
+            m_xHeightEdit->set_sensitive(false);
+            m_xHeightDynBtn->set_sensitive(false);
+
+            m_xLMLbl->set_sensitive(false);
+            m_xLMEdit->set_sensitive(false);
+            m_xRMLbl->set_sensitive(false);
+            m_xRMEdit->set_sensitive(false);
+
+            m_xCntSharedBox->set_sensitive(false);
+            m_xBackgroundBtn->set_sensitive(false);
+            m_xCntSharedFirstBox->set_sensitive(false);
         }
         else
-            m_pTurnOnBox->Check();
+            m_xTurnOnBox->set_active(true);
     }
     UpdateExample();
 }
 
-IMPL_LINK_NOARG(SvxHFPage, DistModify, Edit&, void)
+IMPL_LINK(SvxHFPage, TurnOnHdl, weld::ToggleButton&, rBox, void)
 {
-    UpdateExample();
+    TurnOn(&rBox);
 }
 
-IMPL_LINK_NOARG(SvxHFPage, HeightModify, Edit&, void)
-{
-    UpdateExample();
-}
-
-IMPL_LINK_NOARG(SvxHFPage, BorderModify, Edit&, void)
-{
-    UpdateExample();
-}
-
-IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void)
+IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, weld::Button&, void)
 {
     if(!pBBSet)
     {
@@ -710,13 +667,13 @@ IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void)
 
             if(SID_ATTR_PAGE_HEADERSET == nId)
             {
-                //m_pBspWin->SetHdColor(rItem.GetColor());
-                m_pBspWin->setHeaderFillAttributes(aFillAttributes);
+                //m_aBspWin.SetHdColor(rItem.GetColor());
+                m_aBspWin.setHeaderFillAttributes(aFillAttributes);
             }
             else
             {
-                //m_pBspWin->SetFtColor(rItem.GetColor());
-                m_pBspWin->setFooterFillAttributes(aFillAttributes);
+                //m_aBspWin.SetFtColor(rItem.GetColor());
+                m_aBspWin.setFooterFillAttributes(aFillAttributes);
             }
         }
 
@@ -729,21 +686,21 @@ void SvxHFPage::UpdateExample()
 {
     if ( nId == SID_ATTR_PAGE_HEADERSET )
     {
-        m_pBspWin->SetHeader( m_pTurnOnBox->IsChecked() );
-        m_pBspWin->SetHdHeight( GetCoreValue( *m_pHeightEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetHdDist( GetCoreValue( *m_pDistEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetHdLeft( GetCoreValue( *m_pLMEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetHdRight( GetCoreValue( *m_pRMEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetHeader( m_xTurnOnBox->get_active() );
+        m_aBspWin.SetHdHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetHdDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetHdLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetHdRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
     }
     else
     {
-        m_pBspWin->SetFooter( m_pTurnOnBox->IsChecked() );
-        m_pBspWin->SetFtHeight( GetCoreValue( *m_pHeightEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetFtDist( GetCoreValue( *m_pDistEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetFtLeft( GetCoreValue( *m_pLMEdit, MapUnit::MapTwip ) );
-        m_pBspWin->SetFtRight( GetCoreValue( *m_pRMEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetFooter( m_xTurnOnBox->get_active() );
+        m_aBspWin.SetFtHeight( GetCoreValue( *m_xHeightEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetFtDist( GetCoreValue( *m_xDistEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetFtLeft( GetCoreValue( *m_xLMEdit, MapUnit::MapTwip ) );
+        m_aBspWin.SetFtRight( GetCoreValue( *m_xRMEdit, MapUnit::MapTwip ) );
     }
-    m_pBspWin->Invalidate();
+    m_aBspWin.Invalidate();
 }
 
 void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
@@ -780,7 +737,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
                 }
             }
 
-            m_pBspWin->setHeaderFillAttributes(aHeaderFillAttributes);
+            m_aBspWin.setHeaderFillAttributes(aHeaderFillAttributes);
         }
     }
 
@@ -816,7 +773,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
                 }
             }
 
-            m_pBspWin->setFooterFillAttributes(aFooterFillAttributes);
+            m_aBspWin.setFooterFillAttributes(aFooterFillAttributes);
         }
     }
 
@@ -842,7 +799,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
         }
     }
 
-    m_pBspWin->setPageFillAttributes(aPageFillAttributes);
+    m_aBspWin.setPageFillAttributes(aPageFillAttributes);
 }
 
 void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
@@ -854,13 +811,13 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
         // Set left and right margins
         const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(*pItem);
 
-        m_pBspWin->SetLeft( rLRSpace.GetLeft() );
-        m_pBspWin->SetRight( rLRSpace.GetRight() );
+        m_aBspWin.SetLeft( rLRSpace.GetLeft() );
+        m_aBspWin.SetRight( rLRSpace.GetRight() );
     }
     else
     {
-        m_pBspWin->SetLeft( 0 );
-        m_pBspWin->SetRight( 0 );
+        m_aBspWin.SetLeft( 0 );
+        m_aBspWin.SetRight( 0 );
     }
 
     pItem = GetItem( rSet, SID_ATTR_ULSPACE );
@@ -870,13 +827,13 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
         // Set top and bottom margins
         const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(*pItem);
 
-        m_pBspWin->SetTop( rULSpace.GetUpper() );
-        m_pBspWin->SetBottom( rULSpace.GetLower() );
+        m_aBspWin.SetTop( rULSpace.GetUpper() );
+        m_aBspWin.SetBottom( rULSpace.GetLower() );
     }
     else
     {
-        m_pBspWin->SetTop( 0 );
-        m_pBspWin->SetBottom( 0 );
+        m_aBspWin.SetTop( 0 );
+        m_aBspWin.SetBottom( 0 );
     }
 
     SvxPageUsage nUsage = SvxPageUsage::All;
@@ -885,14 +842,14 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
     if ( pItem )
         nUsage = static_cast<const SvxPageItem*>(pItem)->GetPageUsage();
 
-    m_pBspWin->SetUsage( nUsage );
+    m_aBspWin.SetUsage( nUsage );
 
     if ( SvxPageUsage::Right == nUsage || SvxPageUsage::Left == nUsage )
-        m_pCntSharedBox->Disable();
+        m_xCntSharedBox->set_sensitive(false);
     else
     {
-        m_pCntSharedBox->Enable();
-        m_pCntSharedFirstBox->Enable();
+        m_xCntSharedBox->set_sensitive(true);
+        m_xCntSharedFirstBox->set_sensitive(true);
     }
     pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
 
@@ -901,7 +858,7 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
         // Orientation and Size from the PageItem
         const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(*pItem);
         // if the size is already swapped (Landscape)
-        m_pBspWin->SetSize( rSize.GetSize() );
+        m_aBspWin.SetSize( rSize.GetSize() );
     }
 
     // Evaluate Header attribute
@@ -925,11 +882,11 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
                 rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
             long nDist = rUL.GetLower();
 
-            m_pBspWin->SetHdHeight( rSize.GetSize().Height() - nDist );
-            m_pBspWin->SetHdDist( nDist );
-            m_pBspWin->SetHdLeft( rLR.GetLeft() );
-            m_pBspWin->SetHdRight( rLR.GetRight() );
-            m_pBspWin->SetHeader( true );
+            m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
+            m_aBspWin.SetHdDist( nDist );
+            m_aBspWin.SetHdLeft( rLR.GetLeft() );
+            m_aBspWin.SetHdRight( rLR.GetRight() );
+            m_aBspWin.SetHeader( true );
         }
         else
             pSetItem = nullptr;
@@ -937,12 +894,12 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
 
     if ( !pSetItem )
     {
-        m_pBspWin->SetHeader( false );
+        m_aBspWin.SetHeader( false );
 
         if ( SID_ATTR_PAGE_HEADERSET == nId )
         {
-            m_pCntSharedBox->Disable();
-            m_pCntSharedFirstBox->Disable();
+            m_xCntSharedBox->set_sensitive(false);
+            m_xCntSharedFirstBox->set_sensitive(false);
         }
     }
     pSetItem = nullptr;
@@ -965,11 +922,11 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
                 rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
             long nDist = rUL.GetUpper();
 
-            m_pBspWin->SetFtHeight( rSize.GetSize().Height() - nDist );
-            m_pBspWin->SetFtDist( nDist );
-            m_pBspWin->SetFtLeft( rLR.GetLeft() );
-            m_pBspWin->SetFtRight( rLR.GetRight() );
-            m_pBspWin->SetFooter( true );
+            m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
+            m_aBspWin.SetFtDist( nDist );
+            m_aBspWin.SetFtLeft( rLR.GetLeft() );
+            m_aBspWin.SetFtRight( rLR.GetRight() );
+            m_aBspWin.SetFooter( true );
         }
         else
             pSetItem = nullptr;
@@ -977,12 +934,12 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
 
     if ( !pSetItem )
     {
-        m_pBspWin->SetFooter( false );
+        m_aBspWin.SetFooter( false );
 
         if ( SID_ATTR_PAGE_FOOTERSET == nId )
         {
-            m_pCntSharedBox->Disable();
-            m_pCntSharedFirstBox->Disable();
+            m_xCntSharedBox->set_sensitive(false);
+            m_xCntSharedFirstBox->set_sensitive(false);
         }
     }
 
@@ -990,16 +947,16 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
 
     if ( pItem && dynamic_cast<const SfxBoolItem*>( pItem) !=  nullptr )
     {
-        m_pBspWin->SetTable( true );
-        m_pBspWin->SetHorz( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
+        m_aBspWin.SetTable( true );
+        m_aBspWin.SetHorz( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
     }
 
     pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
 
     if ( pItem && dynamic_cast<const SfxBoolItem*>( pItem) !=  nullptr )
     {
-        m_pBspWin->SetTable( true );
-        m_pBspWin->SetVert( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
+        m_aBspWin.SetTable( true );
+        m_aBspWin.SetVert( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
     }
     ResetBackground_Impl( rSet );
     RangeHdl();
@@ -1012,22 +969,24 @@ DeactivateRC SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
     return DeactivateRC::LeavePage;
 }
 
-IMPL_LINK_NOARG(SvxHFPage, RangeFocusHdl, Control&, void)
+IMPL_LINK_NOARG(SvxHFPage, ValueChangeHdl, weld::MetricSpinButton&, void)
 {
+    UpdateExample();
     RangeHdl();
 }
+
 void SvxHFPage::RangeHdl()
 {
-    long nHHeight = m_pBspWin->GetHdHeight();
-    long nHDist   = m_pBspWin->GetHdDist();
+    long nHHeight = m_aBspWin.GetHdHeight();
+    long nHDist   = m_aBspWin.GetHdDist();
 
-    long nFHeight = m_pBspWin->GetFtHeight();
-    long nFDist   = m_pBspWin->GetFtDist();
+    long nFHeight = m_aBspWin.GetFtHeight();
+    long nFDist   = m_aBspWin.GetFtDist();
 
-    long nHeight = std::max( long(MINBODY),
-        static_cast<long>(m_pHeightEdit->Denormalize( m_pHeightEdit->GetValue( FUNIT_TWIP ) ) ) );
-    long nDist   = m_pTurnOnBox->IsChecked() ?
-        static_cast<long>(m_pDistEdit->Denormalize( m_pDistEdit->GetValue( FUNIT_TWIP ) )) : 0;
+    long nHeight = std::max(long(MINBODY),
+        static_cast<long>(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FUNIT_TWIP))));
+    long nDist   = m_xTurnOnBox->get_active() ?
+        static_cast<long>(m_xDistEdit->denormalize(m_xDistEdit->get_value(FUNIT_TWIP))) : 0;
 
     long nMin;
     long nMax;
@@ -1044,13 +1003,13 @@ void SvxHFPage::RangeHdl()
     }
 
     // Current values of the side edges
-    long nBT = m_pBspWin->GetTop();
-    long nBB = m_pBspWin->GetBottom();
-    long nBL = m_pBspWin->GetLeft();
-    long nBR = m_pBspWin->GetRight();
+    long nBT = m_aBspWin.GetTop();
+    long nBB = m_aBspWin.GetBottom();
+    long nBL = m_aBspWin.GetLeft();
+    long nBR = m_aBspWin.GetRight();
 
-    long nH  = m_pBspWin->GetSize().Height();
-    long nW  = m_pBspWin->GetSize().Width();
+    long nH  = m_aBspWin.GetSize().Height();
+    long nW  = m_aBspWin.GetSize().Width();
 
     // Borders
     if ( nId == SID_ATTR_PAGE_HEADERSET )
@@ -1059,11 +1018,11 @@ void SvxHFPage::RangeHdl()
         nMin = ( nH - nBB - nBT ) / 5; // 20%
         nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
                     nMin );
-        m_pHeightEdit->SetMax( m_pHeightEdit->Normalize( nMax ), FUNIT_TWIP );
+        m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FUNIT_TWIP);
         nMin = ( nH - nBB - nBT ) / 5; // 20%
         nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
                      long(0) );
-        m_pDistEdit->SetMax( m_pDistEdit->Normalize( nDist ), FUNIT_TWIP );
+        m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FUNIT_TWIP);
     }
     else
     {
@@ -1071,53 +1030,33 @@ void SvxHFPage::RangeHdl()
         nMin = ( nH - nBT - nBB ) / 5; // 20%
         nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
                     nMin );
-        m_pHeightEdit->SetMax( m_pHeightEdit->Normalize( nMax ), FUNIT_TWIP );
+        m_xHeightEdit->set_max(m_xHeightEdit->normalize(nMax), FUNIT_TWIP);
         nMin = ( nH - nBT - nBB ) / 5; // 20%
         nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
                      long(0) );
-        m_pDistEdit->SetMax( m_pDistEdit->Normalize( nDist ), FUNIT_TWIP );
+        m_xDistEdit->set_max(m_xDistEdit->normalize(nDist), FUNIT_TWIP);
     }
 
     // Limit Indentation
     nMax = nW - nBL - nBR -
-           static_cast<long>(m_pRMEdit->Denormalize( m_pRMEdit->GetValue( FUNIT_TWIP ) )) - MINBODY;
-    m_pLMEdit->SetMax( m_pLMEdit->Normalize( nMax ), FUNIT_TWIP );
+           static_cast<long>(m_xRMEdit->denormalize(m_xRMEdit->get_value(FUNIT_TWIP))) - MINBODY;
+    m_xLMEdit->set_max(m_xLMEdit->normalize(nMax), FUNIT_TWIP);
 
     nMax = nW - nBL - nBR -
-           static_cast<long>(m_pLMEdit->Denormalize( m_pLMEdit->GetValue( FUNIT_TWIP ) )) - MINBODY;
-    m_pRMEdit->SetMax( m_pLMEdit->Normalize( nMax ), FUNIT_TWIP );
-}
-
-static void lcl_Move(vcl::Window& rWin, sal_Int32 nDiff)
-{
-    Point aPos(rWin.GetPosPixel());
-    aPos.AdjustY( -nDiff );
-    rWin.SetPosPixel(aPos);
+           static_cast<long>(m_xLMEdit->denormalize(m_xLMEdit->get_value(FUNIT_TWIP))) - MINBODY;
+    m_xRMEdit->set_max(m_xLMEdit->normalize(nMax), FUNIT_TWIP);
 }
 
 void SvxHFPage::EnableDynamicSpacing()
 {
-    m_pDynSpacingCB->Show();
-    //move all following controls
-    vcl::Window* aMoveWindows[] =
-    {
-        m_pHeightFT,
-        m_pHeightEdit,
-        m_pHeightDynBtn,
-        m_pBackgroundBtn,
-        nullptr
-    };
-    sal_Int32 nOffset = m_pTurnOnBox->GetPosPixel().Y() - m_pCntSharedBox->GetPosPixel().Y();
-    sal_Int32 nIdx = 0;
-    while(aMoveWindows[nIdx])
-        lcl_Move(*aMoveWindows[nIdx++], nOffset);
+    m_xDynSpacingCB->show();
 }
 
 void SvxHFPage::PageCreated(const SfxAllItemSet &rSet)
 {
     const SfxBoolItem* pSupportDrawingLayerFillStyleItem = rSet.GetItem<SfxBoolItem>(SID_DRAWINGLAYER_FILLSTYLES, false);
 
-    if(pSupportDrawingLayerFillStyleItem)
+    if (pSupportDrawingLayerFillStyleItem)
     {
         const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue());
 
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index eb2fc6ef92fd..7c3d4a7e54f4 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -413,4 +413,379 @@ Size SvxPageWindow::GetOptimalSize() const
     return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont));
 }
 
+PageWindow::PageWindow() :
+    aWinSize(),
+    aSize(),
+    nTop(0),
+    nBottom(0),
+    nLeft(0),
+    nRight(0),
+    bResetBackground(false),
+    bFrameDirection(false),
+    nFrameDirection(SvxFrameDirection::Horizontal_LR_TB),
+    nHdLeft(0),
+    nHdRight(0),
+    nHdDist(0),
+    nHdHeight(0),
+    nFtLeft(0),
+    nFtRight(0),
+    nFtDist(0),
+    nFtHeight(0),
+    maHeaderFillAttributes(),
+    maFooterFillAttributes(),
+    maPageFillAttributes(),
+    bFooter(false),
+    bHeader(false),
+    bTable(false),
+    bHorz(false),
+    bVert(false),
+    eUsage(SvxPageUsage::All)
+{
+}
+
+PageWindow::~PageWindow()
+{
+}
+
+void PageWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
+{
+    rRenderContext.Push(PushFlags::MAPMODE);
+    rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
+
+    Fraction aXScale(aWinSize.Width(), std::max(long(aSize.Width() * 2 + aSize.Width() / 8), 1L));
+    Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), 1L));
+    MapMode aMapMode(rRenderContext.GetMapMode());
+
+    if(aYScale < aXScale)
+    {
+        aMapMode.SetScaleX(aYScale);
+        aMapMode.SetScaleY(aYScale);
+    }
+    else
+    {
+        aMapMode.SetScaleX(aXScale);
+        aMapMode.SetScaleY(aXScale);
+    }
+    rRenderContext.SetMapMode(aMapMode);
+    Size aSz(rRenderContext.PixelToLogic(GetOutputSizePixel()));
+    long nYPos = (aSz.Height() - aSize.Height()) / 2;
+
+    if (eUsage == SvxPageUsage::All)
+    {
+        // all pages are equal -> draw one page
+        if (aSize.Width() > aSize.Height())
+        {
+            // Draw Landscape page of the same size
+            Fraction aX = aMapMode.GetScaleX();
+            Fraction aY = aMapMode.GetScaleY();
+            Fraction a2(1.5);
+            aX *= a2;
+            aY *= a2;
+            aMapMode.SetScaleX(aX);
+            aMapMode.SetScaleY(aY);
+            rRenderContext.SetMapMode(aMapMode);
+            aSz = rRenderContext.PixelToLogic(GetOutputSizePixel());
+            nYPos = (aSz.Height() - aSize.Height()) / 2;
+            long nXPos = (aSz.Width() - aSize.Width()) / 2;
+            DrawPage(rRenderContext, Point(nXPos,nYPos),true,true);
+        }
+        else
+            // Portrait
+            DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 2,nYPos),true,true);
+    }
+    else
+    {
+        // Left and right page are different -> draw two pages if possible
+        DrawPage(rRenderContext, Point(0, nYPos), false,
+                 eUsage == SvxPageUsage::Left || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror);
+        DrawPage(rRenderContext, Point(aSize.Width() + aSize.Width() / 8, nYPos), true,
+                 eUsage == SvxPageUsage::Right || eUsage == SvxPageUsage::All || eUsage == SvxPageUsage::Mirror);
+    }
+    rRenderContext.Pop();
+}
+
+void PageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled)
+{
+    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+    const Color& rFieldColor = rStyleSettings.GetFieldColor();
+    const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor();
+    const Color& rDisableColor = rStyleSettings.GetDisableColor();
+    const Color& rDlgColor = rStyleSettings.GetDialogColor();
+
+    // background
+    if (!bSecond || bResetBackground)
+    {
+        rRenderContext.SetLineColor(COL_TRANSPARENT);
+        rRenderContext.SetFillColor(rDlgColor);
+        Size winSize(rRenderContext.GetOutputSize());
+        rRenderContext.DrawRect(tools::Rectangle(Point(0,0), winSize));
+
+        if (bResetBackground)
+            bResetBackground = false;
+    }
+    rRenderContext.SetLineColor(rFieldTextColor);
+
+    // Shadow
+    Size aTempSize = aSize;
+
+    // Page
+    if (!bEnabled)
+    {
+        rRenderContext.SetFillColor(rDisableColor);
+        rRenderContext.DrawRect(tools::Rectangle(rOrg, aTempSize));
+        return;
+    }
+    rRenderContext.SetFillColor(rFieldColor);
+    rRenderContext.DrawRect(tools::Rectangle(rOrg, aTempSize));
+
+    long nL = nLeft;
+    long nR = nRight;
+
+    if (eUsage == SvxPageUsage::Mirror && !bSecond)
+    {
+        // turn for mirrored
+        nL = nRight;
+        nR = nLeft;
+    }
+
+    tools::Rectangle aRect;
+
+    aRect.SetLeft( rOrg.X() + nL );
+    aRect.SetRight( rOrg.X() + aTempSize.Width() - nR );
+    aRect.SetTop( rOrg.Y() + nTop );
+    aRect.SetBottom( rOrg.Y() + aTempSize.Height() - nBottom );
+
+    tools::Rectangle aHdRect(aRect);
+    tools::Rectangle aFtRect(aRect);
+
+    if (bHeader || bFooter)
+    {
+        // Header and/or footer used
+        const Color aLineColor(rRenderContext.GetLineColor());
+
+        // draw PageFill first and on the whole page, no outline
+        rRenderContext.SetLineColor();
+        drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect);
+        rRenderContext.SetLineColor(aLineColor);
+
+        if (bHeader)
+        {
+            // show headers if possible
+            aHdRect.AdjustLeft(nHdLeft );
+            aHdRect.AdjustRight( -(nHdRight) );
+            aHdRect.SetBottom( aRect.Top() + nHdHeight );
+            aRect.AdjustTop(nHdHeight + nHdDist );
+
+            // draw header over PageFill, plus outline
+            drawFillAttributes(rRenderContext, maHeaderFillAttributes, aHdRect, aHdRect);
+        }
+
+        if (bFooter)
+        {
+            // show footer if possible
+            aFtRect.AdjustLeft(nFtLeft );
+            aFtRect.AdjustRight( -(nFtRight) );
+            aFtRect.SetTop( aRect.Bottom() - nFtHeight );
+            aRect.AdjustBottom( -(nFtHeight + nFtDist) );
+
+            // draw footer over PageFill, plus outline
+            drawFillAttributes(rRenderContext, maFooterFillAttributes, aFtRect, aFtRect);
+        }
+
+        // draw page's reduced outline, only outline
+        drawFillAttributes(rRenderContext, drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect);
+    }
+    else
+    {
+        // draw PageFill and outline
+        drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect);
+    }
+
+    if (bFrameDirection && !bTable)
+    {
+        Point aPos;
+        vcl::Font aFont(rRenderContext.GetFont());
+        const Size aSaveSize = aFont.GetFontSize();
+        Size aDrawSize(0,aRect.GetHeight() / 6);
+        aFont.SetFontSize(aDrawSize);
+        rRenderContext.SetFont(aFont);
+        OUString sText("ABC");
+        Point aMove(1, rRenderContext.GetTextHeight());
+        sal_Unicode cArrow = 0x2193;
+        long nAWidth = rRenderContext.GetTextWidth(sText.copy(0,1));
+        switch (nFrameDirection)
+        {
+        case SvxFrameDirection::Horizontal_LR_TB:
+            aPos = aRect.TopLeft();
+            aPos.AdjustX(rRenderContext.PixelToLogic(Point(1,1)).X() );
+            aMove.setY( 0 );
+            cArrow = 0x2192;
+            break;
+        case SvxFrameDirection::Horizontal_RL_TB:
+            aPos = aRect.TopRight();
+            aPos.AdjustX( -nAWidth );
+            aMove.setY( 0 );
+            aMove.setX( aMove.X() * -1 );
+            cArrow = 0x2190;
+            break;
+        case SvxFrameDirection::Vertical_LR_TB:
+            aPos = aRect.TopLeft();
+            aPos.AdjustX(rRenderContext.PixelToLogic(Point(1,1)).X() );
+            aMove.setX( 0 );
+            break;
+        case SvxFrameDirection::Vertical_RL_TB:
+            aPos = aRect.TopRight();
+            aPos.AdjustX( -nAWidth );
+            aMove.setX( 0 );
+            break;
+        default: break;
+        }
+        sText += OUStringLiteral1(cArrow);
+        for (sal_Int32 i = 0; i < sText.getLength(); i++)
+        {
+            OUString sDraw(sText.copy(i,1));
+            long nHDiff = 0;
+            long nCharWidth = rRenderContext.GetTextWidth(sDraw);
+            bool bHorizontal = 0 == aMove.Y();
+            if (!bHorizontal)
+            {
+                nHDiff = (nAWidth - nCharWidth) / 2;
+                aPos.AdjustX(nHDiff );
+            }
+            rRenderContext.DrawText(aPos,sDraw);
+            if (bHorizontal)
+            {
+                aPos.AdjustX(aMove.X() < 0 ? -nCharWidth : nCharWidth );
+            }
+            else
+            {
+                aPos.AdjustX( -nHDiff );
+                aPos.AdjustY(aMove.Y() );
+            }
+        }
+        aFont.SetFontSize(aSaveSize);
+        rRenderContext.SetFont(aFont);
+
+    }
+    if (bTable)
+    {
+        // Paint Table, if necessary center it
+        rRenderContext.SetLineColor(COL_LIGHTGRAY);
+
+        long nW = aRect.GetWidth();
+        long nH = aRect.GetHeight();
+        long const nTW = CELL_WIDTH * 3;
+        long const nTH = CELL_HEIGHT * 3;
+        long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
+        long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
+        tools::Rectangle aCellRect(Point(_nLeft, _nTop),Size(CELL_WIDTH, CELL_HEIGHT));
+
+        for (sal_uInt16 i = 0; i < 3; ++i)
+        {
+            aCellRect.SetLeft( _nLeft );
+            aCellRect.SetRight( _nLeft + CELL_WIDTH );
+            if(i > 0)
+                aCellRect.Move(0,CELL_HEIGHT);
+
+            for (sal_uInt16 j = 0; j < 3; ++j)
+            {
+                if (j > 0)
+                    aCellRect.Move(CELL_WIDTH,0);
+                rRenderContext.DrawRect(aCellRect);
+            }
+        }
+    }
+}
+
+void PageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
+                                       const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
+                                       const tools::Rectangle& rPaintRange,
+                                       const tools::Rectangle& rDefineRange)
+{
+    const basegfx::B2DRange aPaintRange(
+        rPaintRange.Left(),
+        rPaintRange.Top(),
+        rPaintRange.Right(),
+        rPaintRange.Bottom());
+
+    if(!aPaintRange.isEmpty() &&
+       !basegfx::fTools::equalZero(aPaintRange.getWidth()) &&
+       !basegfx::fTools::equalZero(aPaintRange.getHeight()))
+    {
+        const basegfx::B2DRange aDefineRange(
+            rDefineRange.Left(),
+            rDefineRange.Top(),
+            rDefineRange.Right(),
+            rDefineRange.Bottom());
+
+        // prepare primitive sequence
+        drawinglayer::primitive2d::Primitive2DContainer aSequence;
+
+        // create fill geometry if there is something to fill
+        if (rFillAttributes.get() && rFillAttributes->isUsed())
+        {
+            aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange);
+        }
+
+        // create line geometry if a LineColor is set at the target device
+        if (rRenderContext.IsLineColor())
+        {
+            const drawinglayer::primitive2d::Primitive2DReference xOutline(
+                new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+                    basegfx::utils::createPolygonFromRect(aPaintRange), rRenderContext.GetLineColor().getBColor()));
+
+            aSequence.push_back(xOutline);
+        }
+
+        // draw that if we have something to draw
+        if (!aSequence.empty())
+        {
+            const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
+                            basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(), aPaintRange, nullptr,
+                            0.0, css::uno::Sequence<css::beans::PropertyValue >());
+
+            std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor;
+            pProcessor.reset(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
+
+            if (pProcessor)
+            {
+                pProcessor->process(aSequence);
+            }
+        }
+    }
+}
+
+
+void PageWindow::EnableFrameDirection(bool bEnable)
+{
+    bFrameDirection = bEnable;
+}
+
+void PageWindow::SetFrameDirection(SvxFrameDirection nDirection)
+{
+    nFrameDirection = nDirection;
+}
+
+void PageWindow::ResetBackground()
+{
+    bResetBackground = true;
+}
+
+void PageWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+    OutputDevice& rRefDevice = pDrawingArea->get_ref_device();
+    // Count in Twips by default
+    rRefDevice.Push(PushFlags::MAPMODE);
+    rRefDevice.SetMapMode(MapMode(MapUnit::MapTwip));
+    aWinSize = rRefDevice.LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont));
+    pDrawingArea->set_size_request(aWinSize.Width(), aWinSize.Height());
+    CustomWidgetController::SetDrawingArea(pDrawingArea);
+
+    aWinSize.AdjustHeight( -4 );
+    aWinSize.AdjustWidth( -4 );
+
+    aWinSize = rRefDevice.PixelToLogic(aWinSize);
+    rRefDevice.Pop();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/headfootformatpage.ui b/svx/uiconfig/ui/headfootformatpage.ui
index dbf51adcf028..38ce3e434e2e 100644
--- a/svx/uiconfig/ui/headfootformatpage.ui
+++ b/svx/uiconfig/ui/headfootformatpage.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="svx">
-  <!-- interface-requires gtk+ 3.0 -->
-  <!-- interface-requires LibreOffice 1.0 -->
+  <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">99.989999999999995</property>
     <property name="step_increment">0.10000000000000001</property>
@@ -14,6 +14,16 @@
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment3">
+    <property name="upper">99.989999999999995</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment4">
+    <property name="upper">99.989999999999995</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkGrid" id="HFFormatPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -123,7 +133,6 @@
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
                             <property name="width">2</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -132,8 +141,8 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
                             <property name="hexpand">True</property>
+                            <property name="use_underline">True</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
                           </object>
@@ -141,7 +150,6 @@
                             <property name="left_attach">0</property>
                             <property name="top_attach">1</property>
                             <property name="width">2</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -149,31 +157,28 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="headfootformatpage|labelLeftMarg">_Left margin:</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">spinMargLeft:0.00cm</property>
+                            <property name="mnemonic_widget">spinMargLeft</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkSpinButton" id="spinMargLeft:0.00cm">
+                          <object class="GtkSpinButton" id="spinMargLeft">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="halign">center</property>
+                            <property name="activates_default">True</property>
                             <property name="adjustment">adjustment1</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -181,31 +186,28 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="headfootformatpage|labelRightMarg">R_ight margin:</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">spinMargRight:0.00cm</property>
+                            <property name="mnemonic_widget">spinMargRight</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkSpinButton" id="spinMargRight:0.00cm">
+                          <object class="GtkSpinButton" id="spinMargRight">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="halign">center</property>
-                            <property name="adjustment">adjustment1</property>
+                            <property name="activates_default">True</property>
+                            <property name="adjustment">adjustment3</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -213,31 +215,28 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="headfootformatpage|labelSpacing">_Spacing:</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">spinSpacing:0.00cm</property>
+                            <property name="mnemonic_widget">spinSpacing</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">4</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkSpinButton" id="spinSpacing:0.00cm">
+                          <object class="GtkSpinButton" id="spinSpacing">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="halign">center</property>
-                            <property name="adjustment">adjustment1</property>
+                            <property name="activates_default">True</property>
+                            <property name="adjustment">adjustment4</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">4</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -254,7 +253,6 @@
                             <property name="left_attach">0</property>
                             <property name="top_attach">5</property>
                             <property name="width">2</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -262,32 +260,29 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
                             <property name="label" translatable="yes" context="headfootformatpage|labelHeight">_Height:</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">spinHeight:0.00cm</property>
+                            <property name="mnemonic_widget">spinHeight</property>
                             <property name="ellipsize">end</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">6</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkSpinButton" id="spinHeight:0.00cm">
+                          <object class="GtkSpinButton" id="spinHeight">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="halign">center</property>
+                            <property name="activates_default">True</property>
                             <property name="adjustment">adjustment2</property>
                             <property name="digits">2</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="top_attach">6</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -305,7 +300,6 @@
                             <property name="left_attach">0</property>
                             <property name="top_attach">7</property>
                             <property name="width">2</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -347,7 +341,6 @@
                             <property name="left_attach">0</property>
                             <property name="top_attach">8</property>
                             <property name="width">2</property>
-                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
@@ -372,8 +365,8 @@
               <object class="GtkLabel" id="labelHeaderFormat">
                 <property name="can_focus">False</property>
                 <property name="no_show_all">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="headfootformatpage|labelHeaderFormat">Header</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -388,8 +381,8 @@
               <object class="GtkLabel" id="labelFooterFormat">
                 <property name="can_focus">False</property>
                 <property name="no_show_all">True</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="headfootformatpage|labelFooterFormat">Footer</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -406,8 +399,6 @@
       <packing>
         <property name="left_attach">0</property>
         <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
       </packing>
     </child>
     <child>
@@ -423,7 +414,7 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="svxlo-SvxPageWindow" id="drawingareaPageHF">
+              <object class="GtkDrawingArea" id="drawingareaPageHF">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="halign">center</property>
@@ -432,7 +423,7 @@
                 <property name="vexpand">True</property>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
@@ -443,18 +434,16 @@
       <packing>
         <property name="left_attach">1</property>
         <property name="top_attach">0</property>
-        <property name="width">1</property>
-        <property name="height">1</property>
       </packing>
     </child>
   </object>
   <object class="GtkSizeGroup" id="sizegroup1">
     <property name="ignore_hidden">True</property>
     <widgets>
-      <widget name="spinMargLeft:0.00cm"/>
-      <widget name="spinMargRight:0.00cm"/>
-      <widget name="spinSpacing:0.00cm"/>
-      <widget name="spinHeight:0.00cm"/>
+      <widget name="spinMargLeft"/>
+      <widget name="spinMargRight"/>
+      <widget name="spinSpacing"/>
+      <widget name="spinHeight"/>
     </widgets>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list