Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / nbdtmg.hxx
blob004fecd7b7778a3131c32646ce3d866eac0505d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
22 #include <memory>
23 #include <vector>
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
33 enum class NBOType
35 Bullets = 1, Numbering, Outline
38 enum class NBType
40 Bullets = 1, GraphicBullets
43 class SVX_DLLPUBLIC NumSettings_Impl
45 public:
46 SvxNumType nNumberType;
47 short nParentNumbering;
48 SvxNumberFormat::LabelFollowedBy eLabelFollowedBy;
49 long nTabValue;
50 SvxAdjust eNumAlign;
51 long nNumAlignAt;
52 long nNumIndentAt;
53 rtl::OUString sPrefix;
54 rtl::OUString sSuffix;
55 rtl::OUString sBulletChar;
56 rtl::OUString sBulletFont;
57 SvxBrushItem *pBrushItem;
58 Size aSize;
60 public:
61 NumSettings_Impl()
62 : nNumberType(SVX_NUM_CHARS_UPPER_LETTER)
63 , nParentNumbering(0)
64 , eLabelFollowedBy(SvxNumberFormat::NOTHING)
65 , nTabValue (0)
66 , eNumAlign(SvxAdjust::Left)
67 , nNumAlignAt(0)
68 , nNumIndentAt(0)
69 , pBrushItem(nullptr)
70 , aSize(0,0)
74 typedef std::vector< std::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl;
76 class SVX_DLLPUBLIC BulletsSettings
78 public:
79 bool bIsCustomized;
80 rtl::OUString sDescription;
81 sal_Unicode cBulletChar;
82 vcl::Font aFont;
83 BulletsSettings() : bIsCustomized(false), cBulletChar(0) {}
87 class SVX_DLLPUBLIC NumberSettings_Impl
89 public:
90 bool bIsCustomized;
91 rtl::OUString sDescription;
92 sal_uInt16 nIndex; //index in the tab page display
93 sal_uInt16 nIndexDefault;
94 NumSettings_Impl *pNumSetting;
95 public:
96 NumberSettings_Impl() :
97 bIsCustomized(false),
98 nIndex((sal_uInt16)0xFFFF),
99 nIndexDefault((sal_uInt16)0xFFFF),
100 pNumSetting(nullptr)
104 typedef std::vector< std::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl;
106 class SVX_DLLPUBLIC OutlineSettings_Impl
108 public:
109 bool bIsCustomized;
110 rtl::OUString sDescription;
111 NumSettingsArr_Impl *pNumSettingsArr;
112 public:
113 OutlineSettings_Impl() :
114 bIsCustomized(false),
115 pNumSettingsArr(nullptr)
119 class SVX_DLLPUBLIC NBOTypeMgrBase
121 private:
122 const SfxItemSet* pSet;
123 MapUnit eCoreUnit;
124 // store the attributes passed from pSet
125 OUString aBulletCharFmtName;
126 OUString aNumCharFmtName;
127 NBOTypeMgrBase(const NBOTypeMgrBase&) = delete;
129 public:
130 NBOTypeMgrBase()
131 : pSet(nullptr)
132 , eCoreUnit(MapUnit::MapTwip)
133 , bIsLoading(false)
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);
145 protected:
146 const OUString& GetBulletCharFmtName() { return aBulletCharFmtName;}
147 const OUString& GetNumCharFmtName() { return aNumCharFmtName;}
148 MapUnit GetMapUnit() { return eCoreUnit;}
149 protected:
150 bool bIsLoading;
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;
161 private:
162 BulletsTypeMgr(const BulletsTypeMgr&) = delete;
163 public:
164 static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES];
165 static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES];
166 static BulletsSettings* pActualBullets[DEFAULT_BULLET_TYPES];
167 public:
168 BulletsTypeMgr();
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
181 private:
182 NumberingTypeMgr(const NumberingTypeMgr&) = delete;
183 public:
184 NumberSettingsArr_Impl maNumberSettingsArr;
185 NumberSettingsArr_Impl maDefaultNumberSettingsArr;
186 public:
187 NumberingTypeMgr();
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
200 private:
201 OutlineTypeMgr(const OutlineTypeMgr&) = delete;
202 public:
203 OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
204 OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
205 public:
206 OutlineTypeMgr();
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();
216 #endif
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */