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
;
50 SvxParaPrevWindow m_aExampleWin
;
53 bool m_bSplitLRSpace
= false; ///< which items to use?
54 SvxRelativeField m_aLeftIndent
;
56 SvxRelativeField m_aRightIndent
;
58 std::unique_ptr
<weld::Label
> m_xFLineLabel
;
59 SvxRelativeField m_aFLineIndent
;
60 std::unique_ptr
<weld::CheckButton
> m_xAutoCB
;
63 SvxRelativeField m_aTopDist
;
64 SvxRelativeField m_aBottomDist
;
65 std::unique_ptr
<weld::CheckButton
> m_xContextualCB
;
68 std::unique_ptr
<weld::ComboBox
> m_xLineDist
;
69 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtPercentBox
;
70 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtMetricBox
;
71 std::unique_ptr
<weld::MetricSpinButton
> m_xLineDistAtPlaceHolderBox
;
72 std::unique_ptr
<weld::Label
> m_xLineDistAtLabel
;
73 std::unique_ptr
<weld::Label
> m_xAbsDist
;
76 std::unique_ptr
<weld::CheckButton
> m_xRegisterCB
;
79 std::unique_ptr
<weld::CustomWeld
> m_xExampleWin
;
81 void SetLineSpacing_Impl( const SvxLineSpacingItem
& rAttr
);
83 void UpdateExample_Impl();
86 DECL_LINK(LineDistPopupHdl_Impl
, weld::ComboBox
&, void);
87 DECL_LINK(LineDistHdl_Impl
, weld::ComboBox
&, void);
88 DECL_LINK(ModifyHdl_Impl
, weld::MetricSpinButton
&, void);
89 DECL_LINK(AutoHdl_Impl
, weld::Toggleable
&, void);
91 bool m_bLineDistToggled
= false;
94 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
95 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
99 SvxStdParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
100 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
101 virtual ~SvxStdParagraphTabPage() override
;
103 DECL_LINK(ELRLoseFocusHdl
, weld::MetricSpinButton
&, void);
105 static const WhichRangesContainer
& GetRanges() { return pStdRanges
; }
107 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
108 virtual void Reset( const SfxItemSet
* rSet
) override
;
109 virtual void ChangesApplied() override
;
111 void EnableRelativeMode();
112 void EnableRegisterMode();
113 void EnableContextualMode();
114 void EnableAutoFirstLine();
115 void EnableNegativeMode();
116 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
119 // class SvxParaAlignTabPage ------------------------------------------------
121 class SvxParaAlignTabPage
: public SfxTabPage
123 static const WhichRangesContainer pAlignRanges
, pSdrAlignRanges
;
125 bool m_bSdrVertAlign
;
127 SvxParaPrevWindow m_aExampleWin
;
130 std::unique_ptr
<weld::RadioButton
> m_xLeft
;
131 std::unique_ptr
<weld::RadioButton
> m_xRight
;
132 std::unique_ptr
<weld::RadioButton
> m_xCenter
;
133 std::unique_ptr
<weld::RadioButton
> m_xJustify
;
134 std::unique_ptr
<weld::Label
> m_xLeftBottom
;
135 std::unique_ptr
<weld::Label
> m_xRightTop
;
137 std::unique_ptr
<weld::Label
> m_xLastLineFT
;
138 std::unique_ptr
<weld::ComboBox
> m_xLastLineLB
;
139 std::unique_ptr
<weld::CheckButton
> m_xExpandCB
;
141 std::unique_ptr
<weld::CheckButton
> m_xSnapToGridCB
;
144 std::unique_ptr
<weld::CustomWeld
> m_xExampleWin
;
146 std::unique_ptr
<weld::Widget
> m_xVertAlignFL
;
147 std::unique_ptr
<weld::ComboBox
> m_xVertAlignLB
;
148 std::unique_ptr
<weld::Label
> m_xVertAlign
;
149 std::unique_ptr
<weld::Label
> m_xVertAlignSdr
;
151 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextDirectionLB
;
153 DECL_LINK(AlignHdl_Impl
, weld::Toggleable
&, void);
154 DECL_LINK(LastLineHdl_Impl
, weld::ComboBox
&, void);
155 DECL_LINK(TextDirectionHdl_Impl
, weld::ComboBox
&, void);
157 void UpdateExample_Impl();
160 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
161 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
164 SvxParaAlignTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
165 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
166 virtual ~SvxParaAlignTabPage() override
;
168 static const WhichRangesContainer
& GetRanges() { return pAlignRanges
; }
169 static const WhichRangesContainer
& GetSdrRanges() { return pSdrAlignRanges
; }
171 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
172 virtual void Reset( const SfxItemSet
* rSet
) override
;
173 virtual void ChangesApplied() override
;
175 void EnableJustifyExt();
176 void EnableSdrVertAlign();
177 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
180 // class SvxExtParagraphTabPage ------------------------------------------
183 With this TabPage special attributes of a paragraph can be set
184 (hyphenation, pagebreak, orphan, widow, ...).
187 <SvxHyphenZoneItem><SID_ATTR_PARA_HYPHENZONE>
188 <SvxFormatBreakItem><SID_ATTR_PARA_PAGEBREAK>
189 <SvxFormatSplitItem><SID_ATTR_PARA_SPLIT>
190 <SvxWidowsItem><SID_ATTR_PARA_WIDOWS>
191 <SvxOrphansItem><SID_ATTR_PARA_ORPHANS>
194 class SvxExtParagraphTabPage
: public SfxTabPage
196 static const WhichRangesContainer pExtRanges
;
199 SvxExtParagraphTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
200 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
201 const SfxItemSet
* rSet
);
202 virtual ~SvxExtParagraphTabPage() override
;
204 static const WhichRangesContainer
& GetRanges() { return pExtRanges
; }
206 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
207 virtual void Reset( const SfxItemSet
* rSet
) override
;
208 virtual void ChangesApplied() override
;
210 void DisablePageBreak();
213 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
216 weld::TriStateEnabled aHyphenState
;
217 weld::TriStateEnabled aPageBreakState
;
218 weld::TriStateEnabled aApplyCollState
;
219 weld::TriStateEnabled aPageNumState
;
220 weld::TriStateEnabled aAllowSplitState
;
221 weld::TriStateEnabled aKeepParaState
;
222 weld::TriStateEnabled aOrphanState
;
223 weld::TriStateEnabled aWidowState
;
224 weld::TriStateEnabled aAcrossParagraphState
;
225 weld::TriStateEnabled aAcrossColumnState
;
226 weld::TriStateEnabled aAcrossPageState
;
227 weld::TriStateEnabled aAcrossSpreadState
;
234 std::unique_ptr
<weld::CheckButton
> m_xHyphenBox
;
235 std::unique_ptr
<weld::CheckButton
> m_xHyphenNoCapsBox
;
236 std::unique_ptr
<weld::CheckButton
> m_xHyphenNoLastWordBox
;
237 std::unique_ptr
<weld::Label
> m_xBeforeText
;
238 std::unique_ptr
<weld::SpinButton
> m_xExtHyphenBeforeBox
;
239 std::unique_ptr
<weld::Label
> m_xAfterText
;
240 std::unique_ptr
<weld::SpinButton
> m_xExtHyphenAfterBox
;
241 std::unique_ptr
<weld::Label
> m_xCompoundBeforeText
;
242 std::unique_ptr
<weld::SpinButton
> m_xExtCompoundHyphenBeforeBox
;
243 std::unique_ptr
<weld::Label
> m_xMaxHyphenLabel
;
244 std::unique_ptr
<weld::SpinButton
> m_xMaxHyphenEdit
;
245 std::unique_ptr
<weld::Label
> m_xMinWordLabel
;
246 std::unique_ptr
<weld::SpinButton
> m_xMinWordLength
;
247 std::unique_ptr
<weld::Label
> m_xHyphenZoneLabel
;
248 SvxRelativeField m_aHyphenZone
;
251 std::unique_ptr
<weld::CheckButton
> m_xPageBreakBox
;
252 std::unique_ptr
<weld::Label
> m_xBreakTypeFT
;
253 std::unique_ptr
<weld::ComboBox
> m_xBreakTypeLB
;
254 std::unique_ptr
<weld::Label
> m_xBreakPositionFT
;
255 std::unique_ptr
<weld::ComboBox
> m_xBreakPositionLB
;
256 std::unique_ptr
<weld::CheckButton
> m_xApplyCollBtn
;
257 std::unique_ptr
<weld::ComboBox
> m_xApplyCollBox
;
258 std::unique_ptr
<weld::CheckButton
> m_xPageNumBox
;
259 std::unique_ptr
<weld::SpinButton
> m_xPagenumEdit
;
261 // paragraph division
262 std::unique_ptr
<weld::CheckButton
> m_xAllowSplitBox
;
263 std::unique_ptr
<weld::CheckButton
> m_xKeepParaBox
;
266 std::unique_ptr
<weld::CheckButton
> m_xOrphanBox
;
267 std::unique_ptr
<weld::SpinButton
> m_xOrphanRowNo
;
268 std::unique_ptr
<weld::Label
> m_xOrphanRowLabel
;
270 std::unique_ptr
<weld::CheckButton
> m_xWidowBox
;
271 std::unique_ptr
<weld::SpinButton
> m_xWidowRowNo
;
272 std::unique_ptr
<weld::Label
> m_xWidowRowLabel
;
274 // avoid hyphenation across
275 std::unique_ptr
<weld::Label
> m_xAcrossText
;
276 std::unique_ptr
<weld::CheckButton
> m_xAcrossParagraphBox
;
277 std::unique_ptr
<weld::CheckButton
> m_xAcrossColumnBox
;
278 std::unique_ptr
<weld::CheckButton
> m_xAcrossPageBox
;
279 std::unique_ptr
<weld::CheckButton
> m_xAcrossSpreadBox
;
281 void HyphenClickHdl();
282 void PageNumBoxClickHdl();
283 void ApplyCollClickHdl();
285 void AllowSplitHdl();
289 DECL_LINK(PageBreakHdl_Impl
, weld::Toggleable
&, void);
290 DECL_LINK(AllowSplitHdl_Impl
, weld::Toggleable
&, void);
291 DECL_LINK(WidowHdl_Impl
, weld::Toggleable
&, void);
292 DECL_LINK(OrphanHdl_Impl
, weld::Toggleable
&, void);
293 DECL_LINK(HyphenClickHdl_Impl
, weld::Toggleable
&, void);
294 DECL_LINK(ApplyCollClickHdl_Impl
, weld::Toggleable
&, void);
295 DECL_LINK(PageBreakPosHdl_Impl
, weld::ComboBox
&, void);
296 DECL_LINK(PageBreakTypeHdl_Impl
, weld::ComboBox
&, void);
297 DECL_LINK(PageNumBoxClickHdl_Impl
, weld::Toggleable
&, void);
298 DECL_LINK(KeepParaBoxClickHdl_Impl
, weld::Toggleable
&, void);
299 DECL_LINK(AcrossParagraphHdl_Impl
, weld::Toggleable
&, void);
300 DECL_LINK(AcrossColumnHdl_Impl
, weld::Toggleable
&, void);
301 DECL_LINK(AcrossPageHdl_Impl
, weld::Toggleable
&, void);
302 DECL_LINK(AcrossSpreadHdl_Impl
, weld::Toggleable
&, void);
304 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
307 class SvxAsianTabPage
: public SfxTabPage
309 std::unique_ptr
<weld::CheckButton
> m_xForbiddenRulesCB
;
310 std::unique_ptr
<weld::CheckButton
> m_xHangingPunctCB
;
311 std::unique_ptr
<weld::CheckButton
> m_xScriptSpaceCB
;
314 SvxAsianTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
315 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
316 virtual ~SvxAsianTabPage() override
;
318 static const WhichRangesContainer
& GetRanges();
320 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
321 virtual void Reset( const SfxItemSet
* rSet
) override
;
322 virtual void ChangesApplied() override
;
326 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */