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::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
38 class SVX_DLLPUBLIC NumSettings_Impl
41 SvxNumType nNumberType
;
42 short nParentNumbering
;
43 SvxNumberFormat::LabelFollowedBy eLabelFollowedBy
;
44 tools::Long nTabValue
;
46 tools::Long nNumAlignAt
;
47 tools::Long nNumIndentAt
;
52 SvxBrushItem
*pBrushItem
;
57 : nNumberType(SVX_NUM_CHARS_UPPER_LETTER
)
59 , eLabelFollowedBy(SvxNumberFormat::NOTHING
)
61 , eNumAlign(SvxAdjust::Left
)
69 typedef std::vector
< std::shared_ptr
<NumSettings_Impl
> > NumSettingsArr_Impl
;
71 class SVX_DLLPUBLIC BulletsSettings
75 OUString sDescription
;
78 BulletsSettings() : cBulletChar(0), bIsCustomized(false) {}
82 class SVX_DLLPUBLIC NumberSettings_Impl
86 OUString sDescription
;
87 NumSettings_Impl
* pNumSetting
;
89 NumberSettings_Impl() :
95 typedef std::vector
< std::shared_ptr
<NumberSettings_Impl
> > NumberSettingsArr_Impl
;
97 class SVX_DLLPUBLIC OutlineSettings_Impl
101 OUString sDescription
;
102 NumSettingsArr_Impl
*pNumSettingsArr
;
104 OutlineSettings_Impl() :
105 bIsCustomized(false),
106 pNumSettingsArr(nullptr)
110 class SVX_DLLPUBLIC NBOTypeMgrBase
113 const SfxItemSet
* pSet
;
115 // store the attributes passed from pSet
116 OUString aBulletCharFmtName
;
117 OUString aNumCharFmtName
;
120 NBOTypeMgrBase(const NBOTypeMgrBase
&) = delete;
125 , eCoreUnit(MapUnit::MapTwip
)
128 virtual ~NBOTypeMgrBase() {}
129 virtual void Init()=0;
130 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) = 0;
131 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) = 0;
132 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) = 0;
133 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
)=0;
134 virtual bool IsCustomized(sal_uInt16 nIndex
)=0;
135 static sal_uInt16
IsSingleLevel(sal_uInt16 nCurLevel
);
136 // store the attributes passed from pSet
137 void SetItems(const SfxItemSet
* pArg
);
139 const OUString
& GetBulletCharFmtName() const { return aBulletCharFmtName
;}
140 const OUString
& GetNumCharFmtName() const { return aNumCharFmtName
;}
141 MapUnit
GetMapUnit() const { return eCoreUnit
;}
143 void ImplLoad(std::u16string_view filename
);
144 void ImplStore(std::u16string_view filename
);
149 class BulletsTypeMgr final
: public NBOTypeMgrBase
151 friend class OutlineTypeMgr
;
152 friend class NumberingTypeMgr
;
154 BulletsTypeMgr(const BulletsTypeMgr
&) = delete;
156 static sal_Unicode aDynamicBulletTypes
[DEFAULT_BULLET_TYPES
];
157 static sal_Unicode aDynamicRTLBulletTypes
[DEFAULT_BULLET_TYPES
];
158 static BulletsSettings
* pActualBullets
[DEFAULT_BULLET_TYPES
];
161 virtual void Init() override
;
162 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
163 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
164 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
165 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
166 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
167 static BulletsTypeMgr
& GetInstance();
171 class NumberingTypeMgr final
: public NBOTypeMgrBase
174 NumberingTypeMgr(const NumberingTypeMgr
&) = delete;
176 NumberSettingsArr_Impl maNumberSettingsArr
;
177 NumberSettingsArr_Impl maDefaultNumberSettingsArr
;
180 virtual ~NumberingTypeMgr() override
;
181 virtual void Init() override
;
182 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
183 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
184 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
185 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
186 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
187 static NumberingTypeMgr
& GetInstance();
190 class OutlineTypeMgr final
: public NBOTypeMgrBase
193 OutlineTypeMgr(const OutlineTypeMgr
&) = delete;
195 OutlineSettings_Impl
* pOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
196 OutlineSettings_Impl
* pDefaultOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
199 virtual void Init() override
;
200 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0) override
;
201 virtual void RelplaceNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
) override
;
202 virtual void ApplyNumRule(SvxNumRule
& aNum
, sal_uInt16 nIndex
, sal_uInt16 mLevel
, bool isDefault
=false,bool isResetSize
=false) override
;
203 virtual OUString
GetDescription(sal_uInt16 nIndex
, bool isDefault
) override
;
204 virtual bool IsCustomized(sal_uInt16 nIndex
) override
;
205 static OutlineTypeMgr
& GetInstance();
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */