25 #include <svx/svxids.hrc>
38 #include <pageformatpanel.hrc>
44 #include <com/sun/star/lang/IllegalArgumentException.hpp>
46 namespace sw {
namespace sidebar{
50 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
53 if( pParent ==
nullptr )
54 throw ::com::sun::star::lang::IllegalArgumentException(
"no parent window given to PageFormatPanel::Create",
nullptr, 0);
56 throw ::com::sun::star::lang::IllegalArgumentException(
"no XFrame given to PageFormatPanel::Create",
nullptr, 0);
63 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
65 PanelLayout(pParent,
"PageFormatPanel",
"modules/swriter/ui/pageformatpanel.ui", rxFrame),
66 mpBindings( pBindings ),
67 maPaperSizeController(SID_ATTR_PAGE_SIZE, *pBindings, *this),
68 maPaperOrientationController(SID_ATTR_PAGE, *pBindings, *this),
69 maMetricController(SID_ATTR_METRIC, *pBindings,*this),
70 maSwPageLRControl(SID_ATTR_PAGE_LRSPACE, *pBindings, *this),
71 maSwPageULControl(SID_ATTR_PAGE_ULSPACE, *pBindings, *this),
157 const sal_uInt16 nSId,
163 case SID_ATTR_PAGE_SIZE:
166 if (eState >= SfxItemState::DEFAULT)
167 pSizeItem =
dynamic_cast< const SvxSizeItem*
>(pState);
183 case SID_ATTR_METRIC:
197 if ( eState >= SfxItemState::DEFAULT &&
198 dynamic_cast< const SvxPageItem *>( pState ) )
208 case SID_ATTR_PAGE_LRSPACE:
210 if ( eState >= SfxItemState::DEFAULT &&
211 dynamic_cast< const SvxLongLRSpaceItem *>( pState ) )
218 case SID_ATTR_PAGE_ULSPACE:
220 if ( eState >= SfxItemState::DEFAULT &&
221 dynamic_cast< const SvxLongULSpaceItem *>( pState ) )
235 Paper ePaper = mpPaperSizeBox->GetSelection();
243 if(mpPaperOrientation->GetSelectedEntryPos() == 1 || ePaper==
PAPER_USER)
246 mpPageItem->SetLandscape(mpPaperOrientation->GetSelectedEntryPos() == 1);
248 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem, mpPageItem.get() });
255 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem });
260 bool bMirrored =
false;
261 bool bApplyNewPageMargins =
true;
262 switch ( mpMarginSelectBox->GetSelectedEntryPos() )
265 SetNone(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
268 SetNarrow(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
271 SetModerate(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
274 SetNormal075(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
277 SetNormal100(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
280 SetNormal125(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
283 SetWide(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
286 SetMirrored(mnPageLeftMargin, mnPageRightMargin, mnPageTopMargin, mnPageBottomMargin, bMirrored);
289 bApplyNewPageMargins =
false;
293 if(bApplyNewPageMargins)
295 ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
296 ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
297 if(bMirrored != (mpPageItem->GetPageUsage() == SvxPageUsage::Mirror))
299 mpPageItem->SetPageUsage( bMirrored ? SvxPageUsage::Mirror : SvxPageUsage::All );
300 mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_PAGE,
301 SfxCallMode::RECORD, { mpPageItem.get() });
310 if ( pState && eState >= SfxItemState::DEFAULT )
329 SAL_WARN(
"sw.ui",
"GetModuleFieldUnit(): no module found");
358 bool bMirrored = (
mpPageItem->GetPageUsage() == SvxPageUsage::Mirror);
#define LINK(Instance, Class, Member)
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
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 * >())
sal_Int32 GetSelectedEntryPos(sal_Int32 nSelIndex=0) const
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
MapUnit GetCoreMetric() const
void RemoveEntry(const OUString &rStr)
Dialog to specify the properties of date form field.
virtual SfxObjectShell * GetObjectShell() override
void FillPaperSizeEntries(PaperSizeApp eApp)
#define LISTBOX_ENTRY_NOTFOUND
sal_uInt32 GetMaximumPaperWidth() const
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
void SelectEntry(const OUString &rStr, bool bSelect=true)
SfxModule * GetModule() const
virtual OUString GetText() const
#define SAL_N_ELEMENTS(arr)
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
sal_Int32 InsertEntry(const OUString &rStr, sal_Int32 nPos=LISTBOX_APPEND)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
OUString SwResId(const char *pId)
void SetSelectHdl(const Link< ListBox &, void > &rLink)
void Update(sal_uInt16 nId)
virtual void dispose() override
sal_uInt32 GetMaximumPaperHeight() const
sal_Int32 GetEntryPos(const OUString &rStr) const
static SfxViewFrame * Current()
void SetSelection(Paper eSize)
static VclPtr< reference_type > Create(Arg &&...arg)
SfxDispatcher * GetDispatcher() const
#define SAL_WARN(area, stream)
const Size & GetSize() const
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)