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/relfld.hxx>
23 #include <svx/paraprev.hxx>
24 #include <svx/frmdirlbox.hxx>
26 class SvxLineSpacingItem
;
28 // class SvxStdParagraphTabPage ------------------------------------------
31 With this TabPage standard attributes of a paragraph can be set
32 (indention, distance, alignment, line spacing).
35 <SvxAdjustItem><SID_ATTR_PARA_ADJUST>
36 <SvxLineSpacingItem><SID_ATTR_PARA_LINESPACE>
37 <SvxULSpaceItem><SID_ATTR_ULSPACE>
38 <SvxLRSpaceItem><SID_ATTR_LRSPACE>
41 class SvxStdParagraphTabPage
: public SfxTabPage
43 static const WhichRangesContainer pStdRanges
;
47 tools::Long nMinFixDist
;
51 SvxParaPrevWindow m_aExampleWin
;
54 bool m_bSplitLRSpace
= false; ///< which items to use?
55 SvxRelativeField m_aLeftIndent
;
57 SvxRelativeField m_aRightIndent
;
59 std::unique_ptr
<weld::Label
> m_xFLineLabel
;
60 SvxRelativeField m_aFLineIndent
;
61 std::unique_ptr
<weld::CheckButton
> m_xAutoCB
;
64 SvxRelativeField m_aTopDist
;
65 SvxRelativeField m_aBottomDist
;
66 std::unique_ptr
<weld::CheckButton
> m_xContextualCB
;
69 std::unique_ptr
<weld::ComboBox
> m_xLineDist
;
70 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtPercentBox
;
71 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtMetricBox
;
72 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtPlaceHolderBox
;
73 std::unique_ptr
<weld::Label
> m_xLineDistAtLabel
;
74 std::unique_ptr
<weld::Label
> m_xAbsDist
;
77 std::unique_ptr
<weld::CheckButton
> m_xRegisterCB
;
80 std::unique_ptr
<weld::CustomWeld
> m_xExampleWin
;
82 void SetLineSpacing_Impl( const SvxLineSpacingItem
& rAttr
);
84 void UpdateExample_Impl();
87 DECL_LINK(LineDistPopupHdl_Impl
, weld::ComboBox
&, void);
88 DECL_LINK(LineDistHdl_Impl
, weld::ComboBox
&, void);
89 DECL_LINK(ModifyHdl_Impl
, weld::MetricSpinButton
&, void);
90 DECL_LINK(AutoHdl_Impl
, weld::Toggleable
&, void);
92 bool m_bLineDistToggled
= false;
95 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
96 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
100 SvxStdParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
101 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
102 virtual ~SvxStdParagraphTabPage() override
;
104 DECL_LINK(ELRLoseFocusHdl
, weld::MetricSpinButton
&, void);
106 static WhichRangesContainer
GetRanges() { return pStdRanges
; }
108 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
109 virtual void Reset( const SfxItemSet
* rSet
) override
;
110 virtual void ChangesApplied() override
;
112 void EnableRelativeMode();
113 void EnableRegisterMode();
114 void EnableContextualMode();
115 void EnableAutoFirstLine();
116 void EnableAbsLineDist(tools::Long nMinTwip
);
117 void EnableNegativeMode();
118 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
121 // class SvxParaAlignTabPage ------------------------------------------------
123 class SvxParaAlignTabPage
: public SfxTabPage
125 static const WhichRangesContainer pAlignRanges
, pSdrAlignRanges
;
127 bool m_bSdrVertAlign
;
129 SvxParaPrevWindow m_aExampleWin
;
132 std::unique_ptr
<weld::RadioButton
> m_xLeft
;
133 std::unique_ptr
<weld::RadioButton
> m_xRight
;
134 std::unique_ptr
<weld::RadioButton
> m_xCenter
;
135 std::unique_ptr
<weld::RadioButton
> m_xJustify
;
136 std::unique_ptr
<weld::Label
> m_xLeftBottom
;
137 std::unique_ptr
<weld::Label
> m_xRightTop
;
139 std::unique_ptr
<weld::Label
> m_xLastLineFT
;
140 std::unique_ptr
<weld::ComboBox
> m_xLastLineLB
;
141 std::unique_ptr
<weld::CheckButton
> m_xExpandCB
;
143 std::unique_ptr
<weld::CheckButton
> m_xSnapToGridCB
;
146 std::unique_ptr
<weld::CustomWeld
> m_xExampleWin
;
148 std::unique_ptr
<weld::Widget
> m_xVertAlignFL
;
149 std::unique_ptr
<weld::ComboBox
> m_xVertAlignLB
;
150 std::unique_ptr
<weld::Label
> m_xVertAlign
;
151 std::unique_ptr
<weld::Label
> m_xVertAlignSdr
;
153 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextDirectionLB
;
155 DECL_LINK(AlignHdl_Impl
, weld::Toggleable
&, void);
156 DECL_LINK(LastLineHdl_Impl
, weld::ComboBox
&, void);
157 DECL_LINK(TextDirectionHdl_Impl
, weld::ComboBox
&, void);
159 void UpdateExample_Impl();
162 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
163 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
166 SvxParaAlignTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
167 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
168 virtual ~SvxParaAlignTabPage() override
;
170 static WhichRangesContainer
GetRanges() { return pAlignRanges
; }
171 static WhichRangesContainer
GetSdrRanges() { return pSdrAlignRanges
; }
173 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
174 virtual void Reset( const SfxItemSet
* rSet
) override
;
175 virtual void ChangesApplied() override
;
177 void EnableJustifyExt();
178 void EnableSdrVertAlign();
179 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
182 // class SvxExtParagraphTabPage ------------------------------------------
185 With this TabPage special attributes of a paragraph can be set
186 (hyphenation, pagebreak, orphan, widow, ...).
189 <SvxHyphenZoneItem><SID_ATTR_PARA_HYPHENZONE>
190 <SvxFormatBreakItem><SID_ATTR_PARA_PAGEBREAK>
191 <SvxFormatSplitItem><SID_ATTR_PARA_SPLIT>
192 <SvxWidowsItem><SID_ATTR_PARA_WIDOWS>
193 <SvxOrphansItem><SID_ATTR_PARA_ORPHANS>
196 class SvxExtParagraphTabPage
: public SfxTabPage
198 static const WhichRangesContainer pExtRanges
;
201 SvxExtParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
202 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
203 const SfxItemSet
* rSet
);
204 virtual ~SvxExtParagraphTabPage() override
;
206 static WhichRangesContainer
GetRanges() { return pExtRanges
; }
208 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
209 virtual void Reset( const SfxItemSet
* rSet
) override
;
210 virtual void ChangesApplied() override
;
212 void DisablePageBreak();
215 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
218 weld::TriStateEnabled aHyphenState
;
219 weld::TriStateEnabled aPageBreakState
;
220 weld::TriStateEnabled aApplyCollState
;
221 weld::TriStateEnabled aPageNumState
;
222 weld::TriStateEnabled aKeepTogetherState
;
223 weld::TriStateEnabled aKeepParaState
;
224 weld::TriStateEnabled aOrphanState
;
225 weld::TriStateEnabled aWidowState
;
232 std::unique_ptr
<weld::CheckButton
> m_xHyphenBox
;
233 std::unique_ptr
<weld::CheckButton
> m_xHyphenNoCapsBox
;
234 std::unique_ptr
<weld::CheckButton
> m_xHyphenNoLastWordBox
;
235 std::unique_ptr
<weld::Label
> m_xBeforeText
;
236 std::unique_ptr
<weld::SpinButton
> m_xExtHyphenBeforeBox
;
237 std::unique_ptr
<weld::Label
> m_xAfterText
;
238 std::unique_ptr
<weld::SpinButton
> m_xExtHyphenAfterBox
;
239 std::unique_ptr
<weld::Label
> m_xMaxHyphenLabel
;
240 std::unique_ptr
<weld::SpinButton
> m_xMaxHyphenEdit
;
241 std::unique_ptr
<weld::Label
> m_xMinWordLabel
;
242 std::unique_ptr
<weld::SpinButton
> m_xMinWordLength
;
243 std::unique_ptr
<weld::Label
> m_xHyphenZoneLabel
;
244 SvxRelativeField m_aHyphenZone
;
247 std::unique_ptr
<weld::CheckButton
> m_xPageBreakBox
;
248 std::unique_ptr
<weld::Label
> m_xBreakTypeFT
;
249 std::unique_ptr
<weld::ComboBox
> m_xBreakTypeLB
;
250 std::unique_ptr
<weld::Label
> m_xBreakPositionFT
;
251 std::unique_ptr
<weld::ComboBox
> m_xBreakPositionLB
;
252 std::unique_ptr
<weld::CheckButton
> m_xApplyCollBtn
;
253 std::unique_ptr
<weld::ComboBox
> m_xApplyCollBox
;
254 std::unique_ptr
<weld::CheckButton
> m_xPageNumBox
;
255 std::unique_ptr
<weld::SpinButton
> m_xPagenumEdit
;
257 // paragraph division
258 std::unique_ptr
<weld::CheckButton
> m_xKeepTogetherBox
;
259 std::unique_ptr
<weld::CheckButton
> m_xKeepParaBox
;
262 std::unique_ptr
<weld::CheckButton
> m_xOrphanBox
;
263 std::unique_ptr
<weld::SpinButton
> m_xOrphanRowNo
;
264 std::unique_ptr
<weld::Label
> m_xOrphanRowLabel
;
266 std::unique_ptr
<weld::CheckButton
> m_xWidowBox
;
267 std::unique_ptr
<weld::SpinButton
> m_xWidowRowNo
;
268 std::unique_ptr
<weld::Label
> m_xWidowRowLabel
;
270 void HyphenClickHdl();
271 void PageNumBoxClickHdl();
272 void ApplyCollClickHdl();
274 void KeepTogetherHdl();
278 DECL_LINK(PageBreakHdl_Impl
, weld::Toggleable
&, void);
279 DECL_LINK(KeepTogetherHdl_Impl
, weld::Toggleable
&, void);
280 DECL_LINK(WidowHdl_Impl
, weld::Toggleable
&, void);
281 DECL_LINK(OrphanHdl_Impl
, weld::Toggleable
&, void);
282 DECL_LINK(HyphenClickHdl_Impl
, weld::Toggleable
&, void);
283 DECL_LINK(ApplyCollClickHdl_Impl
, weld::Toggleable
&, void);
284 DECL_LINK(PageBreakPosHdl_Impl
, weld::ComboBox
&, void);
285 DECL_LINK(PageBreakTypeHdl_Impl
, weld::ComboBox
&, void);
286 DECL_LINK(PageNumBoxClickHdl_Impl
, weld::Toggleable
&, void);
287 DECL_LINK(KeepParaBoxClickHdl_Impl
, weld::Toggleable
&, void);
289 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
292 class SvxAsianTabPage
: public SfxTabPage
294 std::unique_ptr
<weld::CheckButton
> m_xForbiddenRulesCB
;
295 std::unique_ptr
<weld::CheckButton
> m_xHangingPunctCB
;
296 std::unique_ptr
<weld::CheckButton
> m_xScriptSpaceCB
;
299 SvxAsianTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
300 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
301 virtual ~SvxAsianTabPage() override
;
303 static WhichRangesContainer
GetRanges();
305 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
306 virtual void Reset( const SfxItemSet
* rSet
) override
;
307 virtual void ChangesApplied() override
;
311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */