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_SVX_NBDTMG_HXX
20 #define INCLUDED_SVX_NBDTMG_HXX
21 #include <svx/svxdllapi.h>
24 #include <editeng/numitem.hxx>
25 #include <vcl/font.hxx>
27 namespace svx
{ namespace sidebar
{
29 #define DEFAULT_BULLET_TYPES 8
30 #define DEFAULT_NUM_VALUSET_COUNT 8
31 #define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10
35 Bullets
= 1, Numbering
, Outline
40 Bullets
= 1, GraphicBullets
43 class SVX_DLLPUBLIC NumSettings_Impl
46 SvxNumType nNumberType
;
47 short nParentNumbering
;
48 SvxNumberFormat::LabelFollowedBy eLabelFollowedBy
;
53 rtl::OUString sPrefix
;
54 rtl::OUString sSuffix
;
55 rtl::OUString sBulletChar
;
56 rtl::OUString sBulletFont
;
57 SvxBrushItem
*pBrushItem
;
62 : nNumberType(SVX_NUM_CHARS_UPPER_LETTER
)
64 , eLabelFollowedBy(SvxNumberFormat::NOTHING
)
66 , eNumAlign(SvxAdjust::Left
)
74 typedef std::vector
< std::shared_ptr
<NumSettings_Impl
> > NumSettingsArr_Impl
;
76 class SVX_DLLPUBLIC BulletsSettings
80 rtl::OUString sDescription
;
81 sal_Unicode cBulletChar
;
83 BulletsSettings() : bIsCustomized(false), cBulletChar(0) {}
87 class SVX_DLLPUBLIC NumberSettings_Impl
91 rtl::OUString sDescription
;
92 sal_uInt16 nIndex
; //index in the tab page display
93 sal_uInt16 nIndexDefault
;
94 NumSettings_Impl
*pNumSetting
;
96 NumberSettings_Impl() :
98 nIndex((sal_uInt16
)0xFFFF),
99 nIndexDefault((sal_uInt16
)0xFFFF),
104 typedef std::vector
< std::shared_ptr
<NumberSettings_Impl
> > NumberSettingsArr_Impl
;
106 class SVX_DLLPUBLIC OutlineSettings_Impl
110 rtl::OUString sDescription
;
111 NumSettingsArr_Impl
*pNumSettingsArr
;
113 OutlineSettings_Impl() :
114 bIsCustomized(false),
115 pNumSettingsArr(nullptr)
119 class SVX_DLLPUBLIC NBOTypeMgrBase
122 const SfxItemSet
* pSet
;
124 // store the attributes passed from pSet
125 OUString aBulletCharFmtName
;
126 OUString aNumCharFmtName
;
127 NBOTypeMgrBase(const NBOTypeMgrBase
&) = delete;
132 , eCoreUnit(MapUnit::MapTwip
)
135 virtual ~NBOTypeMgrBase() {}
136 virtual void Init()=0;
137 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) = 0;
138 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) = 0;
139 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) = 0;
140 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
)=0;
141 virtual bool IsCustomized(sal_uInt16 nIndex
)=0;
142 static sal_uInt16
IsSingleLevel(sal_uInt16 nCurLevel
);
143 // store the attributes passed from pSet
144 void SetItems(const SfxItemSet
* pArg
);
146 const OUString
& GetBulletCharFmtName() { return aBulletCharFmtName
;}
147 const OUString
& GetNumCharFmtName() { return aNumCharFmtName
;}
148 MapUnit
GetMapUnit() { return eCoreUnit
;}
151 void ImplLoad(const OUString
& filename
);
152 void ImplStore(const OUString
& filename
);
157 class SVX_DLLPUBLIC BulletsTypeMgr
: public NBOTypeMgrBase
159 friend class OutlineTypeMgr
;
160 friend class NumberingTypeMgr
;
162 BulletsTypeMgr(const BulletsTypeMgr
&) = delete;
164 static sal_Unicode aDynamicBulletTypes
[DEFAULT_BULLET_TYPES
];
165 static sal_Unicode aDynamicRTLBulletTypes
[DEFAULT_BULLET_TYPES
];
166 static BulletsSettings
* pActualBullets
[DEFAULT_BULLET_TYPES
];
169 virtual void Init() override
;
170 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
171 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
172 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
173 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
174 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
175 static BulletsTypeMgr
& GetInstance();
179 class SVX_DLLPUBLIC NumberingTypeMgr
: public NBOTypeMgrBase
182 NumberingTypeMgr(const NumberingTypeMgr
&) = delete;
184 NumberSettingsArr_Impl maNumberSettingsArr
;
185 NumberSettingsArr_Impl maDefaultNumberSettingsArr
;
188 virtual ~NumberingTypeMgr() override
;
189 virtual void Init() override
;
190 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
191 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
192 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
193 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
194 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
195 static NumberingTypeMgr
& GetInstance();
198 class SVX_DLLPUBLIC OutlineTypeMgr
: public NBOTypeMgrBase
201 OutlineTypeMgr(const OutlineTypeMgr
&) = delete;
203 OutlineSettings_Impl
* pOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
204 OutlineSettings_Impl
* pDefaultOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
207 virtual void Init() override
;
208 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
209 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
210 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
211 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
212 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
213 static OutlineTypeMgr
& GetInstance();
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */