bump product version to 6.3.0.0.beta1
[LibreOffice.git] / cui / source / inc / numpages.hxx
blob183f1d7825ac429cf8f9733b4bd26e7ca09385e5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
22 #include <vector>
23 #include <memory>
25 #include <sfx2/tabdlg.hxx>
26 #include <svx/Palette.hxx>
27 #include <editeng/numdef.hxx>
28 #include <editeng/svxenum.hxx>
29 #include <svtools/ctrlbox.hxx>
30 #include <vcl/customweld.hxx>
31 #include <cui/numberingpreview.hxx>
33 #define MN_GALLERY_ENTRY 100
35 class ColorListBox;
36 class NumValueSet;
37 class SvxNumRule;
38 class SvxBmpNumValueSet;
39 class SvxBrushItem;
40 class ValueSet;
42 struct SvxNumSettings_Impl
44 SvxNumType nNumberType;
45 short nParentNumbering;
46 OUString sPrefix;
47 OUString sSuffix;
48 OUString sBulletChar;
49 OUString sBulletFont;
50 SvxNumSettings_Impl() :
51 nNumberType(SVX_NUM_CHARS_UPPER_LETTER),
52 nParentNumbering(0)
56 typedef std::vector<std::unique_ptr<SvxNumSettings_Impl> > SvxNumSettingsArr_Impl;
59 class SvxSingleNumPickTabPage final : public SfxTabPage
61 using TabPage::ActivatePage;
62 using TabPage::DeactivatePage;
64 SvxNumSettingsArr_Impl aNumSettingsArr;
65 std::unique_ptr<SvxNumRule> pActNum;
66 std::unique_ptr<SvxNumRule> pSaveNum;
67 sal_uInt16 nActNumLvl;
68 bool bModified : 1;
69 bool bPreset : 1;
71 sal_uInt16 nNumItemId;
73 std::unique_ptr<NumValueSet> m_xExamplesVS;
74 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
76 DECL_LINK(NumSelectHdl_Impl, SvtValueSet*, void);
77 DECL_LINK(DoubleClickHdl_Impl, SvtValueSet*, void);
79 public:
80 SvxSingleNumPickTabPage(TabPageParent pParent, const SfxItemSet& rSet);
81 virtual ~SvxSingleNumPickTabPage() override;
82 virtual void dispose() override;
84 static VclPtr<SfxTabPage> Create( TabPageParent pParent,
85 const SfxItemSet* rAttrSet);
87 virtual void ActivatePage(const SfxItemSet& rSet) override;
88 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
89 virtual bool FillItemSet( SfxItemSet* rSet ) override;
90 virtual void Reset( const SfxItemSet* rSet ) override;
93 class SvxBulletPickTabPage final : public SfxTabPage
95 using TabPage::ActivatePage;
96 using TabPage::DeactivatePage;
98 std::unique_ptr<SvxNumRule> pActNum;
99 std::unique_ptr<SvxNumRule> pSaveNum;
100 sal_uInt16 nActNumLvl;
101 bool bModified : 1;
102 bool bPreset : 1;
103 sal_uInt16 nNumItemId;
105 OUString sBulletCharFormatName;
107 std::unique_ptr<NumValueSet> m_xExamplesVS;
108 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
110 DECL_LINK(NumSelectHdl_Impl, SvtValueSet*, void);
111 DECL_LINK(DoubleClickHdl_Impl, SvtValueSet*, void);
112 public:
113 SvxBulletPickTabPage(TabPageParent pParent, const SfxItemSet& rSet);
114 virtual ~SvxBulletPickTabPage() override;
115 virtual void dispose() override;
117 static VclPtr<SfxTabPage> Create( TabPageParent pParent,
118 const SfxItemSet* rAttrSet);
120 virtual void ActivatePage(const SfxItemSet& rSet) override;
121 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
122 virtual bool FillItemSet( SfxItemSet* rSet ) override;
123 virtual void Reset( const SfxItemSet* rSet ) override;
125 virtual void PageCreated(const SfxAllItemSet& aSet) override;
128 #define NUM_VALUSET_COUNT 16
130 /// TabPage for complete numeration
131 class SvxNumPickTabPage final : public SfxTabPage
133 using TabPage::ActivatePage;
134 using TabPage::DeactivatePage;
136 OUString sNumCharFmtName;
137 OUString sBulletCharFormatName;
139 SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // is initialized with the five formats
141 std::unique_ptr<SvxNumRule> pActNum;
142 std::unique_ptr<SvxNumRule> pSaveNum;
143 sal_uInt16 nActNumLvl;
144 sal_uInt16 nNumItemId;
145 bool bModified : 1;
146 bool bPreset : 1;
148 std::unique_ptr<NumValueSet> m_xExamplesVS;
149 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
151 DECL_LINK(NumSelectHdl_Impl, SvtValueSet*, void);
152 DECL_LINK(DoubleClickHdl_Impl, SvtValueSet*, void);
154 public:
155 SvxNumPickTabPage(TabPageParent pParent, const SfxItemSet& rSet);
156 virtual ~SvxNumPickTabPage() override;
157 virtual void dispose() override;
159 static VclPtr<SfxTabPage> Create( TabPageParent pParent,
160 const SfxItemSet* rAttrSet);
162 virtual void ActivatePage(const SfxItemSet& rSet) override;
163 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
164 virtual bool FillItemSet( SfxItemSet* rSet ) override;
165 virtual void Reset( const SfxItemSet* rSet ) override;
167 void SetCharFormatNames(const OUString& rCharName, const OUString& rBulName)
168 { sNumCharFmtName = rCharName;
169 sBulletCharFormatName = rBulName;}
170 virtual void PageCreated(const SfxAllItemSet& aSet) override;
173 class SvxBitmapPickTabPage final : public SfxTabPage
175 using TabPage::ActivatePage;
176 using TabPage::DeactivatePage;
178 std::vector<OUString> aGrfNames;
180 std::unique_ptr<SvxNumRule> pActNum;
181 std::unique_ptr<SvxNumRule> pSaveNum;
182 sal_uInt16 nActNumLvl;
183 sal_uInt16 nNumItemId;
184 MapUnit eCoreUnit;
185 bool bModified : 1;
186 bool bPreset : 1;
188 std::unique_ptr<weld::Label> m_xErrorText;
189 std::unique_ptr<weld::Button> m_xBtBrowseFile;
190 std::unique_ptr<SvxBmpNumValueSet> m_xExamplesVS;
191 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
193 DECL_LINK(NumSelectHdl_Impl, SvtValueSet*, void);
194 DECL_LINK(DoubleClickHdl_Impl, SvtValueSet*, void);
195 DECL_LINK(ClickAddBrowseHdl_Impl, weld::Button&, void);
197 public:
198 SvxBitmapPickTabPage(TabPageParent pParent, const SfxItemSet& rSet);
199 virtual ~SvxBitmapPickTabPage() override;
200 virtual void dispose() override;
202 static VclPtr<SfxTabPage> Create(TabPageParent pParent,
203 const SfxItemSet* rAttrSet);
205 virtual void ActivatePage(const SfxItemSet& rSet) override;
206 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
207 virtual bool FillItemSet( SfxItemSet* rSet ) override;
208 virtual void Reset( const SfxItemSet* rSet ) override;
211 class SvxNumOptionsTabPage : public SfxTabPage
213 using TabPage::ActivatePage;
214 using TabPage::DeactivatePage;
216 OUString m_sNumCharFmtName;
217 OUString m_sBulletCharFormatName;
219 Timer aInvalidateTimer;
221 std::unique_ptr<SvxNumRule> pActNum;
222 std::unique_ptr<SvxNumRule> pSaveNum;
224 Size aInitSize[SVX_MAX_NUM];
226 bool bLastWidthModified : 1;
227 bool bModified : 1;
228 bool bPreset : 1;
229 bool bAutomaticCharStyles: 1;
230 bool bHTMLMode : 1;
232 std::vector<OUString> aGrfNames;
233 vcl::Font aActBulletFont;
235 sal_uInt8 nBullet;
236 sal_uInt16 nActNumLvl;
237 sal_uInt16 nNumItemId;
238 MapUnit eCoreUnit;
240 SvxNumberingPreview m_aPreviewWIN;
241 std::unique_ptr<weld::Widget> m_xGrid;
242 std::unique_ptr<weld::TreeView> m_xLevelLB;
243 std::unique_ptr<weld::ComboBox> m_xFmtLB;
244 std::unique_ptr<weld::Label> m_xSeparatorFT;
245 std::unique_ptr<weld::Label> m_xPrefixFT;
246 std::unique_ptr<weld::Entry> m_xPrefixED;
247 std::unique_ptr<weld::Label> m_xSuffixFT;
248 std::unique_ptr<weld::Entry> m_xSuffixED;
249 std::unique_ptr<weld::Label> m_xCharFmtFT;
250 std::unique_ptr<weld::ComboBox> m_xCharFmtLB;
251 std::unique_ptr<weld::Label> m_xBulColorFT;
252 std::unique_ptr<ColorListBox> m_xBulColLB;
253 std::unique_ptr<weld::Label> m_xBulRelSizeFT;
254 std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
255 std::unique_ptr<weld::Label> m_xAllLevelFT;
256 std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
257 std::unique_ptr<weld::Label> m_xStartFT;
258 std::unique_ptr<weld::SpinButton> m_xStartED;
259 std::unique_ptr<weld::Label> m_xBulletFT;
260 std::unique_ptr<weld::Button> m_xBulletPB;
261 std::unique_ptr<weld::Label> m_xBitmapFT;
262 std::unique_ptr<weld::MenuButton> m_xBitmapMB;
263 std::unique_ptr<weld::Label> m_xWidthFT;
264 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
265 std::unique_ptr<weld::Label> m_xHeightFT;
266 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
267 std::unique_ptr<weld::CheckButton> m_xRatioCB;
268 std::unique_ptr<weld::Label> m_xOrientFT;
269 std::unique_ptr<weld::ComboBox> m_xOrientLB;
270 std::unique_ptr<weld::Widget> m_xAllLevelsFrame;
271 std::unique_ptr<weld::Menu> m_xGalleryMenu;
272 std::unique_ptr<weld::CheckButton> m_xSameLevelCB;
273 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
275 void InitControls();
276 /** To switch between the numbering type
277 0 - Number;
278 1 - Bullet;
279 2 - Bitmap; */
280 void SwitchNumberType( sal_uInt8 nType );
281 void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
283 DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
284 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
285 DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void);
286 DECL_LINK(GraphicHdl_Impl, const OString&, void);
287 DECL_LINK(BulletHdl_Impl, weld::Button&, void);
288 DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
289 DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void);
290 DECL_LINK(CharFmtHdl_Impl, weld::ComboBox&, void);
291 DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
292 DECL_LINK(EditListBoxHdl_Impl, weld::ComboBox&, void);
293 DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
294 DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
295 DECL_LINK(SameLevelHdl_Impl, weld::ToggleButton&, void);
296 DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
297 DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void);
298 DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
299 void EditModifyHdl_Impl(const weld::Entry*);
301 public:
302 SvxNumOptionsTabPage(TabPageParent pParent, const SfxItemSet& rSet);
303 virtual ~SvxNumOptionsTabPage() override;
304 virtual void dispose() override;
306 static VclPtr<SfxTabPage> Create( TabPageParent pParent,
307 const SfxItemSet* rAttrSet);
309 virtual void ActivatePage(const SfxItemSet& rSet) override;
310 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
311 virtual bool FillItemSet( SfxItemSet* rSet ) override;
312 virtual void Reset( const SfxItemSet* rSet ) override;
314 void SetCharFmts(const OUString& rNumName, const OUString& rBulletName)
316 m_sNumCharFmtName = rNumName;
317 m_sBulletCharFormatName = rBulletName;
319 void SetMetric(FieldUnit eSet);
321 void SetModified(bool bRepaint = true);
322 virtual void PageCreated(const SfxAllItemSet& aSet) override;
326 class SvxNumPositionTabPage : public SfxTabPage
328 using TabPage::ActivatePage;
329 using TabPage::DeactivatePage;
331 std::unique_ptr<SvxNumRule> pActNum;
332 std::unique_ptr<SvxNumRule> pSaveNum;
334 sal_uInt16 nActNumLvl;
335 sal_uInt16 nNumItemId;
336 MapUnit eCoreUnit;
338 bool bModified : 1;
339 bool bPreset : 1;
340 bool bInInintControl : 1; // workaround for Modify-error, is said to be corrected from 391 on
341 bool bLabelAlignmentPosAndSpaceModeActive;
343 SvxNumberingPreview m_aPreviewWIN;
344 std::unique_ptr<weld::TreeView> m_xLevelLB;
345 // former set of controls shown for numbering rules containing list level
346 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
347 std::unique_ptr<weld::Label> m_xDistBorderFT;
348 std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF;
349 std::unique_ptr<weld::CheckButton> m_xRelativeCB;
350 std::unique_ptr<weld::Label> m_xIndentFT;
351 std::unique_ptr<weld::MetricSpinButton> m_xIndentMF;
352 std::unique_ptr<weld::Label> m_xDistNumFT;
353 std::unique_ptr<weld::MetricSpinButton> m_xDistNumMF;
354 std::unique_ptr<weld::Label> m_xAlignFT;
355 std::unique_ptr<weld::ComboBox> m_xAlignLB;
356 // new set of controls shown for numbering rules containing list level
357 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
358 std::unique_ptr<weld::Label> m_xLabelFollowedByFT;
359 std::unique_ptr<weld::ComboBox> m_xLabelFollowedByLB;
360 std::unique_ptr<weld::Label> m_xListtabFT;
361 std::unique_ptr<weld::MetricSpinButton> m_xListtabMF;
362 std::unique_ptr<weld::Label>m_xAlign2FT;
363 std::unique_ptr<weld::ComboBox> m_xAlign2LB;
364 std::unique_ptr<weld::Label> m_xAlignedAtFT;
365 std::unique_ptr<weld::MetricSpinButton> m_xAlignedAtMF;
366 std::unique_ptr<weld::Label> m_xIndentAtFT;
367 std::unique_ptr<weld::MetricSpinButton> m_xIndentAtMF;
368 std::unique_ptr<weld::Button> m_xStandardPB;
369 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
371 void InitControls();
373 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
374 DECL_LINK(EditModifyHdl_Impl, weld::ComboBox&, void);
375 DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void);
376 DECL_LINK(DistanceFocusHdl_Impl, Control&, void);
377 DECL_LINK(RelativeHdl_Impl, weld::ToggleButton&, void);
378 DECL_LINK(StandardHdl_Impl, weld::Button&, void);
380 void InitPosAndSpaceMode();
381 void ShowControlsDependingOnPosAndSpaceMode();
383 DECL_LINK(LabelFollowedByHdl_Impl, weld::ComboBox&, void);
384 DECL_LINK(ListtabPosHdl_Impl, weld::MetricSpinButton&, void);
385 DECL_LINK(AlignAtHdl_Impl, weld::MetricSpinButton&, void);
386 DECL_LINK(IndentAtHdl_Impl, weld::MetricSpinButton&, void);
388 public:
389 SvxNumPositionTabPage(TabPageParent pParent, const SfxItemSet& rSet);
390 virtual ~SvxNumPositionTabPage() override;
391 virtual void dispose() override;
393 virtual void ActivatePage(const SfxItemSet& rSet) override;
394 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
395 virtual bool FillItemSet( SfxItemSet* rSet ) override;
396 virtual void Reset( const SfxItemSet* rSet ) override;
398 static VclPtr<SfxTabPage> Create( TabPageParent pParent,
399 const SfxItemSet* rAttrSet);
401 void SetMetric(FieldUnit eSet);
402 void SetModified();
403 virtual void PageCreated(const SfxAllItemSet& aSet) override;
406 #endif
408 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */