1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _NBDTMG_HXX 25 #define _NBDTMG_HXX 26 #include "svx/svxdllapi.h" 27 28 #ifndef _SVX_NUMITEM_HXX 29 #include <editeng/numitem.hxx> 30 #endif 31 #define _SVSTDARR_USHORTS 32 #include <svl/svstdarr.hxx> 33 #include <svl/svarray.hxx> 34 #ifndef _LIST_HXX 35 #include <tools/list.hxx> 36 #endif 37 #ifndef _SV_FONT_HXX 38 #include <vcl/font.hxx> 39 #endif 40 41 namespace svx { namespace sidebar { 42 43 #define DEFAULT_BULLET_TYPES 8 44 #define DEFAULT_NONE 10 45 #define DEFAULT_NUM_TYPE_MEMBER 5 46 #define DEFAULT_NUM_VALUSET_COUNT 8 47 #define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10 48 49 typedef sal_uInt16 NBOType; 50 namespace eNBOType 51 { 52 const NBOType BULLETS = 0x01; 53 const NBOType GRAPHICBULLETS = 0x02; 54 const NBOType NUMBERING = 0x03; 55 const NBOType OUTLINE = 0x04; 56 const NBOType MIXBULLETS = 0x05; 57 } 58 59 typedef sal_uInt16 NBType; 60 namespace eNBType 61 { 62 const NBOType BULLETS = 0x01; 63 const NBOType GRAPHICBULLETS = 0x02; 64 } 65 66 class SVX_DLLPUBLIC NumSettings_Impl 67 { 68 public: 69 short nNumberType; 70 short nParentNumbering; 71 SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy; 72 long nTabValue; 73 SvxAdjust eNumAlign; 74 long nNumAlignAt; 75 long nNumIndentAt; 76 rtl::OUString sPrefix; 77 rtl::OUString sSuffix; 78 rtl::OUString sBulletChar; 79 rtl::OUString sBulletFont; 80 SvxBrushItem *pBrushItem; 81 Size aSize; 82 83 public: NumSettings_Impl()84 NumSettings_Impl() : 85 nNumberType(0), 86 nParentNumbering(0), 87 pBrushItem(0), 88 aSize(0,0) 89 {} ~NumSettings_Impl()90 ~NumSettings_Impl(){} 91 }; 92 /* 93 typedef NumSettings_Impl* NumSettings_ImplPtr; 94 SV_DECL_PTRARR_DEL(NumSettingsArr_Impl,NumSettings_ImplPtr,8,4) 95 SV_IMPL_PTRARR( NumSettingsArr_Impl, NumSettings_ImplPtr )*/ 96 97 class NumSettingsArr_Impl; 98 99 class SVX_DLLPUBLIC BulletsSettings 100 { 101 public: 102 sal_Bool bIsCustomized; 103 rtl::OUString sDescription; 104 NBType eType; 105 public: BulletsSettings(NBType eTy)106 BulletsSettings(NBType eTy) : 107 bIsCustomized(sal_False), 108 eType(eTy) 109 {} ~BulletsSettings()110 virtual ~BulletsSettings(){} 111 }; 112 113 class SVX_DLLPUBLIC BulletsSettings_Impl:public BulletsSettings 114 { 115 public: 116 sal_Unicode cBulletChar; 117 //rtl::OUString sBulletFont; 118 Font aFont; 119 120 public: BulletsSettings_Impl(NBType eTy)121 BulletsSettings_Impl(NBType eTy) : 122 BulletsSettings(eTy) 123 {} ~BulletsSettings_Impl()124 virtual ~BulletsSettings_Impl(){} 125 }; 126 127 class SVX_DLLPUBLIC GrfBulDataRelation: public BulletsSettings 128 { 129 public: 130 String sGrfName; 131 sal_uInt16 nTabIndex; 132 sal_uInt16 nGallaryIndex; 133 const Graphic* pGrfObj; 134 Size aSize; GrfBulDataRelation(NBType eTy)135 GrfBulDataRelation(NBType eTy): 136 BulletsSettings(eTy), 137 nTabIndex((sal_uInt16)0xFFFF), 138 nGallaryIndex((sal_uInt16)0xFFFF), 139 pGrfObj(0), 140 aSize(0,0) 141 {} ~GrfBulDataRelation()142 virtual ~GrfBulDataRelation(){} 143 }; 144 145 class SVX_DLLPUBLIC MixBulletsSettings_Impl 146 { 147 public: 148 NBType eType; 149 sal_uInt16 nIndex; //index in the tab page display 150 sal_uInt16 nIndexDefault; 151 BulletsSettings* pBullets; 152 public: MixBulletsSettings_Impl(NBType eTy)153 MixBulletsSettings_Impl(NBType eTy) : 154 eType(eTy), 155 nIndex((sal_uInt16)0xFFFF), 156 nIndexDefault((sal_uInt16)0xFFFF), 157 pBullets(0) 158 {} ~MixBulletsSettings_Impl()159 ~MixBulletsSettings_Impl(){} 160 }; 161 162 class SVX_DLLPUBLIC NumberSettings_Impl 163 { 164 public: 165 sal_Bool bIsCustomized; 166 rtl::OUString sDescription; 167 sal_uInt16 nIndex; //index in the tab page display 168 sal_uInt16 nIndexDefault; 169 NumSettings_Impl *pNumSetting; 170 public: NumberSettings_Impl()171 NumberSettings_Impl() : 172 bIsCustomized(sal_False), 173 nIndex((sal_uInt16)0xFFFF), 174 nIndexDefault((sal_uInt16)0xFFFF), 175 pNumSetting(NULL) 176 {} ~NumberSettings_Impl()177 ~NumberSettings_Impl(){} 178 }; 179 180 class NumberSettingsArr_Impl; 181 182 class SVX_DLLPUBLIC OutlineSettings_Impl 183 { 184 public: 185 sal_Bool bIsCustomized; 186 rtl::OUString sDescription; 187 NumSettingsArr_Impl *pNumSettingsArr; 188 public: OutlineSettings_Impl()189 OutlineSettings_Impl() : 190 bIsCustomized(sal_False), 191 pNumSettingsArr(NULL) 192 {} ~OutlineSettings_Impl()193 ~OutlineSettings_Impl(){ 194 } 195 }; 196 197 class SVX_DLLPUBLIC NBOTypeMgrBase 198 { 199 public: 200 NBOType eType; 201 private: 202 const SfxItemSet* pSet; 203 SfxMapUnit eCoreUnit; 204 // store the attributes passed from pSet 205 String aNumCharFmtName; 206 void StoreBulCharFmtName_impl(); 207 void StoreMapUnit_impl(); 208 209 public: NBOTypeMgrBase(const NBOType aType)210 NBOTypeMgrBase(const NBOType aType):eType(aType),pSet(0),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} NBOTypeMgrBase(const NBOType aType,const SfxItemSet * pArg)211 NBOTypeMgrBase(const NBOType aType,const SfxItemSet* pArg):eType(aType),pSet(pArg),eCoreUnit(SFX_MAPUNIT_TWIP),aNumCharFmtName(String()){} NBOTypeMgrBase(const NBOTypeMgrBase & aTypeMgr)212 NBOTypeMgrBase(const NBOTypeMgrBase& aTypeMgr){eType = aTypeMgr.eType;pSet = aTypeMgr.pSet;eCoreUnit = aTypeMgr.eCoreUnit;aNumCharFmtName = aTypeMgr.aNumCharFmtName; } ~NBOTypeMgrBase()213 virtual ~NBOTypeMgrBase() {} 214 virtual void Init()=0; 215 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0)=0; 216 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF)=0; 217 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF, sal_Bool isDefault=false,sal_Bool isResetSize=false)=0; 218 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false)=0; 219 virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0; 220 sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel); GetItems()221 const SfxItemSet* GetItems() { return pSet;} 222 // store the attributes passed from pSet SetItems(const SfxItemSet * pArg)223 void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();} 224 protected: 225 String GetBulCharFmtName(); 226 SfxMapUnit GetMapUnit(); 227 protected: 228 sal_Bool bIsLoading; 229 void ImplLoad(String filename); 230 void ImplStore(String filename); 231 232 }; 233 234 235 class SVX_DLLPUBLIC BulletsTypeMgr: public NBOTypeMgrBase 236 { 237 friend class OutlineTypeMgr; 238 friend class NumberingTypeMgr; 239 public: 240 static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]; 241 static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]; 242 static BulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; 243 static BulletsTypeMgr* _instance; 244 public: 245 BulletsTypeMgr(const NBOType aType); 246 BulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); 247 BulletsTypeMgr(const BulletsTypeMgr& aTypeMgr); ~BulletsTypeMgr()248 virtual ~BulletsTypeMgr() {} 249 virtual void Init(); 250 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); 251 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); 252 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); 253 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); 254 virtual sal_Bool IsCustomized(sal_uInt16 nIndex); 255 sal_Unicode GetBulChar(sal_uInt16 nIndex); 256 Font GetBulCharFont(sal_uInt16 nIndex); GetInstance()257 static BulletsTypeMgr* GetInstance() 258 { 259 if ( _instance == 0 ) 260 { 261 _instance = new BulletsTypeMgr(eNBOType::BULLETS); 262 } 263 264 return _instance; 265 } 266 267 }; 268 269 class SVX_DLLPUBLIC GraphicBulletsTypeMgr: public NBOTypeMgrBase 270 { 271 friend class OutlineTypeMgr; 272 friend class NumberingTypeMgr; 273 public: 274 List aGrfDataLst; 275 static GraphicBulletsTypeMgr* _instance; 276 public: 277 GraphicBulletsTypeMgr(const NBOType aType); 278 GraphicBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); 279 GraphicBulletsTypeMgr(const GraphicBulletsTypeMgr& aTypeMgr); ~GraphicBulletsTypeMgr()280 virtual ~GraphicBulletsTypeMgr() {} 281 virtual void Init(); 282 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); 283 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); 284 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); 285 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); 286 virtual sal_Bool IsCustomized(sal_uInt16 nIndex); 287 String GetGrfName(sal_uInt16 nIndex); GetInstance()288 static GraphicBulletsTypeMgr* GetInstance() 289 { 290 if ( _instance == 0 ) 291 { 292 _instance = new GraphicBulletsTypeMgr(eNBOType::BULLETS); 293 } 294 295 return _instance; 296 } 297 298 }; 299 300 class SVX_DLLPUBLIC MixBulletsTypeMgr: public NBOTypeMgrBase 301 { 302 friend class OutlineTypeMgr; 303 friend class NumberingTypeMgr; 304 public: 305 static MixBulletsSettings_Impl* pActualBullets[DEFAULT_BULLET_TYPES]; 306 static MixBulletsSettings_Impl* pDefaultActualBullets[DEFAULT_BULLET_TYPES]; 307 static MixBulletsTypeMgr* _instance; 308 public: 309 MixBulletsTypeMgr(const NBOType aType); 310 MixBulletsTypeMgr(const NBOType aType,const SfxItemSet* pArg); 311 MixBulletsTypeMgr(const MixBulletsTypeMgr& aTypeMgr); ~MixBulletsTypeMgr()312 virtual ~MixBulletsTypeMgr() {} 313 virtual void Init(); 314 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); 315 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); 316 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); 317 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); 318 virtual sal_Bool IsCustomized(sal_uInt16 nIndex); GetInstance()319 static MixBulletsTypeMgr* GetInstance() 320 { 321 if ( _instance == 0 ) 322 { 323 _instance = new MixBulletsTypeMgr(eNBOType::MIXBULLETS); 324 } 325 326 return _instance; 327 } 328 329 }; 330 331 class SVX_DLLPUBLIC NumberingTypeMgr: public NBOTypeMgrBase 332 { 333 public: 334 //NumSettingsArr_Impl* pNumSettingsArr; 335 NumberSettingsArr_Impl* pNumberSettingsArr; 336 NumberSettingsArr_Impl* pDefaultNumberSettingsArr; 337 static NumberingTypeMgr* _instance; 338 public: 339 NumberingTypeMgr(const NBOType aType); 340 NumberingTypeMgr(const NBOType aType,const SfxItemSet* pArg); 341 NumberingTypeMgr(const NumberingTypeMgr& aTypeMgr); ~NumberingTypeMgr()342 virtual ~NumberingTypeMgr() {} 343 virtual void Init(); 344 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); 345 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); 346 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); 347 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); 348 virtual sal_Bool IsCustomized(sal_uInt16 nIndex); 349 sal_uInt16 GetNumCount() const; 350 NumberSettings_Impl* GetNumSettingByIndex(sal_uInt16 nIndex) const; GetInstance()351 static NumberingTypeMgr* GetInstance() 352 { 353 if ( _instance == 0 ) 354 { 355 _instance = new NumberingTypeMgr(eNBOType::NUMBERING); 356 } 357 358 return _instance; 359 } 360 }; 361 362 class SVX_DLLPUBLIC OutlineTypeMgr: public NBOTypeMgrBase 363 { 364 public: 365 //NumSettingsArr_Impl* pNumSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; 366 OutlineSettings_Impl* pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; 367 OutlineSettings_Impl* pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]; 368 static OutlineTypeMgr* _instance; 369 public: 370 OutlineTypeMgr(const NBOType aType); 371 OutlineTypeMgr(const NBOType aType,const SfxItemSet* pArg); 372 OutlineTypeMgr(const OutlineTypeMgr& aTypeMgr); ~OutlineTypeMgr()373 virtual ~OutlineTypeMgr() {} 374 virtual void Init(); 375 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0); 376 virtual sal_Bool RelplaceNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF); 377 virtual sal_Bool ApplyNumRule(SvxNumRule& aNum,sal_uInt16 nIndex,sal_uInt16 mLevel=(sal_uInt16)0xFFFF,sal_Bool isDefault=false,sal_Bool isResetSize=false); 378 virtual String GetDescription(sal_uInt16 nIndex,sal_Bool isDefault=false); 379 virtual sal_Bool IsCustomized(sal_uInt16 nIndex); GetInstance()380 static OutlineTypeMgr* GetInstance() 381 { 382 if ( _instance == 0 ) 383 { 384 _instance = new OutlineTypeMgr(eNBOType::OUTLINE); 385 } 386 387 return _instance; 388 } 389 }; 390 }} 391 #endif 392