1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <sfx2/tabdlg.hxx>
22 #include <svx/pagectrl.hxx>
23 #include <svx/pagenumberlistbox.hxx>
24 #include <svx/papersizelistbox.hxx>
25 #include <svx/frmdirlbox.hxx>
26 #include <i18nutil/paper.hxx>
27 #include <svx/flagsdef.hxx>
28 #include <vcl/print.hxx>
30 // class SvxPageDescPage -------------------------------------------------
33 TabPage for page settings (size, margins, ...)
36 <SvxPageItem>: <SID_ATTR_PAGE>
37 <SvxSizeItem>: <SID_ATTR_SIZE>
38 <SvxSizeItem>: <SID_ATTR_MAXSIZE>
39 <SvxULSpaceItem>: <SID_ATTR_LRSPACE>
40 <SvxLRSpaceItem>: <SID_ATTR_ULSPACE>
41 <SvxPaperBinItem>: <SID_ATTR_PAPERBIN>
42 <SvxBoolItem>: <SID_ATTR_EXT1>
43 <SvxBoolItem>: <SID_ATTR_EXT2>
45 <SfxSetItem>: <SID_ATTR_HEADERSET>
46 <SfxBoolItem>: <SID_ATTR_ON>
47 <SfxBoolItem>: <SID_ATTR_DYNAMIC>
48 <SfxBoolItem>: <SID_ATTR_SHARED>
49 <SvxSizeItem>: <SID_ATTR_SIZE>
50 <SvxULSpaceItem>: <SID_ATTR_ULSPACE>
51 <SvxLRSpaceItem>: <SID_ATTR_LRSPACE>
53 <SfxSetItem>: <SID_ATTR_FOOTERSET>
54 <SfxBoolItem>: <SID_ATTR_ON>
55 <SfxBoolItem>: <SID_ATTR_DYNAMIC>
56 <SfxBoolItem>: <SID_ATTR_SHARED>
57 <SvxSizeItem>: <SID_ATTR_SIZE>
58 <SvxULSpaceItem>: <SID_ATTR_ULSPACE>
59 <SvxLRSpaceItem>: <SID_ATTR_LRSPACE>
62 typedef sal_uInt16 MarginPosition
;
64 class SvxPageDescPage
: public SfxTabPage
66 static const WhichRangesContainer pRanges
;
68 OUString sStandardRegister
;
69 tools::Long nFirstLeftMargin
;
70 tools::Long nFirstRightMargin
;
71 tools::Long nFirstTopMargin
;
72 tools::Long nFirstBottomMargin
;
73 tools::Long nLastLeftMargin
;
74 tools::Long nLastRightMargin
;
75 tools::Long nLastTopMargin
;
76 tools::Long nLastBottomMargin
;
83 MarginPosition m_nPos
;
84 VclPtr
<Printer
> mpDefPrinter
;
86 bool mbDelPrinter
: 1;
87 bool mbEnableDrawingLayerFillStyles
: 1;
89 SvxPageWindow m_aBspWin
;
92 std::unique_ptr
<SvxPaperSizeListBox
> m_xPaperSizeBox
;
93 std::unique_ptr
<weld::MetricSpinButton
> m_xPaperWidthEdit
;
94 std::unique_ptr
<weld::MetricSpinButton
> m_xPaperHeightEdit
;
95 std::unique_ptr
<weld::RadioButton
> m_xPortraitBtn
;
96 std::unique_ptr
<weld::RadioButton
> m_xLandscapeBtn
;
97 std::unique_ptr
<weld::Label
> m_xTextFlowLbl
;
98 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextFlowBox
;
99 std::unique_ptr
<weld::ComboBox
> m_xPaperTrayBox
;
101 std::unique_ptr
<weld::Label
> m_xLeftMarginLbl
;
102 std::unique_ptr
<weld::MetricSpinButton
> m_xLeftMarginEdit
;
103 std::unique_ptr
<weld::Label
> m_xRightMarginLbl
;
104 std::unique_ptr
<weld::MetricSpinButton
> m_xRightMarginEdit
;
105 std::unique_ptr
<weld::MetricSpinButton
> m_xTopMarginEdit
;
106 std::unique_ptr
<weld::MetricSpinButton
> m_xBottomMarginEdit
;
107 std::unique_ptr
<weld::Label
> m_xGutterMarginLbl
;
108 std::unique_ptr
<weld::MetricSpinButton
> m_xGutterMarginEdit
;
110 std::unique_ptr
<weld::Label
> m_xPageText
;
111 std::unique_ptr
<weld::ComboBox
> m_xLayoutBox
;
112 std::unique_ptr
<weld::Label
> m_xNumberFormatText
;
113 std::unique_ptr
<SvxPageNumberListBox
> m_xNumberFormatBox
;
115 std::unique_ptr
<weld::Label
> m_xTblAlignFT
;
116 std::unique_ptr
<weld::CheckButton
> m_xHorzBox
;
117 std::unique_ptr
<weld::CheckButton
> m_xVertBox
;
119 std::unique_ptr
<weld::CheckButton
> m_xAdaptBox
;
121 std::unique_ptr
<weld::CheckButton
> m_xRegisterCB
;
122 std::unique_ptr
<weld::Label
> m_xRegisterFT
;
123 std::unique_ptr
<weld::ComboBox
> m_xRegisterLB
;
124 std::unique_ptr
<weld::Label
> m_xGutterPositionFT
;
125 std::unique_ptr
<weld::ComboBox
> m_xGutterPositionLB
;
126 std::unique_ptr
<weld::CheckButton
> m_xRtlGutterCB
;
127 std::unique_ptr
<weld::CheckButton
> m_xBackgroundFullSizeCB
;
128 std::unique_ptr
<weld::Label
> m_xInsideLbl
;
129 std::unique_ptr
<weld::Label
> m_xOutsideLbl
;
130 std::unique_ptr
<weld::Label
> m_xPrintRangeQueryText
;
131 std::unique_ptr
<weld::CustomWeld
> m_xBspWin
;
134 DECL_LINK(LayoutHdl_Impl
, weld::ComboBox
&, void);
135 DECL_LINK(GutterPositionHdl_Impl
, weld::ComboBox
&, void);
136 DECL_LINK(PaperBinHdl_Impl
, weld::Widget
&, void);
137 DECL_LINK(SwapOrientation_Impl
, weld::Toggleable
&, void);
138 void SwapFirstValues_Impl( bool bSet
);
139 DECL_LINK(BorderModify_Impl
, weld::MetricSpinButton
&, void);
140 void InitHeadFoot_Impl( const SfxItemSet
& rSet
);
141 DECL_LINK(CenterHdl_Impl
, weld::Toggleable
&, void);
142 void UpdateExample_Impl( bool bResetbackground
= false );
144 DECL_LINK(PaperSizeSelect_Impl
, weld::ComboBox
&, void );
145 DECL_LINK(PaperSizeModify_Impl
, weld::MetricSpinButton
&, void);
147 DECL_LINK(FrameDirectionModify_Impl
, weld::ComboBox
&, void );
149 void ResetBackground_Impl( const SfxItemSet
& rSet
);
151 void RangeHdl_Impl();
152 void CalcMargin_Impl();
154 DECL_LINK(RegisterModify
, weld::Toggleable
&, void);
157 /** Disables vertical page direction entries in the text flow listbox. */
158 void DisableVerticalPageDir();
160 bool IsPrinterRangeOverflow(weld::MetricSpinButton
& rField
, tools::Long nFirstMargin
,
161 tools::Long nLastMargin
, MarginPosition nPos
);
162 void CheckMarginEdits( bool _bClear
);
163 bool IsMarginOutOfRange() const;
166 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
167 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
170 SvxPageDescPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
171 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
172 virtual ~SvxPageDescPage() override
;
174 // returns the range of the Which values
175 static const WhichRangesContainer
& GetRanges() { return pRanges
; }
177 virtual bool FillItemSet( SfxItemSet
* rOutSet
) override
;
178 virtual void Reset( const SfxItemSet
* rSet
) override
;
179 virtual void FillUserData() override
;
181 void SetPaperFormatRanges( Paper eStart
)
182 { ePaperStart
= eStart
; }
184 void SetCollectionList(const std::vector
<OUString
> &aList
);
185 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */