35 #include <pageformatpanel.hrc>
42 #include <com/sun/star/lang/IllegalArgumentException.hpp>
50 if( pParent ==
nullptr )
51 throw ::com::sun::star::lang::IllegalArgumentException(
"no parent window given to PageFormatPanel::Create",
nullptr, 0);
53 return std::make_unique<PageFormatPanel>(pParent, pBindings);
67 OUString sStr = rLocaleData.
getNum(RID_PAGEFORMATPANEL_MARGINS_INCH[
i].second, 2,
true,
false) + sSuffix;
76 OUString sStr = rLocaleData.
getNum(RID_PAGEFORMATPANEL_MARGINS_CM[
i].second, 2,
true,
false) +
" " + sSuffix;
84 PanelLayout(pParent,
"PageFormatPanel",
"modules/swriter/ui/pageformatpanel.ui"),
85 mpBindings( pBindings ),
89 mxPaperOrientation(m_xBuilder->weld_combo_box(
"paperorientation")),
90 mxMarginSelectBox(m_xBuilder->weld_combo_box(
"marginLB")),
91 mxCustomEntry(m_xBuilder->weld_label(
"customlabel")),
92 maPaperSizeController(SID_ATTR_PAGE_SIZE, *pBindings, *this),
93 maPaperOrientationController(SID_ATTR_PAGE, *pBindings, *this),
94 maMetricController(SID_ATTR_METRIC, *pBindings,*this),
95 maSwPageLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this),
96 maSwPageULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this),
156 const sal_uInt16 nSId,
162 case SID_ATTR_PAGE_SIZE:
165 if (eState >= SfxItemState::DEFAULT)
166 pSizeItem =
dynamic_cast< const SvxSizeItem*
>(pState);
182 case SID_ATTR_METRIC:
198 if ( eState >= SfxItemState::DEFAULT &&
199 dynamic_cast< const SvxPageItem *>( pState ) )
209 case SID_ATTR_PAGE_LRSPACE:
211 if ( eState >= SfxItemState::DEFAULT &&
212 dynamic_cast< const SvxLongLRSpaceItem *>( pState ) )
219 case SID_ATTR_PAGE_ULSPACE:
221 if ( eState >= SfxItemState::DEFAULT &&
222 dynamic_cast< const SvxLongULSpaceItem *>( pState ) )
236 Paper ePaper = mxPaperSizeBox->get_active_id();
242 aSize =
Size(mxPaperWidth->GetCoreValue(meUnit), mxPaperHeight->GetCoreValue(meUnit));
244 if (mxPaperOrientation->get_active() == 1 || ePaper==
PAPER_USER)
247 mpPageItem->SetLandscape(mxPaperOrientation->get_active() == 1);
249 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem, mpPageItem.get() });
254 Size aSize(mxPaperWidth->GetCoreValue(meUnit), mxPaperHeight->GetCoreValue(meUnit));
256 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem });
261 bool bMirrored =
false;
262 bool bApplyNewPageMargins =
true;
263 switch (mxMarginSelectBox->get_active())
266 SetNone(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
269 SetNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
272 SetModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
275 SetNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
278 SetNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
281 SetNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
284 SetWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
287 SetMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
290 bApplyNewPageMargins =
false;
294 if(bApplyNewPageMargins)
296 ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
297 ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
298 if(bMirrored != (mpPageItem->GetPageUsage() == SvxPageUsage::Mirror))
300 mpPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
301 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE,
302 SfxCallMode::RECORD, { mpPageItem.get() });
311 if ( pState && eState >= SfxItemState::DEFAULT )
330 SAL_WARN(
"sw.ui",
"GetModuleFieldUnit(): no module found");
361 bool bMirrored = (
mpPageItem->GetPageUsage() == SvxPageUsage::Mirror);
365 if (nCustomEntry != -1)
371 if (nCustomEntry != -1)
377 if (nCustomEntry != -1)
383 if (nCustomEntry != -1)
389 if (nCustomEntry != -1)
395 if (nCustomEntry != -1)
401 if (nCustomEntry != -1)
407 if (nCustomEntry != -1)
412 if (nCustomEntry == -1)
#define LINK(Instance, Class, Member)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
const LocaleDataWrapper & GetLocaleDataWrapper() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
static const AllSettings & GetSettings()
MapUnit GetCoreMetric() const
virtual SfxObjectShell * GetObjectShell() override
sal_uInt32 GetMaximumPaperWidth() const
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
constexpr tools::Long Width() const
SfxModule * GetModule() const
#define SAL_N_ELEMENTS(arr)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
OUString SwResId(const char *pId)
void Update(sal_uInt16 nId)
sal_uInt32 GetMaximumPaperHeight() const
static SfxViewFrame * Current()
constexpr tools::Long Height() const
SfxDispatcher * GetDispatcher() const
#define SAL_WARN(area, stream)
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
constexpr OUStringLiteral first
void SetFallbackCoreMetric(MapUnit eFallback)
const Size & GetSize() const
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)