LibreOffice Module svx (master)  1
nbdtmg.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
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>
26 
27 namespace svx { namespace sidebar {
28 
29 #define DEFAULT_BULLET_TYPES 8
30 #define DEFAULT_NUM_VALUSET_COUNT 8
31 #define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10
32 
33 enum class NBOType
34 {
36 };
37 
39 {
40  public:
44  long nTabValue;
48  OUString sPrefix;
49  OUString sSuffix;
50  OUString sBulletChar;
51  OUString sBulletFont;
54 
55  public:
57  : nNumberType(SVX_NUM_CHARS_UPPER_LETTER)
58  , nParentNumbering(0)
59  , eLabelFollowedBy(SvxNumberFormat::NOTHING)
60  , nTabValue (0)
61  , eNumAlign(SvxAdjust::Left)
62  , nNumAlignAt(0)
63  , nNumIndentAt(0)
64  , pBrushItem(nullptr)
65  , aSize(0,0)
66  {}
67 };
68 
69 typedef std::vector< std::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl;
70 
72 {
73 public:
75  OUString sDescription;
78  BulletsSettings() : cBulletChar(0), bIsCustomized(false) {}
79 };
80 
81 
83 {
84  public:
86  OUString sDescription;
88  public:
90  bIsCustomized(false),
91  pNumSetting(nullptr)
92  {}
93 };
94 
95 typedef std::vector< std::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl;
96 
98 {
99  public:
101  OUString sDescription;
102  NumSettingsArr_Impl *pNumSettingsArr;
103  public:
105  bIsCustomized(false),
106  pNumSettingsArr(nullptr)
107  {}
108 };
109 
111 {
112  private:
113  const SfxItemSet* pSet;
115  // store the attributes passed from pSet
117  OUString aNumCharFmtName;
119 
120  NBOTypeMgrBase(const NBOTypeMgrBase&) = delete;
121 
122  public:
124  : pSet(nullptr)
125  , eCoreUnit(MapUnit::MapTwip)
126  , bIsLoading(false)
127  {}
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);
138  protected:
139  const OUString& GetBulletCharFmtName() const { return aBulletCharFmtName;}
140  const OUString& GetNumCharFmtName() const { return aNumCharFmtName;}
141  MapUnit GetMapUnit() const { return eCoreUnit;}
142  protected:
143  void ImplLoad(const OUString& filename);
144  void ImplStore(const OUString& filename);
145 
146 };
147 
148 
149 class BulletsTypeMgr final : public NBOTypeMgrBase
150 {
151  friend class OutlineTypeMgr;
152  friend class NumberingTypeMgr;
153  private:
154  BulletsTypeMgr(const BulletsTypeMgr&) = delete;
155  public:
159  public:
160  BulletsTypeMgr();
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();
168 };
169 
170 
172 {
173  private:
174  NumberingTypeMgr(const NumberingTypeMgr&) = delete;
175  public:
176  NumberSettingsArr_Impl maNumberSettingsArr;
177  NumberSettingsArr_Impl maDefaultNumberSettingsArr;
178  public:
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();
188 };
189 
191 {
192  private:
193  OutlineTypeMgr(const OutlineTypeMgr&) = delete;
194  public:
197  public:
198  OutlineTypeMgr();
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();
206 };
207 }}
208 #endif
209 
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:332
#define DEFAULT_BULLET_TYPES
Definition: nbdtmg.hxx:29
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:884
void Init()
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:640
MapUnit GetMapUnit() const
Definition: nbdtmg.hxx:141
#define DEFAULT_NUM_VALUSET_COUNT
Definition: nbdtmg.hxx:30
NumberSettingsArr_Impl maNumberSettingsArr
Definition: nbdtmg.hxx:176
SVX_NUM_CHARS_UPPER_LETTER
std::vector< std::shared_ptr< NumberSettings_Impl > > NumberSettingsArr_Impl
Definition: nbdtmg.hxx:95
NumSettings_Impl * pNumSetting
Definition: nbdtmg.hxx:87
virtual void Init() override
Definition: nbdtmg.cxx:269
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:371
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:545
SvxNumType
sal_uInt16 sal_Unicode
static OutlineTypeMgr & GetInstance()
Definition: nbdtmg.cxx:591
virtual void Init() override
Definition: nbdtmg.cxx:596
std::vector< std::shared_ptr< NumSettings_Impl > > NumSettingsArr_Impl
Definition: nbdtmg.hxx:69
SvxNumberFormat::LabelFollowedBy eLabelFollowedBy
Definition: nbdtmg.hxx:43
NumSettingsArr_Impl * pNumSettingsArr
Definition: nbdtmg.hxx:102
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:307
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:448
const OUString & GetNumCharFmtName() const
Definition: nbdtmg.hxx:140
SvxAdjust
virtual ~NumberingTypeMgr() override
Definition: nbdtmg.cxx:392
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:281
SvxBrushItem * pBrushItem
Definition: nbdtmg.hxx:52
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:774
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:902
static BulletsSettings * pActualBullets[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:158
NumberSettingsArr_Impl maDefaultNumberSettingsArr
Definition: nbdtmg.hxx:177
OutlineSettings_Impl * pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:195
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:714
const OUString & GetBulletCharFmtName() const
Definition: nbdtmg.hxx:139
static BulletsTypeMgr & GetInstance()
Definition: nbdtmg.cxx:264
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:516
static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:156
static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:157
MapUnit
const SfxItemSet * pSet
Definition: nbdtmg.hxx:113
OutlineSettings_Impl * pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:196
Left
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:359
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:559
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:484
static NumberingTypeMgr & GetInstance()
Definition: nbdtmg.cxx:414
virtual void Init() override
Definition: nbdtmg.cxx:419