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 bool AreListLevelIndentsApplicable() const;
147
148 void dumpAsXml(xmlTextWriterPtr pWriter) const;
149 virtual void FormatDropNotify(const SwFormatDrop& rDrop) override
150 {
151 if(HasWriterListeners() && !IsModifyLocked())
152 CallSwClientNotify(sw::LegacyModifyHint(&rDrop, &rDrop));
153 };
154 bool IsInSwFntCache() const { return m_bInSwFntCache; };
155 void SetInSwFntCache() { m_bInSwFntCache = true; };
156 virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
157 {
158 if(isCHRATR(nWhich))
159 {
160 m_bInSwFntCache = false;
161 }
162 else
163 {
164 switch(nWhich)
165 {
166 case RES_OBJECTDYING:
167 case RES_FMT_CHG:
168 case RES_ATTRSET_CHG:
169 m_bInSwFntCache = false;
170 }
171 }
172 };
173};
174
175class SwGrfFormatColl final : public SwFormatColl
176{
177 friend class SwDoc;
178
179 SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
180 SwGrfFormatColl* pDerFrom = nullptr )
181 : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
182 pDerFrom, RES_GRFFMTCOLL )
183 {}
184
185 SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
186 SwGrfFormatColl* pDerFrom )
187 : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
188 pDerFrom, RES_GRFFMTCOLL )
189 {}
190};
191
192// FEATURE::CONDCOLL
195{
196 NONE,
207};
208
210{
212 sal_uInt32 m_nSubCondition;
213
214public:
215
217 sal_uInt32 nSubCond );
218 virtual ~SwCollCondition() override;
219
221 SwCollCondition( const SwCollCondition& rCpy );
222private:
225public:
226
227 bool operator==( const SwCollCondition& rCmp ) const;
228
229 Master_CollCondition GetCondition() const { return m_nCondition; }
230 sal_uInt32 GetSubCondition() const { return m_nSubCondition; }
231
232 void SetCondition( Master_CollCondition nCond, sal_uInt32 nSubCond );
233 SwTextFormatColl* GetTextFormatColl() const { return const_cast<SwTextFormatColl*>(static_cast<const SwTextFormatColl*>(GetRegisteredIn())); }
234 void RegisterToFormat( SwFormat& );
235};
236
237using SwFormatCollConditions = std::vector<std::unique_ptr<SwCollCondition>>;
238
240{
241 friend class SwDoc;
242 friend class ::sw::DocumentStylePoolManager;
243
245
246 SwConditionTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
247 SwTextFormatColl* pDerFrom )
248 : SwTextFormatColl( rPool, rFormatCollName, pDerFrom, RES_CONDTXTFMTCOLL )
249 {}
250
251public:
252
253 virtual ~SwConditionTextFormatColl() override;
254
255 const SwCollCondition* HasCondition( const SwCollCondition& rCond ) const;
256 const SwFormatCollConditions& GetCondColls() const { return m_CondColls; }
257 void InsertCondition( const SwCollCondition& rCond );
258 void RemoveCondition( const SwCollCondition& rCond );
259
260 void SetConditions( const SwFormatCollConditions& );
261};
262
263// FEATURE::CONDCOLL
266{
267 mpNextTextFormatColl = &rNext;
268}
269#endif
270
271/* 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:211
Master_CollCondition GetCondition() const
Definition: fmtcol.hxx:229
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:233
sal_uInt32 GetSubCondition() const
Definition: fmtcol.hxx:230
sal_uInt32 m_nSubCondition
Definition: fmtcol.hxx:212
SwFormatCollConditions m_CondColls
Definition: fmtcol.hxx:244
SwConditionTextFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwTextFormatColl *pDerFrom)
Definition: fmtcol.hxx:246
const SwFormatCollConditions & GetCondColls() const
Definition: fmtcol.hxx:256
Definition: doc.hxx:195
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:1938
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:63
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:179
SwGrfFormatColl(SwAttrPool &rPool, const OUString &rFormatCollName, SwGrfFormatColl *pDerFrom)
Definition: fmtcol.hxx:185
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:149
bool IsInSwFntCache() const
Definition: fmtcol.hxx:154
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:106
SwTextFormatColl * mpNextTextFormatColl
Definition: fmtcol.hxx:73
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:265
virtual void InvalidateInSwFntCache(sal_uInt16 nWhich) override
Definition: fmtcol.hxx:156
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:155
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:195
std::vector< std::unique_ptr< SwCollCondition > > SwFormatCollConditions
Definition: fmtcol.hxx:237
constexpr TypedWhichId< SwGrfFormatColl > RES_GRFFMTCOLL(158)
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:470
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.
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)