LibreOffice Module sw (master) 1
fmtcol.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_SW_INC_FMTCOL_HXX
20#define INCLUDED_SW_INC_FMTCOL_HXX
21
22#include "swdllapi.h"
23#include "format.hxx"
24#include "hintids.hxx"
25#include "paratr.hxx"
26#include <rtl/ustring.hxx>
27#include <tools/solar.h>
28
29#include <vector>
30#include <memory>
31
32class SwAttrPool;
33namespace sw{ class DocumentStylePoolManager; }
34
35class SAL_DLLPUBLIC_RTTI SwFormatColl: public SwFormat
36{
37protected:
38 SwFormatColl( SwAttrPool& rPool, const char* pFormatName,
39 const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
40 sal_uInt16 nFormatWhich )
41 : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
42 { SetAuto(false); }
43
44 SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
45 const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
46 sal_uInt16 nFormatWhich )
47 : SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
48 { SetAuto(false); }
49
50private:
51 SwFormatColl(const SwFormatColl & ) = delete;
52 const SwFormatColl &operator=(const SwFormatColl &) = delete;
53};
54
57 : public SwFormatColl
59{
60 friend class SwDoc;
61 friend class ::sw::DocumentStylePoolManager;
62
63 SwTextFormatColl(const SwTextFormatColl & rRef) = delete;
64
66
68
70
72
73 SwCharFormat* mpLinkedCharFormat = nullptr;
74
75protected:
76 SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
77 SwTextFormatColl* pDerFrom = nullptr,
78 sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
79 : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
80 , mbStayAssignedToListLevelOfOutlineStyle(false)
81 , mbAssignedToOutlineStyle(false)
82 , m_bInSwFntCache(false)
83 {
84 mpNextTextFormatColl = this;
85 }
86
87 SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
88 SwTextFormatColl* pDerFrom,
89 sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
90 : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
91 , mbStayAssignedToListLevelOfOutlineStyle(false)
92 , mbAssignedToOutlineStyle(false)
93 , m_bInSwFntCache(false)
94 {
95 mpNextTextFormatColl = this;
96 }
97
99 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
100
101public:
102 virtual ~SwTextFormatColl();
103 inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
104 SwTextFormatColl& GetNextTextFormatColl() const { return *mpNextTextFormatColl; }
105
106 void SetLinkedCharFormat(SwCharFormat& rLink);
107
108 const SwCharFormat* GetLinkedCharFormat() const;
109
110 bool IsAtDocNodeSet() const;
111
112 void SetAttrOutlineLevel( int );
113 int GetAttrOutlineLevel() const;
114
115 // Return the list level of the Outline Style - the List Style for the
116 // outline numbering -
117 // to which the Paragraph Style is assigned.
118 int GetAssignedOutlineStyleLevel() const;
119
121 {
122 return mbAssignedToOutlineStyle;
123 }
124
125 // If a Paragraph Style is assigned to list level N of the Outline Style,
126 // then its outline level - AttrOutlineLevel - is set to N+1
127 void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
128 void DeleteAssignmentToListLevelOfOutlineStyle();
129
132 virtual bool SetFormatAttr( const SfxPoolItem& rAttr ) override;
133 virtual bool SetFormatAttr( const SfxItemSet& rSet ) override;
134 virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override;
135
137 virtual sal_uInt16 ResetAllFormatAttr() override;
138
140 {
141 return mbStayAssignedToListLevelOfOutlineStyle;
142 }
143
144 bool AreListLevelIndentsApplicable() const;
145
146 void dumpAsXml(xmlTextWriterPtr pWriter) const;
147 virtual void FormatDropNotify(const SwFormatDrop& rDrop) override
148 {
151 };
152 bool IsInSwFntCache() const { return m_bInSwFntCache; };
153 void SetInSwFntCache() { m_bInSwFntCache = true; };
154 virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
155 {
156 if(isCHRATR(nWhich))
157 {
158 m_bInSwFntCache = false;
159 }
160 else
161 {
162 switch(nWhich)
163 {
164 case RES_OBJECTDYING:
165 case RES_FMT_CHG:
166 case RES_ATTRSET_CHG:
167 m_bInSwFntCache = false;
168 }
169 }
170 };
171};
172
173class SwGrfFormatColl final : public SwFormatColl
174{
175 friend class SwDoc;
176
177 SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
178 SwGrfFormatColl* pDerFrom = nullptr )
179 : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
180 pDerFrom, RES_GRFFMTCOLL )
181 {}
182
183 SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
184 SwGrfFormatColl* pDerFrom )
185 : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
186 pDerFrom, RES_GRFFMTCOLL )
187 {}
188};
189
190// FEATURE::CONDCOLL
193{
194 NONE,
205};
206
208{
211
212public:
213
215 sal_uLong nSubCond );
216 virtual ~SwCollCondition() override;
217
219 SwCollCondition( const SwCollCondition& rCpy );
220private:
223public:
224
225 bool operator==( const SwCollCondition& rCmp ) const;
226
227 Master_CollCondition GetCondition() const { return m_nCondition; }
228 sal_uLong GetSubCondition() const { return m_nSubCondition; }
229
230 void SetCondition( Master_CollCondition nCond, sal_uLong nSubCond );
231 SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); }
232 void RegisterToFormat( SwFormat& );
233};
234
235using SwFormatCollConditions = std::vector<std::unique_ptr<SwCollCondition>>;
236
238{
239 friend class SwDoc;
240 friend class ::sw::DocumentStylePoolManager;
241
243
244 SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
245 SwTextFormatColl* pDerFrom )
246 : SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
247 {}
248
249public:
250
251 virtual ~SwConditionTextFormatColl() override;
252
253 const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
254 const SwFormatCollConditions& GetCondColls() const { return m_CondColls; }
255 void InsertCondition( const SwCollCondition& rCond );
256 void RemoveCondition( const SwCollCondition& rCond );
257
258 void SetConditions( const SwFormatCollConditions& );
259};
260
261// FEATURE::CONDCOLL
264{
265 mpNextTextFormatColl = &rNext;
266}
267#endif
268
269/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _xmlTextWriter * xmlTextWriterPtr
Represents the style of a text portion.
Definition: charfmt.hxx:27
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
Master_CollCondition m_nCondition
Definition: fmtcol.hxx:209
sal_uLong m_nSubCondition
Definition: fmtcol.hxx:210
sal_uLong GetSubCondition() const
Definition: fmtcol.hxx:228
Master_CollCondition GetCondition() const
Definition: fmtcol.hxx:227
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:231
SwFormatCollConditions m_CondColls
Definition: fmtcol.hxx:242
SwConditionTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom)
Definition: fmtcol.hxx:244
const SwFormatCollConditions & GetCondColls() const
Definition: fmtcol.hxx:254
Definition: doc.hxx:192
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
Definition: docfmt.cxx:1943
SwFormatColl(SwAttrPool &rPool, const char *pFormatName, const WhichRangesContainer &pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:38
SwFormatColl(SwAttrPool &rPool, const OUString &rFormatName, const WhichRangesContainer &pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:44
SwFormatColl(const SwFormatColl &)=delete
const SwFormatColl & operator=(const SwFormatColl &)=delete
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps.
Definition: paratr.hxx:63
Base class for various Writer styles.
Definition: format.hxx:47
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:620
void SetAuto(bool bNew)
Definition: format.hxx:179
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: format.cxx:226
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:449
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:648
SwGrfFormatColl(SwAttrPool &rPool, const char *pFormatCollName, SwGrfFormatColl *pDerFrom=nullptr)
Definition: fmtcol.hxx:177
SwGrfFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwGrfFormatColl *pDerFrom)
Definition: fmtcol.hxx:183
bool IsModifyLocked() const
Definition: calbck.hxx:210
bool HasWriterListeners() const
Definition: calbck.hxx:202
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
bool mbAssignedToOutlineStyle
Definition: fmtcol.hxx:67
bool m_bInSwFntCache
Definition: fmtcol.hxx:69
SwTextFormatColl(const SwTextFormatColl &rRef)=delete
bool StayAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:139
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:120
virtual void FormatDropNotify(const SwFormatDrop &rDrop) override
Definition: fmtcol.hxx:147
bool IsInSwFntCache() const
Definition: fmtcol.hxx:152
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:104
SwTextFormatColl * mpNextTextFormatColl
Definition: fmtcol.hxx:71
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:263
virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
Definition: fmtcol.hxx:154
SwTextFormatColl(SwAttrPool &rPool, const char *pFormatCollName, SwTextFormatColl *pDerFrom=nullptr, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:76
bool mbStayAssignedToListLevelOfOutlineStyle
Definition: fmtcol.hxx:65
void SetInSwFntCache()
Definition: fmtcol.hxx:153
SwTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:87
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:325
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:193
std::vector< std::unique_ptr< SwCollCondition > > SwFormatCollConditions
Definition: fmtcol.hxx:235
constexpr TypedWhichId< SwGrfFormatColl > RES_GRFFMTCOLL(158)
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:479
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(157)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
WhichRangesContainer const aGrfFormatCollSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aTextFormatCollSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_LEVEL, RES_PARATR_LIST_LEVEL, RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
NONE
Dialog to specify the properties of date form field.
sal_uIntPtr sal_uLong
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)