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 .
19 #ifndef INCLUDED_CUI_SOURCE_INC_NUMPAGES_HXX
20 #define INCLUDED_CUI_SOURCE_INC_NUMPAGES_HXX
25 #include <sfx2/tabdlg.hxx>
26 #include <editeng/numdef.hxx>
27 #include <editeng/svxenum.hxx>
28 #include <svtools/ctrlbox.hxx>
29 #include <vcl/customweld.hxx>
30 #include <cui/numberingpreview.hxx>
32 #define MN_GALLERY_ENTRY 100
37 class SvxBmpNumValueSet
;
41 struct SvxNumSettings_Impl
43 SvxNumType nNumberType
;
44 short nParentNumbering
;
49 SvxNumSettings_Impl() :
50 nNumberType(SVX_NUM_CHARS_UPPER_LETTER
),
55 typedef std::vector
<std::unique_ptr
<SvxNumSettings_Impl
> > SvxNumSettingsArr_Impl
;
58 class SvxSingleNumPickTabPage final
: public SfxTabPage
60 SvxNumSettingsArr_Impl aNumSettingsArr
;
61 std::unique_ptr
<SvxNumRule
> pActNum
;
62 std::unique_ptr
<SvxNumRule
> pSaveNum
;
63 sal_uInt16 nActNumLvl
;
67 sal_uInt16 nNumItemId
;
69 std::unique_ptr
<NumValueSet
> m_xExamplesVS
;
70 std::unique_ptr
<weld::CustomWeld
> m_xExamplesVSWin
;
72 DECL_LINK(NumSelectHdl_Impl
, SvtValueSet
*, void);
73 DECL_LINK(DoubleClickHdl_Impl
, SvtValueSet
*, void);
76 SvxSingleNumPickTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
77 virtual ~SvxSingleNumPickTabPage() override
;
79 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
80 const SfxItemSet
* rAttrSet
);
82 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
83 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
84 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
85 virtual void Reset( const SfxItemSet
* rSet
) override
;
88 class SvxBulletPickTabPage final
: public SfxTabPage
90 std::unique_ptr
<SvxNumRule
> pActNum
;
91 std::unique_ptr
<SvxNumRule
> pSaveNum
;
92 sal_uInt16 nActNumLvl
;
95 sal_uInt16 nNumItemId
;
97 OUString sBulletCharFormatName
;
99 std::unique_ptr
<NumValueSet
> m_xExamplesVS
;
100 std::unique_ptr
<weld::CustomWeld
> m_xExamplesVSWin
;
102 DECL_LINK(NumSelectHdl_Impl
, SvtValueSet
*, void);
103 DECL_LINK(DoubleClickHdl_Impl
, SvtValueSet
*, void);
105 SvxBulletPickTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
106 virtual ~SvxBulletPickTabPage() override
;
108 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
109 const SfxItemSet
* rAttrSet
);
111 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
112 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
113 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
114 virtual void Reset( const SfxItemSet
* rSet
) override
;
116 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
119 #define NUM_VALUSET_COUNT 16
121 /// TabPage for complete numeration
122 class SvxNumPickTabPage final
: public SfxTabPage
124 OUString sNumCharFmtName
;
125 OUString sBulletCharFormatName
;
127 SvxNumSettingsArr_Impl aNumSettingsArrays
[NUM_VALUSET_COUNT
]; // is initialized with the five formats
129 std::unique_ptr
<SvxNumRule
> pActNum
;
130 std::unique_ptr
<SvxNumRule
> pSaveNum
;
131 sal_uInt16 nActNumLvl
;
132 sal_uInt16 nNumItemId
;
136 std::unique_ptr
<NumValueSet
> m_xExamplesVS
;
137 std::unique_ptr
<weld::CustomWeld
> m_xExamplesVSWin
;
139 DECL_LINK(NumSelectHdl_Impl
, SvtValueSet
*, void);
140 DECL_LINK(DoubleClickHdl_Impl
, SvtValueSet
*, void);
143 SvxNumPickTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
144 virtual ~SvxNumPickTabPage() override
;
146 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
147 const SfxItemSet
* rAttrSet
);
149 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
150 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
151 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
152 virtual void Reset( const SfxItemSet
* rSet
) override
;
154 void SetCharFormatNames(const OUString
& rCharName
, const OUString
& rBulName
)
155 { sNumCharFmtName
= rCharName
;
156 sBulletCharFormatName
= rBulName
;}
157 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
160 class SvxBitmapPickTabPage final
: public SfxTabPage
162 std::vector
<OUString
> aGrfNames
;
164 std::unique_ptr
<SvxNumRule
> pActNum
;
165 std::unique_ptr
<SvxNumRule
> pSaveNum
;
166 sal_uInt16 nActNumLvl
;
167 sal_uInt16 nNumItemId
;
172 std::unique_ptr
<weld::Label
> m_xErrorText
;
173 std::unique_ptr
<weld::Button
> m_xBtBrowseFile
;
174 std::unique_ptr
<SvxBmpNumValueSet
> m_xExamplesVS
;
175 std::unique_ptr
<weld::CustomWeld
> m_xExamplesVSWin
;
177 DECL_LINK(NumSelectHdl_Impl
, SvtValueSet
*, void);
178 DECL_LINK(DoubleClickHdl_Impl
, SvtValueSet
*, void);
179 DECL_LINK(ClickAddBrowseHdl_Impl
, weld::Button
&, void);
182 SvxBitmapPickTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
183 virtual ~SvxBitmapPickTabPage() override
;
185 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
,
186 const SfxItemSet
* rAttrSet
);
188 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
189 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
190 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
191 virtual void Reset( const SfxItemSet
* rSet
) override
;
194 class SvxNumOptionsTabPage
: public SfxTabPage
196 OUString m_sNumCharFmtName
;
197 OUString m_sBulletCharFormatName
;
199 Timer aInvalidateTimer
;
201 std::unique_ptr
<SvxNumRule
> pActNum
;
202 std::unique_ptr
<SvxNumRule
> pSaveNum
;
204 Size aInitSize
[SVX_MAX_NUM
];
206 bool bLastWidthModified
: 1;
209 bool bAutomaticCharStyles
: 1;
212 std::vector
<OUString
> aGrfNames
;
213 vcl::Font aActBulletFont
;
216 sal_uInt16 nActNumLvl
;
217 sal_uInt16 nNumItemId
;
220 SvxNumberingPreview m_aPreviewWIN
;
221 std::unique_ptr
<weld::Widget
> m_xGrid
;
222 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
223 std::unique_ptr
<weld::ComboBox
> m_xFmtLB
;
224 std::unique_ptr
<weld::Label
> m_xSeparatorFT
;
225 std::unique_ptr
<weld::Label
> m_xPrefixFT
;
226 std::unique_ptr
<weld::Entry
> m_xPrefixED
;
227 std::unique_ptr
<weld::Label
> m_xSuffixFT
;
228 std::unique_ptr
<weld::Entry
> m_xSuffixED
;
229 std::unique_ptr
<weld::Label
> m_xCharFmtFT
;
230 std::unique_ptr
<weld::ComboBox
> m_xCharFmtLB
;
231 std::unique_ptr
<weld::Label
> m_xBulColorFT
;
232 std::unique_ptr
<ColorListBox
> m_xBulColLB
;
233 std::unique_ptr
<weld::Label
> m_xBulRelSizeFT
;
234 std::unique_ptr
<weld::MetricSpinButton
> m_xBulRelSizeMF
;
235 std::unique_ptr
<weld::Label
> m_xAllLevelFT
;
236 std::unique_ptr
<weld::SpinButton
> m_xAllLevelNF
;
237 std::unique_ptr
<weld::Label
> m_xStartFT
;
238 std::unique_ptr
<weld::SpinButton
> m_xStartED
;
239 std::unique_ptr
<weld::Label
> m_xBulletFT
;
240 std::unique_ptr
<weld::Button
> m_xBulletPB
;
241 std::unique_ptr
<weld::Label
> m_xBitmapFT
;
242 std::unique_ptr
<weld::MenuButton
> m_xBitmapMB
;
243 std::unique_ptr
<weld::Label
> m_xWidthFT
;
244 std::unique_ptr
<weld::MetricSpinButton
> m_xWidthMF
;
245 std::unique_ptr
<weld::Label
> m_xHeightFT
;
246 std::unique_ptr
<weld::MetricSpinButton
> m_xHeightMF
;
247 std::unique_ptr
<weld::CheckButton
> m_xRatioCB
;
248 std::unique_ptr
<weld::Label
> m_xOrientFT
;
249 std::unique_ptr
<weld::ComboBox
> m_xOrientLB
;
250 std::unique_ptr
<weld::Widget
> m_xAllLevelsFrame
;
251 std::unique_ptr
<weld::Menu
> m_xGalleryMenu
;
252 std::unique_ptr
<weld::CheckButton
> m_xSameLevelCB
;
253 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWIN
;
256 /** To switch between the numbering type
260 void SwitchNumberType( sal_uInt8 nType
);
261 void CheckForStartValue_Impl(sal_uInt16 nNumberingType
);
263 DECL_LINK(NumberTypeSelectHdl_Impl
, weld::ComboBox
&, void);
264 DECL_LINK(LevelHdl_Impl
, weld::TreeView
&, void);
265 DECL_LINK(PopupActivateHdl_Impl
, weld::ToggleButton
&, void);
266 DECL_LINK(GraphicHdl_Impl
, const OString
&, void);
267 DECL_LINK(BulletHdl_Impl
, weld::Button
&, void);
268 DECL_LINK(SizeHdl_Impl
, weld::MetricSpinButton
&, void);
269 DECL_LINK(RatioHdl_Impl
, weld::ToggleButton
&, void);
270 DECL_LINK(CharFmtHdl_Impl
, weld::ComboBox
&, void);
271 DECL_LINK(EditModifyHdl_Impl
, weld::Entry
&, void);
272 DECL_LINK(EditListBoxHdl_Impl
, weld::ComboBox
&, void);
273 DECL_LINK(AllLevelHdl_Impl
, weld::SpinButton
&, void);
274 DECL_LINK(OrientHdl_Impl
, weld::ComboBox
&, void);
275 DECL_LINK(SameLevelHdl_Impl
, weld::ToggleButton
&, void);
276 DECL_LINK(BulColorHdl_Impl
, ColorListBox
&, void);
277 DECL_LINK(BulRelSizeHdl_Impl
, weld::MetricSpinButton
&, void);
278 DECL_LINK(PreviewInvalidateHdl_Impl
, Timer
*, void);
279 void EditModifyHdl_Impl(const weld::Entry
*);
282 SvxNumOptionsTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
283 virtual ~SvxNumOptionsTabPage() override
;
285 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
286 const SfxItemSet
* rAttrSet
);
288 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
289 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
290 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
291 virtual void Reset( const SfxItemSet
* rSet
) override
;
293 void SetCharFmts(const OUString
& rNumName
, const OUString
& rBulletName
)
295 m_sNumCharFmtName
= rNumName
;
296 m_sBulletCharFormatName
= rBulletName
;
298 void SetMetric(FieldUnit eSet
);
300 void SetModified(bool bRepaint
= true);
301 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
305 class SvxNumPositionTabPage
: public SfxTabPage
307 std::unique_ptr
<SvxNumRule
> pActNum
;
308 std::unique_ptr
<SvxNumRule
> pSaveNum
;
310 ImplSVEvent
* m_pLevelHdlEvent
;
311 sal_uInt16 nActNumLvl
;
312 sal_uInt16 nNumItemId
;
317 bool bInInintControl
: 1; // workaround for Modify-error, is said to be corrected from 391 on
318 bool bLabelAlignmentPosAndSpaceModeActive
;
320 SvxNumberingPreview m_aPreviewWIN
;
321 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
322 // former set of controls shown for numbering rules containing list level
323 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
324 std::unique_ptr
<weld::Label
> m_xDistBorderFT
;
325 std::unique_ptr
<weld::MetricSpinButton
> m_xDistBorderMF
;
326 std::unique_ptr
<weld::CheckButton
> m_xRelativeCB
;
327 std::unique_ptr
<weld::Label
> m_xIndentFT
;
328 std::unique_ptr
<weld::MetricSpinButton
> m_xIndentMF
;
329 std::unique_ptr
<weld::Label
> m_xDistNumFT
;
330 std::unique_ptr
<weld::MetricSpinButton
> m_xDistNumMF
;
331 std::unique_ptr
<weld::Label
> m_xAlignFT
;
332 std::unique_ptr
<weld::ComboBox
> m_xAlignLB
;
333 // new set of controls shown for numbering rules containing list level
334 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
335 std::unique_ptr
<weld::Label
> m_xLabelFollowedByFT
;
336 std::unique_ptr
<weld::ComboBox
> m_xLabelFollowedByLB
;
337 std::unique_ptr
<weld::Label
> m_xListtabFT
;
338 std::unique_ptr
<weld::MetricSpinButton
> m_xListtabMF
;
339 std::unique_ptr
<weld::Label
>m_xAlign2FT
;
340 std::unique_ptr
<weld::ComboBox
> m_xAlign2LB
;
341 std::unique_ptr
<weld::Label
> m_xAlignedAtFT
;
342 std::unique_ptr
<weld::MetricSpinButton
> m_xAlignedAtMF
;
343 std::unique_ptr
<weld::Label
> m_xIndentAtFT
;
344 std::unique_ptr
<weld::MetricSpinButton
> m_xIndentAtMF
;
345 std::unique_ptr
<weld::Button
> m_xStandardPB
;
346 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWIN
;
350 DECL_LINK(LevelHdl_Impl
, weld::TreeView
&, void);
351 DECL_LINK(LevelHdl
, void *, void);
352 DECL_LINK(EditModifyHdl_Impl
, weld::ComboBox
&, void);
353 DECL_LINK(DistanceHdl_Impl
, weld::MetricSpinButton
&, void);
354 DECL_LINK(DistanceFocusHdl_Impl
, Control
&, void);
355 DECL_LINK(RelativeHdl_Impl
, weld::ToggleButton
&, void);
356 DECL_LINK(StandardHdl_Impl
, weld::Button
&, void);
358 void InitPosAndSpaceMode();
359 void ShowControlsDependingOnPosAndSpaceMode();
361 DECL_LINK(LabelFollowedByHdl_Impl
, weld::ComboBox
&, void);
362 DECL_LINK(ListtabPosHdl_Impl
, weld::MetricSpinButton
&, void);
363 DECL_LINK(AlignAtHdl_Impl
, weld::MetricSpinButton
&, void);
364 DECL_LINK(IndentAtHdl_Impl
, weld::MetricSpinButton
&, void);
367 SvxNumPositionTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
368 virtual ~SvxNumPositionTabPage() override
;
370 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
371 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
372 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
373 virtual void Reset( const SfxItemSet
* rSet
) override
;
375 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
376 const SfxItemSet
* rAttrSet
);
378 void SetMetric(FieldUnit eSet
);
380 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
385 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */