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