Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : : #ifndef _SVX_NUMPAGES_HXX
20 : : #define _SVX_NUMPAGES_HXX
21 : :
22 : : #include <vector>
23 : : #include <boost/ptr_container/ptr_vector.hpp>
24 : :
25 : : #include <sfx2/tabdlg.hxx>
26 : : #include <vcl/group.hxx>
27 : : #include <vcl/fixed.hxx>
28 : : #include <vcl/menubtn.hxx>
29 : : #include <vcl/lstbox.hxx>
30 : : #include <vcl/edit.hxx>
31 : : #include <vcl/field.hxx>
32 : : #include <editeng/numdef.hxx>
33 : : #include <svtools/ctrlbox.hxx>
34 : :
35 : : // -----------------------------------------------------------------------
36 : : class SvxNumRule;
37 : : class SvxBmpNumValueSet;
38 : : class SvxNumValueSet;
39 : : class SvxNumberingPreview;
40 : : class SvxBrushItem;
41 : :
42 : :
43 : : //------------------------------------------------
44 : :
45 : 0 : struct SvxNumSettings_Impl
46 : : {
47 : : short nNumberType;
48 : : short nParentNumbering;
49 : : rtl::OUString sPrefix;
50 : : rtl::OUString sSuffix;
51 : : rtl::OUString sBulletChar;
52 : : rtl::OUString sBulletFont;
53 : 0 : SvxNumSettings_Impl() :
54 : : nNumberType(0),
55 : 0 : nParentNumbering(0)
56 : 0 : {}
57 : : };
58 : :
59 : : typedef boost::ptr_vector<SvxNumSettings_Impl> SvxNumSettingsArr_Impl;
60 : :
61 : :
62 : : //------------------------------------------------
63 : : class SvxSingleNumPickTabPage : public SfxTabPage
64 : : {
65 : : using TabPage::ActivatePage;
66 : : using TabPage::DeactivatePage;
67 : :
68 : : FixedLine aValuesFL;
69 : : SvxNumValueSet* pExamplesVS;
70 : : SvxNumSettingsArr_Impl aNumSettingsArr;
71 : : SvxNumRule* pActNum;
72 : : SvxNumRule* pSaveNum;
73 : : sal_uInt16 nActNumLvl;
74 : : sal_Bool bModified : 1;
75 : : sal_Bool bPreset : 1;
76 : :
77 : : String sNumCharFmtName;
78 : : sal_uInt16 nNumItemId;
79 : :
80 : : protected:
81 : : DECL_LINK(NumSelectHdl_Impl, void *);
82 : : DECL_LINK(DoubleClickHdl_Impl, void *);
83 : :
84 : : public:
85 : : SvxSingleNumPickTabPage(Window* pParent,
86 : : const SfxItemSet& rSet);
87 : : ~SvxSingleNumPickTabPage();
88 : :
89 : : static SfxTabPage* Create( Window* pParent,
90 : : const SfxItemSet& rAttrSet);
91 : :
92 : : virtual void ActivatePage(const SfxItemSet& rSet);
93 : : virtual int DeactivatePage(SfxItemSet *pSet);
94 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
95 : : virtual void Reset( const SfxItemSet& rSet );
96 : :
97 : : void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;}
98 : : };
99 : :
100 : :
101 : : //------------------------------------------------
102 : :
103 : : class SvxBulletPickTabPage : public SfxTabPage
104 : : {
105 : : using TabPage::ActivatePage;
106 : : using TabPage::DeactivatePage;
107 : :
108 : : FixedLine aValuesFL;
109 : : SvxNumValueSet* pExamplesVS;
110 : : SvxNumRule* pActNum;
111 : : SvxNumRule* pSaveNum;
112 : : sal_uInt16 nActNumLvl;
113 : : sal_Bool bModified : 1;
114 : : sal_Bool bPreset : 1;
115 : : sal_uInt16 nNumItemId;
116 : :
117 : : String sBulletCharFmtName;
118 : : protected:
119 : : DECL_LINK(NumSelectHdl_Impl, void *);
120 : : DECL_LINK(DoubleClickHdl_Impl, void *);
121 : : public:
122 : : SvxBulletPickTabPage(Window* pParent,
123 : : const SfxItemSet& rSet);
124 : : ~SvxBulletPickTabPage();
125 : :
126 : : static SfxTabPage* Create( Window* pParent,
127 : : const SfxItemSet& rAttrSet);
128 : :
129 : : virtual void ActivatePage(const SfxItemSet& rSet);
130 : : virtual int DeactivatePage(SfxItemSet *pSet);
131 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
132 : : virtual void Reset( const SfxItemSet& rSet );
133 : :
134 : 0 : void SetCharFmtName(const String& rName){sBulletCharFmtName = rName;}
135 : : virtual void PageCreated(SfxAllItemSet aSet);
136 : : };
137 : :
138 : : #define NUM_VALUSET_COUNT 16
139 : :
140 : : /// TabPage for complete numeration
141 : : class SvxNumPickTabPage : public SfxTabPage
142 : : {
143 : : using TabPage::ActivatePage;
144 : : using TabPage::DeactivatePage;
145 : :
146 : : FixedLine aValuesFL;
147 : : SvxNumValueSet* pExamplesVS;
148 : : String sNumCharFmtName;
149 : : String sBulletCharFmtName;
150 : :
151 : : SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // is initialized with the five formats
152 : :
153 : : SvxNumRule* pActNum;
154 : : SvxNumRule* pSaveNum;
155 : : sal_uInt16 nActNumLvl;
156 : : sal_uInt16 nNumItemId;
157 : : sal_Bool bModified : 1;
158 : : sal_Bool bPreset : 1;
159 : :
160 : :
161 : : protected:
162 : : DECL_LINK(NumSelectHdl_Impl, void *);
163 : : DECL_LINK(DoubleClickHdl_Impl, void *);
164 : :
165 : : public:
166 : : SvxNumPickTabPage(Window* pParent,
167 : : const SfxItemSet& rSet);
168 : : ~SvxNumPickTabPage();
169 : :
170 : : static SfxTabPage* Create( Window* pParent,
171 : : const SfxItemSet& rAttrSet);
172 : :
173 : : virtual void ActivatePage(const SfxItemSet& rSet);
174 : : virtual int DeactivatePage(SfxItemSet *pSet);
175 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
176 : : virtual void Reset( const SfxItemSet& rSet );
177 : :
178 : 0 : void SetCharFmtNames(const String& rCharName, const String& rBulName)
179 : 0 : { sNumCharFmtName = rCharName;
180 : 0 : sBulletCharFmtName = rBulName;}
181 : : virtual void PageCreated(SfxAllItemSet aSet);
182 : : };
183 : :
184 : :
185 : : //------------------------------------------------
186 : : class SvxBitmapPickTabPage : public SfxTabPage
187 : : {
188 : : using TabPage::ActivatePage;
189 : : using TabPage::DeactivatePage;
190 : :
191 : : FixedLine aValuesFL;
192 : : SvxBmpNumValueSet* pExamplesVS;
193 : : FixedText aErrorText;
194 : : CheckBox aLinkedCB;
195 : :
196 : : std::vector<String> aGrfNames;
197 : : String sNumCharFmtName;
198 : :
199 : : SvxNumRule* pActNum;
200 : : SvxNumRule* pSaveNum;
201 : : sal_uInt16 nActNumLvl;
202 : : sal_uInt16 nNumItemId;
203 : : SfxMapUnit eCoreUnit;
204 : : sal_Bool bModified : 1;
205 : : sal_Bool bPreset : 1;
206 : :
207 : : protected:
208 : : DECL_LINK(NumSelectHdl_Impl, void *);
209 : : DECL_LINK(DoubleClickHdl_Impl, void *);
210 : : DECL_LINK(LinkBmpHdl_Impl, void *);
211 : :
212 : : public:
213 : : SvxBitmapPickTabPage(Window* pParent,
214 : : const SfxItemSet& rSet);
215 : : ~SvxBitmapPickTabPage();
216 : :
217 : : static SfxTabPage* Create( Window* pParent,
218 : : const SfxItemSet& rAttrSet);
219 : :
220 : : virtual void ActivatePage(const SfxItemSet& rSet);
221 : : virtual int DeactivatePage(SfxItemSet *pSet);
222 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
223 : : virtual void Reset( const SfxItemSet& rSet );
224 : :
225 : : void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;}
226 : : };
227 : :
228 : : //------------------------------------------------
229 : : class SvxNumOptionsTabPage : public SfxTabPage
230 : : {
231 : : using TabPage::ActivatePage;
232 : : using TabPage::DeactivatePage;
233 : :
234 : : FixedLine aFormatFL;
235 : : FixedText aLevelFT;
236 : : MultiListBox aLevelLB;
237 : :
238 : : FixedText aFmtFT;
239 : : ListBox aFmtLB;
240 : : FixedText aPrefixFT;
241 : : Edit aPrefixED;
242 : : FixedText aSuffixFT;
243 : : Edit aSuffixED;
244 : : FixedText aCharFmtFT;
245 : : ListBox aCharFmtLB;
246 : : FixedText aBulColorFT;
247 : : ColorListBox aBulColLB;
248 : : FixedText aBulRelSizeFT;
249 : : MetricField aBulRelSizeMF;
250 : : FixedText aAllLevelFT;
251 : : NumericField aAllLevelNF;
252 : : FixedText aStartFT;
253 : : NumericField aStartED;
254 : : PushButton aBulletPB;
255 : : FixedText aAlignFT;
256 : : ListBox aAlignLB;
257 : : FixedText aBitmapFT;
258 : : MenuButton aBitmapMB;
259 : : FixedText aSizeFT;
260 : : MetricField aWidthMF;
261 : : FixedText aMultFT;
262 : : MetricField aHeightMF;
263 : : CheckBox aRatioCB;
264 : : FixedText aOrientFT;
265 : : ListBox aOrientLB;
266 : :
267 : : FixedLine aSameLevelFL;
268 : : CheckBox aSameLevelCB;
269 : :
270 : : String sNumCharFmtName;
271 : : String sBulletCharFmtName;
272 : :
273 : : Timer aInvalidateTimer;
274 : :
275 : : SvxNumberingPreview* pPreviewWIN;
276 : :
277 : : SvxNumRule* pActNum;
278 : : SvxNumRule* pSaveNum;
279 : :
280 : : Size aInitSize[SVX_MAX_NUM];
281 : :
282 : : sal_Bool bLastWidthModified : 1;
283 : : sal_Bool bModified : 1;
284 : : sal_Bool bPreset : 1;
285 : : sal_Bool bAutomaticCharStyles: 1;
286 : : sal_Bool bHTMLMode : 1;
287 : : sal_Bool bMenuButtonInitialized : 1;
288 : :
289 : : std::vector<String> aGrfNames;
290 : : Font aActBulletFont;
291 : : String sBullet;
292 : : String sStartWith;
293 : :
294 : : sal_uInt8 nBullet;
295 : : sal_uInt16 nActNumLvl;
296 : : sal_uInt16 nNumItemId;
297 : : SfxMapUnit eCoreUnit;
298 : :
299 : : void InitControls();
300 : : /** To switch between the numbering type
301 : : 0 - Number;
302 : : 1 - Bullet;
303 : : 2 - Bitmap; */
304 : : void SwitchNumberType( sal_uInt8 nType, sal_Bool bBmp = sal_False );
305 : : void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
306 : :
307 : : DECL_LINK( NumberTypeSelectHdl_Impl, ListBox * );
308 : : DECL_LINK( LevelHdl_Impl, ListBox * );
309 : : DECL_LINK(PopupActivateHdl_Impl, void *);
310 : : DECL_LINK( GraphicHdl_Impl, MenuButton * );
311 : : DECL_LINK(BulletHdl_Impl, void *);
312 : : DECL_LINK( SizeHdl_Impl, MetricField * );
313 : : DECL_LINK( RatioHdl_Impl, CheckBox * );
314 : : DECL_LINK(CharFmtHdl_Impl, void *);
315 : : DECL_LINK( EditModifyHdl_Impl, Edit * );
316 : : DECL_LINK( AllLevelHdl_Impl, NumericField * );
317 : : DECL_LINK( OrientHdl_Impl, ListBox * );
318 : : DECL_LINK( SameLevelHdl_Impl, CheckBox * );
319 : : DECL_LINK( BulColorHdl_Impl, ColorListBox* );
320 : : DECL_LINK( BulRelSizeHdl_Impl, MetricField *);
321 : : DECL_LINK(PreviewInvalidateHdl_Impl, void *);
322 : :
323 : : DECL_STATIC_LINK( SvxNumOptionsTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
324 : :
325 : : public:
326 : : SvxNumOptionsTabPage(Window* pParent,
327 : : const SfxItemSet& rSet);
328 : : ~SvxNumOptionsTabPage();
329 : :
330 : : static SfxTabPage* Create( Window* pParent,
331 : : const SfxItemSet& rAttrSet);
332 : :
333 : : virtual void ActivatePage(const SfxItemSet& rSet);
334 : : virtual int DeactivatePage(SfxItemSet *pSet);
335 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
336 : : virtual void Reset( const SfxItemSet& rSet );
337 : :
338 : 0 : void SetCharFmts(const String& rNumName, const String& rBulletName )
339 : : {
340 : 0 : sNumCharFmtName = rNumName;
341 : 0 : sBulletCharFmtName = rBulletName;
342 : 0 : }
343 : : void SetMetric(FieldUnit eSet);
344 : :
345 : 0 : ListBox& GetCharFmtListBox() {return aCharFmtLB;}
346 : : void SetModified(sal_Bool bRepaint = sal_True);
347 : : virtual void PageCreated(SfxAllItemSet aSet);
348 : :
349 : : /** Get the numberings provided by the i18n framework (CTL, Asian, ...) and
350 : : add them to the listbox. Extended numbering schemes present in the
351 : : resource and already in the listbox but not offered by the i18n
352 : : framework per configuration are removed.
353 : :
354 : : @param nDoNotRemove
355 : : A value that shall not be removed, i.e. the ugly 0x88
356 : : (SVX_NUM_BITMAP|0x80)
357 : : Pass ::std::numeric_limits<sal_uInt16>::max() if there is no such
358 : : restriction.
359 : : */
360 : : static void GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove );
361 : : };
362 : :
363 : : //------------------------------------------------
364 : : class SvxNumPositionTabPage : public SfxTabPage
365 : : {
366 : : using TabPage::ActivatePage;
367 : : using TabPage::DeactivatePage;
368 : :
369 : : FixedLine aPositionFL;
370 : : FixedText aLevelFT;
371 : : MultiListBox aLevelLB;
372 : :
373 : : // former set of controls shown for numbering rules containing list level
374 : : // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
375 : : FixedText aDistBorderFT;
376 : : MetricField aDistBorderMF;
377 : : CheckBox aRelativeCB;
378 : : FixedText aIndentFT;
379 : : MetricField aIndentMF;
380 : : FixedText aDistNumFT;
381 : : MetricField aDistNumMF;
382 : : FixedText aAlignFT;
383 : : ListBox aAlignLB;
384 : :
385 : : // new set of controls shown for numbering rules containing list level
386 : : // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
387 : : FixedText aLabelFollowedByFT;
388 : : ListBox aLabelFollowedByLB;
389 : : FixedText aListtabFT;
390 : : MetricField aListtabMF;
391 : : FixedText aAlign2FT;
392 : : ListBox aAlign2LB;
393 : : FixedText aAlignedAtFT;
394 : : MetricField aAlignedAtMF;
395 : : FixedText aIndentAtFT;
396 : : MetricField aIndentAtMF;
397 : :
398 : : PushButton aStandardPB;
399 : :
400 : : #if OSL_DEBUG_LEVEL > 1
401 : : FixedText* pDebugFixedText;
402 : : #endif
403 : : SvxNumberingPreview* pPreviewWIN;
404 : :
405 : : SvxNumRule* pActNum;
406 : : SvxNumRule* pSaveNum;
407 : :
408 : : sal_uInt16 nActNumLvl;
409 : : sal_uInt16 nNumItemId;
410 : : SfxMapUnit eCoreUnit;
411 : :
412 : : sal_Bool bModified : 1;
413 : : sal_Bool bPreset : 1;
414 : : sal_Bool bInInintControl : 1; // workaround for Modify-error, is said to be correctet from 391 on
415 : : bool bLabelAlignmentPosAndSpaceModeActive;
416 : :
417 : : void InitControls();
418 : :
419 : : DECL_LINK( LevelHdl_Impl, ListBox * );
420 : : DECL_LINK(EditModifyHdl_Impl, void *);
421 : : DECL_LINK( DistanceHdl_Impl, MetricField * );
422 : : DECL_LINK( RelativeHdl_Impl, CheckBox * );
423 : : DECL_LINK(StandardHdl_Impl, void *);
424 : :
425 : : void InitPosAndSpaceMode();
426 : : void ShowControlsDependingOnPosAndSpaceMode();
427 : :
428 : : DECL_LINK(LabelFollowedByHdl_Impl, void *);
429 : : DECL_LINK( ListtabPosHdl_Impl, MetricField* );
430 : : DECL_LINK( AlignAtHdl_Impl, MetricField* );
431 : : DECL_LINK( IndentAtHdl_Impl, MetricField* );
432 : :
433 : : public:
434 : : SvxNumPositionTabPage(Window* pParent,
435 : : const SfxItemSet& rSet);
436 : : ~SvxNumPositionTabPage();
437 : :
438 : : virtual void ActivatePage(const SfxItemSet& rSet);
439 : : virtual int DeactivatePage(SfxItemSet *pSet);
440 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
441 : : virtual void Reset( const SfxItemSet& rSet );
442 : :
443 : : static SfxTabPage* Create( Window* pParent,
444 : : const SfxItemSet& rAttrSet);
445 : :
446 : : void SetMetric(FieldUnit eSet);
447 : : void SetModified(sal_Bool bRepaint = sal_True);
448 : : virtual void PageCreated(SfxAllItemSet aSet);
449 : : };
450 : :
451 : : #endif
452 : :
453 : :
454 : :
455 : :
456 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|