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 ) ));
363 if (
nId == SID_ATTR_PAGE_HEADERSET )
386 bool bIsCalc =
false;
421 nullptr != (pItem = pShell->
GetItem(SID_HTML_MODE))))
423 sal_uInt16 nHtmlMode = pItem->
GetValue();
477 if (
nId == SID_ATTR_PAGE_HEADERSET)
480 nResult = aDlg.
run();
485 nResult = aDlg.
run();
524 const sal_uInt16 nOuter(
GetWhich(SID_ATTR_BORDER_OUTER));
525 const sal_uInt16 nInner(
GetWhich(SID_ATTR_BORDER_INNER,
false));
526 const sal_uInt16 nShadow(
GetWhich(SID_ATTR_BORDER_SHADOW));
528 if(mbEnableDrawingLayerFillStyles)
532 SID_COLOR_TABLE, SID_PATTERN_LIST>
535 pBBSet->MergeRange(nOuter, nOuter);
536 pBBSet->MergeRange(nInner, nInner);
537 pBBSet->MergeRange(nShadow, nShadow);
541 static const sal_uInt16 nCopyFlags[] = {
550 for(sal_uInt16
a(0); nCopyFlags[
a];
a++)
560 OSL_ENSURE(
false,
"XPropertyList missing (!)");
566 const sal_uInt16 nBrush(
GetWhich(SID_ATTR_BRUSH));
571 pBBSet->MergeRange(nBrush, nBrush);
572 pBBSet->MergeRange(nOuter, nOuter);
573 pBBSet->MergeRange(nInner, nInner);
574 pBBSet->MergeRange(nShadow, nShadow);
587 if(mbEnableDrawingLayerFillStyles)
597 if(SfxItemState::SET ==
GetItemSet().GetItemState(nInner,
false, &pItem))
609 mbEnableDrawingLayerFillStyles));
611 pDlg->StartExecuteAsync([pDlg,
this](sal_Int32 nResult) {
612 if (nResult ==
RET_OK && pDlg->GetOutputItemSet())
614 SfxItemIter aIter(*pDlg->GetOutputItemSet());
616 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
618 if(!IsInvalidItem(pItem))
625 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
627 if (mbEnableDrawingLayerFillStyles)
631 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(*pBBSet);
635 const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH);
637 if (pBBSet->GetItemState(nWhich) == SfxItemState::SET)
640 const SvxBrushItem& rItem
641 = static_cast<const SvxBrushItem&>(pBBSet->Get(nWhich));
642 SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aTempSet(*pBBSet->GetPool());
644 setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet);
646 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
650 if (SID_ATTR_PAGE_HEADERSET ==
nId)
653 m_aBspWin.setHeaderFillAttributes(aFillAttributes);
658 m_aBspWin.setFooterFillAttributes(aFillAttributes);
670 if (
nId == SID_ATTR_PAGE_HEADERSET )
691 sal_uInt16 nWhich(
GetWhich(SID_ATTR_PAGE_HEADERSET));
706 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
719 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
727 nWhich =
GetWhich(SID_ATTR_PAGE_FOOTERSET);
742 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
755 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
768 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(
rSet);
781 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
826 nUsage =
static_cast<const SvxPageItem*
>(pItem)->GetPageUsage();
852 reinterpret_cast<const SfxPoolItem**
>(&pSetItem) ) )
880 if ( SID_ATTR_PAGE_HEADERSET ==
nId )
890 reinterpret_cast<const SfxPoolItem**
>(&pSetItem) ) )
918 if ( SID_ATTR_PAGE_FOOTERSET ==
nId )
927 if (
auto pBoolItem =
dynamic_cast<const SfxBoolItem*
>( pItem) )
935 if (
auto pBoolItem =
dynamic_cast<const SfxBoolItem*
>( pItem) )
948 return DeactivateRC::LeavePage;
973 if (
nId == SID_ATTR_PAGE_HEADERSET )
994 if (
nId == SID_ATTR_PAGE_HEADERSET )
997 nMin = ( nH - nBB - nBT ) / 5;
998 nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1001 nMin = ( nH - nBB - nBT ) / 5;
1002 nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1009 nMin = ( nH - nBT - nBB ) / 5;
1010 nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1013 nMin = ( nH - nBT - nBB ) / 5;
1014 nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1020 nMax = nW - nBL - nBR -
1024 nMax = nW - nBL - nBR -
1038 if (pSupportDrawingLayerFillStyleItem)
1040 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)