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