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 .
23 #include <sfx2/tabdlg.hxx>
24 #include <swtypes.hxx>
25 #include "numprevw.hxx"
26 #include "numberingtypelistbox.hxx"
27 #include <rtl/ustring.hxx>
31 class SwChapterNumRules
;
33 class SwOutlineTabDialog final
: public SfxTabDialogController
35 static sal_uInt16 s_nNumLevel
;
36 static_assert(sizeof(s_nNumLevel
) * CHAR_BIT
>= MAXLEVEL
);
38 OUString m_aCollNames
[MAXLEVEL
];
41 std::unique_ptr
<SwNumRule
> m_xNumRule
;
42 SwChapterNumRules
* m_pChapterNumRules
;
46 std::unique_ptr
<weld::MenuButton
> m_xMenuButton
;
48 DECL_LINK(CancelHdl
, weld::Button
&, void);
49 DECL_LINK(FormHdl
, weld::Toggleable
&, void);
50 DECL_LINK(MenuSelectHdl
, const OUString
&, void);
52 virtual void PageCreated(const OUString
& rPageId
, SfxTabPage
& rPage
) override
;
53 virtual short Ok() override
;
56 SwOutlineTabDialog(weld::Window
* pParent
, const SfxItemSet
* pSwItemSet
, SwWrtShell
&);
57 virtual ~SwOutlineTabDialog() override
;
59 SwNumRule
* GetNumRule() { return m_xNumRule
.get(); }
60 sal_uInt16
GetLevel(std::u16string_view rFormatName
) const;
61 OUString
* GetCollNames() {return m_aCollNames
;}
63 static sal_uInt16
GetActNumLevel() {return s_nNumLevel
;}
64 static void SetActNumLevel(sal_uInt16 nSet
) {s_nNumLevel
= nSet
;}
67 class SwOutlineSettingsTabPage final
: public SfxTabPage
69 OUString m_aNoFormatName
;
70 OUString m_aSaveCollNames
[MAXLEVEL
];
72 SwNumRule
* m_pNumRule
;
73 OUString
* m_pCollNames
;
74 sal_uInt16 m_nActLevel
;
75 NumberingPreview m_aPreviewWIN
;
77 std::unique_ptr
<weld::TreeView
> m_xLevelLB
;
78 std::unique_ptr
<weld::ComboBox
> m_xCollBox
;
79 std::unique_ptr
<SwNumberingTypeListBox
> m_xNumberBox
;
80 std::unique_ptr
<weld::ComboBox
> m_xCharFormatLB
;
81 std::unique_ptr
<weld::Label
> m_xAllLevelFT
;
82 std::unique_ptr
<weld::SpinButton
> m_xAllLevelNF
;
83 std::unique_ptr
<weld::Entry
> m_xPrefixED
;
84 std::unique_ptr
<weld::Entry
> m_xSuffixED
;
85 std::unique_ptr
<weld::SpinButton
> m_xStartEdit
;
86 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWIN
;
88 DECL_LINK( LevelHdl
, weld::TreeView
&, void );
89 DECL_LINK( ToggleComplete
, weld::SpinButton
&, void );
90 DECL_LINK( CollSelect
, weld::ComboBox
&, void );
92 DECL_LINK( NumberSelect
, weld::ComboBox
&, void );
93 DECL_LINK( DelimModify
, weld::Entry
&, void );
94 DECL_LINK( StartModified
, weld::SpinButton
&, void );
95 DECL_LINK( CharFormatHdl
, weld::ComboBox
&, void );
99 void SetModified() { m_aPreviewWIN
.Invalidate(); }
100 void CheckForStartValue_Impl(sal_uInt16 nNumberingType
);
103 SwOutlineSettingsTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
104 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
,
105 const SfxItemSet
* rAttrSet
);
106 virtual ~SwOutlineSettingsTabPage() override
;
108 void SetWrtShell(SwWrtShell
* pShell
);
110 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
111 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
113 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
114 virtual void Reset( const SfxItemSet
* rSet
) override
;
115 void SetNumRule(SwNumRule
*pRule
)
118 m_aPreviewWIN
.SetNumRule(m_pNumRule
);
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */