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
27namespace svx::sidebar {
28
29#define DEFAULT_BULLET_TYPES 8
30#define DEFAULT_NUM_VALUSET_COUNT 8
31#define DEFAULT_NUMBERING_CACHE_FORMAT_VERSION 0x10
32
33enum class NBOType
34{
36};
37
39{
40 public:
48 OUString sPrefix;
49 OUString sSuffix;
50 OUString sBulletChar;
51 OUString sBulletFont;
54
55 public:
57 : nNumberType(SVX_NUM_CHARS_UPPER_LETTER)
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
69typedef std::vector< std::shared_ptr<NumSettings_Impl> > NumSettingsArr_Impl;
70
72{
73public:
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
95typedef std::vector< std::shared_ptr<NumberSettings_Impl> > NumberSettingsArr_Impl;
96
98{
99 public:
101 OUString sDescription;
103 public:
105 bIsCustomized(false),
106 pNumSettingsArr(nullptr)
107 {}
108};
109
111{
112 private:
115 // store the attributes passed from pSet
119
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(std::u16string_view filename);
144 void ImplStore(std::u16string_view filename);
145
146};
147
148
149class BulletsTypeMgr final : public NBOTypeMgrBase
150{
151 friend class OutlineTypeMgr;
152 friend class NumberingTypeMgr;
153 private:
155 public:
159 public:
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:
175 public:
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;
188};
189
190class OutlineTypeMgr final : public NBOTypeMgrBase
191{
192 private:
194 public:
197 public:
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 RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:295
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:358
static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:156
static BulletsTypeMgr & GetInstance()
Definition: nbdtmg.cxx:250
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:346
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:320
BulletsTypeMgr(const BulletsTypeMgr &)=delete
static BulletsSettings * pActualBullets[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:158
virtual void Init() override
Definition: nbdtmg.cxx:256
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:269
static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:157
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel)=0
virtual bool IsCustomized(sal_uInt16 nIndex)=0
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault)=0
MapUnit GetMapUnit() const
Definition: nbdtmg.hxx:141
const SfxItemSet * pSet
Definition: nbdtmg.hxx:113
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false)=0
const OUString & GetNumCharFmtName() const
Definition: nbdtmg.hxx:140
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0)=0
NBOTypeMgrBase(const NBOTypeMgrBase &)=delete
const OUString & GetBulletCharFmtName() const
Definition: nbdtmg.hxx:139
SvxNumberFormat::LabelFollowedBy eLabelFollowedBy
Definition: nbdtmg.hxx:43
SvxBrushItem * pBrushItem
Definition: nbdtmg.hxx:52
NumSettings_Impl * pNumSetting
Definition: nbdtmg.hxx:87
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:497
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:465
static NumberingTypeMgr & GetInstance()
Definition: nbdtmg.cxx:394
virtual void Init() override
Definition: nbdtmg.cxx:400
NumberSettingsArr_Impl maDefaultNumberSettingsArr
Definition: nbdtmg.hxx:177
NumberingTypeMgr(const NumberingTypeMgr &)=delete
virtual ~NumberingTypeMgr() override
Definition: nbdtmg.cxx:378
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:524
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:538
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:429
NumberSettingsArr_Impl maNumberSettingsArr
Definition: nbdtmg.hxx:176
NumSettingsArr_Impl * pNumSettingsArr
Definition: nbdtmg.hxx:102
static OutlineTypeMgr & GetInstance()
Definition: nbdtmg.cxx:563
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:754
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:614
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:864
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:882
OutlineTypeMgr(const OutlineTypeMgr &)=delete
virtual void RelplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:694
virtual void Init() override
Definition: nbdtmg.cxx:569
OutlineSettings_Impl * pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:195
OutlineSettings_Impl * pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:196
sal_Int16 nParentNumbering
MapUnit
std::vector< std::shared_ptr< NumberSettings_Impl > > NumberSettingsArr_Impl
Definition: nbdtmg.hxx:95
std::vector< std::shared_ptr< NumSettings_Impl > > NumSettingsArr_Impl
Definition: nbdtmg.hxx:69
long Long
#define DEFAULT_BULLET_TYPES
Definition: nbdtmg.hxx:29
#define DEFAULT_NUM_VALUSET_COUNT
Definition: nbdtmg.hxx:30
const sal_Unicode cBulletChar
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
SvxNumType
SVX_NUM_CHARS_UPPER_LETTER
SvxAdjust
Left
sal_uInt16 sal_Unicode
sal_uInt32 sal_UCS4