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
37class SAL_DLLPUBLIC_RTTI SwFormatColl: public SwFormat
38{
39protected:
40 SwFormatColl( SwAttrPool& rPool, const char* pFormatName,
41 const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
42 sal_uInt16 nFormatWhich )
43 : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
44 { SetAuto(false); }
45
46 SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
47 const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
48 sal_uInt16 nFormatWhich )
49 : SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
50 { SetAuto(false); }
51
52private:
53 SwFormatColl(const SwFormatColl & ) = delete;
54 const SwFormatColl &operator=(const SwFormatColl &) = delete;
55};
56
59 : public SwFormatColl
61{
62 friend class SwDoc;
63 friend class ::sw::DocumentStylePoolManager;
64
65 SwTextFormatColl(const SwTextFormatColl & rRef) = delete;
66
68
70
72
74
75 SwCharFormat* mpLinkedCharFormat = nullptr;
76
77protected:
78 SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
79 SwTextFormatColl* pDerFrom = nullptr,
80 sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
81 : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
82 , mbStayAssignedToListLevelOfOutlineStyle(false)
83 , mbAssignedToOutlineStyle(false)
84 , m_bInSwFntCache(false)
85 {
86 mpNextTextFormatColl = this;
87 }
88
89 SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
90 SwTextFormatColl* pDerFrom,
91 sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
92 : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
93 , mbStayAssignedToListLevelOfOutlineStyle(false)
94 , mbAssignedToOutlineStyle(false)
95 , m_bInSwFntCache(false)
96 {
97 mpNextTextFormatColl = this;
98 }
99
101 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
102
103public:
104 virtual ~SwTextFormatColl();
105 inline void SetNextTextFormatColl(SwTextFormatColl& rNext);
106 SwTextFormatColl& GetNextTextFormatColl() const { return *mpNextTextFormatColl; }
107
108 void SetLinkedCharFormat(SwCharFormat* pLink);
109
110 const SwCharFormat* GetLinkedCharFormat() const;
111
112 bool IsAtDocNodeSet() const;
113
114 void SetAttrOutlineLevel( int );
115 int GetAttrOutlineLevel() const;
116
117 // Return the list level of the Outline Style - the List Style for the
118 // outline numbering -
119 // to which the Paragraph Style is assigned.
120 int GetAssignedOutlineStyleLevel() const;
121
123 {
124 return mbAssignedToOutlineStyle;
125 }
126
127 // If a Paragraph Style is assigned to list level N of the Outline Style,
128 // then its outline level - AttrOutlineLevel - is set to N+1
129 void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
130 void DeleteAssignmentToListLevelOfOutlineStyle();
131
134 virtual bool SetFormatAttr( const SfxPoolItem& rAttr ) override;
135 virtual bool SetFormatAttr( const SfxItemSet& rSet ) override;
136 virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ) override;
137
139 virtual sal_uInt16 ResetAllFormatAttr() override;
140
142 {
143 return mbStayAssignedToListLevelOfOutlineStyle;
144 }
145
146 ::sw::ListLevelIndents AreListLevelIndentsApplicable() const;
147 bool AreListLevelIndentsApplicableImpl(sal_uInt16 nWhich) const;
148
149 void dumpAsXml(xmlTextWriterPtr pWriter) const;
150 virtual void FormatDropNotify(const SwFormatDrop& rDrop) override
151 {
152 if(HasWriterListeners() && !IsModifyLocked())
153 CallSwClientNotify(sw::LegacyModifyHint(&rDrop, &rDrop));
154 };
155 bool IsInSwFntCache() const { return m_bInSwFntCache; };
156 void SetInSwFntCache() { m_bInSwFntCache = true; };
157 virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
158 {
159 if(isCHRATR(nWhich))
160 {
161 m_bInSwFntCache = false;
162 }
163 else
164 {
165 switch(nWhich)
166 {
167 case RES_OBJECTDYING:
168 case RES_FMT_CHG:
169 case RES_ATTRSET_CHG:
170 m_bInSwFntCache = false;
171 }
172 }
173 };
174};
175
176class SwGrfFormatColl final : public SwFormatColl
177{
178 friend class SwDoc;
179
180 SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
181 SwGrfFormatColl* pDerFrom = nullptr )
182 : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
183 pDerFrom, RES_GRFFMTCOLL )
184 {}
185
186 SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
187 SwGrfFormatColl* pDerFrom )
188 : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
189 pDerFrom, RES_GRFFMTCOLL )
190 {}
191};
192
193// FEATURE::CONDCOLL
196{
197 NONE,
208};
209
211{
213 sal_uInt32 m_nSubCondition;
214
215public:
216
218 sal_uInt32 nSubCond );
219 virtual ~SwCollCondition() override;
220
222 SwCollCondition( const SwCollCondition& rCpy );
223private:
226public:
227
228 bool operator==( const SwCollCondition& rCmp ) const;
229
230 Master_CollCondition GetCondition() const { return m_nCondition; }
231 sal_uInt32 GetSubCondition() const { return m_nSubCondition; }
232
233 void SetCondition( Master_CollCondition nCond, sal_uInt32 nSubCond );
234 SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); }
235 void RegisterToFormat( SwFormat& );
236};
237
238using SwFormatCollConditions = std::vector<std::unique_ptr<SwCollCondition>>;
239
241{
242 friend class SwDoc;
243 friend class ::sw::DocumentStylePoolManager;
244
246
247 SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
248 SwTextFormatColl* pDerFrom )
249 : SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
250 {}
251
252public:
253
254 virtual ~SwConditionTextFormatColl() override;
255
256 const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
257 const SwFormatCollConditions& GetCondColls() const { return m_CondColls; }
258 void InsertCondition( const SwCollCondition& rCond );
259 void RemoveCondition( const SwCollCondition& rCond );
260
261 void SetConditions( const SwFormatCollConditions& );
262};
263
264// FEATURE::CONDCOLL
267{
268 mpNextTextFormatColl = &rNext;
269}
270#endif
271
272/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Represents the style of a text portion.
Definition: charfmt.hxx:27
Master_CollCondition m_nCondition
Definition: fmtcol.hxx:212
Master_CollCondition GetCondition() const
Definition: fmtcol.hxx:230
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:234
sal_uInt32 GetSubCondition() const
Definition: fmtcol.hxx:231
sal_uInt32 m_nSubCondition
Definition: fmtcol.hxx:213
SwFormatCollConditions m_CondColls
Definition: fmtcol.hxx:245
SwConditionTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom)
Definition: fmtcol.hxx:247
const SwFormatCollConditions & GetCondColls() const
Definition: fmtcol.hxx:257
Definition: doc.hxx:197
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:1966
SwFormatColl is just an SwFormat subclass that defaults to m_bAutoFormat=false, expressing that this ...
Definition: fmtcol.hxx:38
SwFormatColl(SwAttrPool &rPool, const char *pFormatName, const WhichRangesContainer &pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:40
SwFormatColl(SwAttrPool &rPool, const OUString &rFormatName, const WhichRangesContainer &pWhichRanges, SwFormatColl *pDerFrom, sal_uInt16 nFormatWhich)
Definition: fmtcol.hxx:46
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:72
Base class for various Writer styles.
Definition: format.hxx:47
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
void SetAuto(bool bNew)
Definition: format.hxx:179
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: format.cxx:224
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:646
SwGrfFormatColl(SwAttrPool &rPool, const char *pFormatCollName, SwGrfFormatColl *pDerFrom=nullptr)
Definition: fmtcol.hxx:180
SwGrfFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwGrfFormatColl *pDerFrom)
Definition: fmtcol.hxx:186
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool mbAssignedToOutlineStyle
Definition: fmtcol.hxx:69
bool m_bInSwFntCache
Definition: fmtcol.hxx:71
SwTextFormatColl(const SwTextFormatColl &rRef)=delete
bool StayAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:141
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
virtual void FormatDropNotify(const SwFormatDrop &rDrop) override
Definition: fmtcol.hxx:150
bool IsInSwFntCache() const
Definition: fmtcol.hxx:155
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:106
SwTextFormatColl * mpNextTextFormatColl
Definition: fmtcol.hxx:73
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:266
virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
Definition: fmtcol.hxx:157
SwTextFormatColl(SwAttrPool &rPool, const char *pFormatCollName, SwTextFormatColl *pDerFrom=nullptr, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:78
bool mbStayAssignedToListLevelOfOutlineStyle
Definition: fmtcol.hxx:67
void SetInSwFntCache()
Definition: fmtcol.hxx:156
SwTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom, sal_uInt16 nFormatWh=RES_TXTFMTCOLL)
Definition: fmtcol.hxx:89
struct _xmlTextWriter * xmlTextWriterPtr
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:196
std::vector< std::unique_ptr< SwCollCondition > > SwFormatCollConditions
Definition: fmtcol.hxx:238
constexpr TypedWhichId< SwGrfFormatColl > RES_GRFFMTCOLL(164)
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:468
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(163)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_FORMAT_MSG_BEGIN)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
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.
ListLevelIndents
Definition: paratr.hxx:52
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)