[Libreoffice-commits] core.git: sw/inc sw/sdi sw/source sw/uiconfig

Susobhan Ghosh susobhang70 at gmail.com
Fri Jun 17 14:03:03 UTC 2016


 sw/inc/cmdid.h                               |    8 +
 sw/sdi/_viewsh.sdi                           |   40 +++++
 sw/sdi/swriter.sdi                           |  144 +++++++++++++++++++
 sw/source/uibase/sidebar/PageFooterPanel.cxx |  201 +++++++++++++++++++++++++--
 sw/source/uibase/sidebar/PageFooterPanel.hxx |   41 +++++
 sw/source/uibase/sidebar/PageHeaderPanel.cxx |  192 +++++++++++++++++++++----
 sw/source/uibase/sidebar/PageHeaderPanel.hxx |   33 +++-
 sw/source/uibase/sidebar/SwPanelFactory.cxx  |    2 
 sw/source/uibase/uiview/viewtab.cxx          |  165 ++++++++++++++++++++++
 sw/uiconfig/swriter/ui/pagefooterpanel.ui    |  153 ++++++++++++--------
 sw/uiconfig/swriter/ui/pageheaderpanel.ui    |  151 ++++++++++++--------
 11 files changed, 958 insertions(+), 172 deletions(-)

New commits:
commit b461236af355d8f504064ac6cfe259b9f8a7b01e
Author: Susobhan Ghosh <susobhang70 at gmail.com>
Date:   Wed Jun 1 19:29:34 2016 +0530

    tdf#83830: Page Header Panel & Page Footer Panel
    
    Change-Id: Ic927bd52949f1bd196bec0efd3d49f9bb2841bd6
    Reviewed-on: https://gerrit.libreoffice.org/25781
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 94bbb0e..a832571 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -850,6 +850,14 @@
 #define SID_ATTR_PAGE_COLUMN            (FN_SIDEBAR + 0)
 #define SID_ATTR_PAGE_ULSPACE           (FN_SIDEBAR + 1)
 #define SID_ATTR_PAGE_LRSPACE           (FN_SIDEBAR + 2)
+#define SID_ATTR_PAGE_HEADER            (FN_SIDEBAR + 3)
+#define SID_ATTR_PAGE_HEADER_LRMARGIN   (FN_SIDEBAR + 4)
+#define SID_ATTR_PAGE_HEADER_SPACING    (FN_SIDEBAR + 5)
+#define SID_ATTR_PAGE_HEADER_LAYOUT     (FN_SIDEBAR + 6)
+#define SID_ATTR_PAGE_FOOTER            (FN_SIDEBAR + 7)
+#define SID_ATTR_PAGE_FOOTER_LRMARGIN   (FN_SIDEBAR + 8)
+#define SID_ATTR_PAGE_FOOTER_SPACING    (FN_SIDEBAR + 9)
+#define SID_ATTR_PAGE_FOOTER_LAYOUT     (FN_SIDEBAR + 10)
 
 //Member IDs for Fill / SetVariable of items
 #define         MID_STYLE       0xe0
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 6113dc9..c63d359 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -441,6 +441,46 @@ interface BaseTextEditView
         ExecMethod = ExecTabWin ;
         StateMethod = StateTabWin ;
     ]
+    SID_ATTR_PAGE_HEADER
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_HEADER_LRMARGIN
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_HEADER_SPACING
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_HEADER_LAYOUT
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_FOOTER
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_FOOTER_LRMARGIN
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_FOOTER_SPACING
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
+    SID_ATTR_PAGE_FOOTER_LAYOUT
+    [
+        ExecMethod = ExecTabWin ;
+        StateMethod = StateTabWin ;
+    ]
     SID_ATTR_PAGE_ULSPACE
     [
         ExecMethod = ExecTabWin ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 1b6c16a..d4246d6 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7489,6 +7489,150 @@ SvxLongLRSpaceItem SwPageLRMargin SID_ATTR_PAGE_LRSPACE
     GroupId = GID_FORMAT;
 ]
 
+SfxBoolItem SwPageHeaderItem SID_ATTR_PAGE_HEADER
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SvxLongLRSpaceItem SwPageHeaderLRMargin SID_ATTR_PAGE_HEADER_LRMARGIN
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SvxLongULSpaceItem SwPageHeaderSpacing SID_ATTR_PAGE_HEADER_SPACING
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SfxInt16Item SwPageHeaderLayout SID_ATTR_PAGE_HEADER_LAYOUT
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SfxBoolItem SwPageFooterItem SID_ATTR_PAGE_FOOTER
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SvxLongLRSpaceItem SwPageFooterLRMargin SID_ATTR_PAGE_FOOTER_LRMARGIN
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SvxLongULSpaceItem SwPageFooterSpacing SID_ATTR_PAGE_FOOTER_SPACING
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
+SfxInt16Item SwPageFooterLayout SID_ATTR_PAGE_FOOTER_LAYOUT
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_FORMAT;
+]
+
 SfxVoidItem AddTextBox FN_ADD_TEXT_BOX
 ()
 [
diff --git a/sw/source/uibase/sidebar/PageFooterPanel.cxx b/sw/source/uibase/sidebar/PageFooterPanel.cxx
index f204c827..68fb1e8 100644
--- a/sw/source/uibase/sidebar/PageFooterPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFooterPanel.cxx
@@ -19,6 +19,7 @@
 #include <sal/config.h>
 #include <swtypes.hxx>
 #include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
 #include <editeng/sizeitem.hxx>
 #include <editeng/paperinf.hxx>
 #include <svx/svxids.hrc>
@@ -39,22 +40,40 @@ namespace sw { namespace sidebar{
 
 VclPtr<vcl::Window> PageFooterPanel::Create(
     vcl::Window* pParent,
-    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame)
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+    SfxBindings* pBindings)
 {
     if( pParent == nullptr )
         throw ::com::sun::star::lang::IllegalArgumentException("no parent window given to PageFooterPanel::Create", nullptr, 0);
     if( !rxFrame.is() )
         throw ::com::sun::star::lang::IllegalArgumentException("no XFrame given to PageFooterPanel::Create", nullptr, 0);
 
-    return VclPtr<PageFooterPanel>::Create(pParent, rxFrame);
+    return VclPtr<PageFooterPanel>::Create(pParent, rxFrame, pBindings);
 }
 
 PageFooterPanel::PageFooterPanel(
     vcl::Window* pParent,
-    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame
-    ) :
-    PanelLayout(pParent, "PageFooterPanel", "modules/swriter/ui/pagefooterpanel.ui", rxFrame)
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+    SfxBindings* pBindings) :
+    PanelLayout(pParent, "PageFooterPanel", "modules/swriter/ui/pagefooterpanel.ui", rxFrame),
+    mpBindings( pBindings ),
+    maHFToggleController(SID_ATTR_PAGE_FOOTER, *pBindings, *this),
+    maFooterLRMarginController(SID_ATTR_PAGE_FOOTER_LRMARGIN, *pBindings, *this),
+    maFooterSpacingController(SID_ATTR_PAGE_FOOTER_SPACING, *pBindings, *this),
+    maFooterLayoutController(SID_ATTR_PAGE_FOOTER_LAYOUT, *pBindings, *this),
+    aCustomEntry(),
+    mpFooterItem( new SfxBoolItem(SID_ATTR_PAGE_FOOTER) ),
+    mpFooterLRMarginItem( new SvxLongLRSpaceItem(0, 0, SID_ATTR_PAGE_FOOTER_LRMARGIN)),
+    mpFooterSpacingItem( new SvxLongULSpaceItem(0, 0, SID_ATTR_PAGE_FOOTER_SPACING)),
+    mpFooterLayoutItem( new SfxInt16Item(SID_ATTR_PAGE_FOOTER_LAYOUT))
 {
+    get(mpFooterToggle, "footertoggle");
+    get(mpFooterSpacingLB, "spacingpreset");
+    get(mpFooterLayoutLB, "samecontentLB");
+    get(mpFooterMarginPresetLB, "footermarginpreset");
+    get(mpCustomEntry, "customlabel");
+
+    Initialize();
 }
 
 PageFooterPanel::~PageFooterPanel()
@@ -64,17 +83,181 @@ PageFooterPanel::~PageFooterPanel()
 
 void PageFooterPanel::dispose()
 {
+    mpFooterToggle.disposeAndClear();
+    mpFooterSpacingLB.disposeAndClear();
+    mpFooterLayoutLB.disposeAndClear();
+    mpFooterMarginPresetLB.disposeAndClear();
+    mpCustomEntry.clear();
+
     PanelLayout::dispose();
 }
 
+void PageFooterPanel::Initialize()
+{
+    aCustomEntry = mpCustomEntry->GetText();
+    mpFooterToggle->SetClickHdl( LINK(this, PageFooterPanel, FooterToggleHdl) );
+    mpFooterMarginPresetLB->SetSelectHdl( LINK(this, PageFooterPanel, FooterLRMarginHdl));
+    mpFooterSpacingLB->SetSelectHdl( LINK(this, PageFooterPanel, FooterSpacingHdl));
+    mpFooterLayoutLB->SetSelectHdl( LINK(this, PageFooterPanel, FooterLayoutHdl));
+
+    mpBindings->Invalidate(SID_ATTR_PAGE_FOOTER);
+    mpBindings->Invalidate(SID_ATTR_PAGE_FOOTER_LRMARGIN);
+    mpBindings->Invalidate(SID_ATTR_PAGE_FOOTER_SPACING);
+    mpBindings->Invalidate(SID_ATTR_PAGE_FOOTER_LAYOUT);
+}
+
+void PageFooterPanel::UpdateFooterCheck()
+{
+    if(mpFooterToggle->IsChecked())
+    {
+        mpFooterSpacingLB->Enable();
+        mpFooterLayoutLB->Enable();
+        mpFooterMarginPresetLB->Enable();
+    }
+    else
+    {
+        mpFooterSpacingLB->Disable();
+        mpFooterLayoutLB->Disable();
+        mpFooterMarginPresetLB->Disable();
+    }
+}
+
+void PageFooterPanel::UpdateMarginControl()
+{
+    sal_uInt16 nLeft = mpFooterLRMarginItem->GetLeft();
+    sal_uInt16 nRight = mpFooterLRMarginItem->GetRight();
+    sal_uInt16 nCount = mpFooterMarginPresetLB->GetEntryCount();
+    if(nLeft == nRight)
+    {
+        for(sal_uInt16 i = 0; i < nCount; i++)
+        {
+            if(reinterpret_cast<sal_uLong>(mpFooterMarginPresetLB->GetEntryData(i)) == nLeft )
+            {
+                mpFooterMarginPresetLB->SelectEntryPos(i);
+                mpFooterMarginPresetLB->RemoveEntry(aCustomEntry);
+                return;
+            }
+        }
+    }
+    mpFooterMarginPresetLB->InsertEntry(aCustomEntry);
+    mpFooterMarginPresetLB->SelectEntry(aCustomEntry);
+}
+
+void PageFooterPanel::UpdateSpacingControl()
+{
+    sal_uInt16 nBottom = mpFooterSpacingItem->GetUpper();
+    sal_uInt16 nCount = mpFooterSpacingLB->GetEntryCount();
+    for(sal_uInt16 i = 0; i < nCount; i++)
+    {
+        if(reinterpret_cast<sal_uLong>(mpFooterSpacingLB->GetEntryData(i)) == nBottom )
+        {
+            mpFooterSpacingLB->SelectEntryPos(i);
+            mpFooterSpacingLB->RemoveEntry(aCustomEntry);
+            return;
+        }
+    }
+    mpFooterSpacingLB->InsertEntry(aCustomEntry);
+    mpFooterSpacingLB->SelectEntry(aCustomEntry);
+}
+
+void PageFooterPanel::UpdateLayoutControl()
+{
+    sal_uInt16 nLayout = mpFooterLayoutItem->GetValue();
+    mpFooterLayoutLB->SelectEntryPos( nLayout );
+}
+
 void PageFooterPanel::NotifyItemUpdate(
-    const sal_uInt16 /*nSid*/,
-    const SfxItemState /*eState*/,
-    const SfxPoolItem* /*pState*/,
-    const bool /*bIsEnabled*/)
+    const sal_uInt16 nSid,
+    const SfxItemState eState,
+    const SfxPoolItem* pState,
+    const bool bIsEnabled)
+{
+    (void)bIsEnabled;
+
+    if (IsDisposed())
+        return;
+
+    switch(nSid)
+    {
+        case SID_ATTR_PAGE_FOOTER:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SfxBoolItem*>( pState) !=  nullptr )
+            {
+                mpFooterItem.reset( static_cast<SfxBoolItem*>(pState->Clone()) );
+                mpFooterToggle->Check(mpFooterItem->GetValue());
+                UpdateFooterCheck();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_FOOTER_LRMARGIN:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SvxLongLRSpaceItem*>( pState) !=  nullptr )
+            {
+                mpFooterLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
+                UpdateMarginControl();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_FOOTER_SPACING:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SvxLongULSpaceItem*>( pState) !=  nullptr )
+            {
+                mpFooterSpacingItem.reset(static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
+                UpdateSpacingControl();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_FOOTER_LAYOUT:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SfxInt16Item*>( pState) !=  nullptr )
+            {
+                mpFooterLayoutItem.reset(static_cast<SfxInt16Item*>(pState->Clone()) );
+                UpdateLayoutControl();
+            }
+        }
+        break;
+        default:
+            break;
+    }
+}
+
+IMPL_LINK_NOARG_TYPED( PageFooterPanel, FooterToggleHdl, Button*, void )
+{
+    bool IsChecked = mpFooterToggle->IsChecked();
+    mpFooterItem->SetValue(IsChecked);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_FOOTER, SfxCallMode::RECORD, { mpFooterItem.get() } );
+    UpdateFooterCheck();
+}
+
+IMPL_LINK_NOARG_TYPED( PageFooterPanel, FooterLRMarginHdl, ListBox&, void )
+{
+    sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(mpFooterMarginPresetLB->GetSelectEntryData());
+    mpFooterLRMarginItem->SetLeft(nVal);
+    mpFooterLRMarginItem->SetRight(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_FOOTER_LRMARGIN,
+                                                 SfxCallMode::RECORD, { mpFooterLRMarginItem.get() } );
+}
+
+IMPL_LINK_NOARG_TYPED( PageFooterPanel, FooterSpacingHdl, ListBox&, void )
 {
+    sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(mpFooterSpacingLB->GetSelectEntryData());
+    mpFooterSpacingItem->SetUpper(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_FOOTER_SPACING,
+                                                 SfxCallMode::RECORD, { mpFooterSpacingItem.get() } );
 
 }
+IMPL_LINK_NOARG_TYPED( PageFooterPanel, FooterLayoutHdl, ListBox&, void )
+{
+    sal_uInt16 nVal = mpFooterLayoutLB->GetSelectEntryPos();
+    mpFooterLayoutItem->SetValue(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_FOOTER_LAYOUT,
+                                                 SfxCallMode::RECORD, { mpFooterLayoutItem.get() } );
+}
+
 
 } }
 
diff --git a/sw/source/uibase/sidebar/PageFooterPanel.hxx b/sw/source/uibase/sidebar/PageFooterPanel.hxx
index 0fbb20a..6738525 100644
--- a/sw/source/uibase/sidebar/PageFooterPanel.hxx
+++ b/sw/source/uibase/sidebar/PageFooterPanel.hxx
@@ -42,7 +42,7 @@
 #include <svl/intitem.hxx>
 #include <tools/fldunit.hxx>
 #include <svl/poolitem.hxx>
-#include <svx/rulritem.hxx>
+#include <svl/eitem.hxx>
 
 namespace sw { namespace sidebar {
 
@@ -53,7 +53,8 @@ class PageFooterPanel:
 public:
     static VclPtr<vcl::Window> Create(
         vcl::Window* pParent,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame);
+        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+        SfxBindings* pBindings);
 
     virtual void NotifyItemUpdate(
         const sal_uInt16 nSId,
@@ -61,11 +62,45 @@ public:
         const SfxPoolItem* pState,
         const bool bIsEnabled) override;
 
+    SfxBindings* GetBindings() const { return mpBindings; }
     PageFooterPanel(
         vcl::Window* pParent,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame);
+        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
+        SfxBindings* pBindings);
     virtual ~PageFooterPanel();
     virtual void dispose() override;
+
+private:
+
+    SfxBindings* mpBindings;
+
+    ::sfx2::sidebar::ControllerItem maHFToggleController;
+    ::sfx2::sidebar::ControllerItem maFooterLRMarginController;
+    ::sfx2::sidebar::ControllerItem maFooterSpacingController;
+    ::sfx2::sidebar::ControllerItem maFooterLayoutController;
+
+    VclPtr<CheckBox>    mpFooterToggle;
+    VclPtr<ListBox>     mpFooterSpacingLB;
+    VclPtr<ListBox>     mpFooterLayoutLB;
+    VclPtr<ListBox>     mpFooterMarginPresetLB;
+    VclPtr<FixedText>   mpCustomEntry;
+    OUString aCustomEntry;
+
+    void Initialize();
+    void UpdateFooterCheck();
+    void UpdateMarginControl();
+    void UpdateSpacingControl();
+    void UpdateLayoutControl();
+
+    ::std::unique_ptr<SfxBoolItem>        mpFooterItem;
+    ::std::unique_ptr<SvxLongLRSpaceItem> mpFooterLRMarginItem;
+    ::std::unique_ptr<SvxLongULSpaceItem> mpFooterSpacingItem;
+    ::std::unique_ptr<SfxInt16Item>       mpFooterLayoutItem;
+
+    DECL_LINK_TYPED( FooterToggleHdl, Button*, void );
+    DECL_LINK_TYPED( FooterLRMarginHdl, ListBox&, void);
+    DECL_LINK_TYPED( FooterSpacingHdl, ListBox&, void);
+    DECL_LINK_TYPED( FooterLayoutHdl, ListBox&, void);
 };
 
 } } //end of namespace sw::sidebar
diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.cxx b/sw/source/uibase/sidebar/PageHeaderPanel.cxx
index 65c0766..ae84c2e 100644
--- a/sw/source/uibase/sidebar/PageHeaderPanel.cxx
+++ b/sw/source/uibase/sidebar/PageHeaderPanel.cxx
@@ -59,14 +59,22 @@ PageHeaderPanel::PageHeaderPanel(
     SfxBindings* pBindings
     ) :
     PanelLayout(pParent, "PageHeaderPanel", "modules/swriter/ui/pageheaderpanel.ui", rxFrame),
-    mpBindings( pBindings )
+    mpBindings( pBindings ),
+    maHFToggleController(SID_ATTR_PAGE_HEADER, *pBindings, *this),
+    maHeaderLRMarginController(SID_ATTR_PAGE_HEADER_LRMARGIN, *pBindings, *this),
+    maHeaderSpacingController(SID_ATTR_PAGE_HEADER_SPACING, *pBindings, *this),
+    maHeaderLayoutController(SID_ATTR_PAGE_HEADER_LAYOUT, *pBindings, *this),
+    aCustomEntry(),
+    mpHeaderItem( new SfxBoolItem(SID_ATTR_PAGE_HEADER) ),
+    mpHeaderLRMarginItem( new SvxLongLRSpaceItem(0, 0, SID_ATTR_PAGE_HEADER_LRMARGIN)),
+    mpHeaderSpacingItem( new SvxLongULSpaceItem(0, 0, SID_ATTR_PAGE_HEADER_SPACING)),
+    mpHeaderLayoutItem( new SfxInt16Item(SID_ATTR_PAGE_HEADER_LAYOUT))
 {
     get(mpHeaderToggle, "headertoggle");
-    get(mpHeaderHeightField, "heightspinfield");
-    get(mpHeaderLMargin, "leftmargin");
-    get(mpHeaderRMargin, "rightmargin");
-    get(mpHeaderSpacing, "spacingspinfield");
-    get(mpSameContentLB, "samecontentLB");
+    get(mpHeaderSpacingLB, "spacingpreset");
+    get(mpHeaderLayoutLB, "samecontentLB");
+    get(mpHeaderMarginPresetLB, "headermarginpreset");
+    get(mpCustomEntry, "customlabel");
 
     Initialize();
 }
@@ -79,57 +87,179 @@ PageHeaderPanel::~PageHeaderPanel()
 void PageHeaderPanel::dispose()
 {
     mpHeaderToggle.disposeAndClear();
-    mpHeaderHeightField.disposeAndClear();
-    mpHeaderLMargin.disposeAndClear();
-    mpHeaderRMargin.disposeAndClear();
-    mpHeaderSpacing.disposeAndClear();
-    mpSameContentLB.disposeAndClear();
+    mpHeaderSpacingLB.disposeAndClear();
+    mpHeaderLayoutLB.disposeAndClear();
+    mpHeaderMarginPresetLB.disposeAndClear();
+    mpCustomEntry.clear();
 
     PanelLayout::dispose();
 }
 
 void PageHeaderPanel::Initialize()
 {
+    aCustomEntry = mpCustomEntry->GetText();
     mpHeaderToggle->SetClickHdl( LINK(this, PageHeaderPanel, HeaderToggleHdl) );
+    mpHeaderMarginPresetLB->SetSelectHdl( LINK(this, PageHeaderPanel, HeaderLRMarginHdl));
+    mpHeaderSpacingLB->SetSelectHdl( LINK(this, PageHeaderPanel, HeaderSpacingHdl));
+    mpHeaderLayoutLB->SetSelectHdl( LINK(this, PageHeaderPanel, HeaderLayoutHdl));
+
+    mpBindings->Invalidate(SID_ATTR_PAGE_HEADER);
+    mpBindings->Invalidate(SID_ATTR_PAGE_HEADER_LRMARGIN);
+    mpBindings->Invalidate(SID_ATTR_PAGE_HEADER_SPACING);
+    mpBindings->Invalidate(SID_ATTR_PAGE_HEADER_LAYOUT);
 }
 
-void PageHeaderPanel::UpdateControls()
+void PageHeaderPanel::UpdateHeaderCheck()
 {
-    bool bIsEnabled = (bool)mpHeaderToggle->IsChecked();
-    if(bIsEnabled)
+    if(mpHeaderToggle->IsChecked())
     {
-        mpHeaderHeightField->Enable();
-        mpHeaderLMargin->Enable();
-        mpHeaderRMargin->Enable();
-        mpHeaderSpacing->Enable();
-        mpSameContentLB->Enable();
+        mpHeaderSpacingLB->Enable();
+        mpHeaderLayoutLB->Enable();
+        mpHeaderMarginPresetLB->Enable();
     }
     else
     {
-        mpHeaderHeightField->Disable();
-        mpHeaderLMargin->Disable();
-        mpHeaderRMargin->Disable();
-        mpHeaderSpacing->Disable();
-        mpSameContentLB->Disable();
+        mpHeaderSpacingLB->Disable();
+        mpHeaderLayoutLB->Disable();
+        mpHeaderMarginPresetLB->Disable();
     }
 }
 
+void PageHeaderPanel::UpdateMarginControl()
+{
+    sal_uInt16 nLeft = mpHeaderLRMarginItem->GetLeft();
+    sal_uInt16 nRight = mpHeaderLRMarginItem->GetRight();
+    sal_uInt16 nCount = mpHeaderMarginPresetLB->GetEntryCount();
+    if(nLeft == nRight)
+    {
+        for(sal_uInt16 i = 0; i < nCount; i++)
+        {
+            if(reinterpret_cast<sal_uLong>(mpHeaderMarginPresetLB->GetEntryData(i)) == nLeft )
+            {
+                mpHeaderMarginPresetLB->SelectEntryPos(i);
+                mpHeaderMarginPresetLB->RemoveEntry(aCustomEntry);
+                return;
+            }
+        }
+    }
+    mpHeaderMarginPresetLB->InsertEntry(aCustomEntry);
+    mpHeaderMarginPresetLB->SelectEntry(aCustomEntry);
+}
+
+void PageHeaderPanel::UpdateSpacingControl()
+{
+    sal_uInt16 nBottom = mpHeaderSpacingItem->GetLower();
+    sal_uInt16 nCount = mpHeaderSpacingLB->GetEntryCount();
+    for(sal_uInt16 i = 0; i < nCount; i++)
+    {
+        if(reinterpret_cast<sal_uLong>(mpHeaderSpacingLB->GetEntryData(i)) == nBottom )
+        {
+            mpHeaderSpacingLB->SelectEntryPos(i);
+            mpHeaderSpacingLB->RemoveEntry(aCustomEntry);
+            return;
+        }
+    }
+    mpHeaderSpacingLB->InsertEntry(aCustomEntry);
+    mpHeaderSpacingLB->SelectEntry(aCustomEntry);
+}
+
+void PageHeaderPanel::UpdateLayoutControl()
+{
+    sal_uInt16 nLayout = mpHeaderLayoutItem->GetValue();
+    mpHeaderLayoutLB->SelectEntryPos( nLayout );
+}
+
 void PageHeaderPanel::NotifyItemUpdate(
-    const sal_uInt16 /*nSid*/,
-    const SfxItemState /*eState*/,
-    const SfxPoolItem* /*pState*/,
-    const bool /*bIsEnabled*/)
+    const sal_uInt16 nSid,
+    const SfxItemState eState,
+    const SfxPoolItem* pState,
+    const bool bIsEnabled)
 {
+    (void)bIsEnabled;
+
+    if (IsDisposed())
+        return;
+
+    switch(nSid)
+    {
+        case SID_ATTR_PAGE_HEADER:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SfxBoolItem*>( pState) !=  nullptr )
+            {
+                mpHeaderItem.reset( static_cast<SfxBoolItem*>(pState->Clone()) );
+                mpHeaderToggle->Check(mpHeaderItem->GetValue());
+                UpdateHeaderCheck();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_HEADER_LRMARGIN:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SvxLongLRSpaceItem*>( pState) !=  nullptr )
+            {
+                mpHeaderLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
+                UpdateMarginControl();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_HEADER_SPACING:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SvxLongULSpaceItem*>( pState) !=  nullptr )
+            {
+                mpHeaderSpacingItem.reset(static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
+                UpdateSpacingControl();
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_HEADER_LAYOUT:
+        {
+            if(eState >= SfxItemState::DEFAULT &&
+                pState && dynamic_cast<const SfxInt16Item*>( pState) !=  nullptr )
+            {
+                mpHeaderLayoutItem.reset(static_cast<SfxInt16Item*>(pState->Clone()) );
+                UpdateLayoutControl();
+            }
+        }
+        break;
+        default:
+            break;
+    }
 }
 
 IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderToggleHdl, Button*, void )
 {
     bool IsChecked = mpHeaderToggle->IsChecked();
-    SfxBoolItem aItem(SID_ATTR_PAGE_ON, IsChecked);
-    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADERSET, SfxCallMode::RECORD, { &aItem } );
-    UpdateControls();
+    mpHeaderItem->SetValue(IsChecked);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADER, SfxCallMode::RECORD, { mpHeaderItem.get() } );
+    UpdateHeaderCheck();
 }
 
+IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderLRMarginHdl, ListBox&, void )
+{
+    sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(mpHeaderMarginPresetLB->GetSelectEntryData());
+    mpHeaderLRMarginItem->SetLeft(nVal);
+    mpHeaderLRMarginItem->SetRight(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADER_LRMARGIN,
+                                                 SfxCallMode::RECORD, { mpHeaderLRMarginItem.get() } );
+}
+
+IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderSpacingHdl, ListBox&, void )
+{
+    sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(mpHeaderSpacingLB->GetSelectEntryData());
+    mpHeaderSpacingItem->SetLower(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADER_SPACING,
+                                                 SfxCallMode::RECORD, { mpHeaderSpacingItem.get() } );
+
+}
+IMPL_LINK_NOARG_TYPED( PageHeaderPanel, HeaderLayoutHdl, ListBox&, void )
+{
+    sal_uInt16 nVal = mpHeaderLayoutLB->GetSelectEntryPos();
+    mpHeaderLayoutItem->SetValue(nVal);
+    GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_HEADER_LAYOUT,
+                                                 SfxCallMode::RECORD, { mpHeaderLayoutItem.get() } );
+}
 
 
 } }
diff --git a/sw/source/uibase/sidebar/PageHeaderPanel.hxx b/sw/source/uibase/sidebar/PageHeaderPanel.hxx
index ae1b525..54b94e2 100644
--- a/sw/source/uibase/sidebar/PageHeaderPanel.hxx
+++ b/sw/source/uibase/sidebar/PageHeaderPanel.hxx
@@ -42,7 +42,7 @@
 #include <svl/intitem.hxx>
 #include <tools/fldunit.hxx>
 #include <svl/poolitem.hxx>
-#include <svx/rulritem.hxx>
+#include <svl/eitem.hxx>
 
 namespace sw { namespace sidebar {
 
@@ -74,18 +74,33 @@ private:
 
     SfxBindings* mpBindings;
 
-    VclPtr<CheckBox> mpHeaderToggle;
-    VclPtr<MetricField> mpHeaderHeightField;
-    VclPtr<MetricField> mpHeaderLMargin;
-    VclPtr<MetricField> mpHeaderRMargin;
-    VclPtr<MetricField> mpHeaderSpacing;
-    VclPtr<ListBox> mpSameContentLB;
+    ::sfx2::sidebar::ControllerItem maHFToggleController;
+    ::sfx2::sidebar::ControllerItem maHeaderLRMarginController;
+    ::sfx2::sidebar::ControllerItem maHeaderSpacingController;
+    ::sfx2::sidebar::ControllerItem maHeaderLayoutController;
+
+    VclPtr<CheckBox>    mpHeaderToggle;
+    VclPtr<ListBox>     mpHeaderSpacingLB;
+    VclPtr<ListBox>     mpHeaderLayoutLB;
+    VclPtr<ListBox>     mpHeaderMarginPresetLB;
+    VclPtr<FixedText>   mpCustomEntry;
+    OUString aCustomEntry;
 
     void Initialize();
-    void UpdateControls();
+    void UpdateHeaderCheck();
+    void UpdateMarginControl();
+    void UpdateSpacingControl();
+    void UpdateLayoutControl();
 
-    DECL_LINK_TYPED( HeaderToggleHdl, Button*, void );
+    ::std::unique_ptr<SfxBoolItem>        mpHeaderItem;
+    ::std::unique_ptr<SvxLongLRSpaceItem> mpHeaderLRMarginItem;
+    ::std::unique_ptr<SvxLongULSpaceItem> mpHeaderSpacingItem;
+    ::std::unique_ptr<SfxInt16Item>       mpHeaderLayoutItem;
 
+    DECL_LINK_TYPED( HeaderToggleHdl, Button*, void );
+    DECL_LINK_TYPED( HeaderLRMarginHdl, ListBox&, void);
+    DECL_LINK_TYPED( HeaderSpacingHdl, ListBox&, void);
+    DECL_LINK_TYPED( HeaderLayoutHdl, ListBox&, void);
 };
 
 } } //end of namespace sw::sidebar
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index 7f28f93..913a170 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -162,7 +162,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
     }
     else if(rsResourceURL.endsWith("/PageFooterPanel"))
     {
-        VclPtr<vcl::Window> pPanel = sw::sidebar::PageFooterPanel::Create( pParentWindow, xFrame );
+        VclPtr<vcl::Window> pPanel = sw::sidebar::PageFooterPanel::Create( pParentWindow, xFrame, pBindings );
         xElement = sfx2::sidebar::SidebarPanelBase::Create(
             rsResourceURL,
             xFrame,
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index f5df065..e4e7964 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -21,6 +21,8 @@
 #include "uitool.hxx"
 #include <sfx2/app.hxx>
 #include <svx/rulritem.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xfillit0.hxx>
 #include <editeng/tstpitem.hxx>
 #include <sfx2/request.hxx>
 #include <editeng/lrspitem.hxx>
@@ -56,6 +58,8 @@
 
 #include <IDocumentSettingAccess.hxx>
 
+#include <svx/xtable.hxx>
+
 using namespace ::com::sun::star;
 
 // Pack columns
@@ -975,6 +979,113 @@ void SwView::ExecTabWin( SfxRequest& rReq )
         }
         break;
 
+    case SID_ATTR_PAGE_HEADER:
+    {
+        if ( pReqArgs )
+        {
+            const bool bHeaderOn =  static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER)).GetValue();
+            SwPageDesc aDesc(rDesc);
+            SwFrameFormat &rMaster = aDesc.GetMaster();
+            rMaster.SetFormatAttr( SwFormatHeader( bHeaderOn ));
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_HEADER_LRMARGIN:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive() )
+        {
+            const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LRMARGIN));
+            SvxLRSpaceItem aLR(RES_LR_SPACE);
+            SwPageDesc aDesc(rDesc);
+            aLR.SetLeft(aLongLR.GetLeft());
+            aLR.SetRight(aLongLR.GetRight());
+            SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
+            pFormat->SetFormatAttr( aLR );
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_HEADER_SPACING:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
+        {
+            const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_SPACING));
+            SwPageDesc aDesc(rDesc);
+            SvxULSpaceItem aUL(0, aLongUL.GetLower(), RES_UL_SPACE );
+            SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetHeader().GetHeaderFormat());
+            pFormat->SetFormatAttr( aUL );
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_HEADER_LAYOUT:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetHeader().IsActive())
+        {
+            const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_HEADER_LAYOUT));
+            sal_uInt16 nLayout = aLayoutItem.GetValue();
+            SwPageDesc aDesc(rDesc);
+            aDesc.ChgHeaderShare((nLayout>>1) == 1);
+            aDesc.ChgFirstShare((nLayout % 2) == 1); // FIXME control changes for both header footer - tdf#100287
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_FOOTER:
+    {
+        if ( pReqArgs )
+        {
+            const bool bFooterOn =  static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER)).GetValue();
+            SwPageDesc aDesc(rDesc);
+            SwFrameFormat &rMaster = aDesc.GetMaster();
+            rMaster.SetFormatAttr( SwFormatFooter( bFooterOn ));
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_FOOTER_LRMARGIN:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive() )
+        {
+            const SvxLongLRSpaceItem& aLongLR = static_cast<const SvxLongLRSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LRMARGIN));
+            SvxLRSpaceItem aLR(RES_LR_SPACE);
+            SwPageDesc aDesc(rDesc);
+            aLR.SetLeft(aLongLR.GetLeft());
+            aLR.SetRight(aLongLR.GetRight());
+            SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
+            pFormat->SetFormatAttr( aLR );
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_FOOTER_SPACING:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
+        {
+            const SvxLongULSpaceItem& aLongUL = static_cast<const SvxLongULSpaceItem&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_SPACING));
+            SwPageDesc aDesc(rDesc);
+            SvxULSpaceItem aUL(aLongUL.GetUpper(), 0, RES_UL_SPACE );
+            SwFrameFormat* pFormat = const_cast<SwFrameFormat*>(aDesc.GetMaster().GetFooter().GetFooterFormat());
+            pFormat->SetFormatAttr( aUL );
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+    case SID_ATTR_PAGE_FOOTER_LAYOUT:
+    {
+        if ( pReqArgs && rDesc.GetMaster().GetFooter().IsActive())
+        {
+            const SfxInt16Item& aLayoutItem = static_cast<const SfxInt16Item&>(pReqArgs->Get(SID_ATTR_PAGE_FOOTER_LAYOUT));
+            sal_uInt16 nLayout = aLayoutItem.GetValue();
+            SwPageDesc aDesc(rDesc);
+            aDesc.ChgFooterShare((nLayout>>1) == 1);
+            aDesc.ChgFirstShare((nLayout % 2) == 1); // FIXME control changes for both header footer - tdf#100287
+            rSh.ChgPageDesc(rSh.GetCurPageDesc(), aDesc);
+        }
+    }
+    break;
+
     default:
         OSL_ENSURE( false, "wrong SlotId");
     }
@@ -1076,6 +1187,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
             {
                 nColumnType = 3;
             }
+            else
+                nColumnType = nCols;
 
             rSet.Put( SfxInt16Item( SID_ATTR_PAGE_COLUMN, nColumnType ) );
         }
@@ -2037,6 +2150,58 @@ void SwView::StateTabWin(SfxItemSet& rSet)
             }
         }
         break;
+        case SID_ATTR_PAGE_HEADER:
+        case SID_ATTR_PAGE_HEADER_LRMARGIN:
+        case SID_ATTR_PAGE_HEADER_SPACING:
+        case SID_ATTR_PAGE_HEADER_LAYOUT:
+        {
+            const SwFormatHeader& rHeader = rDesc.GetMaster().GetHeader();
+            bool bHeaderOn = rHeader.IsActive();
+            rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
+            if(bHeaderOn)
+            {
+                const SvxLRSpaceItem* rLR = static_cast<const SvxLRSpaceItem*>(
+                                            rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
+                const SvxULSpaceItem* rUL = static_cast<const SvxULSpaceItem*>(
+                                            rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
+                SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_HEADER_LRMARGIN);
+                rSet.Put(aLR);
+                SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_HEADER_SPACING);
+                rSet.Put(aUL);
+
+                bool rShared = rDesc.IsHeaderShared();
+                bool rFirst = rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
+                sal_uInt16 nLayout = ((int)rShared<<1) + (int)rFirst;
+                SfxInt16Item aLayoutItem(SID_ATTR_PAGE_HEADER_LAYOUT, nLayout);
+                rSet.Put(aLayoutItem);
+            }
+        }
+        break;
+        case SID_ATTR_PAGE_FOOTER:
+        case SID_ATTR_PAGE_FOOTER_LRMARGIN:
+        case SID_ATTR_PAGE_FOOTER_SPACING:
+        case SID_ATTR_PAGE_FOOTER_LAYOUT:
+        {
+            const SwFormatFooter& rFooter = rDesc.GetMaster().GetFooter();
+            bool bFooterOn = rFooter.IsActive();
+            rSet.Put( SfxBoolItem(SID_ATTR_PAGE_FOOTER, bFooterOn ) );
+            if(bFooterOn)
+            {
+                const SvxLRSpaceItem* rLR = static_cast<const SvxLRSpaceItem*>(rFooter.GetFooterFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
+                const SvxULSpaceItem* rUL = static_cast<const SvxULSpaceItem*>(rFooter.GetFooterFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
+                SvxLongLRSpaceItem aLR(rLR->GetLeft(), rLR->GetRight(), SID_ATTR_PAGE_FOOTER_LRMARGIN);
+                rSet.Put(aLR);
+                SvxLongULSpaceItem aUL( rUL->GetUpper(), rUL->GetLower(), SID_ATTR_PAGE_FOOTER_SPACING);
+                rSet.Put(aUL);
+
+                bool rShared = rDesc.IsFooterShared();
+                bool rFirst = rDesc.IsFirstShared(); // FIXME control changes for both header footer - tdf#100287
+                sal_uInt16 nLayout = ((int)rShared<<1) + (int)rFirst;
+                SfxInt16Item aLayoutItem(SID_ATTR_PAGE_FOOTER_LAYOUT, nLayout);
+                rSet.Put(aLayoutItem);
+            }
+        }
+        break;
         }
         nWhich = aIter.NextWhich();
     }
diff --git a/sw/uiconfig/swriter/ui/pagefooterpanel.ui b/sw/uiconfig/swriter/ui/pagefooterpanel.ui
index 401b2cd..2f47df4 100644
--- a/sw/uiconfig/swriter/ui/pagefooterpanel.ui
+++ b/sw/uiconfig/swriter/ui/pagefooterpanel.ui
@@ -1,7 +1,49 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
+  <object class="GtkListStore" id="spacinglist">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name gint1 -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">None</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Extra Small (0.16cm)</col>
+        <col id="1">91</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Small (0.32cm)</col>
+        <col id="1">181</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Small Medium (0.64cm)</col>
+        <col id="1">363</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Medium (0.95cm)</col>
+        <col id="1">539</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Medium Large (1.27cm)</col>
+        <col id="1">720</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Large (1.9cm)</col>
+        <col id="1">1077</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Extra Large (2.54cm)</col>
+        <col id="1">1440</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkGrid" id="PageFooterPanel">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -11,6 +53,7 @@
         <property name="can_focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
+        <property name="border_width">6</property>
         <property name="row_spacing">6</property>
         <property name="column_spacing">6</property>
         <child>
@@ -19,7 +62,7 @@
             <property name="can_focus">False</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkCheckButton" id="headertoggle">
+              <object class="GtkCheckButton" id="footertoggle">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -33,10 +76,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="height">
+              <object class="GtkLabel" id="samecontent">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Height:</property>
+                <property name="label" translatable="yes">Same Content:</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -48,17 +91,8 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSpinButton" id="heightspinfield">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <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>
         <child>
@@ -70,94 +104,93 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box2">
+          <object class="GtkLabel" id="spacing">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkSpinButton" id="leftmargin">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="rightmargin">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="label" translatable="yes">Spacing:</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
+            <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="GtkLabel" id="spacing">
+          <object class="GtkComboBox" id="spacingpreset">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Spacing:</property>
+            <property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="model">spacinglist</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
+            <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>
-          <object class="GtkLabel" id="samecontent">
+          <object class="GtkComboBoxText" id="samecontentLB">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Same Content:</property>
+            <property name="hexpand">True</property>
+            <items>
+              <item translatable="yes">First & Left/Right</item>
+              <item translatable="yes">Left/Right</item>
+              <item translatable="yes">First Page</item>
+              <item translatable="yes">All Pages</item>
+            </items>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">3</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="spacingspinfield">
+          <object class="GtkComboBox" id="footermarginpreset">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
+            <property name="can_focus">False</property>
+            <property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="model">spacinglist</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkComboBoxText" id="samecontentLB">
-            <property name="visible">True</property>
+          <object class="GtkLabel" id="customlabel">
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <items>
-              <item translatable="yes">Left/Right</item>
-              <item translatable="yes">First Page</item>
-              <item translatable="yes">All Pages</item>
-            </items>
+            <property name="label" translatable="yes">Custom</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>
+          <placeholder/>
+        </child>
       </object>
       <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>
   </object>
diff --git a/sw/uiconfig/swriter/ui/pageheaderpanel.ui b/sw/uiconfig/swriter/ui/pageheaderpanel.ui
index 546f2f6..25f1c07 100644
--- a/sw/uiconfig/swriter/ui/pageheaderpanel.ui
+++ b/sw/uiconfig/swriter/ui/pageheaderpanel.ui
@@ -1,7 +1,49 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
+  <object class="GtkListStore" id="spacinglist">
+    <columns>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name gint1 -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">None</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Extra Small (0.16cm)</col>
+        <col id="1">91</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Small (0.32cm)</col>
+        <col id="1">181</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Small Medium (0.64cm)</col>
+        <col id="1">363</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Medium (0.95cm)</col>
+        <col id="1">539</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Medium Large (1.27cm)</col>
+        <col id="1">720</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Large (1.9cm)</col>
+        <col id="1">1077</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Extra Large (2.54cm)</col>
+        <col id="1">1440</col>
+      </row>
+    </data>
+  </object>
   <object class="GtkGrid" id="PageHeaderPanel">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -11,6 +53,7 @@
         <property name="can_focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
+        <property name="border_width">6</property>
         <property name="row_spacing">6</property>
         <property name="column_spacing">6</property>
         <child>
@@ -33,10 +76,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="height">
+              <object class="GtkLabel" id="samecontent">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Height:</property>
+                <property name="label" translatable="yes">Same Content:</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -48,17 +91,8 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkSpinButton" id="heightspinfield">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <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>
         <child>
@@ -70,94 +104,93 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box2">
+          <object class="GtkLabel" id="spacing">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkSpinButton" id="leftmargin">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkSpinButton" id="rightmargin">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
+            <property name="label" translatable="yes">Spacing:</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
-            <property name="top_attach">1</property>
+            <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="GtkLabel" id="spacing">
+          <object class="GtkComboBox" id="spacingpreset">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Spacing:</property>
+            <property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="model">spacinglist</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
+            <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>
-          <object class="GtkLabel" id="samecontent">
+          <object class="GtkComboBoxText" id="samecontentLB">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Same Content:</property>
+            <property name="hexpand">True</property>
+            <items>
+              <item translatable="yes">First & Left/Right</item>
+              <item translatable="yes">Left/Right</item>
+              <item translatable="yes">First Page</item>
+              <item translatable="yes">All Pages</item>
+            </items>
           </object>
           <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">3</property>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="spacingspinfield">
+          <object class="GtkComboBox" id="headermarginpreset">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
+            <property name="can_focus">False</property>
+            <property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property>
+            <property name="model">spacinglist</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">2</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
           </packing>
         </child>
         <child>
-          <object class="GtkComboBoxText" id="samecontentLB">
-            <property name="visible">True</property>
+          <object class="GtkLabel" id="customlabel">
             <property name="can_focus">False</property>
-            <property name="hexpand">True</property>
-            <items>
-              <item translatable="yes">Left/Right</item>
-              <item translatable="yes">First Page</item>
-              <item translatable="yes">All Pages</item>
-            </items>
+            <property name="label" translatable="yes">Custom</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>
+          <placeholder/>
+        </child>
       </object>
       <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>
   </object>


More information about the Libreoffice-commits mailing list