22 #include <svx/svxids.hrc>
32 #include <osl/diagnose.h>
59 SID_ATTR_BRUSH, SID_ATTR_BRUSH,
65 SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
66 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
67 SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
68 SID_ATTR_LRSPACE, SID_ATTR_LRSPACE,
69 SID_ATTR_ULSPACE, SID_ATTR_ULSPACE,
70 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
71 SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
72 SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
73 SID_ATTR_PAGE_ON, SID_ATTR_PAGE_ON,
74 SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
75 SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
76 SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST,
77 SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
88 if ( pDlg->Execute() ==
RET_OK && pDlg->GetOutputItemSet() )
92 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
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);
205 const sal_uInt16 aWhichTab[] = {
207 nWLRSpace, nWLRSpace,
208 nWULSpace, nWULSpace,
210 nWDynamic, nWDynamic,
212 nWSharedFirst, nWSharedFirst,
214 nWBoxInfo, nWBoxInfo,
217 nWDynSpacing, nWDynSpacing,
245 std::unique_ptr<SfxBoolItem> pBoolItem(static_cast<SfxBoolItem*>(pPool->
GetDefaultItem(nWDynSpacing).
Clone()));
247 aSet.
Put(std::move(pBoolItem));
251 SvxSizeItem aSizeItem( static_cast<const SvxSizeItem&>(rOldSet.
Get( nWSize )) );
257 aSize.setHeight( nH );
259 aSet.
Put( aSizeItem );
268 if (
nId == SID_ATTR_PAGE_HEADERSET )
269 aUL.
SetLower( static_cast<sal_uInt16>(nDist) );
271 aUL.
SetUpper( static_cast<sal_uInt16>(nDist) );
289 aSet.
Put(_pSet->
Get(nWBrush));
294 aSet.
Put(_pSet->
Get(nWBoxInfo));
299 aSet.
Put(_pSet->
Get(nWBox));
304 aSet.
Put(_pSet->
Get(nWShadow));
310 if(_pSet->
GetItemState(nFillStyleId) == SfxItemState::SET)
312 aSet.
Put(_pSet->
Get(nFillStyleId));
320 rSet->
Put( aSetItem );
336 bool bIsCalc =
false;
339 if (dynamic_cast<const SfxBoolItem*>(pExt1) && dynamic_cast<const SfxBoolItem*>(pExt2) )
347 reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
363 pSharedFirst = static_cast<const SfxBoolItem*>(&rHeaderSet.
Get(
GetWhich( SID_ATTR_PAGE_SHARED_FIRST ) ));
378 if (
nId == SID_ATTR_PAGE_HEADERSET )
430 if(SfxItemState::SET == rSet->
GetItemState(SID_HTML_MODE,
false, &pItem) ||
432 nullptr != (pItem = pShell->
GetItem(SID_HTML_MODE))))
488 if (
nId == SID_ATTR_PAGE_HEADERSET)
491 nResult = aDlg.
run();
496 nResult = aDlg.
run();
535 const sal_uInt16 nOuter(
GetWhich(SID_ATTR_BORDER_OUTER));
536 const sal_uInt16 nInner(
GetWhich(SID_ATTR_BORDER_INNER,
false));
537 const sal_uInt16 nShadow(
GetWhich(SID_ATTR_BORDER_SHADOW));
539 if(mbEnableDrawingLayerFillStyles)
544 {SID_COLOR_TABLE, SID_PATTERN_LIST},
547 {nShadow, nShadow}}));
551 static const sal_uInt16 nCopyFlags[] = {
560 for(sal_uInt16
a(0); nCopyFlags[
a];
a++)
570 OSL_ENSURE(
false,
"XPropertyList missing (!)");
576 const sal_uInt16 nBrush(
GetWhich(SID_ATTR_BRUSH));
584 {nShadow, nShadow}}) );
593 pBBSet->Put(static_cast<const SvxSetItem*>(pItem)->
GetItemSet());
597 if(mbEnableDrawingLayerFillStyles)
607 if(SfxItemState::SET ==
GetItemSet().GetItemState(nInner,
false, &pItem))
619 mbEnableDrawingLayerFillStyles));
621 pDlg->StartExecuteAsync([pDlg,
this](sal_Int32 nResult) {
622 if (nResult ==
RET_OK && pDlg->GetOutputItemSet())
626 for (
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
637 if (mbEnableDrawingLayerFillStyles)
641 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(*pBBSet);
645 const sal_uInt16 nWhich =
GetWhich(SID_ATTR_BRUSH);
647 if (pBBSet->GetItemState(nWhich) == SfxItemState::SET)
651 =
static_cast<const SvxBrushItem&
>(pBBSet->Get(nWhich));
657 std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
661 if (SID_ATTR_PAGE_HEADERSET ==
nId)
664 m_aBspWin.setHeaderFillAttributes(aFillAttributes);
669 m_aBspWin.setFooterFillAttributes(aFillAttributes);
681 if (
nId == SID_ATTR_PAGE_HEADERSET )
702 sal_uInt16 nWhich(
GetWhich(SID_ATTR_PAGE_HEADERSET));
704 if (SfxItemState::SET == rSet.
GetItemState(nWhich,
false))
717 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
730 aHeaderFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
738 nWhich =
GetWhich(SID_ATTR_PAGE_FOOTERSET);
740 if (SfxItemState::SET == rSet.
GetItemState(nWhich,
false))
753 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rTmpSet);
766 aFooterFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
779 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(rSet);
792 aPageFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(aTempSet);
817 pItem =
GetItem( rSet, SID_ATTR_ULSPACE );
834 pItem =
GetItem( rSet, SID_ATTR_PAGE );
837 nUsage =
static_cast<const SvxPageItem*
>(pItem)->GetPageUsage();
848 pItem =
GetItem( rSet, SID_ATTR_PAGE_SIZE );
863 reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
893 if ( SID_ATTR_PAGE_HEADERSET ==
nId )
903 reinterpret_cast<const SfxPoolItem**>(&pSetItem) ) )
933 if ( SID_ATTR_PAGE_FOOTERSET ==
nId )
940 pItem =
GetItem( rSet, SID_ATTR_PAGE_EXT1 );
942 if (
auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
948 pItem =
GetItem( rSet, SID_ATTR_PAGE_EXT2 );
950 if (
auto pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
963 return DeactivateRC::LeavePage;
988 if (
nId == SID_ATTR_PAGE_HEADERSET )
1009 if (
nId == SID_ATTR_PAGE_HEADERSET )
1012 nMin = ( nH - nBB - nBT ) / 5;
1013 nMax = std::max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
1016 nMin = ( nH - nBB - nBT ) / 5;
1017 nDist = std::max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
1024 nMin = ( nH - nBT - nBB ) / 5;
1025 nMax = std::max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
1028 nMin = ( nH - nBT - nBB ) / 5;
1029 nDist = std::max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
1035 nMax = nW - nBL - nBR -
1039 nMax = nW - nBL - nBR -
1053 if (pSupportDrawingLayerFillStyleItem)
1055 const bool bNew(pSupportDrawingLayerFillStyleItem->
GetValue());
#define LINK(Instance, Class, Member)
std::unique_ptr< weld::MetricSpinButton > m_xHeightEdit
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, weld::Button &, void)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
sal_uInt16 GetLower() const
void SetFooter(bool bNew)
const tools::Long DEF_DIST_CALC
virtual VclPtr< SfxAbstractTabDialog > CreateSvxBorderBackgroundDlg(weld::Window *pParent, const SfxItemSet &rCoreSet, bool bEnableDrawingLayerFillStyles)=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
static SvxAbstractDialogFactory * Create()
tools::Long GetRight() const
void SetFtHeight(tools::Long nNew)
void SetHdHeight(tools::Long nNew)
const SfxItemSet & GetItemSet() const
static SfxObjectShell * Current()
void SetTop(tools::Long nNew)
tools::Long GetHdDist() const
tools::Long GetFtHeight() const
void EnableDynamicSpacing()
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
const tools::Long DEF_DIST_WRITER
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
std::unique_ptr< weld::MetricSpinButton > m_xLMEdit
bool ShowBorderBackgroundDlg(weld::Window *pParent, SfxItemSet *pBBSet)
Reference< XNameAccess > m_xContainer
void SetFtRight(tools::Long nNew)
tools::Long GetFtDist() const
void SetExchangeSupport()
void SetFtLeft(tools::Long nNew)
void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
tools::Long GetTop() const
tools::Long GetRight() const
tools::Long GetBottom() const
virtual void Reset(const SfxItemSet *rSet) override
tools::Long GetHdHeight() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::MetricSpinButton > m_xRMEdit
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
virtual void PageCreated(const SfxAllItemSet &) override
std::unique_ptr< weld::CheckButton > m_xTurnOnBox
SvxHFPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet, sal_uInt16 nSetId)
std::unique_ptr< weld::Label > m_xDistFT
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
std::unique_ptr< weld::CheckButton > m_xHeightDynBtn
const tools::Long MINBODY
std::unique_ptr< weld::CheckButton > m_xCntSharedBox
static bool GetWhich(const SfxItemSet &rSet, sal_uInt16 nSlot, sal_uInt16 &rWhich)
void SetHeader(bool bNew)
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
tools::Long GetLeft() const
std::unique_ptr< SfxItemSet > pBBSet
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
tools::Long Width() const
void SetFtDist(tools::Long nNew)
void SetBottom(tools::Long nNew)
void SetHdDist(tools::Long nNew)
std::unique_ptr< weld::Label > m_xHeightFT
void SetSize(const Size &rSize)
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
void SetHdRight(tools::Long nNew)
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
SVX_DLLPRIVATE void ResetBackground_Impl(const SfxItemSet &rSet)
SvxPageUsage GetUsage() const
void TurnOn(const weld::ToggleButton *pButton)
const Size & GetSize() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
tools::Long GetLeft() const
weld::Window * GetFrameWeld() const
std::unique_ptr< weld::Button > m_xBackgroundBtn
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
tools::Long Height() const
void SetSize(const Size &rSize)
virtual ~SvxHFPage() override
IMPL_LINK(SvxHFPage, TurnOnHdl, weld::ToggleButton &, rBox, void)
std::unique_ptr< weld::Label > m_xRMLbl
void SetLeft(tools::Long nNew)
void SetRight(tools::Long nNew)
virtual bool FillItemSet(SfxItemSet *rOutSet) override
virtual void ActivatePage(const SfxItemSet &rSet) override
std::unique_ptr< weld::CheckButton > m_xCntSharedFirstBox
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
void SetUsage(SvxPageUsage eU)
bool mbEnableDrawingLayerFillStyles
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
bool IsInvalidItem(const SfxPoolItem *pItem)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
std::unique_ptr< weld::CheckButton > m_xDynSpacingCB
std::unique_ptr< weld::MetricSpinButton > m_xDistEdit
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
void SetHdLeft(tools::Long nNew)
static const sal_uInt16 pRanges[]
std::unique_ptr< weld::Label > m_xLMLbl
static bool IsWhich(sal_uInt16 nId)
const Size & GetSize() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
sal_uInt16 GetUpper() const
std::unique_ptr< weld::Label > m_xPageLbl