Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SWATRSET_HXX
29 : : #define _SWATRSET_HXX
30 : : #include <tools/solar.h>
31 : : #include <tools/mempool.hxx>
32 : : #include <svl/itemset.hxx>
33 : : #include <svl/itempool.hxx>
34 : : #include <swdllapi.h>
35 : :
36 : : class SwModify;
37 : : class SwDoc;
38 : : class OutputDevice;
39 : : class IDocumentSettingAccess;
40 : : class SfxBoolItem;
41 : : class SvxPostureItem;
42 : : class SvxWeightItem;
43 : : class SvxShadowedItem;
44 : : class SvxAutoKernItem;
45 : : class SvxWordLineModeItem;
46 : : class SvxContourItem;
47 : : class SvxKerningItem;
48 : : class SvxUnderlineItem;
49 : : class SvxOverlineItem;
50 : : class SvxCrossedOutItem;
51 : : class SvxFontHeightItem;
52 : : class SvxPropSizeItem;
53 : : class SvxFontItem;
54 : : class SvxColorItem;
55 : : class SvxCharSetColorItem;
56 : : class SvxLanguageItem;
57 : : class SvxEscapementItem;
58 : : class SvxCaseMapItem;
59 : : class SvxNoHyphenItem;
60 : : class SvxBlinkItem;
61 : : class SvxEmphasisMarkItem;
62 : : class SvxTwoLinesItem;
63 : : class SvxCharScaleWidthItem;
64 : : class SvxCharRotateItem;
65 : : class SvxCharReliefItem;
66 : : class SvxCharHiddenItem;
67 : :
68 : : // Frame attributes
69 : : class SwFmtFillOrder;
70 : : class SwFmtFrmSize;
71 : : class SvxPaperBinItem;
72 : : class SvxLRSpaceItem;
73 : : class SvxULSpaceItem;
74 : : class SwFmtCntnt;
75 : : class SwFmtHeader;
76 : : class SwFmtFooter;
77 : : class SvxPrintItem;
78 : : class SvxOpaqueItem;
79 : : class SvxProtectItem;
80 : : class SwFmtSurround;
81 : : class SwFmtVertOrient;
82 : : class SwFmtHoriOrient;
83 : : class SwFmtAnchor;
84 : : class SvxBoxItem;
85 : : class SvxBrushItem;
86 : : class SvxShadowItem;
87 : : class SwFmtPageDesc;
88 : : class SvxFmtBreakItem;
89 : : class SwFmtCol;
90 : : class SvxMacroItem;
91 : : class SvxFmtKeepItem;
92 : : class SwFmtURL;
93 : : class SwFmtLineNumber;
94 : : class SwFmtEditInReadonly;
95 : : class SwFmtLayoutSplit;
96 : : class SwFmtRowSplit;
97 : : class SwFmtChain;
98 : : class SwFmtFtnAtTxtEnd;
99 : : class SwFmtEndAtTxtEnd;
100 : : class SwFmtNoBalancedColumns;
101 : : class SvxFrameDirectionItem;
102 : : class SwTextGridItem;
103 : : class SwHeaderAndFooterEatSpacingItem;
104 : : class SwFmtFollowTextFlow;
105 : : class SwFmtWrapInfluenceOnObjPos;
106 : :
107 : : // Graphic attributes
108 : : class SwMirrorGrf;
109 : : class SwCropGrf;
110 : : class SwRotationGrf;
111 : : class SwLuminanceGrf;
112 : : class SwContrastGrf;
113 : : class SwChannelRGrf;
114 : : class SwChannelGGrf;
115 : : class SwChannelBGrf;
116 : : class SwGammaGrf;
117 : : class SwInvertGrf;
118 : : class SwTransparencyGrf;
119 : : class SwDrawModeGrf;
120 : :
121 : : // Paragraph attributes
122 : : class SvxLineSpacingItem;
123 : : class SvxAdjustItem;
124 : : class SvxFmtSplitItem;
125 : : class SwRegisterItem;
126 : : class SwNumRuleItem;
127 : : class SvxWidowsItem;
128 : : class SvxOrphansItem;
129 : : class SvxTabStopItem;
130 : : class SvxHyphenZoneItem;
131 : : class SwFmtDrop;
132 : : class SvxScriptSpaceItem;
133 : : class SvxHangingPunctuationItem;
134 : : class SvxForbiddenRuleItem;
135 : : class SvxParaVertAlignItem;
136 : : class SvxParaGridItem;
137 : : class SwParaConnectBorderItem;
138 : :
139 : : // TableBox attributes
140 : : class SwTblBoxNumFormat;
141 : : class SwTblBoxFormula;
142 : : class SwTblBoxValue;
143 : :
144 : : class SwAttrPool : public SfxItemPool
145 : : {
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 : :
157 : : SwDoc* pDoc;
158 : :
159 : : public:
160 : : SwAttrPool( SwDoc* pDoc );
161 : : protected:
162 : : virtual ~SwAttrPool();
163 : : public:
164 : :
165 : 465915 : SwDoc* GetDoc() { return pDoc; }
166 : : const SwDoc* GetDoc() const { return pDoc; }
167 : :
168 : : static sal_uInt16* GetVersionMap1() { return pVersionMap1; }
169 : : static sal_uInt16* GetVersionMap2() { return pVersionMap2; }
170 : : static sal_uInt16* GetVersionMap3() { return pVersionMap3; }
171 : : static sal_uInt16* GetVersionMap6() { return pVersionMap4; }
172 : : };
173 : :
174 : :
175 [ - + ]: 1101170 : class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
176 : : {
177 : : // Pointer for Modify-System
178 : : SwAttrSet *pOldSet, *pNewSet;
179 : :
180 : : // Notification-Callback
181 : : virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
182 : :
183 : 226942 : void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
184 : : public:
185 : : SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
186 : : SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
187 : : SwAttrSet( const SwAttrSet& );
188 : :
189 : : virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
190 : :
191 : : int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
192 : : int Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
193 : :
194 : : // Delete an item or a range.
195 : : sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
196 : : sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
197 : : SwAttrSet* pOld = 0, SwAttrSet* pNew = 0 );
198 : :
199 : : int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
200 : :
201 : : void GetPresentation( SfxItemPresentation ePres,
202 : : SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, String &rText ) const;
203 : :
204 : 826689 : SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); }
205 : :
206 : : // Copy attributes, if necessary across documents.
207 : : void CopyToModify( SwModify& rMod ) const;
208 : :
209 : : // Special treatment for some attributes.
210 : : // Set Modify-pointer (the old pDefinedIn) at the following attributes:
211 : : // - SwFmtDropCaps
212 : : // - SwFmtPageDesc
213 : : // (Is called at insert in formats/nodes.)
214 : : // Second version is for the SwAttrSet handles of SwCntntNode.
215 : : bool SetModifyAtAttr( const SwModify* pModify );
216 : :
217 : : // Document is set at SwAttrPool. Therefore it is always accessible.
218 : 168266 : const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
219 : 266935 : SwDoc *GetDoc() { return GetPool()->GetDoc(); }
220 : :
221 : : // Get methods: bool indicates whether to search only in Set (sal_False)
222 : : // or also in parents. If nothing is found then default attribute is returned.
223 : : // Character attributes. Implementation in charatr.hxx.
224 : : inline const SvxPostureItem &GetPosture( sal_Bool = sal_True ) const;
225 : : inline const SvxWeightItem &GetWeight( sal_Bool = sal_True ) const;
226 : : inline const SvxShadowedItem &GetShadowed( sal_Bool = sal_True ) const;
227 : : inline const SvxAutoKernItem &GetAutoKern( sal_Bool = sal_True ) const;
228 : : inline const SvxWordLineModeItem &GetWordLineMode( sal_Bool = sal_True ) const;
229 : : inline const SvxContourItem &GetContour( sal_Bool = sal_True ) const;
230 : : inline const SvxKerningItem &GetKerning( sal_Bool = sal_True ) const;
231 : : inline const SvxUnderlineItem &GetUnderline( sal_Bool = sal_True ) const;
232 : : inline const SvxOverlineItem &GetOverline( sal_Bool = sal_True ) const;
233 : : inline const SvxCrossedOutItem &GetCrossedOut( sal_Bool = sal_True ) const;
234 : : inline const SvxFontHeightItem &GetSize( sal_Bool = sal_True ) const;
235 : : inline const SvxPropSizeItem &GetPropSize( sal_Bool = sal_True ) const;
236 : : inline const SvxFontItem &GetFont( sal_Bool = sal_True ) const;
237 : : inline const SvxColorItem &GetColor( sal_Bool = sal_True ) const;
238 : : inline const SvxCharSetColorItem &GetCharSetColor( sal_Bool = sal_True ) const;
239 : : inline const SvxLanguageItem &GetLanguage( sal_Bool = sal_True ) const;
240 : : inline const SvxEscapementItem &GetEscapement( sal_Bool = sal_True ) const;
241 : : inline const SvxCaseMapItem &GetCaseMap( sal_Bool = sal_True ) const;
242 : : inline const SvxNoHyphenItem &GetNoHyphenHere( sal_Bool = sal_True ) const;
243 : : inline const SvxBlinkItem &GetBlink( sal_Bool = sal_True ) const;
244 : : inline const SvxBrushItem &GetChrBackground( sal_Bool = sal_True ) const;
245 : : inline const SvxFontItem &GetCJKFont( sal_Bool = sal_True ) const;
246 : : inline const SvxFontHeightItem &GetCJKSize( sal_Bool = sal_True ) const;
247 : : inline const SvxLanguageItem &GetCJKLanguage( sal_Bool = sal_True ) const;
248 : : inline const SvxPostureItem &GetCJKPosture( sal_Bool = sal_True ) const;
249 : : inline const SvxWeightItem &GetCJKWeight( sal_Bool = sal_True ) const;
250 : : inline const SvxFontItem &GetCTLFont( sal_Bool = sal_True ) const;
251 : : inline const SvxFontHeightItem &GetCTLSize( sal_Bool = sal_True ) const;
252 : : inline const SvxLanguageItem &GetCTLLanguage( sal_Bool = sal_True ) const;
253 : : inline const SvxPostureItem &GetCTLPosture( sal_Bool = sal_True ) const;
254 : : inline const SvxWeightItem &GetCTLWeight( sal_Bool = sal_True ) const;
255 : : inline const SfxBoolItem &GetWritingDirection( sal_Bool = sal_True ) const;
256 : : inline const SvxEmphasisMarkItem &GetEmphasisMark( sal_Bool = sal_True ) const;
257 : : inline const SvxTwoLinesItem &Get2Lines( sal_Bool = sal_True ) const;
258 : : inline const SvxCharScaleWidthItem &GetCharScaleW( sal_Bool = sal_True ) const;
259 : : inline const SvxCharRotateItem &GetCharRotate( sal_Bool = sal_True ) const;
260 : : inline const SvxCharReliefItem &GetCharRelief( sal_Bool = sal_True ) const;
261 : : inline const SvxCharHiddenItem &GetCharHidden( sal_Bool = sal_True ) const;
262 : :
263 : : // Frame attributes. Implementation in frmatr.hxx.
264 : : inline const SwFmtFillOrder &GetFillOrder( sal_Bool = sal_True ) const;
265 : : inline const SwFmtFrmSize &GetFrmSize( sal_Bool = sal_True ) const;
266 : : inline const SvxPaperBinItem &GetPaperBin( sal_Bool = sal_True ) const;
267 : : inline const SvxLRSpaceItem &GetLRSpace( sal_Bool = sal_True ) const;
268 : : inline const SvxULSpaceItem &GetULSpace( sal_Bool = sal_True ) const;
269 : : inline const SwFmtCntnt &GetCntnt( sal_Bool = sal_True ) const;
270 : : inline const SwFmtHeader &GetHeader( sal_Bool = sal_True ) const;
271 : : inline const SwFmtFooter &GetFooter( sal_Bool = sal_True ) const;
272 : : inline const SvxPrintItem &GetPrint( sal_Bool = sal_True ) const;
273 : : inline const SvxOpaqueItem &GetOpaque( sal_Bool = sal_True ) const;
274 : : inline const SvxProtectItem &GetProtect( sal_Bool = sal_True ) const;
275 : : inline const SwFmtSurround &GetSurround( sal_Bool = sal_True ) const;
276 : : inline const SwFmtVertOrient &GetVertOrient( sal_Bool = sal_True ) const;
277 : : inline const SwFmtHoriOrient &GetHoriOrient( sal_Bool = sal_True ) const;
278 : : inline const SwFmtAnchor &GetAnchor( sal_Bool = sal_True ) const;
279 : : inline const SvxBoxItem &GetBox( sal_Bool = sal_True ) const;
280 : : inline const SvxFmtKeepItem &GetKeep( sal_Bool = sal_True ) const;
281 : : inline const SvxBrushItem &GetBackground( sal_Bool = sal_True ) const;
282 : : inline const SvxShadowItem &GetShadow( sal_Bool = sal_True ) const;
283 : : inline const SwFmtPageDesc &GetPageDesc( sal_Bool = sal_True ) const;
284 : : inline const SvxFmtBreakItem &GetBreak( sal_Bool = sal_True ) const;
285 : : inline const SwFmtCol &GetCol( sal_Bool = sal_True ) const;
286 : : inline const SvxMacroItem &GetMacro( sal_Bool = sal_True ) const;
287 : : inline const SwFmtURL &GetURL( sal_Bool = sal_True ) const;
288 : : inline const SwFmtEditInReadonly &GetEditInReadonly( sal_Bool = sal_True ) const;
289 : : inline const SwFmtLayoutSplit &GetLayoutSplit( sal_Bool = sal_True ) const;
290 : : inline const SwFmtRowSplit &GetRowSplit( sal_Bool = sal_True ) const;
291 : : inline const SwFmtChain &GetChain( sal_Bool = sal_True ) const;
292 : : inline const SwFmtLineNumber &GetLineNumber( sal_Bool = sal_True ) const;
293 : : inline const SwFmtFtnAtTxtEnd &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
294 : : inline const SwFmtEndAtTxtEnd &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
295 : : inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
296 : : inline const SvxFrameDirectionItem &GetFrmDir( sal_Bool = sal_True ) const;
297 : : inline const SwTextGridItem &GetTextGrid( sal_Bool = sal_True ) const;
298 : : inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
299 : : inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
300 : : inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
301 : :
302 : : // Graphic attributes - implementation in grfatr.hxx
303 : : inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
304 : : inline const SwCropGrf &GetCropGrf( sal_Bool = sal_True ) const;
305 : : inline const SwRotationGrf &GetRotationGrf(sal_Bool = sal_True ) const;
306 : : inline const SwLuminanceGrf &GetLuminanceGrf(sal_Bool = sal_True ) const;
307 : : inline const SwContrastGrf &GetContrastGrf(sal_Bool = sal_True ) const;
308 : : inline const SwChannelRGrf &GetChannelRGrf(sal_Bool = sal_True ) const;
309 : : inline const SwChannelGGrf &GetChannelGGrf(sal_Bool = sal_True ) const;
310 : : inline const SwChannelBGrf &GetChannelBGrf(sal_Bool = sal_True ) const;
311 : : inline const SwGammaGrf &GetGammaGrf(sal_Bool = sal_True ) const;
312 : : inline const SwInvertGrf &GetInvertGrf(sal_Bool = sal_True ) const;
313 : : inline const SwTransparencyGrf &GetTransparencyGrf(sal_Bool = sal_True ) const;
314 : : inline const SwDrawModeGrf &GetDrawModeGrf(sal_Bool = sal_True ) const;
315 : :
316 : : // Paragraph attributes - implementation in paratr.hxx
317 : : inline const SvxLineSpacingItem &GetLineSpacing( sal_Bool = sal_True ) const;
318 : : inline const SvxAdjustItem &GetAdjust( sal_Bool = sal_True ) const;
319 : : inline const SvxFmtSplitItem &GetSplit( sal_Bool = sal_True ) const;
320 : : inline const SwRegisterItem &GetRegister( sal_Bool = sal_True ) const;
321 : : inline const SwNumRuleItem &GetNumRule( sal_Bool = sal_True ) const;
322 : : inline const SvxWidowsItem &GetWidows( sal_Bool = sal_True ) const;
323 : : inline const SvxOrphansItem &GetOrphans( sal_Bool = sal_True ) const;
324 : : inline const SvxTabStopItem &GetTabStops( sal_Bool = sal_True ) const;
325 : : inline const SvxHyphenZoneItem &GetHyphenZone( sal_Bool = sal_True ) const;
326 : : inline const SwFmtDrop &GetDrop( sal_Bool = sal_True ) const;
327 : : inline const SvxScriptSpaceItem &GetScriptSpace(sal_Bool = sal_True) const;
328 : : inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
329 : : inline const SvxForbiddenRuleItem &GetForbiddenRule(sal_Bool = sal_True) const;
330 : : inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
331 : : inline const SvxParaGridItem &GetParaGrid(sal_Bool = sal_True) const;
332 : : inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
333 : :
334 : : // Tablebox attributes - implementation in cellatr.hxx
335 : : inline const SwTblBoxNumFormat &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
336 : : inline const SwTblBoxFormula &GetTblBoxFormula( sal_Bool = sal_True ) const;
337 : : inline const SwTblBoxValue &GetTblBoxValue( sal_Bool = sal_True ) const;
338 : :
339 [ + - ][ + - ]: 583911 : DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
340 : : };
341 : :
342 : : //Helper for filters to find true lineheight of a font
343 : : SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
344 : : const SwAttrSet &rSet,
345 : : const OutputDevice &rOut, sal_Int16 nScript);
346 : : #endif
347 : :
348 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|