Line data Source code
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 _SWATRSET_HXX
20 : #define _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>
26 :
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;
58 :
59 : // Frame attributes
60 : class SwFmtFillOrder;
61 : class SwFmtFrmSize;
62 : class SvxPaperBinItem;
63 : class SvxLRSpaceItem;
64 : class SvxULSpaceItem;
65 : class SwFmtCntnt;
66 : class SwFmtHeader;
67 : class SwFmtFooter;
68 : class SvxPrintItem;
69 : class SvxOpaqueItem;
70 : class SvxProtectItem;
71 : class SwFmtSurround;
72 : class SwFmtVertOrient;
73 : class SwFmtHoriOrient;
74 : class SwFmtAnchor;
75 : class SvxBoxItem;
76 : class SvxBrushItem;
77 : class SvxShadowItem;
78 : class SwFmtPageDesc;
79 : class SvxFmtBreakItem;
80 : class SwFmtCol;
81 : class SvxMacroItem;
82 : class SvxFmtKeepItem;
83 : class SwFmtURL;
84 : class SwFmtLineNumber;
85 : class SwFmtEditInReadonly;
86 : class SwFmtLayoutSplit;
87 : class SwFmtRowSplit;
88 : class SwFmtChain;
89 : class SwFmtFtnAtTxtEnd;
90 : class SwFmtEndAtTxtEnd;
91 : class SwFmtNoBalancedColumns;
92 : class SvxFrameDirectionItem;
93 : class SwTextGridItem;
94 : class SwHeaderAndFooterEatSpacingItem;
95 : class SwFmtFollowTextFlow;
96 : class SwFmtWrapInfluenceOnObjPos;
97 :
98 : // Graphic attributes
99 : class SwMirrorGrf;
100 : class SwCropGrf;
101 : class SwRotationGrf;
102 : class SwLuminanceGrf;
103 : class SwContrastGrf;
104 : class SwChannelRGrf;
105 : class SwChannelGGrf;
106 : class SwChannelBGrf;
107 : class SwGammaGrf;
108 : class SwInvertGrf;
109 : class SwTransparencyGrf;
110 : class SwDrawModeGrf;
111 :
112 : // Paragraph attributes
113 : class SvxLineSpacingItem;
114 : class SvxAdjustItem;
115 : class SvxFmtSplitItem;
116 : class SwRegisterItem;
117 : class SwNumRuleItem;
118 : class SvxWidowsItem;
119 : class SvxOrphansItem;
120 : class SvxTabStopItem;
121 : class SvxHyphenZoneItem;
122 : class SwFmtDrop;
123 : class SvxScriptSpaceItem;
124 : class SvxHangingPunctuationItem;
125 : class SvxForbiddenRuleItem;
126 : class SvxParaVertAlignItem;
127 : class SvxParaGridItem;
128 : class SwParaConnectBorderItem;
129 :
130 : // TableBox attributes
131 : class SwTblBoxNumFormat;
132 : class SwTblBoxFormula;
133 : class SwTblBoxValue;
134 :
135 : class SwAttrPool : public SfxItemPool
136 : {
137 : friend void _InitCore(); // For creating/deleting of version maps.
138 : friend void _FinitCore();
139 : static sal_uInt16* pVersionMap1;
140 : static sal_uInt16* pVersionMap2;
141 : static sal_uInt16* pVersionMap3;
142 : static sal_uInt16* pVersionMap4;
143 : // due to extension of attribute set a new version
144 : // map for binary filter is necessary (version map 5).
145 : static sal_uInt16* pVersionMap5;
146 : static sal_uInt16* pVersionMap6;
147 :
148 : SwDoc* pDoc;
149 :
150 : public:
151 : SwAttrPool( SwDoc* pDoc );
152 : protected:
153 : virtual ~SwAttrPool();
154 : public:
155 :
156 73150 : SwDoc* GetDoc() { return pDoc; }
157 : const SwDoc* GetDoc() const { return pDoc; }
158 :
159 : static sal_uInt16* GetVersionMap1() { return pVersionMap1; }
160 : static sal_uInt16* GetVersionMap2() { return pVersionMap2; }
161 : static sal_uInt16* GetVersionMap3() { return pVersionMap3; }
162 : static sal_uInt16* GetVersionMap6() { return pVersionMap4; }
163 : };
164 :
165 :
166 288175 : class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
167 : {
168 : // Pointer for Modify-System
169 : SwAttrSet *pOldSet, *pNewSet;
170 :
171 : // Notification-Callback
172 : virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
173 :
174 73696 : void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
175 : public:
176 : SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
177 : SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
178 : SwAttrSet( const SwAttrSet& );
179 :
180 : virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
181 :
182 : int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
183 : int 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 = 0, SwAttrSet* pNew = 0 );
189 :
190 : int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
191 :
192 : void GetPresentation( SfxItemPresentation ePres,
193 : SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const;
194 :
195 203973 : SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); }
196 :
197 : // Copy attributes, if necessary across documents.
198 : void CopyToModify( SwModify& rMod ) const;
199 :
200 : // Special treatment for some attributes.
201 : // Set Modify-pointer (the old pDefinedIn) at the following attributes:
202 : // - SwFmtDropCaps
203 : // - SwFmtPageDesc
204 : // (Is called at insert in formats/nodes.)
205 : // Second version is for the SwAttrSet handles of SwCntntNode.
206 : bool SetModifyAtAttr( const SwModify* pModify );
207 :
208 : // Document is set at SwAttrPool. Therefore it is always accessible.
209 18270 : const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
210 43845 : SwDoc *GetDoc() { return GetPool()->GetDoc(); }
211 :
212 : // Get methods: bool indicates whether to search only in Set (sal_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( sal_Bool = sal_True ) const;
216 : inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const;
217 : inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const;
218 : inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const;
219 : inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const;
220 : inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const;
221 : inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const;
222 : inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const;
223 : inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const;
224 : inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const;
225 : inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const;
226 : inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const;
227 : inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const;
228 : inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const;
229 : inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const;
230 : inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const;
231 : inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const;
232 : inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const;
233 : inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const;
234 : inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const;
235 : inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const;
236 : inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const;
237 : inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const;
238 : inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const;
239 : inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const;
240 : inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const;
241 : inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const;
242 : inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const;
243 : inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const;
244 : inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const;
245 : inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const;
246 : inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const;
247 : inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const;
248 : inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const;
249 : inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const;
250 : inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const;
251 : inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const;
252 : inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const;
253 :
254 : // Frame attributes. Implementation in frmatr.hxx.
255 : inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const;
256 : inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const;
257 : inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const;
258 : inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const;
259 : inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const;
260 : inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const;
261 : inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const;
262 : inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const;
263 : inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const;
264 : inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const;
265 : inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const;
266 : inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const;
267 : inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const;
268 : inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const;
269 : inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const;
270 : inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const;
271 : inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const;
272 : inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const;
273 : inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const;
274 : inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const;
275 : inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const;
276 : inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const;
277 : inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const;
278 : inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const;
279 : inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const;
280 : inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const;
281 : inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const;
282 : inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const;
283 : inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const;
284 : inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
285 : inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
286 : inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
287 : inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const;
288 : inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const;
289 : inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
290 : inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
291 : inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
292 :
293 : // Graphic attributes - implementation in grfatr.hxx
294 : inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
295 : inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const;
296 : inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const;
297 : inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const;
298 : inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const;
299 : inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const;
300 : inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const;
301 : inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const;
302 : inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const;
303 : inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const;
304 : inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const;
305 : inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const;
306 :
307 : // Paragraph attributes - implementation in paratr.hxx
308 : inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const;
309 : inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const;
310 : inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const;
311 : inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const;
312 : inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const;
313 : inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const;
314 : inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const;
315 : inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const;
316 : inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const;
317 : inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const;
318 : inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const;
319 : inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
320 : inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const;
321 : inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
322 : inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const;
323 : inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
324 :
325 : // Tablebox attributes - implementation in cellatr.hxx
326 : inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
327 : inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const;
328 : inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const;
329 :
330 117514 : DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
331 : };
332 :
333 : //Helper for filters to find true lineheight of a font
334 : SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
335 : const SwAttrSet &rSet,
336 : const OutputDevice &rOut, sal_Int16 nScript);
337 : #endif
338 :
339 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|