summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/sidebar/PageFooterPanel.cxx201
-rw-r--r--sw/source/uibase/sidebar/PageFooterPanel.hxx41
-rw-r--r--sw/source/uibase/sidebar/PageHeaderPanel.cxx192
-rw-r--r--sw/source/uibase/sidebar/PageHeaderPanel.hxx33
-rw-r--r--sw/source/uibase/sidebar/SwPanelFactory.cxx2
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx165
6 files changed, 581 insertions, 53 deletions
diff --git a/sw/source/uibase/sidebar/PageFooterPanel.cxx b/sw/source/uibase/sidebar/PageFooterPanel.cxx
index f204c827f037..68fb1e8ed731 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 0fbb20a3abb1..67385256c22d 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 65c07661e1d1..ae84c2e3b78a 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 ae1b525d850a..54b94e23d771 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 7f28f93bad2c..913a17086092 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 f5df065a1ffe..e4e7964c9660 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();
}