/src/libreoffice/sw/inc/swatrset.hxx
Line | Count | Source |
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_SWATRSET_HXX |
20 | | #define INCLUDED_SW_INC_SWATRSET_HXX |
21 | | |
22 | | #include <svl/itemset.hxx> |
23 | | #include <svl/itempool.hxx> |
24 | | #include "swdllapi.h" |
25 | | #include "calbck.hxx" |
26 | | |
27 | | class SwDoc; |
28 | | class OutputDevice; |
29 | | class IDocumentSettingAccess; |
30 | | class ItemInfoPackage; |
31 | | class SvxPostureItem; |
32 | | class SvxWeightItem; |
33 | | class SvxShadowedItem; |
34 | | class SvxAutoKernItem; |
35 | | class SvxWordLineModeItem; |
36 | | class SvxContourItem; |
37 | | class SvxKerningItem; |
38 | | class SvxUnderlineItem; |
39 | | class SvxOverlineItem; |
40 | | class SvxCrossedOutItem; |
41 | | class SvxFontHeightItem; |
42 | | class SvxFontItem; |
43 | | class SvxColorItem; |
44 | | class SvxLanguageItem; |
45 | | class SvxEscapementItem; |
46 | | class SvxCaseMapItem; |
47 | | class SvxNoHyphenItem; |
48 | | class SvxEmphasisMarkItem; |
49 | | class SvxTwoLinesItem; |
50 | | class SvxCharScaleWidthItem; |
51 | | class SvxCharRotateItem; |
52 | | class SvxCharReliefItem; |
53 | | class SvxCharHiddenItem; |
54 | | class SvxScriptHintItem; |
55 | | class SvxOpticalSizingItem; |
56 | | |
57 | | // Frame attributes |
58 | | class SwFormatFillOrder; |
59 | | class SwFormatFrameSize; |
60 | | class SvxPaperBinItem; |
61 | | class SvxLeftMarginItem; |
62 | | class SvxTextLeftMarginItem; |
63 | | class SvxFirstLineIndentItem; |
64 | | class SvxRightMarginItem; |
65 | | class SvxGutterLeftMarginItem; |
66 | | class SvxGutterRightMarginItem; |
67 | | class SvxLRSpaceItem; |
68 | | class SvxULSpaceItem; |
69 | | class SwFormatContent; |
70 | | class SwFormatHeader; |
71 | | class SwFormatFooter; |
72 | | class SvxPrintItem; |
73 | | class SvxOpaqueItem; |
74 | | class SvxProtectItem; |
75 | | class SwFormatSurround; |
76 | | class SwFormatVertOrient; |
77 | | class SwFormatHoriOrient; |
78 | | class SwFormatAnchor; |
79 | | class SvxBoxItem; |
80 | | class SvxBrushItem; |
81 | | class SvxShadowItem; |
82 | | class SwFormatPageDesc; |
83 | | class SvxFormatBreakItem; |
84 | | class SwFormatCol; |
85 | | class SvxMacroItem; |
86 | | class SvxFormatKeepItem; |
87 | | class SwFormatURL; |
88 | | class SwFormatLineNumber; |
89 | | class SwFormatEditInReadonly; |
90 | | class SwFormatLayoutSplit; |
91 | | class SwFormatRowSplit; |
92 | | class SwFormatFlySplit; |
93 | | class SwFormatWrapTextAtFlyStart; |
94 | | class SwFormatChain; |
95 | | class SwFormatFootnoteAtTextEnd; |
96 | | class SwFormatEndAtTextEnd; |
97 | | class SwFormatNoBalancedColumns; |
98 | | class SvxFrameDirectionItem; |
99 | | class SwHeaderAndFooterEatSpacingItem; |
100 | | class SwFormatFollowTextFlow; |
101 | | class SwFormatWrapInfluenceOnObjPos; |
102 | | class SdrTextVertAdjustItem; |
103 | | |
104 | | // Graphic attributes |
105 | | class SwMirrorGrf; |
106 | | class SwCropGrf; |
107 | | class SwRotationGrf; |
108 | | class SwLuminanceGrf; |
109 | | class SwContrastGrf; |
110 | | class SwChannelRGrf; |
111 | | class SwChannelGGrf; |
112 | | class SwChannelBGrf; |
113 | | class SwGammaGrf; |
114 | | class SwInvertGrf; |
115 | | class SwTransparencyGrf; |
116 | | class SwDrawModeGrf; |
117 | | |
118 | | // Paragraph attributes |
119 | | class SvxLineSpacingItem; |
120 | | class SvxAdjustItem; |
121 | | class SvxFormatSplitItem; |
122 | | class SwRegisterItem; |
123 | | class SwNumRuleItem; |
124 | | class SvxWidowsItem; |
125 | | class SvxOrphansItem; |
126 | | class SvxTabStopItem; |
127 | | class SvxHyphenZoneItem; |
128 | | class SwFormatDrop; |
129 | | class SvxScriptSpaceItem; |
130 | | class SvxHangingPunctuationItem; |
131 | | class SvxForbiddenRuleItem; |
132 | | class SvxParaVertAlignItem; |
133 | | class SvxParaGridItem; |
134 | | class SvxAutoFrameDirectionItem; |
135 | | class SwParaConnectBorderItem; |
136 | | |
137 | | // TableBox attributes |
138 | | class SwTableBoxNumFormat; |
139 | | class SwTableBoxFormula; |
140 | | class SwTableBoxValue; |
141 | | |
142 | | namespace vcl { |
143 | | typedef OutputDevice RenderContext; |
144 | | }; |
145 | | |
146 | | class SAL_DLLPUBLIC_RTTI SwAttrPool final : public SfxItemPool |
147 | | { |
148 | | private: |
149 | | friend void InitCore(); // For creating/deleting of version maps. |
150 | | friend void FinitCore(); |
151 | | |
152 | | SwDoc& m_rDoc; |
153 | | |
154 | | public: |
155 | | SwAttrPool(ItemInfoPackage& rInfoPackage, SwDoc& rDoc); |
156 | | private: |
157 | | virtual ~SwAttrPool() override; |
158 | | public: |
159 | | |
160 | 40.2M | SwDoc& GetDoc() { return m_rDoc; } |
161 | 0 | const SwDoc& GetDoc() const { return m_rDoc; } |
162 | | |
163 | | }; |
164 | | |
165 | | class SW_DLLPUBLIC SwAttrSet final : public SfxItemSet |
166 | | { |
167 | | // Pointer for Modify-System |
168 | | SwAttrSet *m_pOldSet; |
169 | | SwAttrSet *m_pNewSet; |
170 | | |
171 | | // processor for change callback |
172 | | virtual void Changed(const SfxPoolItem* pOld, const SfxPoolItem* pNew) const override; |
173 | | |
174 | | public: |
175 | | SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 ); |
176 | | SwAttrSet( SwAttrPool&, const WhichRangesContainer& nWhichPairTable ); |
177 | | SwAttrSet( const SwAttrSet& ); |
178 | | |
179 | | virtual std::unique_ptr<SfxItemSet> Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const override; |
180 | | SwAttrSet CloneAsValue(bool bItems = true) const; |
181 | | |
182 | | bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew ); |
183 | | bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); |
184 | | |
185 | | // Delete an item or a range. |
186 | | sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew ); |
187 | | sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2, |
188 | | SwAttrSet* pOld = nullptr, SwAttrSet* pNew = nullptr ); |
189 | | |
190 | | int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew ); |
191 | | |
192 | | void GetPresentation( SfxItemPresentation ePres, |
193 | | MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const; |
194 | | |
195 | 213M | SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); } |
196 | | |
197 | | // Copy attributes, if necessary across documents. |
198 | | void CopyToModify( sw::BroadcastingModify& rMod ) const; |
199 | | |
200 | | // Special treatment for some attributes. |
201 | | // Set Modify-pointer (the old pDefinedIn) at the following attributes: |
202 | | // - SwFormatDropCaps |
203 | | // - SwFormatPageDesc |
204 | | // (Is called at insert in formats/nodes.) |
205 | | // Second version is for the SwAttrSet handles of SwContentNode. |
206 | | bool SetModifyAtAttr( const sw::BroadcastingModify* pModify ); |
207 | | |
208 | | // Document is set at SwAttrPool. Therefore it is always accessible. |
209 | 4.46M | const SwDoc &GetDoc() const { return GetPool()->GetDoc(); } |
210 | 23.7M | SwDoc &GetDoc() { return GetPool()->GetDoc(); } |
211 | | |
212 | | // Get methods: bool indicates whether to search only in Set (when false) |
213 | | // or also in parents. If nothing is found then default attribute is returned. |
214 | | // Character attributes. Implementation in charatr.hxx. |
215 | | inline const SvxPostureItem &GetPosture( bool = true ) const; |
216 | | inline const SvxWeightItem &GetWeight( bool = true ) const; |
217 | | inline const SvxShadowedItem &GetShadowed( bool = true ) const; |
218 | | inline const SvxAutoKernItem &GetAutoKern( bool = true ) const; |
219 | | inline const SvxWordLineModeItem &GetWordLineMode( bool = true ) const; |
220 | | inline const SvxContourItem &GetContour( bool = true ) const; |
221 | | inline const SvxKerningItem &GetKerning( bool = true ) const; |
222 | | inline const SvxUnderlineItem &GetUnderline( bool = true ) const; |
223 | | inline const SvxOverlineItem &GetOverline( bool = true ) const; |
224 | | inline const SvxCrossedOutItem &GetCrossedOut( bool = true ) const; |
225 | | inline const SvxFontHeightItem &GetSize( bool = true ) const; |
226 | | inline const SvxFontItem &GetFont( bool = true ) const; |
227 | | inline const SvxColorItem &GetColor( bool = true ) const; |
228 | | inline const SvxLanguageItem &GetLanguage( bool = true ) const; |
229 | | inline const SvxEscapementItem &GetEscapement( bool = true ) const; |
230 | | inline const SvxCaseMapItem &GetCaseMap( bool = true ) const; |
231 | | inline const SvxNoHyphenItem &GetNoHyphenHere( bool = true ) const; |
232 | | inline const SvxFontItem &GetCJKFont( bool = true ) const; |
233 | | inline const SvxFontHeightItem &GetCJKSize( bool = true ) const; |
234 | | inline const SvxLanguageItem &GetCJKLanguage( bool = true ) const; |
235 | | inline const SvxPostureItem &GetCJKPosture( bool = true ) const; |
236 | | inline const SvxWeightItem &GetCJKWeight( bool = true ) const; |
237 | | inline const SvxFontItem &GetCTLFont( bool = true ) const; |
238 | | inline const SvxFontHeightItem &GetCTLSize( bool = true ) const; |
239 | | inline const SvxLanguageItem &GetCTLLanguage( bool = true ) const; |
240 | | inline const SvxPostureItem &GetCTLPosture( bool = true ) const; |
241 | | inline const SvxWeightItem &GetCTLWeight( bool = true ) const; |
242 | | inline const SvxEmphasisMarkItem &GetEmphasisMark( bool = true ) const; |
243 | | inline const SvxTwoLinesItem &Get2Lines( bool = true ) const; |
244 | | inline const SvxCharScaleWidthItem &GetCharScaleW( bool = true ) const; |
245 | | inline const SvxCharRotateItem &GetCharRotate( bool = true ) const; |
246 | | inline const SvxCharReliefItem &GetCharRelief( bool = true ) const; |
247 | | inline const SvxCharHiddenItem &GetCharHidden( bool = true ) const; |
248 | | inline const SvxOpticalSizingItem &GetOpticalSizing( bool = true ) const; |
249 | | |
250 | | // Frame attributes. Implementation in frmatr.hxx. |
251 | | inline const SwFormatFillOrder &GetFillOrder( bool = true ) const; |
252 | | inline const SwFormatFrameSize &GetFrameSize( bool = true ) const; |
253 | | inline const SvxPaperBinItem &GetPaperBin( bool = true ) const; |
254 | | inline const SvxLeftMarginItem & GetLeftMargin(bool = true) const; |
255 | | inline const SvxTextLeftMarginItem &GetTextLeftMargin(bool = true) const; |
256 | | inline const SvxFirstLineIndentItem &GetFirstLineIndent(bool = true) const; |
257 | | inline const SvxRightMarginItem & GetRightMargin(bool = true) const; |
258 | | inline const SvxGutterLeftMarginItem &GetGutterLeftMargin(bool = true) const; |
259 | | inline const SvxGutterRightMarginItem &GetGutterRightMargin(bool = true) const; |
260 | | inline const SvxLRSpaceItem &GetLRSpace( bool = true ) const; |
261 | | inline const SvxULSpaceItem &GetULSpace( bool = true ) const; |
262 | | inline const SwFormatContent &GetContent( bool = true ) const; |
263 | | inline const SwFormatHeader &GetHeader( bool = true ) const; |
264 | | inline const SwFormatFooter &GetFooter( bool = true ) const; |
265 | | inline const SvxPrintItem &GetPrint( bool = true ) const; |
266 | | inline const SvxOpaqueItem &GetOpaque( bool = true ) const; |
267 | | inline const SvxProtectItem &GetProtect( bool = true ) const; |
268 | | inline const SwFormatSurround &GetSurround( bool = true ) const; |
269 | | inline const SwFormatVertOrient &GetVertOrient( bool = true ) const; |
270 | | inline const SwFormatHoriOrient &GetHoriOrient( bool = true ) const; |
271 | | inline const SwFormatAnchor &GetAnchor( bool = true ) const; |
272 | | inline const SvxBoxItem &GetBox( bool = true ) const; |
273 | | inline const SvxFormatKeepItem &GetKeep( bool = true ) const; |
274 | | inline const SvxBrushItem &GetBackground( bool = true ) const; |
275 | | inline const SvxShadowItem &GetShadow( bool = true ) const; |
276 | | inline const SwFormatPageDesc &GetPageDesc( bool = true ) const; |
277 | | inline const SvxFormatBreakItem &GetBreak( bool = true ) const; |
278 | | inline const SwFormatCol &GetCol( bool = true ) const; |
279 | | inline const SvxMacroItem &GetMacro( bool = true ) const; |
280 | | inline const SwFormatURL &GetURL( bool = true ) const; |
281 | | inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const; |
282 | | inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const; |
283 | | inline const SwFormatRowSplit &GetRowSplit( bool = true ) const; |
284 | | inline const SwFormatFlySplit &GetFlySplit( bool = true ) const; |
285 | | inline const SwFormatWrapTextAtFlyStart &GetWrapTextAtFlyStart( bool = true ) const; |
286 | | inline const SwFormatChain &GetChain( bool = true ) const; |
287 | | inline const SwFormatLineNumber &GetLineNumber( bool = true ) const; |
288 | | inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const; |
289 | | inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const; |
290 | | inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const; |
291 | | inline const SvxFrameDirectionItem &GetFrameDir( bool = true ) const; |
292 | | inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const; |
293 | | inline const SwFormatFollowTextFlow &GetFollowTextFlow(bool = true) const; |
294 | | inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const; |
295 | | inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const; |
296 | | |
297 | | // Graphic attributes - implementation in grfatr.hxx |
298 | | inline const SwMirrorGrf &GetMirrorGrf( bool = true ) const; |
299 | | inline const SwCropGrf &GetCropGrf( bool = true ) const; |
300 | | inline const SwRotationGrf &GetRotationGrf(bool = true ) const; |
301 | | inline const SwLuminanceGrf &GetLuminanceGrf(bool = true ) const; |
302 | | inline const SwContrastGrf &GetContrastGrf(bool = true ) const; |
303 | | inline const SwChannelRGrf &GetChannelRGrf(bool = true ) const; |
304 | | inline const SwChannelGGrf &GetChannelGGrf(bool = true ) const; |
305 | | inline const SwChannelBGrf &GetChannelBGrf(bool = true ) const; |
306 | | inline const SwGammaGrf &GetGammaGrf(bool = true ) const; |
307 | | inline const SwInvertGrf &GetInvertGrf(bool = true ) const; |
308 | | inline const SwTransparencyGrf &GetTransparencyGrf(bool = true ) const; |
309 | | inline const SwDrawModeGrf &GetDrawModeGrf(bool = true ) const; |
310 | | |
311 | | // Paragraph attributes - implementation in paratr.hxx |
312 | | inline const SvxLineSpacingItem &GetLineSpacing( bool = true ) const; |
313 | | inline const SvxAdjustItem &GetAdjust( bool = true ) const; |
314 | | inline const SvxFormatSplitItem &GetSplit( bool = true ) const; |
315 | | inline const SwRegisterItem &GetRegister( bool = true ) const; |
316 | | inline const SwNumRuleItem &GetNumRule( bool = true ) const; |
317 | | inline const SvxWidowsItem &GetWidows( bool = true ) const; |
318 | | inline const SvxOrphansItem &GetOrphans( bool = true ) const; |
319 | | inline const SvxTabStopItem &GetTabStops( bool = true ) const; |
320 | | inline const SvxHyphenZoneItem &GetHyphenZone( bool = true ) const; |
321 | | inline const SwFormatDrop &GetDrop( bool = true ) const; |
322 | | inline const SvxScriptSpaceItem &GetScriptSpace(bool = true) const; |
323 | | inline const SvxHangingPunctuationItem &GetHangingPunctuation(bool = true) const; |
324 | | inline const SvxForbiddenRuleItem &GetForbiddenRule(bool = true) const; |
325 | | inline const SvxParaVertAlignItem &GetParaVertAlign(bool = true) const; |
326 | | inline const SvxParaGridItem &GetParaGrid(bool = true) const; |
327 | | inline const SwParaConnectBorderItem &GetParaConnectBorder(bool = true ) const; |
328 | | inline const SvxAutoFrameDirectionItem &GetAutoFrameDirection(bool = true) const; |
329 | | |
330 | | // Tablebox attributes - implementation in cellatr.hxx |
331 | | inline const SwTableBoxNumFormat &GetTableBoxNumFormat( bool = true ) const; |
332 | | inline const SwTableBoxFormula &GetTableBoxFormula( bool = true ) const; |
333 | | inline const SwTableBoxValue &GetTableBoxValue( bool = true ) const; |
334 | | }; |
335 | | |
336 | | //Helper for filters to find true lineheight of a font |
337 | | SW_DLLPUBLIC tools::Long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, |
338 | | const SwAttrSet &rSet, |
339 | | const vcl::RenderContext &rOut, sal_Int16 nScript); |
340 | | #endif |
341 | | |
342 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |