Bump version to 6.4.7.2.M8
[LibreOffice.git] / cui / source / inc / numpages.hxx
blob8b45dc53205b9e50ccdf6f15709bb6af8eaef45e
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 <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
34 class ColorListBox;
35 class NumValueSet;
36 class SvxNumRule;
37 class SvxBmpNumValueSet;
38 class SvxBrushItem;
39 class ValueSet;
41 struct SvxNumSettings_Impl
43 SvxNumType nNumberType;
44 short nParentNumbering;
45 OUString sPrefix;
46 OUString sSuffix;
47 OUString sBulletChar;
48 OUString sBulletFont;
49 SvxNumSettings_Impl() :
50 nNumberType(SVX_NUM_CHARS_UPPER_LETTER),
51 nParentNumbering(0)
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;
64 bool bModified : 1;
65 bool bPreset : 1;
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);
75 public:
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;
93 bool bModified : 1;
94 bool bPreset : 1;
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);
104 public:
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;
133 bool bModified : 1;
134 bool bPreset : 1;
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);
142 public:
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;
168 MapUnit eCoreUnit;
169 bool bModified : 1;
170 bool bPreset : 1;
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);
181 public:
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 ImplSVEvent* m_pLevelHdlEvent;
208 bool bLastWidthModified : 1;
209 bool bModified : 1;
210 bool bPreset : 1;
211 bool bAutomaticCharStyles: 1;
212 bool bHTMLMode : 1;
214 std::vector<OUString> aGrfNames;
215 vcl::Font aActBulletFont;
217 sal_uInt8 nBullet;
218 sal_uInt16 nActNumLvl;
219 sal_uInt16 nNumItemId;
220 MapUnit eCoreUnit;
222 SvxNumberingPreview m_aPreviewWIN;
223 std::unique_ptr<weld::Widget> m_xGrid;
224 std::unique_ptr<weld::TreeView> m_xLevelLB;
225 std::unique_ptr<weld::ComboBox> m_xFmtLB;
226 std::unique_ptr<weld::Label> m_xSeparatorFT;
227 std::unique_ptr<weld::Label> m_xPrefixFT;
228 std::unique_ptr<weld::Entry> m_xPrefixED;
229 std::unique_ptr<weld::Label> m_xSuffixFT;
230 std::unique_ptr<weld::Entry> m_xSuffixED;
231 std::unique_ptr<weld::Label> m_xCharFmtFT;
232 std::unique_ptr<weld::ComboBox> m_xCharFmtLB;
233 std::unique_ptr<weld::Label> m_xBulColorFT;
234 std::unique_ptr<ColorListBox> m_xBulColLB;
235 std::unique_ptr<weld::Label> m_xBulRelSizeFT;
236 std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
237 std::unique_ptr<weld::Label> m_xAllLevelFT;
238 std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
239 std::unique_ptr<weld::Label> m_xStartFT;
240 std::unique_ptr<weld::SpinButton> m_xStartED;
241 std::unique_ptr<weld::Label> m_xBulletFT;
242 std::unique_ptr<weld::Button> m_xBulletPB;
243 std::unique_ptr<weld::Label> m_xBitmapFT;
244 std::unique_ptr<weld::MenuButton> m_xBitmapMB;
245 std::unique_ptr<weld::Label> m_xWidthFT;
246 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
247 std::unique_ptr<weld::Label> m_xHeightFT;
248 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
249 std::unique_ptr<weld::CheckButton> m_xRatioCB;
250 std::unique_ptr<weld::Label> m_xOrientFT;
251 std::unique_ptr<weld::ComboBox> m_xOrientLB;
252 std::unique_ptr<weld::Widget> m_xAllLevelsFrame;
253 std::unique_ptr<weld::Menu> m_xGalleryMenu;
254 std::unique_ptr<weld::CheckButton> m_xSameLevelCB;
255 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
257 void InitControls();
258 /** To switch between the numbering type
259 0 - Number;
260 1 - Bullet;
261 2 - Bitmap; */
262 void SwitchNumberType( sal_uInt8 nType );
263 void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
265 DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
266 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
267 DECL_LINK(LevelHdl, void *, void);
268 DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void);
269 DECL_LINK(GraphicHdl_Impl, const OString&, void);
270 DECL_LINK(BulletHdl_Impl, weld::Button&, void);
271 DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
272 DECL_LINK(RatioHdl_Impl, weld::ToggleButton&, void);
273 DECL_LINK(CharFmtHdl_Impl, weld::ComboBox&, void);
274 DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
275 DECL_LINK(EditListBoxHdl_Impl, weld::ComboBox&, void);
276 DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void);
277 DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
278 DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
279 DECL_LINK(SameLevelHdl_Impl, weld::ToggleButton&, void);
280 DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
281 DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void);
282 DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
283 void EditModifyHdl_Impl(const weld::Entry*);
285 public:
286 SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
287 virtual ~SvxNumOptionsTabPage() override;
289 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
290 const SfxItemSet* rAttrSet);
292 virtual void ActivatePage(const SfxItemSet& rSet) override;
293 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
294 virtual bool FillItemSet( SfxItemSet* rSet ) override;
295 virtual void Reset( const SfxItemSet* rSet ) override;
297 void SetCharFmts(const OUString& rNumName, const OUString& rBulletName)
299 m_sNumCharFmtName = rNumName;
300 m_sBulletCharFormatName = rBulletName;
302 void SetMetric(FieldUnit eSet);
304 void SetModified(bool bRepaint = true);
305 virtual void PageCreated(const SfxAllItemSet& aSet) override;
309 class SvxNumPositionTabPage : public SfxTabPage
311 std::unique_ptr<SvxNumRule> pActNum;
312 std::unique_ptr<SvxNumRule> pSaveNum;
314 ImplSVEvent* m_pLevelHdlEvent;
315 sal_uInt16 nActNumLvl;
316 sal_uInt16 nNumItemId;
317 MapUnit eCoreUnit;
319 bool bModified : 1;
320 bool bPreset : 1;
321 bool bInInintControl : 1; // workaround for Modify-error, is said to be corrected from 391 on
322 bool bLabelAlignmentPosAndSpaceModeActive;
324 SvxNumberingPreview m_aPreviewWIN;
325 std::unique_ptr<weld::TreeView> m_xLevelLB;
326 // former set of controls shown for numbering rules containing list level
327 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
328 std::unique_ptr<weld::Label> m_xDistBorderFT;
329 std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF;
330 std::unique_ptr<weld::CheckButton> m_xRelativeCB;
331 std::unique_ptr<weld::Label> m_xIndentFT;
332 std::unique_ptr<weld::MetricSpinButton> m_xIndentMF;
333 std::unique_ptr<weld::Label> m_xDistNumFT;
334 std::unique_ptr<weld::MetricSpinButton> m_xDistNumMF;
335 std::unique_ptr<weld::Label> m_xAlignFT;
336 std::unique_ptr<weld::ComboBox> m_xAlignLB;
337 // new set of controls shown for numbering rules containing list level
338 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
339 std::unique_ptr<weld::Label> m_xLabelFollowedByFT;
340 std::unique_ptr<weld::ComboBox> m_xLabelFollowedByLB;
341 std::unique_ptr<weld::Label> m_xListtabFT;
342 std::unique_ptr<weld::MetricSpinButton> m_xListtabMF;
343 std::unique_ptr<weld::Label>m_xAlign2FT;
344 std::unique_ptr<weld::ComboBox> m_xAlign2LB;
345 std::unique_ptr<weld::Label> m_xAlignedAtFT;
346 std::unique_ptr<weld::MetricSpinButton> m_xAlignedAtMF;
347 std::unique_ptr<weld::Label> m_xIndentAtFT;
348 std::unique_ptr<weld::MetricSpinButton> m_xIndentAtMF;
349 std::unique_ptr<weld::Button> m_xStandardPB;
350 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
352 void InitControls();
354 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
355 DECL_LINK(LevelHdl, void *, void);
356 DECL_LINK(EditModifyHdl_Impl, weld::ComboBox&, void);
357 DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void);
358 DECL_LINK(DistanceFocusHdl_Impl, Control&, void);
359 DECL_LINK(RelativeHdl_Impl, weld::ToggleButton&, void);
360 DECL_LINK(StandardHdl_Impl, weld::Button&, void);
362 void InitPosAndSpaceMode();
363 void ShowControlsDependingOnPosAndSpaceMode();
365 DECL_LINK(LabelFollowedByHdl_Impl, weld::ComboBox&, void);
366 DECL_LINK(ListtabPosHdl_Impl, weld::MetricSpinButton&, void);
367 DECL_LINK(AlignAtHdl_Impl, weld::MetricSpinButton&, void);
368 DECL_LINK(IndentAtHdl_Impl, weld::MetricSpinButton&, void);
370 public:
371 SvxNumPositionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
372 virtual ~SvxNumPositionTabPage() override;
374 virtual void ActivatePage(const SfxItemSet& rSet) override;
375 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
376 virtual bool FillItemSet( SfxItemSet* rSet ) override;
377 virtual void Reset( const SfxItemSet* rSet ) override;
379 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
380 const SfxItemSet* rAttrSet);
382 void SetMetric(FieldUnit eSet);
383 void SetModified();
384 virtual void PageCreated(const SfxAllItemSet& aSet) override;
387 #endif
389 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */