2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "svx/svxdllapi.h"
21 #include <boost/shared_ptr.hpp>
23 #include <editeng/numitem.hxx>
24 #include <vcl/font.hxx>
26 namespace svx
{ namespace sidebar
{
28 #define DEFAULT_BULLET_TYPES 8
29 #define DEFAULT_NONE 10
30 #define DEFAULT_NUM_TYPE_MEMBER 5
31 #define DEFAULT_NUM_VALUSET_COUNT 8
32 #define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10
34 typedef sal_uInt16 NBOType
;
37 const NBOType BULLETS
= 0x01;
38 const NBOType GRAPHICBULLETS
= 0x02;
39 const NBOType NUMBERING
= 0x03;
40 const NBOType OUTLINE
= 0x04;
41 const NBOType MIXBULLETS
= 0x05;
44 typedef sal_uInt16 NBType
;
47 const NBOType BULLETS
= 0x01;
48 const NBOType GRAPHICBULLETS
= 0x02;
51 class SVX_DLLPUBLIC NumSettings_Impl
55 short nParentNumbering
;
56 SvxNumberFormat::LabelFollowedBy eLabelFollowedBy
;
61 rtl::OUString sPrefix
;
62 rtl::OUString sSuffix
;
63 rtl::OUString sBulletChar
;
64 rtl::OUString sBulletFont
;
65 SvxBrushItem
*pBrushItem
;
78 typedef NumSettings_Impl
* NumSettings_ImplPtr
;
79 typedef std::vector
< boost::shared_ptr
<NumSettings_Impl
> > NumSettingsArr_Impl
;
81 class SVX_DLLPUBLIC BulletsSettings
84 sal_Bool bIsCustomized
;
85 rtl::OUString sDescription
;
88 BulletsSettings(NBType eTy
) :
89 bIsCustomized(sal_False
),
92 virtual ~BulletsSettings(){}
95 class SVX_DLLPUBLIC BulletsSettings_Impl
:public BulletsSettings
98 sal_Unicode cBulletChar
;
99 //rtl::OUString sBulletFont;
103 BulletsSettings_Impl(NBType eTy
) :
106 virtual ~BulletsSettings_Impl(){}
109 class SVX_DLLPUBLIC GrfBulDataRelation
: public BulletsSettings
113 sal_uInt16 nTabIndex
;
114 sal_uInt16 nGallaryIndex
;
115 const Graphic
* pGrfObj
;
117 GrfBulDataRelation(NBType eTy
):
118 BulletsSettings(eTy
),
119 nTabIndex((sal_uInt16
)0xFFFF),
120 nGallaryIndex((sal_uInt16
)0xFFFF),
124 virtual ~GrfBulDataRelation(){}
127 class SVX_DLLPUBLIC MixBulletsSettings_Impl
131 sal_uInt16 nIndex
; //index in the tab page display
132 sal_uInt16 nIndexDefault
;
133 BulletsSettings
* pBullets
;
135 MixBulletsSettings_Impl(NBType eTy
) :
137 nIndex((sal_uInt16
)0xFFFF),
138 nIndexDefault((sal_uInt16
)0xFFFF),
141 ~MixBulletsSettings_Impl(){}
144 class SVX_DLLPUBLIC NumberSettings_Impl
147 sal_Bool bIsCustomized
;
148 rtl::OUString sDescription
;
149 sal_uInt16 nIndex
; //index in the tab page display
150 sal_uInt16 nIndexDefault
;
151 NumSettings_Impl
*pNumSetting
;
153 NumberSettings_Impl() :
154 bIsCustomized(sal_False
),
155 nIndex((sal_uInt16
)0xFFFF),
156 nIndexDefault((sal_uInt16
)0xFFFF),
159 ~NumberSettings_Impl(){}
162 typedef NumberSettings_Impl
* NumberSettings_ImplPtr
;
163 typedef std::vector
< boost::shared_ptr
<NumberSettings_Impl
> > NumberSettingsArr_Impl
;
165 class SVX_DLLPUBLIC OutlineSettings_Impl
168 sal_Bool bIsCustomized
;
169 rtl::OUString sDescription
;
170 NumSettingsArr_Impl
*pNumSettingsArr
;
172 OutlineSettings_Impl() :
173 bIsCustomized(sal_False
),
174 pNumSettingsArr(NULL
)
176 ~OutlineSettings_Impl(){
180 class SVX_DLLPUBLIC NBOTypeMgrBase
185 const SfxItemSet
* pSet
;
186 SfxMapUnit eCoreUnit
;
187 //Sym3_2508 store the attributes passed from pSet
188 String aNumCharFmtName
;
189 void StoreBulCharFmtName_impl();
190 void StoreMapUnit_impl();
193 NBOTypeMgrBase(const NBOType aType
):eType(aType
),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP
),aNumCharFmtName(String()){}
194 NBOTypeMgrBase(const NBOType aType
,const SfxItemSet
* pArg
):eType(aType
),pSet(pArg
),eCoreUnit(SFX_MAPUNIT_TWIP
),aNumCharFmtName(String()){}
195 NBOTypeMgrBase(const NBOTypeMgrBase
& aTypeMgr
){eType
= aTypeMgr
.eType
;pSet
= aTypeMgr
.pSet
;eCoreUnit
= aTypeMgr
.eCoreUnit
;aNumCharFmtName
= aTypeMgr
.aNumCharFmtName
; }
196 virtual ~NBOTypeMgrBase() {}
197 virtual void Init()=0;
198 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0)=0;
199 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF)=0;
200 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF, sal_Bool isDefault
=false,sal_Bool isResetSize
=false)=0;
201 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false)=0;
202 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
)=0;
203 sal_uInt16
IsSingleLevel(sal_uInt16 nCurLevel
);
204 const SfxItemSet
* GetItems() { return pSet
;}
205 //Sym3_2508 store the attributes passed from pSet
206 void SetItems(const SfxItemSet
* pArg
) { pSet
= pArg
;StoreBulCharFmtName_impl();StoreMapUnit_impl();}
208 String
GetBulCharFmtName();
209 SfxMapUnit
GetMapUnit();
212 void ImplLoad(String filename
);
213 void ImplStore(String filename
);
218 class SVX_DLLPUBLIC BulletsTypeMgr
: public NBOTypeMgrBase
220 friend class OutlineTypeMgr
;
221 friend class NumberingTypeMgr
;
223 static sal_Unicode aDynamicBulletTypes
[DEFAULT_BULLET_TYPES
];
224 static sal_Unicode aDynamicRTLBulletTypes
[DEFAULT_BULLET_TYPES
];
225 static BulletsSettings_Impl
* pActualBullets
[DEFAULT_BULLET_TYPES
];
226 static BulletsTypeMgr
* _instance
;
228 BulletsTypeMgr(const NBOType aType
);
229 BulletsTypeMgr(const NBOType aType
,const SfxItemSet
* pArg
);
230 BulletsTypeMgr(const BulletsTypeMgr
& aTypeMgr
);
231 virtual ~BulletsTypeMgr() {}
233 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0);
234 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF);
235 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF,sal_Bool isDefault
=false,sal_Bool isResetSize
=false);
236 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false);
237 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
);
238 sal_Unicode
GetBulChar(sal_uInt16 nIndex
);
239 Font
GetBulCharFont(sal_uInt16 nIndex
);
240 static BulletsTypeMgr
* GetInstance()
242 if ( _instance
== 0 )
244 _instance
= new BulletsTypeMgr(eNBOType::BULLETS
);
252 class SVX_DLLPUBLIC GraphyicBulletsTypeMgr
: public NBOTypeMgrBase
254 friend class OutlineTypeMgr
;
255 friend class NumberingTypeMgr
;
257 typedef std::vector
<GrfBulDataRelation
*> ListType
;
258 ListType aGrfDataLst
;
259 static GraphyicBulletsTypeMgr
* _instance
;
261 GraphyicBulletsTypeMgr(const NBOType aType
);
262 GraphyicBulletsTypeMgr(const NBOType aType
,const SfxItemSet
* pArg
);
263 GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr
& aTypeMgr
);
264 virtual ~GraphyicBulletsTypeMgr();
266 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0);
267 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF);
268 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF,sal_Bool isDefault
=false,sal_Bool isResetSize
=false);
269 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false);
270 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
);
271 String
GetGrfName(sal_uInt16 nIndex
);
272 static GraphyicBulletsTypeMgr
* GetInstance()
274 if ( _instance
== 0 )
276 _instance
= new GraphyicBulletsTypeMgr(eNBOType::BULLETS
);
284 class SVX_DLLPUBLIC MixBulletsTypeMgr
: public NBOTypeMgrBase
286 friend class OutlineTypeMgr
;
287 friend class NumberingTypeMgr
;
289 static MixBulletsSettings_Impl
* pActualBullets
[DEFAULT_BULLET_TYPES
];
290 static MixBulletsSettings_Impl
* pDefaultActualBullets
[DEFAULT_BULLET_TYPES
];
291 static MixBulletsTypeMgr
* _instance
;
293 MixBulletsTypeMgr(const NBOType aType
);
294 MixBulletsTypeMgr(const NBOType aType
,const SfxItemSet
* pArg
);
295 MixBulletsTypeMgr(const MixBulletsTypeMgr
& aTypeMgr
);
296 virtual ~MixBulletsTypeMgr() {}
298 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0);
299 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF);
300 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF,sal_Bool isDefault
=false,sal_Bool isResetSize
=false);
301 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false);
302 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
);
303 static MixBulletsTypeMgr
* GetInstance()
305 if ( _instance
== 0 )
307 _instance
= new MixBulletsTypeMgr(eNBOType::MIXBULLETS
);
315 class SVX_DLLPUBLIC NumberingTypeMgr
: public NBOTypeMgrBase
318 //NumSettingsArr_Impl* pNumSettingsArr;
319 NumberSettingsArr_Impl
* pNumberSettingsArr
;
320 NumberSettingsArr_Impl
* pDefaultNumberSettingsArr
;
321 static NumberingTypeMgr
* _instance
;
323 NumberingTypeMgr(const NBOType aType
);
324 NumberingTypeMgr(const NBOType aType
,const SfxItemSet
* pArg
);
325 NumberingTypeMgr(const NumberingTypeMgr
& aTypeMgr
);
326 virtual ~NumberingTypeMgr() {}
328 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0);
329 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF);
330 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF,sal_Bool isDefault
=false,sal_Bool isResetSize
=false);
331 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false);
332 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
);
333 sal_uInt16
GetNumCount() const;
334 NumberSettings_Impl
* GetNumSettingByIndex(sal_uInt16 nIndex
) const;
335 static NumberingTypeMgr
* GetInstance()
337 if ( _instance
== 0 )
339 _instance
= new NumberingTypeMgr(eNBOType::NUMBERING
);
346 class SVX_DLLPUBLIC OutlineTypeMgr
: public NBOTypeMgrBase
349 //NumSettingsArr_Impl* pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT];
350 OutlineSettings_Impl
* pOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
351 OutlineSettings_Impl
* pDefaultOutlineSettingsArrs
[DEFAULT_NUM_VALUSET_COUNT
];
352 static OutlineTypeMgr
* _instance
;
354 OutlineTypeMgr(const NBOType aType
);
355 OutlineTypeMgr(const NBOType aType
,const SfxItemSet
* pArg
);
356 OutlineTypeMgr(const OutlineTypeMgr
& aTypeMgr
);
357 virtual ~OutlineTypeMgr() {}
359 virtual sal_uInt16
GetNBOIndexForNumRule(SvxNumRule
& aNum
,sal_uInt16 mLevel
,sal_uInt16 nFromIndex
=0);
360 virtual sal_Bool
RelplaceNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF);
361 virtual sal_Bool
ApplyNumRule(SvxNumRule
& aNum
,sal_uInt16 nIndex
,sal_uInt16 mLevel
=(sal_uInt16
)0xFFFF,sal_Bool isDefault
=false,sal_Bool isResetSize
=false);
362 virtual String
GetDescription(sal_uInt16 nIndex
,sal_Bool isDefault
=false);
363 virtual sal_Bool
IsCustomized(sal_uInt16 nIndex
);
364 static OutlineTypeMgr
* GetInstance()
366 if ( _instance
== 0 )
368 _instance
= new OutlineTypeMgr(eNBOType::OUTLINE
);