Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / sw / inc / swatrset.hxx
blobbe584b623c27159252077e9eadb371841411c914
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_SWATRSET_HXX
20 #define INCLUDED_SW_INC_SWATRSET_HXX
21 #include <tools/solar.h>
22 #include <tools/mempool.hxx>
23 #include <svl/itemset.hxx>
24 #include <svl/itempool.hxx>
25 #include <swdllapi.h>
27 class SwModify;
28 class SwDoc;
29 class OutputDevice;
30 class IDocumentSettingAccess;
31 class SfxBoolItem;
32 class SvxPostureItem;
33 class SvxWeightItem;
34 class SvxShadowedItem;
35 class SvxAutoKernItem;
36 class SvxWordLineModeItem;
37 class SvxContourItem;
38 class SvxKerningItem;
39 class SvxUnderlineItem;
40 class SvxOverlineItem;
41 class SvxCrossedOutItem;
42 class SvxFontHeightItem;
43 class SvxPropSizeItem;
44 class SvxFontItem;
45 class SvxColorItem;
46 class SvxCharSetColorItem;
47 class SvxLanguageItem;
48 class SvxEscapementItem;
49 class SvxCaseMapItem;
50 class SvxNoHyphenItem;
51 class SvxBlinkItem;
52 class SvxEmphasisMarkItem;
53 class SvxTwoLinesItem;
54 class SvxCharScaleWidthItem;
55 class SvxCharRotateItem;
56 class SvxCharReliefItem;
57 class SvxCharHiddenItem;
59 // Frame attributes
60 class SwFormatFillOrder;
61 class SwFormatFrameSize;
62 class SvxPaperBinItem;
63 class SvxLRSpaceItem;
64 class SvxULSpaceItem;
65 class SwFormatContent;
66 class SwFormatHeader;
67 class SwFormatFooter;
68 class SvxPrintItem;
69 class SvxOpaqueItem;
70 class SvxProtectItem;
71 class SwFormatSurround;
72 class SwFormatVertOrient;
73 class SwFormatHoriOrient;
74 class SwFormatAnchor;
75 class SvxBoxItem;
76 class SvxBrushItem;
77 class SvxShadowItem;
78 class SwFormatPageDesc;
79 class SvxFormatBreakItem;
80 class SwFormatCol;
81 class SvxMacroItem;
82 class SvxFormatKeepItem;
83 class SwFormatURL;
84 class SwFormatLineNumber;
85 class SwFormatEditInReadonly;
86 class SwFormatLayoutSplit;
87 class SwFormatRowSplit;
88 class SwFormatChain;
89 class SwFormatFootnoteAtTextEnd;
90 class SwFormatEndAtTextEnd;
91 class SwFormatNoBalancedColumns;
92 class SvxFrameDirectionItem;
93 class SwTextGridItem;
94 class SwHeaderAndFooterEatSpacingItem;
95 class SwFormatFollowTextFlow;
96 class SwFormatWrapInfluenceOnObjPos;
97 class SdrTextVertAdjustItem;
99 // Graphic attributes
100 class SwMirrorGrf;
101 class SwCropGrf;
102 class SwRotationGrf;
103 class SwLuminanceGrf;
104 class SwContrastGrf;
105 class SwChannelRGrf;
106 class SwChannelGGrf;
107 class SwChannelBGrf;
108 class SwGammaGrf;
109 class SwInvertGrf;
110 class SwTransparencyGrf;
111 class SwDrawModeGrf;
113 // Paragraph attributes
114 class SvxLineSpacingItem;
115 class SvxAdjustItem;
116 class SvxFormatSplitItem;
117 class SwRegisterItem;
118 class SwNumRuleItem;
119 class SvxWidowsItem;
120 class SvxOrphansItem;
121 class SvxTabStopItem;
122 class SvxHyphenZoneItem;
123 class SwFormatDrop;
124 class SvxScriptSpaceItem;
125 class SvxHangingPunctuationItem;
126 class SvxForbiddenRuleItem;
127 class SvxParaVertAlignItem;
128 class SvxParaGridItem;
129 class SwParaConnectBorderItem;
131 // TableBox attributes
132 class SwTableBoxNumFormat;
133 class SwTableBoxFormula;
134 class SwTableBoxValue;
136 class SwAttrPool : public SfxItemPool
138 private:
139 // helpers to add/rmove DrawingLayer ItemPool, used in constructor
140 // and destructor; still isolated to evtl. allow other use later, but
141 // used bz default now to have it instantly as needed for DrawingLayer
142 // FillStyle support
143 void createAndAddSecondaryPools();
144 void removeAndDeleteSecondaryPools();
146 friend void InitCore(); // For creating/deleting of version maps.
147 friend void FinitCore();
148 static sal_uInt16* pVersionMap1;
149 static sal_uInt16* pVersionMap2;
150 static sal_uInt16* pVersionMap3;
151 static sal_uInt16* pVersionMap4;
152 // due to extension of attribute set a new version
153 // map for binary filter is necessary (version map 5).
154 static sal_uInt16* pVersionMap5;
155 static sal_uInt16* pVersionMap6;
156 static sal_uInt16* pVersionMap7;
158 SwDoc* m_pDoc;
160 public:
161 SwAttrPool( SwDoc* pDoc );
162 protected:
163 virtual ~SwAttrPool() override;
164 public:
166 SwDoc* GetDoc() { return m_pDoc; }
167 const SwDoc* GetDoc() const { return m_pDoc; }
171 class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
173 // Pointer for Modify-System
174 SwAttrSet *m_pOldSet, *m_pNewSet;
176 // Notification-Callback
177 virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew ) override;
179 void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
180 public:
181 SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
182 SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
183 SwAttrSet( const SwAttrSet& );
185 virtual SfxItemSet* Clone(bool bItems = true, SfxItemPool *pToPool = nullptr) const override;
187 bool Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
188 bool Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
190 // Delete an item or a range.
191 sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
192 sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
193 SwAttrSet* pOld = nullptr, SwAttrSet* pNew = nullptr );
195 int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
197 void GetPresentation( SfxItemPresentation ePres,
198 MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText ) const;
200 SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); }
202 // Copy attributes, if necessary across documents.
203 void CopyToModify( SwModify& rMod ) const;
205 // Special treatment for some attributes.
206 // Set Modify-pointer (the old pDefinedIn) at the following attributes:
207 // - SwFormatDropCaps
208 // - SwFormatPageDesc
209 // (Is called at insert in formats/nodes.)
210 // Second version is for the SwAttrSet handles of SwContentNode.
211 bool SetModifyAtAttr( const SwModify* pModify );
213 // Document is set at SwAttrPool. Therefore it is always accessible.
214 const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
215 SwDoc *GetDoc() { return GetPool()->GetDoc(); }
217 // Get methods: bool indicates whether to search only in Set (when false)
218 // or also in parents. If nothing is found then default attribute is returned.
219 // Character attributes. Implementation in charatr.hxx.
220 inline const SvxPostureItem &GetPosture( bool = true ) const;
221 inline const SvxWeightItem &GetWeight( bool = true ) const;
222 inline const SvxShadowedItem &GetShadowed( bool = true ) const;
223 inline const SvxAutoKernItem &GetAutoKern( bool = true ) const;
224 inline const SvxWordLineModeItem &GetWordLineMode( bool = true ) const;
225 inline const SvxContourItem &GetContour( bool = true ) const;
226 inline const SvxKerningItem &GetKerning( bool = true ) const;
227 inline const SvxUnderlineItem &GetUnderline( bool = true ) const;
228 inline const SvxOverlineItem &GetOverline( bool = true ) const;
229 inline const SvxCrossedOutItem &GetCrossedOut( bool = true ) const;
230 inline const SvxFontHeightItem &GetSize( bool = true ) const;
231 inline const SvxFontItem &GetFont( bool = true ) const;
232 inline const SvxColorItem &GetColor( bool = true ) const;
233 inline const SvxLanguageItem &GetLanguage( bool = true ) const;
234 inline const SvxEscapementItem &GetEscapement( bool = true ) const;
235 inline const SvxCaseMapItem &GetCaseMap( bool = true ) const;
236 inline const SvxNoHyphenItem &GetNoHyphenHere( bool = true ) const;
237 inline const SvxBlinkItem &GetBlink( bool = true ) const;
238 inline const SvxFontItem &GetCJKFont( bool = true ) const;
239 inline const SvxFontHeightItem &GetCJKSize( bool = true ) const;
240 inline const SvxLanguageItem &GetCJKLanguage( bool = true ) const;
241 inline const SvxPostureItem &GetCJKPosture( bool = true ) const;
242 inline const SvxWeightItem &GetCJKWeight( bool = true ) const;
243 inline const SvxFontItem &GetCTLFont( bool = true ) const;
244 inline const SvxFontHeightItem &GetCTLSize( bool = true ) const;
245 inline const SvxLanguageItem &GetCTLLanguage( bool = true ) const;
246 inline const SvxPostureItem &GetCTLPosture( bool = true ) const;
247 inline const SvxWeightItem &GetCTLWeight( bool = true ) const;
248 inline const SvxEmphasisMarkItem &GetEmphasisMark( bool = true ) const;
249 inline const SvxTwoLinesItem &Get2Lines( bool = true ) const;
250 inline const SvxCharScaleWidthItem &GetCharScaleW( bool = true ) const;
251 inline const SvxCharRotateItem &GetCharRotate( bool = true ) const;
252 inline const SvxCharReliefItem &GetCharRelief( bool = true ) const;
253 inline const SvxCharHiddenItem &GetCharHidden( bool = true ) const;
255 // Frame attributes. Implementation in frmatr.hxx.
256 inline const SwFormatFillOrder &GetFillOrder( bool = true ) const;
257 inline const SwFormatFrameSize &GetFrameSize( bool = true ) const;
258 inline const SvxPaperBinItem &GetPaperBin( bool = true ) const;
259 inline const SvxLRSpaceItem &GetLRSpace( bool = true ) const;
260 inline const SvxULSpaceItem &GetULSpace( bool = true ) const;
261 inline const SwFormatContent &GetContent( bool = true ) const;
262 inline const SwFormatHeader &GetHeader( bool = true ) const;
263 inline const SwFormatFooter &GetFooter( bool = true ) const;
264 inline const SvxPrintItem &GetPrint( bool = true ) const;
265 inline const SvxOpaqueItem &GetOpaque( bool = true ) const;
266 inline const SvxProtectItem &GetProtect( bool = true ) const;
267 inline const SwFormatSurround &GetSurround( bool = true ) const;
268 inline const SwFormatVertOrient &GetVertOrient( bool = true ) const;
269 inline const SwFormatHoriOrient &GetHoriOrient( bool = true ) const;
270 inline const SwFormatAnchor &GetAnchor( bool = true ) const;
271 inline const SvxBoxItem &GetBox( bool = true ) const;
272 inline const SvxFormatKeepItem &GetKeep( bool = true ) const;
273 inline const SvxBrushItem &GetBackground( bool = true ) const;
274 inline const SvxShadowItem &GetShadow( bool = true ) const;
275 inline const SwFormatPageDesc &GetPageDesc( bool = true ) const;
276 inline const SvxFormatBreakItem &GetBreak( bool = true ) const;
277 inline const SwFormatCol &GetCol( bool = true ) const;
278 inline const SvxMacroItem &GetMacro( bool = true ) const;
279 inline const SwFormatURL &GetURL( bool = true ) const;
280 inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const;
281 inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const;
282 inline const SwFormatRowSplit &GetRowSplit( bool = true ) const;
283 inline const SwFormatChain &GetChain( bool = true ) const;
284 inline const SwFormatLineNumber &GetLineNumber( bool = true ) const;
285 inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const;
286 inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const;
287 inline const SwFormatNoBalancedColumns &GetBalancedColumns( bool = true ) const;
288 inline const SvxFrameDirectionItem &GetFrameDir( bool = true ) const;
289 inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( bool = true ) const;
290 inline const SwFormatFollowTextFlow &GetFollowTextFlow(bool = true) const;
291 inline const SwFormatWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(bool = true) const;
292 inline const SdrTextVertAdjustItem& GetTextVertAdjust(bool = true) const;
294 // Graphic attributes - implementation in grfatr.hxx
295 inline const SwMirrorGrf &GetMirrorGrf( bool = true ) const;
296 inline const SwCropGrf &GetCropGrf( bool = true ) const;
297 inline const SwRotationGrf &GetRotationGrf(bool = true ) const;
298 inline const SwLuminanceGrf &GetLuminanceGrf(bool = true ) const;
299 inline const SwContrastGrf &GetContrastGrf(bool = true ) const;
300 inline const SwChannelRGrf &GetChannelRGrf(bool = true ) const;
301 inline const SwChannelGGrf &GetChannelGGrf(bool = true ) const;
302 inline const SwChannelBGrf &GetChannelBGrf(bool = true ) const;
303 inline const SwGammaGrf &GetGammaGrf(bool = true ) const;
304 inline const SwInvertGrf &GetInvertGrf(bool = true ) const;
305 inline const SwTransparencyGrf &GetTransparencyGrf(bool = true ) const;
306 inline const SwDrawModeGrf &GetDrawModeGrf(bool = true ) const;
308 // Paragraph attributes - implementation in paratr.hxx
309 inline const SvxLineSpacingItem &GetLineSpacing( bool = true ) const;
310 inline const SvxAdjustItem &GetAdjust( bool = true ) const;
311 inline const SvxFormatSplitItem &GetSplit( bool = true ) const;
312 inline const SwRegisterItem &GetRegister( bool = true ) const;
313 inline const SwNumRuleItem &GetNumRule( bool = true ) const;
314 inline const SvxWidowsItem &GetWidows( bool = true ) const;
315 inline const SvxOrphansItem &GetOrphans( bool = true ) const;
316 inline const SvxTabStopItem &GetTabStops( bool = true ) const;
317 inline const SvxHyphenZoneItem &GetHyphenZone( bool = true ) const;
318 inline const SwFormatDrop &GetDrop( bool = true ) const;
319 inline const SvxScriptSpaceItem &GetScriptSpace(bool = true) const;
320 inline const SvxHangingPunctuationItem &GetHangingPunctuation(bool = true) const;
321 inline const SvxForbiddenRuleItem &GetForbiddenRule(bool = true) const;
322 inline const SvxParaVertAlignItem &GetParaVertAlign(bool = true) const;
323 inline const SvxParaGridItem &GetParaGrid(bool = true) const;
324 inline const SwParaConnectBorderItem &GetParaConnectBorder(bool = true ) const;
326 // Tablebox attributes - implementation in cellatr.hxx
327 inline const SwTableBoxNumFormat &GetTableBoxNumFormat( bool = true ) const;
328 inline const SwTableBoxFormula &GetTableBoxFormula( bool = true ) const;
329 inline const SwTableBoxValue &GetTableBoxValue( bool = true ) const;
331 DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
334 //Helper for filters to find true lineheight of a font
335 SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
336 const SwAttrSet &rSet,
337 const OutputDevice &rOut, sal_Int16 nScript);
338 #endif
340 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */