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
23 #include <boost/ptr_container/ptr_vector.hpp>
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 #include <vcl/dialog.hxx>
37 class SvxBmpNumValueSet
;
41 class SvxNumberingPreview
: public vcl::Window
43 const SvxNumRule
* pActNum
;
46 const OUString
* pOutlineNames
;
51 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
54 SvxNumberingPreview(vcl::Window
* pParent
, WinBits nWinBits
= WB_BORDER
);
56 void SetNumRule(const SvxNumRule
* pNum
)
57 {pActNum
= pNum
; Invalidate();};
58 void SetPageWidth(long nPgWidth
)
59 {nPageWidth
= nPgWidth
;}
60 void SetOutlineNames(const OUString
* pNames
)
61 {pOutlineNames
= pNames
;}
62 void SetPositionMode()
64 void SetLevel(sal_uInt16 nSet
) {nActLevel
= nSet
;}
70 struct SvxNumSettings_Impl
73 short nParentNumbering
;
78 SvxNumSettings_Impl() :
84 typedef boost::ptr_vector
<SvxNumSettings_Impl
> SvxNumSettingsArr_Impl
;
88 class SvxSingleNumPickTabPage
: public SfxTabPage
90 using TabPage::ActivatePage
;
91 using TabPage::DeactivatePage
;
93 VclPtr
<SvxNumValueSet
> m_pExamplesVS
;
94 SvxNumSettingsArr_Impl aNumSettingsArr
;
97 sal_uInt16 nActNumLvl
;
101 OUString sNumCharFmtName
;
102 sal_uInt16 nNumItemId
;
105 DECL_LINK(NumSelectHdl_Impl
, void *);
106 DECL_LINK(DoubleClickHdl_Impl
, void *);
109 SvxSingleNumPickTabPage(vcl::Window
* pParent
,
110 const SfxItemSet
& rSet
);
111 virtual ~SvxSingleNumPickTabPage();
112 virtual void dispose() SAL_OVERRIDE
;
114 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
115 const SfxItemSet
* rAttrSet
);
117 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
118 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
119 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
120 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
122 void SetNumCharFmtName(const OUString
& rName
){sNumCharFmtName
= rName
;}
128 class SvxBulletPickTabPage
: public SfxTabPage
130 using TabPage::ActivatePage
;
131 using TabPage::DeactivatePage
;
133 VclPtr
<SvxNumValueSet
> m_pExamplesVS
;
135 SvxNumRule
* pSaveNum
;
136 sal_uInt16 nActNumLvl
;
139 sal_uInt16 nNumItemId
;
141 OUString sBulletCharFormatName
;
143 DECL_LINK(NumSelectHdl_Impl
, void *);
144 DECL_LINK(DoubleClickHdl_Impl
, void *);
146 SvxBulletPickTabPage(vcl::Window
* pParent
,
147 const SfxItemSet
& rSet
);
148 virtual ~SvxBulletPickTabPage();
149 virtual void dispose() SAL_OVERRIDE
;
151 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
152 const SfxItemSet
* rAttrSet
);
154 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
155 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
156 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
157 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
159 void SetCharFormatName(const OUString
& rName
){sBulletCharFormatName
= rName
;}
160 virtual void PageCreated(const SfxAllItemSet
& aSet
) SAL_OVERRIDE
;
163 #define NUM_VALUSET_COUNT 16
165 /// TabPage for complete numeration
166 class SvxNumPickTabPage
: public SfxTabPage
168 using TabPage::ActivatePage
;
169 using TabPage::DeactivatePage
;
171 VclPtr
<SvxNumValueSet
> m_pExamplesVS
;
172 OUString sNumCharFmtName
;
173 OUString sBulletCharFormatName
;
175 SvxNumSettingsArr_Impl aNumSettingsArrays
[NUM_VALUSET_COUNT
]; // is initialized with the five formats
178 SvxNumRule
* pSaveNum
;
179 sal_uInt16 nActNumLvl
;
180 sal_uInt16 nNumItemId
;
186 DECL_LINK(NumSelectHdl_Impl
, void *);
187 DECL_LINK(DoubleClickHdl_Impl
, void *);
190 SvxNumPickTabPage(vcl::Window
* pParent
,
191 const SfxItemSet
& rSet
);
192 virtual ~SvxNumPickTabPage();
193 virtual void dispose() SAL_OVERRIDE
;
195 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
196 const SfxItemSet
* rAttrSet
);
198 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
199 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
200 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
201 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
203 void SetCharFormatNames(const OUString
& rCharName
, const OUString
& rBulName
)
204 { sNumCharFmtName
= rCharName
;
205 sBulletCharFormatName
= rBulName
;}
206 virtual void PageCreated(const SfxAllItemSet
& aSet
) SAL_OVERRIDE
;
211 class SvxBitmapPickTabPage
: public SfxTabPage
213 using TabPage::ActivatePage
;
214 using TabPage::DeactivatePage
;
216 VclPtr
<FixedText
> m_pErrorText
;
217 VclPtr
<SvxBmpNumValueSet
> m_pExamplesVS
;
218 VclPtr
<Button
> m_pBtBrowseFile
;
220 std::vector
<OUString
> aGrfNames
;
221 OUString sNumCharFmtName
;
224 SvxNumRule
* pSaveNum
;
225 sal_uInt16 nActNumLvl
;
226 sal_uInt16 nNumItemId
;
227 SfxMapUnit eCoreUnit
;
232 DECL_LINK(NumSelectHdl_Impl
, void *);
233 DECL_LINK(DoubleClickHdl_Impl
, void *);
234 DECL_LINK(LinkBmpHdl_Impl
, void *);
235 DECL_LINK(ClickAddBrowseHdl_Impl
, void * );
239 SvxBitmapPickTabPage(vcl::Window
* pParent
,
240 const SfxItemSet
& rSet
);
241 virtual ~SvxBitmapPickTabPage();
242 virtual void dispose() SAL_OVERRIDE
;
244 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
245 const SfxItemSet
* rAttrSet
);
247 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
248 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
249 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
250 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
252 void SetNumCharFmtName(const OUString
& rName
){sNumCharFmtName
= rName
;}
256 class SvxNumOptionsTabPage
: public SfxTabPage
258 using TabPage::ActivatePage
;
259 using TabPage::DeactivatePage
;
261 VclPtr
<ListBox
> m_pLevelLB
;
263 VclPtr
<ListBox
> m_pFmtLB
;
265 VclPtr
<FixedText
> m_pSeparatorFT
;
266 VclPtr
<FixedText
> m_pPrefixFT
;
267 VclPtr
<Edit
> m_pPrefixED
;
268 VclPtr
<FixedText
> m_pSuffixFT
;
269 VclPtr
<Edit
> m_pSuffixED
;
270 VclPtr
<FixedText
> m_pCharFmtFT
;
271 VclPtr
<ListBox
> m_pCharFmtLB
;
272 VclPtr
<FixedText
> m_pBulColorFT
;
273 VclPtr
<ColorListBox
> m_pBulColLB
;
274 VclPtr
<FixedText
> m_pBulRelSizeFT
;
275 VclPtr
<MetricField
> m_pBulRelSizeMF
;
276 VclPtr
<FixedText
> m_pAllLevelFT
;
277 VclPtr
<NumericField
> m_pAllLevelNF
;
278 VclPtr
<FixedText
> m_pStartFT
;
279 VclPtr
<NumericField
> m_pStartED
;
280 VclPtr
<FixedText
> m_pBulletFT
;
281 VclPtr
<PushButton
> m_pBulletPB
;
282 VclPtr
<FixedText
> m_pAlignFT
;
283 VclPtr
<ListBox
> m_pAlignLB
;
284 VclPtr
<FixedText
> m_pBitmapFT
;
285 VclPtr
<MenuButton
> m_pBitmapMB
;
286 sal_uInt16 m_nGalleryId
;
287 VclPtr
<FixedText
> m_pWidthFT
;
288 VclPtr
<MetricField
> m_pWidthMF
;
289 VclPtr
<FixedText
> m_pHeightFT
;
290 VclPtr
<MetricField
> m_pHeightMF
;
291 VclPtr
<CheckBox
> m_pRatioCB
;
292 VclPtr
<FixedText
> m_pOrientFT
;
293 VclPtr
<ListBox
> m_pOrientLB
;
295 VclPtr
<VclContainer
> m_pAllLevelsFrame
;
296 VclPtr
<CheckBox
> m_pSameLevelCB
;
298 VclPtr
<SvxNumberingPreview
> m_pPreviewWIN
;
300 OUString m_sNumCharFmtName
;
301 OUString m_sBulletCharFormatName
;
303 Timer aInvalidateTimer
;
306 SvxNumRule
* pSaveNum
;
308 Size aInitSize
[SVX_MAX_NUM
];
310 bool bLastWidthModified
: 1;
313 bool bAutomaticCharStyles
: 1;
315 bool bMenuButtonInitialized
: 1;
317 std::vector
<OUString
> aGrfNames
;
318 vcl::Font aActBulletFont
;
321 sal_uInt16 nActNumLvl
;
322 sal_uInt16 nNumItemId
;
323 SfxMapUnit eCoreUnit
;
326 /** To switch between the numbering type
330 void SwitchNumberType( sal_uInt8 nType
, bool bBmp
= false );
331 void CheckForStartValue_Impl(sal_uInt16 nNumberingType
);
333 DECL_LINK( NumberTypeSelectHdl_Impl
, ListBox
* );
334 DECL_LINK( LevelHdl_Impl
, ListBox
* );
335 DECL_LINK_TYPED(PopupActivateHdl_Impl
, Menu
*, bool);
336 DECL_LINK_TYPED( GraphicHdl_Impl
, MenuButton
*, void );
337 DECL_LINK(BulletHdl_Impl
, void *);
338 DECL_LINK( SizeHdl_Impl
, MetricField
* );
339 DECL_LINK( RatioHdl_Impl
, CheckBox
* );
340 DECL_LINK(CharFmtHdl_Impl
, void *);
341 DECL_LINK( EditModifyHdl_Impl
, Edit
* );
342 DECL_LINK( AllLevelHdl_Impl
, NumericField
* );
343 DECL_LINK( OrientHdl_Impl
, ListBox
* );
344 DECL_LINK( SameLevelHdl_Impl
, CheckBox
* );
345 DECL_LINK( BulColorHdl_Impl
, ColorListBox
* );
346 DECL_LINK( BulRelSizeHdl_Impl
, MetricField
*);
347 DECL_LINK_TYPED(PreviewInvalidateHdl_Impl
, Timer
*, void);
349 DECL_STATIC_LINK( SvxNumOptionsTabPage
, GraphicArrivedHdl_Impl
, SvxBrushItem
* );
352 SvxNumOptionsTabPage(vcl::Window
* pParent
,
353 const SfxItemSet
& rSet
);
354 virtual ~SvxNumOptionsTabPage();
355 virtual void dispose() SAL_OVERRIDE
;
357 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
358 const SfxItemSet
* rAttrSet
);
360 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
361 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
362 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
363 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
365 void SetCharFmts(const OUString
& rNumName
, const OUString
& rBulletName
)
367 m_sNumCharFmtName
= rNumName
;
368 m_sBulletCharFormatName
= rBulletName
;
370 void SetMetric(FieldUnit eSet
);
372 ListBox
& GetCharFmtListBox() {return *m_pCharFmtLB
;}
373 void SetModified(bool bRepaint
= true);
374 virtual void PageCreated(const SfxAllItemSet
& aSet
) SAL_OVERRIDE
;
376 /** Get the numberings provided by the i18n framework (CTL, Asian, ...) and
377 add them to the listbox. Extended numbering schemes present in the
378 resource and already in the listbox but not offered by the i18n
379 framework per configuration are removed.
382 A value that shall not be removed, i.e. the ugly 0x88
383 (SVX_NUM_BITMAP|0x80)
384 Pass ::std::numeric_limits<sal_uInt16>::max() if there is no such
387 static void GetI18nNumbering( ListBox
& rFmtLB
, sal_uInt16 nDoNotRemove
);
391 class SvxNumPositionTabPage
: public SfxTabPage
393 using TabPage::ActivatePage
;
394 using TabPage::DeactivatePage
;
396 VclPtr
<ListBox
> m_pLevelLB
;
398 // former set of controls shown for numbering rules containing list level
399 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
400 VclPtr
<FixedText
> m_pDistBorderFT
;
401 VclPtr
<MetricField
> m_pDistBorderMF
;
402 VclPtr
<CheckBox
> m_pRelativeCB
;
403 VclPtr
<FixedText
> m_pIndentFT
;
404 VclPtr
<MetricField
> m_pIndentMF
;
405 VclPtr
<FixedText
> m_pDistNumFT
;
406 VclPtr
<MetricField
> m_pDistNumMF
;
407 VclPtr
<FixedText
> m_pAlignFT
;
408 VclPtr
<ListBox
> m_pAlignLB
;
410 // new set of controls shown for numbering rules containing list level
411 // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
412 VclPtr
<FixedText
> m_pLabelFollowedByFT
;
413 VclPtr
<ListBox
> m_pLabelFollowedByLB
;
414 VclPtr
<FixedText
> m_pListtabFT
;
415 VclPtr
<MetricField
> m_pListtabMF
;
416 VclPtr
<FixedText
> m_pAlign2FT
;
417 VclPtr
<ListBox
> m_pAlign2LB
;
418 VclPtr
<FixedText
> m_pAlignedAtFT
;
419 VclPtr
<MetricField
> m_pAlignedAtMF
;
420 VclPtr
<FixedText
> m_pIndentAtFT
;
421 VclPtr
<MetricField
> m_pIndentAtMF
;
423 VclPtr
<PushButton
> m_pStandardPB
;
425 VclPtr
<SvxNumberingPreview
> m_pPreviewWIN
;
428 SvxNumRule
* pSaveNum
;
430 sal_uInt16 nActNumLvl
;
431 sal_uInt16 nNumItemId
;
432 SfxMapUnit eCoreUnit
;
436 bool bInInintControl
: 1; // workaround for Modify-error, is said to be corrected from 391 on
437 bool bLabelAlignmentPosAndSpaceModeActive
;
441 DECL_LINK( LevelHdl_Impl
, ListBox
* );
442 DECL_LINK(EditModifyHdl_Impl
, void *);
443 DECL_LINK( DistanceHdl_Impl
, MetricField
* );
444 DECL_LINK( RelativeHdl_Impl
, CheckBox
* );
445 DECL_LINK(StandardHdl_Impl
, void *);
447 void InitPosAndSpaceMode();
448 void ShowControlsDependingOnPosAndSpaceMode();
450 DECL_LINK(LabelFollowedByHdl_Impl
, void *);
451 DECL_LINK( ListtabPosHdl_Impl
, MetricField
* );
452 DECL_LINK( AlignAtHdl_Impl
, MetricField
* );
453 DECL_LINK( IndentAtHdl_Impl
, MetricField
* );
456 SvxNumPositionTabPage(vcl::Window
* pParent
,
457 const SfxItemSet
& rSet
);
458 virtual ~SvxNumPositionTabPage();
459 virtual void dispose() SAL_OVERRIDE
;
461 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
462 virtual sfxpg
DeactivatePage(SfxItemSet
*pSet
) SAL_OVERRIDE
;
463 virtual bool FillItemSet( SfxItemSet
* rSet
) SAL_OVERRIDE
;
464 virtual void Reset( const SfxItemSet
* rSet
) SAL_OVERRIDE
;
466 static VclPtr
<SfxTabPage
> Create( vcl::Window
* pParent
,
467 const SfxItemSet
* rAttrSet
);
469 void SetMetric(FieldUnit eSet
);
470 void SetModified(bool bRepaint
= true);
471 virtual void PageCreated(const SfxAllItemSet
& aSet
) SAL_OVERRIDE
;
476 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */