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