xref: /trunk/main/sw/inc/swatrset.hxx (revision 56b35d86)
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 private:
144     //UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor
145     // and destructor; still isolated to evtl. allow other use later, but
146     // used bz default now to have it instantly as needed for DrawingLayer
147     // FillStyle support
148     void createAndAddSecondaryPools();
149     void removeAndDeleteSecondaryPools();
150 
151 	friend void _InitCore();			// fuers anlegen/zerstoeren der
152 	friend void _FinitCore();           // Versionsmaps
153 	static sal_uInt16* pVersionMap1;
154 	static sal_uInt16* pVersionMap2;
155 	static sal_uInt16* pVersionMap3;
156 	static sal_uInt16* pVersionMap4;
157     // OD 2004-01-21 #i18732# - due to extension of attribute set a new version
158     // map for binary filter is necessary (version map 5).
159     static sal_uInt16* pVersionMap5;
160     static sal_uInt16* pVersionMap6;
161 
162 	SwDoc* pDoc;
163 
164 public:
165 	SwAttrPool( SwDoc* pDoc );
166 protected:
167 	virtual ~SwAttrPool();
168 public:
169 
GetDoc()170 		  SwDoc* GetDoc() 			{ return pDoc; }
GetDoc() const171 	const SwDoc* GetDoc() const		{ return pDoc; }
172 
GetVersionMap1()173     static sal_uInt16* GetVersionMap1() { return pVersionMap1; }
GetVersionMap2()174     static sal_uInt16* GetVersionMap2() { return pVersionMap2; }
GetVersionMap3()175     static sal_uInt16* GetVersionMap3() { return pVersionMap3; }
GetVersionMap6()176     static sal_uInt16* GetVersionMap6() { return pVersionMap4; }
177 };
178 
179 
180 class SW_DLLPUBLIC SwAttrSet : public SfxItemSet
181 {
182 	// Pointer fuers Modify-System
183 	SwAttrSet *pOldSet, *pNewSet;
184 
185 	// Notification-Callback
186 	virtual void Changed( const SfxPoolItem& rOld, const SfxPoolItem& rNew );
187 
PutChgd(const SfxPoolItem & rI)188 	void PutChgd( const SfxPoolItem& rI ) { SfxItemSet::PutDirect( rI ); }
189 public:
190 	SwAttrSet( SwAttrPool&, sal_uInt16 nWhich1, sal_uInt16 nWhich2 );
191 	SwAttrSet( SwAttrPool&, const sal_uInt16* nWhichPairTable );
192 	SwAttrSet( const SwAttrSet& );
193 
194     virtual SfxItemSet* Clone(sal_Bool bItems = sal_True, SfxItemPool *pToPool = 0) const;
195 
196 	int Put_BC( const SfxPoolItem& rAttr, SwAttrSet* pOld, SwAttrSet* pNew );
197 	int Put_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
198 
199 	// ein Item oder einen Bereich loeschen
200 	sal_uInt16 ClearItem_BC( sal_uInt16 nWhich, SwAttrSet* pOld, SwAttrSet* pNew );
201 	sal_uInt16 ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
202 						SwAttrSet* pOld = 0, SwAttrSet* pNew = 0 );
203 
204 	int Intersect_BC( const SfxItemSet& rSet, SwAttrSet* pOld, SwAttrSet* pNew );
205 
206 	void GetPresentation( SfxItemPresentation ePres,
207 		SfxMapUnit eCoreMetric,	SfxMapUnit ePresMetric,	String &rText ) const;
208 
GetPool() const209 	SwAttrPool*	GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); }
210 
211 	// kopiere die Attribute ggfs. ueber Dokumentgrenzen
212 	void CopyToModify( SwModify& rMod ) const;
213 
214 	// ----------------------------------------------------------------
215 	// Sonderbehandlung fuer einige Attribute
216 	// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
217 	//	- SwFmtDropCaps
218 	//	- SwFmtPageDesc
219 	// (Wird beim Einfuegen in Formate/Nodes gerufen)
220     // Second version is for the SwAttrSet handles of SwCntntNode.
221     bool SetModifyAtAttr( const SwModify* pModify );
222 
223 	// Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
224 	// im Zugriff.
GetDoc() const225 	const SwDoc *GetDoc() const { return GetPool()->GetDoc(); }
GetDoc()226 		  SwDoc *GetDoc() 		{ return GetPool()->GetDoc(); }
227 
228     // GetMethoden: das Bool gibt an, ob nur im Set (sal_False) oder auch in
229 	//				den Parents gesucht werden soll. Wird nichts gefunden,
230 	//				wird das deflt. Attribut returnt.
231 	// Charakter-Attribute	- impl. steht im charatr.hxx
232 	// AMA 12.10.94: Umstellung von SwFmt... auf Svx...
233     inline const SvxPostureItem           &GetPosture( sal_Bool = sal_True ) const;
234     inline const SvxWeightItem          &GetWeight( sal_Bool = sal_True ) const;
235     inline const SvxShadowedItem        &GetShadowed( sal_Bool = sal_True ) const;
236     inline const SvxAutoKernItem        &GetAutoKern( sal_Bool = sal_True ) const;
237     inline const SvxWordLineModeItem    &GetWordLineMode( sal_Bool = sal_True ) const;
238     inline const SvxContourItem         &GetContour( sal_Bool = sal_True ) const;
239     inline const SvxKerningItem         &GetKerning( sal_Bool = sal_True ) const;
240     inline const SvxUnderlineItem       &GetUnderline( sal_Bool = sal_True ) const;
241     inline const SvxOverlineItem        &GetOverline( sal_Bool = sal_True ) const;
242     inline const SvxCrossedOutItem      &GetCrossedOut( sal_Bool = sal_True ) const;
243     inline const SvxFontHeightItem        &GetSize( sal_Bool = sal_True ) const;
244     inline const SvxPropSizeItem        &GetPropSize( sal_Bool = sal_True ) const;
245     inline const SvxFontItem            &GetFont( sal_Bool = sal_True ) const;
246     inline const SvxColorItem           &GetColor( sal_Bool = sal_True ) const;
247     inline const SvxCharSetColorItem    &GetCharSetColor( sal_Bool = sal_True ) const;
248     inline const SvxLanguageItem        &GetLanguage( sal_Bool = sal_True ) const;
249     inline const SvxEscapementItem      &GetEscapement( sal_Bool = sal_True ) const;
250     inline const SvxCaseMapItem         &GetCaseMap( sal_Bool = sal_True ) const;
251     inline const SvxNoHyphenItem      &GetNoHyphenHere( sal_Bool = sal_True ) const;
252     inline const SvxBlinkItem         &GetBlink( sal_Bool = sal_True ) const;
253     inline const SvxBrushItem         &GetChrBackground( sal_Bool = sal_True ) const;
254     inline const SvxFontItem          &GetCJKFont( sal_Bool = sal_True ) const;
255     inline const SvxFontHeightItem    &GetCJKSize( sal_Bool = sal_True ) const;
256     inline const SvxLanguageItem      &GetCJKLanguage( sal_Bool = sal_True ) const;
257     inline const SvxPostureItem       &GetCJKPosture( sal_Bool = sal_True ) const;
258     inline const SvxWeightItem        &GetCJKWeight( sal_Bool = sal_True ) const;
259     inline const SvxFontItem          &GetCTLFont( sal_Bool = sal_True ) const;
260     inline const SvxFontHeightItem    &GetCTLSize( sal_Bool = sal_True ) const;
261     inline const SvxLanguageItem      &GetCTLLanguage( sal_Bool = sal_True ) const;
262     inline const SvxPostureItem       &GetCTLPosture( sal_Bool = sal_True ) const;
263     inline const SvxWeightItem        &GetCTLWeight( sal_Bool = sal_True ) const;
264     inline const SfxBoolItem              &GetWritingDirection( sal_Bool = sal_True ) const;
265     inline const SvxEmphasisMarkItem  &GetEmphasisMark( sal_Bool = sal_True ) const;
266     inline const SvxTwoLinesItem      &Get2Lines( sal_Bool = sal_True ) const;
267     inline const SvxCharScaleWidthItem    &GetCharScaleW( sal_Bool = sal_True ) const;
268     inline const SvxCharRotateItem        &GetCharRotate( sal_Bool = sal_True ) const;
269     inline const SvxCharReliefItem        &GetCharRelief( sal_Bool = sal_True ) const;
270     inline const SvxCharHiddenItem      &GetCharHidden( sal_Bool = sal_True ) const;
271 
272 	// Frame-Attribute	- impl. steht im frmatr.hxx
273     inline const SwFmtFillOrder       &GetFillOrder( sal_Bool = sal_True ) const;
274     inline const SwFmtFrmSize             &GetFrmSize( sal_Bool = sal_True ) const;
275     inline const SvxPaperBinItem      &GetPaperBin( sal_Bool = sal_True ) const;
276     inline const SvxLRSpaceItem           &GetLRSpace( sal_Bool = sal_True ) const;
277     inline const SvxULSpaceItem           &GetULSpace( sal_Bool = sal_True ) const;
278     inline const SwFmtCntnt           &GetCntnt( sal_Bool = sal_True ) const;
279     inline const SwFmtHeader          &GetHeader( sal_Bool = sal_True ) const;
280     inline const SwFmtFooter          &GetFooter( sal_Bool = sal_True ) const;
281     inline const SvxPrintItem             &GetPrint( sal_Bool = sal_True ) const;
282     inline const SvxOpaqueItem            &GetOpaque( sal_Bool = sal_True ) const;
283     inline const SvxProtectItem           &GetProtect( sal_Bool = sal_True ) const;
284     inline const SwFmtSurround            &GetSurround( sal_Bool = sal_True ) const;
285     inline const SwFmtVertOrient      &GetVertOrient( sal_Bool = sal_True ) const;
286     inline const SwFmtHoriOrient      &GetHoriOrient( sal_Bool = sal_True ) const;
287     inline const SwFmtAnchor          &GetAnchor( sal_Bool = sal_True ) const;
288     inline const SvxBoxItem               &GetBox( sal_Bool = sal_True ) const;
289     inline const SvxFmtKeepItem         &GetKeep( sal_Bool = sal_True ) const;
290     inline const SvxBrushItem           &GetBackground( sal_Bool = sal_True ) const;
291     inline const SvxShadowItem            &GetShadow( sal_Bool = sal_True ) const;
292     inline const SwFmtPageDesc            &GetPageDesc( sal_Bool = sal_True ) const;
293     inline const SvxFmtBreakItem      &GetBreak( sal_Bool = sal_True ) const;
294     inline const SwFmtCol                 &GetCol( sal_Bool = sal_True ) const;
295     inline const SvxMacroItem             &GetMacro( sal_Bool = sal_True ) const;
296     inline const SwFmtURL             &GetURL( sal_Bool = sal_True ) const;
297     inline const SwFmtEditInReadonly  &GetEditInReadonly( sal_Bool = sal_True ) const;
298     inline const SwFmtLayoutSplit     &GetLayoutSplit( sal_Bool = sal_True ) const;
299     inline const SwFmtRowSplit          &GetRowSplit( sal_Bool = sal_True ) const;
300     inline const SwFmtChain             &GetChain( sal_Bool = sal_True ) const;
301     inline const SwFmtLineNumber      &GetLineNumber( sal_Bool = sal_True ) const;
302     inline const SwFmtFtnAtTxtEnd     &GetFtnAtTxtEnd( sal_Bool = sal_True ) const;
303     inline const SwFmtEndAtTxtEnd     &GetEndAtTxtEnd( sal_Bool = sal_True ) const;
304     inline const SwFmtNoBalancedColumns &GetBalancedColumns( sal_Bool = sal_True ) const;
305     inline const SvxFrameDirectionItem    &GetFrmDir( sal_Bool = sal_True ) const;
306     inline const SwTextGridItem         &GetTextGrid( sal_Bool = sal_True ) const;
307     inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
308     // OD 18.09.2003 #i18732#
309     inline const SwFmtFollowTextFlow    &GetFollowTextFlow(sal_Bool = sal_True) const;
310     // OD 2004-05-05 #i28701#
311     inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
312 
313 	// Grafik-Attribute	- impl. steht im grfatr.hxx
314     inline const SwMirrorGrf            &GetMirrorGrf( sal_Bool = sal_True ) const;
315     inline const SwCropGrf            &GetCropGrf( sal_Bool = sal_True ) const;
316     inline const SwRotationGrf            &GetRotationGrf(sal_Bool = sal_True ) const;
317     inline const SwLuminanceGrf       &GetLuminanceGrf(sal_Bool = sal_True ) const;
318     inline const SwContrastGrf            &GetContrastGrf(sal_Bool = sal_True ) const;
319     inline const SwChannelRGrf            &GetChannelRGrf(sal_Bool = sal_True ) const;
320     inline const SwChannelGGrf            &GetChannelGGrf(sal_Bool = sal_True ) const;
321     inline const SwChannelBGrf            &GetChannelBGrf(sal_Bool = sal_True ) const;
322     inline const SwGammaGrf           &GetGammaGrf(sal_Bool = sal_True ) const;
323     inline const SwInvertGrf          &GetInvertGrf(sal_Bool = sal_True ) const;
324     inline const SwTransparencyGrf        &GetTransparencyGrf(sal_Bool = sal_True ) const;
325     inline const SwDrawModeGrf            &GetDrawModeGrf(sal_Bool = sal_True ) const;
326 
327 	// Paragraph-Attribute	- impl. steht im paratr.hxx
328     inline const SvxLineSpacingItem       &GetLineSpacing( sal_Bool = sal_True ) const;
329     inline const SvxAdjustItem            &GetAdjust( sal_Bool = sal_True ) const;
330     inline const SvxFmtSplitItem      &GetSplit( sal_Bool = sal_True ) const;
331     inline const SwRegisterItem           &GetRegister( sal_Bool = sal_True ) const;
332     inline const SwNumRuleItem            &GetNumRule( sal_Bool = sal_True ) const;
333     inline const SvxWidowsItem            &GetWidows( sal_Bool = sal_True ) const;
334     inline const SvxOrphansItem           &GetOrphans( sal_Bool = sal_True ) const;
335     inline const SvxTabStopItem           &GetTabStops( sal_Bool = sal_True ) const;
336     inline const SvxHyphenZoneItem        &GetHyphenZone( sal_Bool = sal_True ) const;
337     inline const SwFmtDrop                &GetDrop( sal_Bool = sal_True ) const;
338     inline const SvxScriptSpaceItem       &GetScriptSpace(sal_Bool = sal_True) const;
339     inline const SvxHangingPunctuationItem &GetHangingPunctuation(sal_Bool = sal_True) const;
340     inline const SvxForbiddenRuleItem     &GetForbiddenRule(sal_Bool = sal_True) const;
341     inline const SvxParaVertAlignItem &GetParaVertAlign(sal_Bool = sal_True) const;
342     inline const SvxParaGridItem        &GetParaGrid(sal_Bool = sal_True) const;
343     inline const SwParaConnectBorderItem &GetParaConnectBorder(sal_Bool = sal_True ) const;
344 
345 	// TabellenBox-Attribute	- impl. steht im cellatr.hxx
346     inline  const SwTblBoxNumFormat       &GetTblBoxNumFmt( sal_Bool = sal_True ) const;
347     inline  const SwTblBoxFormula     &GetTblBoxFormula( sal_Bool = sal_True ) const;
348     inline  const SwTblBoxValue           &GetTblBoxValue( sal_Bool = sal_True ) const;
349 
350 	DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet)
351 };
352 
353 //Helper for filters to find true lineheight of a font
354 SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
355                           const SwAttrSet &rSet,
356                           const OutputDevice &rOut, sal_Int16 nScript);
357 #endif
358