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 ReplaceNumRule(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 ReplaceNumRule(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{
174 public:
176 virtual ~NumberingTypeMgr() override;
177 virtual void Init() override;
178 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) override;
179 virtual void ReplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override;
180 virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) override;
181 virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override;
182 virtual bool IsCustomized(sal_uInt16 nIndex) override;
184 private:
187};
188
189class OutlineTypeMgr final : public NBOTypeMgrBase
190{
192 public:
194 virtual void Init() override;
195 virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex=0) override;
196 virtual void ReplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override;
197 virtual void ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false,bool isResetSize=false) override;
198 virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override;
199 virtual bool IsCustomized(sal_uInt16 nIndex) override;
200 static OutlineTypeMgr& GetInstance();
201 private:
204};
205}
206#endif
207
208/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:365
static sal_Unicode aDynamicBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:156
static BulletsTypeMgr & GetInstance()
Definition: nbdtmg.cxx:256
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:353
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:327
virtual void ReplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:301
BulletsTypeMgr(const BulletsTypeMgr &)=delete
static BulletsSettings * pActualBullets[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:158
virtual void Init() override
Definition: nbdtmg.cxx:262
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:275
static sal_Unicode aDynamicRTLBulletTypes[DEFAULT_BULLET_TYPES]
Definition: nbdtmg.hxx:157
virtual bool IsCustomized(sal_uInt16 nIndex)=0
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault)=0
virtual void ReplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel)=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:504
virtual void ReplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:472
static NumberingTypeMgr & GetInstance()
Definition: nbdtmg.cxx:401
virtual void Init() override
Definition: nbdtmg.cxx:407
NumberSettingsArr_Impl maDefaultNumberSettingsArr
Definition: nbdtmg.hxx:186
NumberingTypeMgr(const NumberingTypeMgr &)=delete
virtual ~NumberingTypeMgr() override
Definition: nbdtmg.cxx:385
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:531
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:545
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:436
NumberSettingsArr_Impl maNumberSettingsArr
Definition: nbdtmg.hxx:185
NumSettingsArr_Impl * pNumSettingsArr
Definition: nbdtmg.hxx:102
static OutlineTypeMgr & GetInstance()
Definition: nbdtmg.cxx:570
virtual void ApplyNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel, bool isDefault=false, bool isResetSize=false) override
Definition: nbdtmg.cxx:769
virtual sal_uInt16 GetNBOIndexForNumRule(SvxNumRule &aNum, sal_uInt16 mLevel, sal_uInt16 nFromIndex=0) override
Definition: nbdtmg.cxx:627
virtual OUString GetDescription(sal_uInt16 nIndex, bool isDefault) override
Definition: nbdtmg.cxx:881
virtual bool IsCustomized(sal_uInt16 nIndex) override
Definition: nbdtmg.cxx:899
virtual void ReplaceNumRule(SvxNumRule &aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) override
Definition: nbdtmg.cxx:709
OutlineTypeMgr(const OutlineTypeMgr &)=delete
virtual void Init() override
Definition: nbdtmg.cxx:576
OutlineSettings_Impl * pOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:202
OutlineSettings_Impl * pDefaultOutlineSettingsArrs[DEFAULT_NUM_VALUSET_COUNT]
Definition: nbdtmg.hxx:203
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