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);
65 for (
auto const& [
aName, nSize] : RID_PAGEFORMATPANEL_MARGINS_INCH)
67 OUString sStr = rLocaleData.
getNum(nSize, 2,
true,
false) +
sSuffix;
74 for (
auto const& [
aName, nSize] : RID_PAGEFORMATPANEL_MARGINS_CM)
76 OUString sStr = rLocaleData.
getNum(nSize, 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),
154 const sal_uInt16 nSId,
160 case SID_ATTR_PAGE_SIZE:
163 if (eState >= SfxItemState::DEFAULT)
164 pSizeItem =
dynamic_cast< const SvxSizeItem*
>(pState);
180 case SID_ATTR_METRIC:
196 if ( eState >= SfxItemState::DEFAULT &&
207 case SID_ATTR_PAGE_LRSPACE:
209 if ( eState >= SfxItemState::DEFAULT &&
217 case SID_ATTR_PAGE_ULSPACE:
219 if ( eState >= SfxItemState::DEFAULT &&
234 Paper ePaper = mxPaperSizeBox->get_active_id();
240 aSize =
Size(mxPaperWidth->GetCoreValue(meUnit), mxPaperHeight->GetCoreValue(meUnit));
242 if (mxPaperOrientation->get_active() == 1 || ePaper==
PAPER_USER)
245 mpPageItem->SetLandscape(mxPaperOrientation->get_active() == 1);
247 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem, mpPageItem.get() });
252 Size aSize(mxPaperWidth->GetCoreValue(meUnit), mxPaperHeight->GetCoreValue(meUnit));
254 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem });
259 bool bMirrored =
false;
260 bool bApplyNewPageMargins =
true;
261 switch (mxMarginSelectBox->get_active())
264 SetNone(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
267 SetNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
270 SetModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
273 SetNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
276 SetNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
279 SetNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
282 SetWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
285 SetMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
288 bApplyNewPageMargins =
false;
292 if(bApplyNewPageMargins)
294 ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
295 ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
296 if(bMirrored != (mpPageItem->GetPageUsage() == SvxPageUsage::Mirror))
298 mpPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
299 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE,
300 SfxCallMode::RECORD, { mpPageItem.get() });
309 if ( pState && eState >= SfxItemState::DEFAULT )
328 SAL_WARN(
"sw.ui",
"GetModuleFieldUnit(): no module found");
359 bool bMirrored = (
mpPageItem->GetPageUsage() == SvxPageUsage::Mirror);
363 if (nCustomEntry != -1)
369 if (nCustomEntry != -1)
375 if (nCustomEntry != -1)
381 if (nCustomEntry != -1)
387 if (nCustomEntry != -1)
393 if (nCustomEntry != -1)
399 if (nCustomEntry != -1)
405 if (nCustomEntry != -1)
410 if (nCustomEntry == -1)
const LocaleDataWrapper & GetLocaleDataWrapper() const
static const AllSettings & GetSettings()
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
void Update(sal_uInt16 nId)
SfxDispatcher * GetDispatcher() const
void SetFallbackCoreMetric(MapUnit eFallback)
MapUnit GetCoreMetric() const
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 * >())
SfxModule * GetModule() const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
virtual SfxObjectShell * GetObjectShell() override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
const Size & GetSize() const
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
sal_uInt32 GetMaximumPaperHeight()
sal_uInt32 GetMaximumPaperWidth()
OUString SwResId(TranslateId aId)