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