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 $
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 ************************************************************************/
34 #include <tools/solar.h>
37 #ifndef _SVMEMPOOL_HXX //autogen
38 #include <tools/mempool.hxx>
40 #ifndef _SFXITEMSET_HXX //autogen
41 #include <bf_svtools/itemset.hxx>
43 #ifndef _SFXITEMPOOL_HXX //autogen
44 #include <bf_svtools/itempool.hxx>
57 class SvxShadowedItem
;
58 class SvxAutoKernItem
;
59 class SvxWordLineModeItem
;
62 class SvxUnderlineItem
;
63 class SvxCrossedOutItem
;
64 class SvxFontHeightItem
;
65 class SvxPropSizeItem
;
68 class SvxCharSetColorItem
;
69 class SvxLanguageItem
;
70 class SvxEscapementItem
;
72 class SvxNoHyphenItem
;
74 class SvxEmphasisMarkItem
;
75 class SvxTwoLinesItem
;
76 class SvxCharScaleWidthItem
;
77 class SvxCharRotateItem
;
78 class SvxCharReliefItem
;
83 class SvxPaperBinItem
;
93 class SwFmtVertOrient
;
94 class SwFmtHoriOrient
;
100 class SvxFmtBreakItem
;
103 class SvxFmtKeepItem
;
105 class SwFmtLineNumber
;
106 class SwFmtEditInReadonly
;
107 class SwFmtLayoutSplit
;
109 class SwFmtFtnAtTxtEnd
;
110 class SwFmtEndAtTxtEnd
;
111 class SwFmtNoBalancedColumns
;
112 class SvxFrameDirectionItem
;
113 class SwTextGridItem
;
114 class SwHeaderAndFooterEatSpacingItem
;
120 class SwLuminanceGrf
;
127 class SwTransparencyGrf
;
130 // Paragraph-Attribute
131 class SvxLineSpacingItem
;
133 class SvxFmtSplitItem
;
134 class SwRegisterItem
;
137 class SvxOrphansItem
;
138 class SvxTabStopItem
;
139 class SvxHyphenZoneItem
;
141 class SvxScriptSpaceItem
;
142 class SvxHangingPunctuationItem
;
143 class SvxForbiddenRuleItem
;
144 class SvxParaVertAlignItem
;
145 class SvxParaGridItem
;
146 class SwParaConnectBorderItem
;
148 // TabellenBox-Attribute
149 class SwTblBoxNumFormat
;
150 class SwTblBoxFormula
;
153 #if defined(MACOSX) && ( __GNUC__ < 3 )
154 #define INLINE /* GrP revisit with gcc3 */
156 #define INLINE inline
159 class SwAttrPool
: public SfxItemPool
161 friend void _InitCore(); // fuers anlegen/zerstoeren der
162 friend void _FinitCore(); // Versionsmaps
163 static USHORT
* pVersionMap1
;
164 static USHORT
* pVersionMap2
;
165 static USHORT
* pVersionMap3
;
166 static USHORT
* pVersionMap4
;
171 SwAttrPool( SwDoc
* pDoc
);
173 SwDoc
* GetDoc() { return pDoc
; }
174 const SwDoc
* GetDoc() const { return pDoc
; }
176 static USHORT
* GetVersionMap1() { return pVersionMap1
; }
177 static USHORT
* GetVersionMap2() { return pVersionMap2
; }
178 static USHORT
* GetVersionMap3() { return pVersionMap3
; }
179 static USHORT
* GetVersionMap6() { return pVersionMap4
; }
183 class SwAttrSet
: public SfxItemSet
185 // Pointer fuers Modify-System
186 SwAttrSet
*pOldSet
, *pNewSet
;
188 // Notification-Callback
189 virtual void Changed( const SfxPoolItem
& rOld
, const SfxPoolItem
& rNew
);
191 void PutChgd( const SfxPoolItem
& rI
) { SfxItemSet::PutDirect( rI
); }
193 SwAttrSet( SwAttrPool
&, USHORT nWhich1
, USHORT nWhich2
);
194 SwAttrSet( SwAttrPool
&, const USHORT
* nWhichPairTable
);
195 SwAttrSet( const SwAttrSet
& );
197 int Put_BC( const SfxPoolItem
& rAttr
, SwAttrSet
* pOld
, SwAttrSet
* pNew
);
198 int Put_BC( const SfxItemSet
& rSet
, SwAttrSet
* pOld
, SwAttrSet
* pNew
);
200 // ein Item oder einen Bereich loeschen
201 USHORT
ClearItem_BC( USHORT nWhich
, SwAttrSet
* pOld
, SwAttrSet
* pNew
);
202 USHORT
ClearItem_BC( USHORT nWhich1
, USHORT nWhich2
,
203 SwAttrSet
* pOld
= 0, SwAttrSet
* pNew
= 0 );
205 int Intersect_BC( const SfxItemSet
& rSet
, SwAttrSet
* pOld
, SwAttrSet
* pNew
);
207 void GetPresentation( SfxItemPresentation ePres
,
208 SfxMapUnit eCoreMetric
, SfxMapUnit ePresMetric
, String
&rText
) const;
210 SwAttrPool
* GetPool() const { return (SwAttrPool
*)SfxItemSet::GetPool(); }
212 // kopiere die Attribute ggfs. ueber Dokumentgrenzen
213 void CopyToModify( SwModify
& rMod
) const;
215 // ----------------------------------------------------------------
216 // Sonderbehandlung fuer einige Attribute
217 // Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
220 // (Wird beim Einfuegen in Formate/Nodes gerufen)
221 void SetModifyAtAttr( const SwModify
* pModify
);
223 // Das Doc wird jetzt am SwAttrPool gesetzt. Dadurch hat man es immer
225 const SwDoc
*GetDoc() const { return GetPool()->GetDoc(); }
226 SwDoc
*GetDoc() { return GetPool()->GetDoc(); }
228 // GetMethoden: das Bool gibt an, ob nur im Set (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( BOOL
= TRUE
) const;
234 inline const SvxWeightItem
&GetWeight( BOOL
= TRUE
) const;
235 inline const SvxShadowedItem
&GetShadowed( BOOL
= TRUE
) const;
236 inline const SvxAutoKernItem
&GetAutoKern( BOOL
= TRUE
) const;
237 inline const SvxWordLineModeItem
&GetWordLineMode( BOOL
= TRUE
) const;
238 inline const SvxContourItem
&GetContour( BOOL
= TRUE
) const;
239 inline const SvxKerningItem
&GetKerning( BOOL
= TRUE
) const;
240 inline const SvxUnderlineItem
&GetUnderline( 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;
270 // Frame-Attribute - impl. steht im frmatr.hxx
271 INLINE
const SwFmtFillOrder
&GetFillOrder( BOOL
= TRUE
) const;
272 INLINE
const SwFmtFrmSize
&GetFrmSize( BOOL
= TRUE
) const;
273 INLINE
const SvxPaperBinItem
&GetPaperBin( BOOL
= TRUE
) const;
274 INLINE
const SvxLRSpaceItem
&GetLRSpace( BOOL
= TRUE
) const;
275 INLINE
const SvxULSpaceItem
&GetULSpace( BOOL
= TRUE
) const;
276 INLINE
const SwFmtCntnt
&GetCntnt( BOOL
= TRUE
) const;
277 INLINE
const SwFmtHeader
&GetHeader( BOOL
= TRUE
) const;
278 INLINE
const SwFmtFooter
&GetFooter( BOOL
= TRUE
) const;
279 INLINE
const SvxPrintItem
&GetPrint( BOOL
= TRUE
) const;
280 INLINE
const SvxOpaqueItem
&GetOpaque( BOOL
= TRUE
) const;
281 INLINE
const SvxProtectItem
&GetProtect( BOOL
= TRUE
) const;
282 INLINE
const SwFmtSurround
&GetSurround( BOOL
= TRUE
) const;
283 INLINE
const SwFmtVertOrient
&GetVertOrient( BOOL
= TRUE
) const;
284 INLINE
const SwFmtHoriOrient
&GetHoriOrient( BOOL
= TRUE
) const;
285 INLINE
const SwFmtAnchor
&GetAnchor( BOOL
= TRUE
) const;
286 INLINE
const SvxBoxItem
&GetBox( BOOL
= TRUE
) const;
287 INLINE
const SvxFmtKeepItem
&GetKeep( BOOL
= TRUE
) const;
288 INLINE
const SvxBrushItem
&GetBackground( BOOL
= TRUE
) const;
289 INLINE
const SvxShadowItem
&GetShadow( BOOL
= TRUE
) const;
290 INLINE
const SwFmtPageDesc
&GetPageDesc( BOOL
= TRUE
) const;
291 INLINE
const SvxFmtBreakItem
&GetBreak( BOOL
= TRUE
) const;
292 INLINE
const SwFmtCol
&GetCol( BOOL
= TRUE
) const;
293 INLINE
const SvxMacroItem
&GetMacro( BOOL
= TRUE
) const;
294 INLINE
const SwFmtURL
&GetURL( BOOL
= TRUE
) const;
295 INLINE
const SwFmtEditInReadonly
&GetEditInReadonly( BOOL
= TRUE
) const;
296 INLINE
const SwFmtLayoutSplit
&GetLayoutSplit( BOOL
= TRUE
) const;
297 INLINE
const SwFmtChain
&GetChain( BOOL
= TRUE
) const;
298 INLINE
const SwFmtLineNumber
&GetLineNumber( BOOL
= TRUE
) const;
299 INLINE
const SwFmtFtnAtTxtEnd
&GetFtnAtTxtEnd( BOOL
= TRUE
) const;
300 INLINE
const SwFmtEndAtTxtEnd
&GetEndAtTxtEnd( BOOL
= TRUE
) const;
301 INLINE
const SwFmtNoBalancedColumns
&GetBalancedColumns( BOOL
= TRUE
) const;
302 INLINE
const SvxFrameDirectionItem
&GetFrmDir( BOOL
= TRUE
) const;
303 INLINE
const SwTextGridItem
&GetTextGrid( BOOL
= TRUE
) const;
304 inline const SwHeaderAndFooterEatSpacingItem
&GetHeaderAndFooterEatSpacing( BOOL
= TRUE
) const;
306 // Grafik-Attribute - impl. steht im grfatr.hxx
307 INLINE
const SwMirrorGrf
&GetMirrorGrf( BOOL
= TRUE
) const;
308 inline const SwCropGrf
&GetCropGrf( BOOL
= TRUE
) const;
309 inline const SwRotationGrf
&GetRotationGrf(BOOL
= TRUE
) const;
310 inline const SwLuminanceGrf
&GetLuminanceGrf(BOOL
= TRUE
) const;
311 inline const SwContrastGrf
&GetContrastGrf(BOOL
= TRUE
) const;
312 inline const SwChannelRGrf
&GetChannelRGrf(BOOL
= TRUE
) const;
313 inline const SwChannelGGrf
&GetChannelGGrf(BOOL
= TRUE
) const;
314 inline const SwChannelBGrf
&GetChannelBGrf(BOOL
= TRUE
) const;
315 inline const SwGammaGrf
&GetGammaGrf(BOOL
= TRUE
) const;
316 inline const SwInvertGrf
&GetInvertGrf(BOOL
= TRUE
) const;
317 inline const SwTransparencyGrf
&GetTransparencyGrf(BOOL
= TRUE
) const;
318 inline const SwDrawModeGrf
&GetDrawModeGrf(BOOL
= TRUE
) const;
320 // Paragraph-Attribute - impl. steht im paratr.hxx
321 inline const SvxLineSpacingItem
&GetLineSpacing( BOOL
= TRUE
) const;
322 inline const SvxAdjustItem
&GetAdjust( BOOL
= TRUE
) const;
323 inline const SvxFmtSplitItem
&GetSplit( BOOL
= TRUE
) const;
324 inline const SwRegisterItem
&GetRegister( BOOL
= TRUE
) const;
325 inline const SwNumRuleItem
&GetNumRule( BOOL
= TRUE
) const;
326 inline const SvxWidowsItem
&GetWidows( BOOL
= TRUE
) const;
327 inline const SvxOrphansItem
&GetOrphans( BOOL
= TRUE
) const;
328 inline const SvxTabStopItem
&GetTabStops( BOOL
= TRUE
) const;
329 inline const SvxHyphenZoneItem
&GetHyphenZone( BOOL
= TRUE
) const;
330 inline const SwFmtDrop
&GetDrop( BOOL
= TRUE
) const;
331 inline const SvxScriptSpaceItem
&GetScriptSpace(BOOL
= TRUE
) const;
332 inline const SvxHangingPunctuationItem
&GetHangingPunctuation(BOOL
= TRUE
) const;
333 inline const SvxForbiddenRuleItem
&GetForbiddenRule(BOOL
= TRUE
) const;
334 inline const SvxParaVertAlignItem
&GetParaVertAlign(BOOL
= TRUE
) const;
335 inline const SvxParaGridItem
&GetParaGrid(BOOL
= TRUE
) const;
336 inline const SwParaConnectBorderItem
&GetParaConnectBorder(BOOL
= TRUE
) const;
338 // TabellenBox-Attribute - impl. steht im cellatr.hxx
339 INLINE
const SwTblBoxNumFormat
&GetTblBoxNumFmt( BOOL
= TRUE
) const;
340 INLINE
const SwTblBoxFormula
&GetTblBoxFormula( BOOL
= TRUE
) const;
341 INLINE
const SwTblBoxValue
&GetTblBoxValue( BOOL
= TRUE
) const;
343 DECL_FIXEDMEMPOOL_NEWDEL(SwAttrSet
)
346 //Helper for filters to find true lineheight of a font
347 long AttrSetToLineHeight(const SwDoc
&rDoc
, const SwAttrSet
&rSet
,
348 const OutputDevice
&rOut
, sal_Int16 nScript
);
349 } //namespace binfilter