sd: keep a non-owning pointer to the OverridingShell
[LibreOffice.git] / cui / source / inc / numpages.hxx
blobacfc0d2a1433a9ee2e74cb67551a1c039b9c01e6
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 #pragma once
21 #include <vector>
22 #include <memory>
24 #include <sfx2/tabdlg.hxx>
25 #include <editeng/numdef.hxx>
26 #include <editeng/svxenum.hxx>
27 #include <svtools/ctrlbox.hxx>
28 #include <svx/numberingpreview.hxx>
29 #include <vcl/customweld.hxx>
30 #include <vcl/timer.hxx>
31 #include <svx/dlgutil.hxx>
33 #define MN_GALLERY_ENTRY 100
35 class ColorListBox;
36 class SvxNumValueSet;
37 class SvxNumRule;
38 class SvxBmpNumValueSet;
39 class SvxBrushItem;
40 struct ImplSVEvent;
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 SvxNumSettingsArr_Impl aNumSettingsArr;
62 std::unique_ptr<SvxNumRule> pActNum;
63 std::unique_ptr<SvxNumRule> pSaveNum;
64 sal_uInt16 nActNumLvl;
65 bool bModified : 1;
66 bool bPreset : 1;
67 TypedWhichId<SvxNumBulletItem> nNumItemId;
69 std::unique_ptr<SvxNumValueSet> m_xExamplesVS;
70 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
72 DECL_LINK(NumSelectHdl_Impl, ValueSet*, void);
73 DECL_LINK(DoubleClickHdl_Impl, ValueSet*, 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 TypedWhichId<SvxNumBulletItem> nNumItemId;
97 OUString sBulletCharFormatName;
99 std::unique_ptr<weld::Button> m_xBtChangeBullet;
100 std::unique_ptr<SvxNumValueSet> m_xExamplesVS;
101 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
102 css::uno::Sequence<OUString> m_aBulletSymbols;
103 css::uno::Sequence<OUString> m_aBulletSymbolsFonts;
105 DECL_LINK(NumSelectHdl_Impl, ValueSet*, void);
106 DECL_LINK(DoubleClickHdl_Impl, ValueSet*, void);
107 DECL_LINK(ClickAddChangeHdl_Impl, weld::Button&, void);
108 public:
109 SvxBulletPickTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
110 virtual ~SvxBulletPickTabPage() override;
112 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
113 const SfxItemSet* rAttrSet);
115 virtual void ActivatePage(const SfxItemSet& rSet) override;
116 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
117 virtual bool FillItemSet( SfxItemSet* rSet ) override;
118 virtual void Reset( const SfxItemSet* rSet ) override;
120 virtual void PageCreated(const SfxAllItemSet& aSet) override;
123 #define NUM_VALUSET_COUNT 16
125 /// TabPage for complete numeration
126 class SvxNumPickTabPage final : public SfxTabPage
128 OUString sNumCharFmtName;
129 OUString sBulletCharFormatName;
131 SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // is initialized with the five formats
133 std::unique_ptr<SvxNumRule> pActNum;
134 std::unique_ptr<SvxNumRule> pSaveNum;
135 sal_uInt16 nActNumLvl;
136 TypedWhichId<SvxNumBulletItem> nNumItemId;
137 bool bModified : 1;
138 bool bPreset : 1;
140 std::unique_ptr<SvxNumValueSet> m_xExamplesVS;
141 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
143 DECL_LINK(NumSelectHdl_Impl, ValueSet*, void);
144 DECL_LINK(DoubleClickHdl_Impl, ValueSet*, void);
146 public:
147 SvxNumPickTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
148 virtual ~SvxNumPickTabPage() override;
150 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
151 const SfxItemSet* rAttrSet);
153 virtual void ActivatePage(const SfxItemSet& rSet) override;
154 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
155 virtual bool FillItemSet( SfxItemSet* rSet ) override;
156 virtual void Reset( const SfxItemSet* rSet ) override;
158 void SetCharFormatNames(const OUString& rCharName, const OUString& rBulName)
159 { sNumCharFmtName = rCharName;
160 sBulletCharFormatName = rBulName;}
161 virtual void PageCreated(const SfxAllItemSet& aSet) override;
164 class SvxBitmapPickTabPage final : public SfxTabPage
166 std::vector<OUString> aGrfNames;
168 std::unique_ptr<SvxNumRule> pActNum;
169 std::unique_ptr<SvxNumRule> pSaveNum;
170 sal_uInt16 nActNumLvl;
171 TypedWhichId<SvxNumBulletItem> nNumItemId;
172 MapUnit eCoreUnit;
173 bool bModified : 1;
174 bool bPreset : 1;
176 std::unique_ptr<weld::Label> m_xErrorText;
177 std::unique_ptr<weld::Button> m_xBtBrowseFile;
178 std::unique_ptr<SvxBmpNumValueSet> m_xExamplesVS;
179 std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
181 DECL_LINK(NumSelectHdl_Impl, ValueSet*, void);
182 DECL_LINK(DoubleClickHdl_Impl, ValueSet*, void);
183 DECL_LINK(ClickAddBrowseHdl_Impl, weld::Button&, void);
185 public:
186 SvxBitmapPickTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
187 virtual ~SvxBitmapPickTabPage() override;
189 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController,
190 const SfxItemSet* rAttrSet);
192 virtual void ActivatePage(const SfxItemSet& rSet) override;
193 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
194 virtual bool FillItemSet( SfxItemSet* rSet ) override;
195 virtual void Reset( const SfxItemSet* rSet ) override;
198 class SvxNumOptionsTabPage : public SfxTabPage
200 OUString m_sNumCharFmtName;
201 OUString m_sBulletCharFormatName;
203 Timer aInvalidateTimer;
205 std::unique_ptr<SvxNumRule> pActNum;
206 std::unique_ptr<SvxNumRule> pSaveNum;
208 Size aInitSize[SVX_MAX_NUM];
210 ImplSVEvent* m_pLevelHdlEvent;
212 bool bLastWidthModified : 1;
213 bool bModified : 1;
214 bool bPreset : 1;
215 bool bAutomaticCharStyles: 1;
216 bool bHTMLMode : 1;
218 std::vector<OUString> aGrfNames;
219 vcl::Font aActBulletFont;
221 sal_uInt8 nBullet;
222 sal_uInt16 nActNumLvl;
223 TypedWhichId<SvxNumBulletItem> nNumItemId;
224 MapUnit eCoreUnit;
226 SvxRatioConnector m_aRatioTop;
227 SvxRatioConnector m_aRatioBottom;
228 SvxNumberingPreview m_aPreviewWIN;
229 std::unique_ptr<weld::Widget> m_xGrid;
230 std::unique_ptr<weld::TreeView> m_xLevelLB;
231 std::unique_ptr<weld::ComboBox> m_xFmtLB;
232 std::unique_ptr<weld::Label> m_xSeparatorFT;
233 std::unique_ptr<weld::Label> m_xPrefixFT;
234 std::unique_ptr<weld::Entry> m_xPrefixED;
235 std::unique_ptr<weld::Label> m_xSuffixFT;
236 std::unique_ptr<weld::Entry> m_xSuffixED;
237 std::unique_ptr<weld::Label> m_xCharFmtFT;
238 std::unique_ptr<weld::ComboBox> m_xCharFmtLB;
239 std::unique_ptr<weld::Label> m_xBulColorFT;
240 std::unique_ptr<ColorListBox> m_xBulColLB;
241 std::unique_ptr<weld::Label> m_xBulRelSizeFT;
242 std::unique_ptr<weld::MetricSpinButton> m_xBulRelSizeMF;
243 std::unique_ptr<weld::Label> m_xAllLevelFT;
244 std::unique_ptr<weld::SpinButton> m_xAllLevelNF;
245 std::unique_ptr<weld::CheckButton> m_xIsLegalCB;
246 std::unique_ptr<weld::Label> m_xStartFT;
247 std::unique_ptr<weld::SpinButton> m_xStartED;
248 std::unique_ptr<weld::Label> m_xBulletFT;
249 std::unique_ptr<weld::Button> m_xBulletPB;
250 std::unique_ptr<weld::Label> m_xBitmapFT;
251 std::unique_ptr<weld::MenuButton> m_xBitmapMB;
252 std::unique_ptr<weld::Label> m_xWidthFT;
253 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
254 std::unique_ptr<weld::Label> m_xHeightFT;
255 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
256 std::unique_ptr<weld::CheckButton> m_xRatioCB;
257 std::unique_ptr<weld::Image> m_xCbxScaleImg;
258 std::unique_ptr<weld::CustomWeld> m_xImgRatioTop;
259 std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom;
260 std::unique_ptr<weld::Label> m_xOrientFT;
261 std::unique_ptr<weld::ComboBox> m_xOrientLB;
262 std::unique_ptr<weld::Widget> m_xAllLevelsFrame;
263 std::unique_ptr<weld::Menu> m_xGalleryMenu;
264 std::unique_ptr<weld::CheckButton> m_xSameLevelCB;
265 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
267 void InitControls();
268 /** To switch between the numbering type
269 0 - Number;
270 1 - Bullet;
271 2 - Bitmap; */
272 void SwitchNumberType( sal_uInt8 nType );
273 void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
275 DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void);
276 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
277 DECL_LINK(LevelHdl, void *, void);
278 DECL_LINK(PopupActivateHdl_Impl, weld::Toggleable&, void);
279 DECL_LINK(GraphicHdl_Impl, const OUString&, void);
280 DECL_LINK(BulletHdl_Impl, weld::Button&, void);
281 DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void);
282 DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void);
283 DECL_LINK(CharFmtHdl_Impl, weld::ComboBox&, void);
284 DECL_LINK(EditModifyHdl_Impl, weld::Entry&, void);
285 DECL_LINK(SpinModifyHdl_Impl, weld::SpinButton&, void);
286 DECL_LINK(AllLevelHdl_Impl, weld::SpinButton&, void);
287 DECL_LINK(IsLegalHdl_Impl, weld::Toggleable&, void);
288 DECL_LINK(OrientHdl_Impl, weld::ComboBox&, void);
289 DECL_LINK(SameLevelHdl_Impl, weld::Toggleable&, void);
290 DECL_LINK(BulColorHdl_Impl, ColorListBox&, void);
291 DECL_LINK(BulRelSizeHdl_Impl, weld::MetricSpinButton&, void);
292 DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void);
293 void EditModifyHdl_Impl(const weld::Entry*);
295 public:
296 SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
297 virtual ~SvxNumOptionsTabPage() override;
299 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
300 const SfxItemSet* rAttrSet);
302 virtual void ActivatePage(const SfxItemSet& rSet) override;
303 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
304 virtual bool FillItemSet( SfxItemSet* rSet ) override;
305 virtual void Reset( const SfxItemSet* rSet ) override;
307 void SetCharFmts(const OUString& rNumName, const OUString& rBulletName)
309 m_sNumCharFmtName = rNumName;
310 m_sBulletCharFormatName = rBulletName;
312 void SetMetric(FieldUnit eSet);
314 void SetModified(bool bRepaint = true);
315 virtual void PageCreated(const SfxAllItemSet& aSet) override;
319 class SvxNumPositionTabPage : public SfxTabPage
321 std::unique_ptr<SvxNumRule> pActNum;
322 std::unique_ptr<SvxNumRule> pSaveNum;
324 ImplSVEvent* m_pLevelHdlEvent;
325 sal_uInt16 nActNumLvl;
326 TypedWhichId<SvxNumBulletItem> nNumItemId;
327 MapUnit eCoreUnit;
329 bool bModified : 1;
330 bool bPreset : 1;
331 bool bInInintControl : 1; // workaround for Modify-error, is said to be corrected from 391 on
332 bool bLabelAlignmentPosAndSpaceModeActive;
334 SvxNumberingPreview m_aPreviewWIN;
335 std::unique_ptr<weld::TreeView> m_xLevelLB;
336 // former set of controls shown for numbering rules containing list level
337 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
338 std::unique_ptr<weld::Label> m_xDistBorderFT;
339 std::unique_ptr<weld::MetricSpinButton> m_xDistBorderMF;
340 std::unique_ptr<weld::CheckButton> m_xRelativeCB;
341 std::unique_ptr<weld::Label> m_xIndentFT;
342 std::unique_ptr<weld::MetricSpinButton> m_xIndentMF;
343 std::unique_ptr<weld::Label> m_xDistNumFT;
344 std::unique_ptr<weld::MetricSpinButton> m_xDistNumMF;
345 std::unique_ptr<weld::Label> m_xAlignFT;
346 std::unique_ptr<weld::ComboBox> m_xAlignLB;
347 // new set of controls shown for numbering rules containing list level
348 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
349 std::unique_ptr<weld::Label> m_xLabelFollowedByFT;
350 std::unique_ptr<weld::ComboBox> m_xLabelFollowedByLB;
351 std::unique_ptr<weld::Label> m_xListtabFT;
352 std::unique_ptr<weld::MetricSpinButton> m_xListtabMF;
353 std::unique_ptr<weld::Label>m_xAlign2FT;
354 std::unique_ptr<weld::ComboBox> m_xAlign2LB;
355 std::unique_ptr<weld::Label> m_xAlignedAtFT;
356 std::unique_ptr<weld::MetricSpinButton> m_xAlignedAtMF;
357 std::unique_ptr<weld::Label> m_xIndentAtFT;
358 std::unique_ptr<weld::MetricSpinButton> m_xIndentAtMF;
359 std::unique_ptr<weld::Button> m_xStandardPB;
360 std::unique_ptr<weld::CustomWeld> m_xPreviewWIN;
362 void InitControls();
364 DECL_LINK(LevelHdl_Impl, weld::TreeView&, void);
365 DECL_LINK(LevelHdl, void *, void);
366 DECL_LINK(EditModifyHdl_Impl, weld::ComboBox&, void);
367 DECL_LINK(DistanceHdl_Impl, weld::MetricSpinButton&, void);
368 DECL_LINK(RelativeHdl_Impl, weld::Toggleable&, void);
369 DECL_LINK(StandardHdl_Impl, weld::Button&, void);
371 void InitPosAndSpaceMode();
372 void ShowControlsDependingOnPosAndSpaceMode();
374 DECL_LINK(LabelFollowedByHdl_Impl, weld::ComboBox&, void);
375 DECL_LINK(ListtabPosHdl_Impl, weld::MetricSpinButton&, void);
376 DECL_LINK(AlignAtHdl_Impl, weld::MetricSpinButton&, void);
377 DECL_LINK(IndentAtHdl_Impl, weld::MetricSpinButton&, void);
379 public:
380 SvxNumPositionTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
381 virtual ~SvxNumPositionTabPage() override;
383 virtual void ActivatePage(const SfxItemSet& rSet) override;
384 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
385 virtual bool FillItemSet( SfxItemSet* rSet ) override;
386 virtual void Reset( const SfxItemSet* rSet ) override;
388 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController,
389 const SfxItemSet* rAttrSet);
391 void SetMetric(FieldUnit eSet);
392 void SetModified();
393 virtual void PageCreated(const SfxAllItemSet& aSet) override;
396 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */