25#include <svx/svxids.hrc>
35#include <osl/diagnose.h>
65 SID_ATTR_BRUSH, SID_ATTR_BRUSH,
66 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
67 SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
68 SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
69 SID_ATTR_LRSPACE, SID_ATTR_LRSPACE,
70 SID_ATTR_ULSPACE, SID_ATTR_ULSPACE,
71 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
72 SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
73 SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
74 SID_ATTR_PAGE_ON, SID_ATTR_PAGE_ON,
75 SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
76 SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
77 SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
78 SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST
88 if ( pDlg->Execute() ==
RET_OK && pDlg->GetOutputItemSet() )
95 pBBSet->
Put( *pItem );
105 return std::make_unique<SvxHeaderPage>( pPage, pController, *
rSet );
110 return std::make_unique<SvxFooterPage>( pPage, pController, *
rSet );
114 :
SvxHFPage( pPage, pController, rAttr, SID_ATTR_PAGE_HEADERSET )
119 :
SvxHFPage( pPage, pController, rAttr, SID_ATTR_PAGE_FOOTERSET )
124 :
SfxTabPage(pPage, pController,
"svx/ui/headfootformatpage.ui",
"HFFormatPage", &
rSet)
126 , mbDisableQueryBox(false)
127 , mbEnableDrawingLayerFillStyles(false)
128 , m_xCntSharedBox(m_xBuilder->weld_check_button(
"checkSameLR"))
129 , m_xCntSharedFirstBox(m_xBuilder->weld_check_button(
"checkSameFP"))
130 , m_xLMLbl(m_xBuilder->weld_label(
"labelLeftMarg"))
131 , m_xLMEdit(m_xBuilder->weld_metric_spin_button(
"spinMargLeft",
FieldUnit::
CM))
132 , m_xRMLbl(m_xBuilder->weld_label(
"labelRightMarg"))
133 , m_xRMEdit(m_xBuilder->weld_metric_spin_button(
"spinMargRight",
FieldUnit::
CM))
134 , m_xDistFT(m_xBuilder->weld_label(
"labelSpacing"))
135 , m_xDistEdit(m_xBuilder->weld_metric_spin_button(
"spinSpacing",
FieldUnit::
CM))
136 , m_xDynSpacingCB(m_xBuilder->weld_check_button(
"checkDynSpacing"))
137 , m_xHeightFT(m_xBuilder->weld_label(
"labelHeight"))
138 , m_xHeightEdit(m_xBuilder->weld_metric_spin_button(
"spinHeight",
FieldUnit::
CM))
139 , m_xHeightDynBtn(m_xBuilder->weld_check_button(
"checkAutofit"))
140 , m_xBackgroundBtn(m_xBuilder->weld_button(
"buttonMore"))
141 , m_xBspWin(new
weld::CustomWeld(*m_xBuilder,
"drawingareaPageHF", m_aBspWin))
144 if (
nId == SID_ATTR_PAGE_FOOTERSET)
146 m_xContainer->set_help_id(
"svx/ui/headfootformatpage/FFormatPage");
147 m_xPageLbl = m_xBuilder->weld_label(
"labelFooterFormat");
148 m_xTurnOnBox = m_xBuilder->weld_check_button(
"checkFooterOn");
155 m_xLMEdit->set_help_id(
"SVX_HID_FOOTER_SPINMARGLEFT" );
156 m_xRMEdit->set_help_id(
"SVX_HID_FOOTER_SPINMARGRIGHT" );
157 m_xDistEdit->set_help_id(
"SVX_HID_FOOTER_SPINSPACING" );
165 m_xContainer->set_help_id(
"svx/ui/headfootformatpage/HFormatPage");
166 m_xPageLbl = m_xBuilder->weld_label(
"labelHeaderFormat");
167 m_xTurnOnBox = m_xBuilder->weld_check_button(
"checkHeaderOn");
192 const sal_uInt16 nWSize =
GetWhich(SID_ATTR_PAGE_SIZE);
193 const sal_uInt16 nWLRSpace =
GetWhich(SID_ATTR_LRSPACE);
194 const sal_uInt16 nWULSpace =
GetWhich(SID_ATTR_ULSPACE);
195 const sal_uInt16 nWOn =
GetWhich(SID_ATTR_PAGE_ON);
196 const sal_uInt16 nWDynamic =
GetWhich(SID_ATTR_PAGE_DYNAMIC);
197 const sal_uInt16 nWDynSpacing =
GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING);
198 const sal_uInt16 nWShared =
GetWhich(SID_ATTR_PAGE_SHARED);
199 const sal_uInt16 nWSharedFirst =
GetWhich( SID_ATTR_PAGE_SHARED_FIRST );
200 const sal_uInt16 nWBrush =
GetWhich(SID_ATTR_BRUSH);
201 const sal_uInt16 nWBox =
GetWhich(SID_ATTR_BORDER_OUTER);
202 const sal_uInt16 nWBoxInfo =
GetWhich(SID_ATTR_BORDER_INNER);
203 const sal_uInt16 nWShadow =
GetWhich(SID_ATTR_BORDER_SHADOW);
218 aSet.
MergeRange(nWSharedFirst, nWSharedFirst);
242 aSet.
Put(std::move(pBoolItem));
254 aSet.
Put( aSizeItem );
263 if (
nId == SID_ATTR_PAGE_HEADERSET )
264 aUL.
SetLower(
static_cast<sal_uInt16
>(nDist) );
266 aUL.
SetUpper(
static_cast<sal_uInt16
>(nDist) );
284 aSet.
Put(_pSet->
Get(nWBrush));
289 aSet.
Put(_pSet->
Get(nWBoxInfo));
294 aSet.
Put(_pSet->
Get(nWBox));
299 aSet.
Put(_pSet->
Get(nWShadow));
305 if(_pSet->
GetItemState(nFillStyleId) == SfxItemState::SET)
307 aSet.
Put(_pSet->
Get(nFillStyleId));
334 reinterpret_cast<const SfxPoolItem**
>(&pSetItem) ) )
345 rHeaderSet.
Get(
GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
347 rHeaderSet.
Get(
GetWhich( SID_ATTR_PAGE_SHARED ) );
350 pSharedFirst =
static_cast<const SfxBoolItem*
>(&rHeaderSet.
Get(
GetWhich( SID_ATTR_PAGE_SHARED_FIRST ) ));
365 if (
nId == SID_ATTR_PAGE_HEADERSET )
388 bool bIsCalc =
false;
423 nullptr != (pItem = pShell->
GetItem(SID_HTML_MODE))))
425 sal_uInt16 nHtmlMode = pItem->
GetValue();
479 if (
nId == SID_ATTR_PAGE_HEADERSET)
482 nResult = aDlg.
run();
487 nResult = aDlg.
run();
526 const sal_uInt16 nOuter(
GetWhich(SID_ATTR_BORDER_OUTER));
527 const sal_uInt16 nInner(
GetWhich(SID_ATTR_BORDER_INNER,
false));
528 const sal_uInt16 nShadow(
GetWhich(SID_ATTR_BORDER_SHADOW));
530 if(mbEnableDrawingLayerFillStyles)
534 SID_COLOR_TABLE, SID_PATTERN_LIST>
537 pBBSet->MergeRange(nOuter, nOuter);
538 pBBSet->MergeRange(nInner, nInner);
539 pBBSet->MergeRange(nShadow, nShadow);
543 static const sal_uInt16 nCopyFlags[] = {
552 for(sal_uInt16
a(0); nCopyFlags[
a];
a++)
562 OSL_ENSURE(
false,
"XPropertyList missing (!)");
568 const sal_uInt16 nBrush(
GetWhich(SID_ATTR_BRUSH));
573 pBBSet->MergeRange(nBrush, nBrush);
574 pBBSet->MergeRange(nOuter, nOuter);
575 pBBSet->MergeRange(nInner, nInner);
576 pBBSet->MergeRange(nShadow, nShadow);
589 if(mbEnableDrawingLayerFillStyles)
599 if(SfxItemState::SET ==
GetItemSet().GetItemState(nInner,
false, &pItem))
611 mbEnableDrawingLayerFillStyles));
613 pDlg->StartExecuteAsync([pDlg,
this](sal_Int32 nResult) {
614 if (nResult ==
RET_OK && pDlg->GetOutputItemSet())
616 SfxItemIter aIter(*pDlg->GetOutputItemSet());
618 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
620 if(!IsInvalidItem(pItem))
627 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
629 if (mbEnableDrawingLayerFillStyles)
633 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(*pBBSet);
637 const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);
639 if (pBBSet->GetItemState(nWhich) == SfxItemState::SET)
642 const SvxBrushItem& rItem
643 = static_cast<const SvxBrushItem&>(pBBSet->Get(nWhich));
644 SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*pBBSet->GetPool());
646 setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
648 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
652 if (SID_ATTR_PAGE_HEADERSET ==
nId)
655 m_aBspWin.setHeaderFillAttributes(aFillAttributes);
660 m_aBspWin.setFooterFillAttributes(aFillAttributes);
672 if (
nId == SID_ATTR_PAGE_HEADERSET )
693 sal_uInt16 nWhich(
GetWhich(SID_ATTR_PAGE_HEADERSET));
708 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
721 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
729 nWhich =
GetWhich(SID_ATTR_PAGE_FOOTERSET);
744 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
757 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
770 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(
rSet);
783 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
828 nUsage =
static_cast<const SvxPageItem*
>(pItem)->GetPageUsage();
854 reinterpret_cast<const SfxPoolItem**
>(&pSetItem) ) )
884 if ( SID_ATTR_PAGE_HEADERSET ==
nId )
894 reinterpret_cast<const SfxPoolItem**
>(&pSetItem) ) )
924 if ( SID_ATTR_PAGE_FOOTERSET ==
nId )
933 if (
auto pBoolItem =
dynamic_cast<const SfxBoolItem*
>( pItem) )
941 if (
auto pBoolItem =
dynamic_cast<const SfxBoolItem*
>( pItem) )
954 return DeactivateRC::LeavePage;
979 if (
nId == SID_ATTR_PAGE_HEADERSET )
1000 if (
nId == SID_ATTR_PAGE_HEADERSET )
1003 nMin = ( nH - nBB - nBT ) / 5;
1004 nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1007 nMin = ( nH - nBB - nBT ) / 5;
1008 nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1015 nMin = ( nH - nBT - nBB ) / 5;
1016 nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1019 nMin = ( nH - nBT - nBB ) / 5;
1020 nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1026 nMax = nW - nBL - nBR -
1030 nMax = nW - nBL - nBR -
1044 if (pSupportDrawingLayerFillStyleItem)
1046 const bool bNew(pSupportDrawingLayerFillStyleItem->
GetValue());
sal_uInt16 GetValue() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
static bool IsWhich(sal_uInt16 nId)
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxItemSet & GetItemSet() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const SfxItemSet & GetItemSet() const
void SetExchangeSupport()
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
weld::Window * GetFrameWeld() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
constexpr tools::Long Height() const
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
virtual VclPtr< SfxAbstractTabDialog > CreateSvxBorderBackgroundDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, bool bEnableDrawingLayerFillStyles)=0
static SvxAbstractDialogFactory * Create()
virtual void Reset(const SfxItemSet *rSet) override
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::Label > m_xDistFT
std::unique_ptr< weld::Label > m_xPageLbl
std::unique_ptr< weld::MetricSpinButton > m_xDistEdit
std::unique_ptr< weld::CheckButton > m_xCntSharedBox
void EnableDynamicSpacing()
std::unique_ptr< weld::CheckButton > m_xTurnOnBox
static const WhichRangesContainer pRanges
SVX_DLLPRIVATE void ResetBackground_Impl(const SfxItemSet &rSet)
SvxHFPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet, sal_uInt16 nSetId)
std::unique_ptr< weld::MetricSpinButton > m_xRMEdit
std::unique_ptr< weld::Label > m_xHeightFT
std::unique_ptr< weld::MetricSpinButton > m_xLMEdit
bool mbEnableDrawingLayerFillStyles
virtual void PageCreated(const SfxAllItemSet &) override
std::unique_ptr< weld::CheckButton > m_xDynSpacingCB
std::unique_ptr< weld::Button > m_xBackgroundBtn
std::unique_ptr< weld::CheckButton > m_xHeightDynBtn
std::unique_ptr< weld::Label > m_xRMLbl
virtual bool FillItemSet(SfxItemSet *rOutSet) override
std::unique_ptr< weld::MetricSpinButton > m_xHeightEdit
std::unique_ptr< SfxItemSet > pBBSet
virtual ~SvxHFPage() override
void TurnOn(const weld::Toggleable *pButton)
std::unique_ptr< weld::CheckButton > m_xCntSharedFirstBox
std::unique_ptr< weld::Label > m_xLMLbl
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
void SetUsage(SvxPageUsage eU)
void SetBottom(tools::Long nNew)
tools::Long GetFtDist() const
void SetHdLeft(tools::Long nNew)
const Size & GetSize() const
tools::Long GetBottom() const
void SetHdHeight(tools::Long nNew)
tools::Long GetTop() const
SvxPageUsage GetUsage() const
void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
void SetFtDist(tools::Long nNew)
void SetSize(const Size &rSize)
void SetLeft(tools::Long nNew)
void SetHdDist(tools::Long nNew)
void SetFtLeft(tools::Long nNew)
void SetFtRight(tools::Long nNew)
void SetHdRight(tools::Long nNew)
void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
tools::Long GetRight() const
void SetFooter(bool bNew)
tools::Long GetLeft() const
tools::Long GetHdHeight() const
void SetFtHeight(tools::Long nNew)
tools::Long GetHdDist() const
void SetHeader(bool bNew)
tools::Long GetFtHeight() const
void SetTop(tools::Long nNew)
void SetRight(tools::Long nNew)
const Size & GetSize() const
void SetSize(const Size &rSize)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetUpper() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetLower() const
#define DBG_ASSERT(sCon, aError)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
static bool GetWhich(const SfxItemSet &rSet, sal_uInt16 nSlot, sal_uInt16 &rWhich)
IMPL_LINK(SvxHFPage, TurnOnHdl, weld::Toggleable &, rBox, void)
IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, weld::Button &, void)
const tools::Long DEF_DIST_WRITER
const tools::Long DEF_DIST_CALC
constexpr tools::Long MINBODY
#define LINK(Instance, Class, Member)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
constexpr auto toTwips(N number, Length from)
static constexpr auto Items
bool ShowBorderBackgroundDlg(weld::Window *pParent, SfxItemSet *pBBSet)
Reference< XNameAccess > m_xContainer
bool IsInvalidItem(const SfxPoolItem *pItem)
SVT_DLLPUBLIC sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton &rCtrl, FieldUnit eUnit, bool bAll=false)
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)