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: txatbase.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>
36 #ifndef _SFXPOOLITEM_HXX //autogen
37 #include <bf_svtools/poolitem.hxx>
40 #include <hintids.hxx>
54 class SvxUnderlineItem
;
55 class SvxFontHeightItem
;
56 class SvxPropSizeItem
;
57 class SvxShadowedItem
;
58 class SvxAutoKernItem
;
59 class SvxWordLineModeItem
;
61 class SvxCrossedOutItem
;
63 class SvxCharSetColorItem
;
64 class SvXMLAttrContainerItem
;
66 class SvxTwoLinesItem
;
67 class SvxEmphasisMarkItem
;
68 class SvxCharScaleWidthItem
;
69 class SvxCharRotateItem
;
70 class SvxCharReliefItem
;
76 class SvxLanguageItem
;
77 class SvxEscapementItem
;
79 class SvxNoHyphenItem
;
90 const SfxPoolItem
* pAttr
;
93 BOOL bLockExpandFlag
: 1;
95 BOOL bDontMergeAttr
: 1; // refmarks, toxmarks, ruby
96 BOOL bDontMoveAttr
: 1; // refmarks, toxmarks
97 BOOL bCharFmtAttr
: 1; // charfmt, inet
98 BOOL bOverlapAllowedAttr
: 1; // refmarks, toxmarks
99 BOOL bPriorityAttr
: 1; // attribute has priority (redlining)
100 BOOL bDontExpandStart
: 1; // don't expand start at paragraph start (ruby)
102 SwTxtAttr( const SfxPoolItem
& rAttr
, xub_StrLen nStart
);
104 void SetLockExpandFlag( BOOL bFlag
) { bLockExpandFlag
= bFlag
; }
105 void SetDontMergeAttr( BOOL bFlag
) { bDontMergeAttr
= bFlag
; }
106 void SetDontMoveAttr( BOOL bFlag
) { bDontMoveAttr
= bFlag
; }
107 void SetCharFmtAttr( BOOL bFlag
) { bCharFmtAttr
= bFlag
; }
108 void SetOverlapAllowedAttr( BOOL bFlag
){ bOverlapAllowedAttr
= bFlag
; }
109 void SetDontExpandStartAttr(BOOL bFlag
) { bDontExpandStart
= bFlag
; }
112 virtual ~SwTxtAttr();
114 // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!!
115 void RemoveFromPool( SfxItemPool
& rPool
);
117 // Start Position erfragen
118 xub_StrLen
* GetStart() { return &nStart
; }
119 const xub_StrLen
* GetStart() const { return &nStart
; }
121 // End Position erfragen
122 virtual xub_StrLen
* GetEnd();
123 inline const xub_StrLen
* GetEnd() const;
124 inline const xub_StrLen
* GetAnyEnd() const;
126 inline void SetDontExpand( BOOL bNew
);
127 BOOL
DontExpand() const { return bDontExpand
; }
128 BOOL
IsLockExpandFlag() const { return bLockExpandFlag
; }
129 BOOL
IsDontMergeAttr() const { return bDontMergeAttr
; }
130 BOOL
IsDontMoveAttr() const { return bDontMoveAttr
; }
131 BOOL
IsCharFmtAttr() const { return bCharFmtAttr
; }
132 BOOL
IsOverlapAllowedAttr() const { return bOverlapAllowedAttr
; }
133 BOOL
IsPriorityAttr() const { return bPriorityAttr
; }
134 void SetPriorityAttr( BOOL bFlag
) { bPriorityAttr
= bFlag
; }
135 BOOL
IsDontExpandStartAttr() const { return bDontExpandStart
; }
137 inline const SfxPoolItem
& GetAttr() const;
138 inline USHORT
Which() const { return GetAttr().Which(); }
141 inline const SvxFontItem
&GetFont() const;
142 inline const SvxPostureItem
&GetPosture() const;
143 inline const SvxWeightItem
&GetWeight() const;
144 inline const SvxUnderlineItem
&GetUnderline() const;
145 inline const SvxFontHeightItem
&GetFontSize() const;
146 inline const SvxPropSizeItem
&GetPropSize() const;
147 inline const SvxShadowedItem
&GetShadowed() const;
148 inline const SvxAutoKernItem
&GetAutoKern() const;
149 inline const SvxWordLineModeItem
&GetWordLineMode() const;
150 inline const SvxContourItem
&GetContour() const;
151 inline const SvxCrossedOutItem
&GetCrossedOut() const;
152 inline const SvxColorItem
&GetColor() const;
153 inline const SvxCharSetColorItem
&GetCharSetColor() const;
154 inline const SwFmtCharFmt
&GetCharFmt() const;
155 inline const SvxKerningItem
&GetKerning() const;
156 inline const SvxCaseMapItem
&GetCaseMap() const;
157 inline const SvxLanguageItem
&GetLanguage() const;
158 inline const SvxEscapementItem
&GetEscapement() const;
159 inline const SvxBlinkItem
&GetBlink() const;
160 inline const SvxBrushItem
&GetChrBackground() const;
161 inline const SvxNoHyphenItem
&GetNoHyphenHere() const;
162 inline const SwFmtSoftHyph
&GetSoftHyph() const;
163 inline const SwFmtHardBlank
&GetHardBlank() const;
164 inline const SwFmtFld
&GetFld() const;
165 inline const SwFmtFtn
&GetFtn() const;
166 inline const SwFmtFlyCnt
&GetFlyCnt() const;
167 inline const SwTOXMark
&GetTOXMark() const;
168 inline const SwFmtRefMark
&GetRefMark() const;
169 inline const SwFmtINetFmt
&GetINetFmt() const;
170 inline const SvXMLAttrContainerItem
&GetXMLAttrContainer() const;
171 inline const SwFmtRuby
&GetRuby() const;
172 inline const SvxTwoLinesItem
&Get2Lines() const;
173 inline const SvxEmphasisMarkItem
&GetEmphasisMark() const;
174 inline const SvxCharScaleWidthItem
&GetCharScaleW() const;
175 inline const SvxCharRotateItem
&GetCharRotate() const;
176 inline const SvxCharReliefItem
&GetCharRelief() const;
179 SwTxtAttr( const SwTxtAttr
& );
180 SwTxtAttr
& operator=( const SwTxtAttr
& );
183 class SwTxtAttrEnd
: public SwTxtAttr
189 SwTxtAttrEnd( const SfxPoolItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
190 virtual xub_StrLen
* GetEnd();
194 // --------------- Inline Implementierungen ------------------------
196 inline const xub_StrLen
* SwTxtAttr::GetEnd() const
198 return ((SwTxtAttr
*)this)->GetEnd();
201 inline const xub_StrLen
* SwTxtAttr::GetAnyEnd() const
203 const xub_StrLen
* pEnd
= GetEnd();
204 return pEnd
? pEnd
: &nStart
;
207 inline const SfxPoolItem
& SwTxtAttr::GetAttr() const
209 ASSERT( pAttr
, "wo ist mein Attribut?" );
213 inline void SwTxtAttr::SetDontExpand( BOOL bNew
)
215 if( !bLockExpandFlag
)
219 inline const SvxFontItem
& SwTxtAttr::GetFont() const
221 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_FONT
, "Falsche Abfrage" );
222 return (const SvxFontItem
&)*pAttr
;
225 inline const SvxPostureItem
& SwTxtAttr::GetPosture() const
227 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_POSTURE
, "Falsche Abfrage" );
228 return (const SvxPostureItem
&)*pAttr
;
231 inline const SvxWeightItem
& SwTxtAttr::GetWeight() const
233 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_WEIGHT
, "Falsche Abfrage" );
234 return (const SvxWeightItem
&)*pAttr
;
237 inline const SvxUnderlineItem
& SwTxtAttr::GetUnderline() const
239 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_UNDERLINE
, "Falsche Abfrage" );
240 return (const SvxUnderlineItem
&)*pAttr
;
243 inline const SvxFontHeightItem
& SwTxtAttr::GetFontSize() const
245 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_FONTSIZE
, "Falsche Abfrage" );
246 return (const SvxFontHeightItem
&)*pAttr
;
249 inline const SvxPropSizeItem
& SwTxtAttr::GetPropSize() const
251 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_PROPORTIONALFONTSIZE
, "Falsche Abfrage" );
252 return (const SvxPropSizeItem
&)*pAttr
;
255 inline const SvxShadowedItem
& SwTxtAttr::GetShadowed() const
257 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_SHADOWED
, "Falsche Abfrage" );
258 return (const SvxShadowedItem
&)*pAttr
;
261 inline const SvxAutoKernItem
& SwTxtAttr::GetAutoKern() const
263 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_AUTOKERN
, "Falsche Abfrage" );
264 return (const SvxAutoKernItem
&)*pAttr
;
267 inline const SvxWordLineModeItem
& SwTxtAttr::GetWordLineMode() const
269 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_WORDLINEMODE
, "Falsche Abfrage" );
270 return (const SvxWordLineModeItem
&)*pAttr
;
273 inline const SvxContourItem
& SwTxtAttr::GetContour() const
275 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_CONTOUR
, "Falsche Abfrage" );
276 return (const SvxContourItem
&)*pAttr
;
279 inline const SvxCrossedOutItem
& SwTxtAttr::GetCrossedOut() const
281 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_CROSSEDOUT
, "Falsche Abfrage" );
282 return (const SvxCrossedOutItem
&)*pAttr
;
285 inline const SvxColorItem
& SwTxtAttr::GetColor() const
287 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_COLOR
, "Falsche Abfrage" );
288 return (const SvxColorItem
&)*pAttr
;
291 inline const SvxCharSetColorItem
& SwTxtAttr::GetCharSetColor() const
293 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_CHARSETCOLOR
, "Falsche Abfrage" );
294 return (const SvxCharSetColorItem
&)*pAttr
;
297 inline const SwFmtCharFmt
& SwTxtAttr::GetCharFmt() const
299 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_CHARFMT
, "Falsche Abfrage" );
300 return (const SwFmtCharFmt
&)*pAttr
;
303 inline const SvxKerningItem
& SwTxtAttr::GetKerning() const
305 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_KERNING
, "Falsche Abfrage" );
306 return (const SvxKerningItem
&)*pAttr
;
309 inline const SvxCaseMapItem
& SwTxtAttr::GetCaseMap() const
311 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_CASEMAP
, "Falsche Abfrage" );
312 return (const SvxCaseMapItem
&)*pAttr
;
315 inline const SvxLanguageItem
& SwTxtAttr::GetLanguage() const
317 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_LANGUAGE
, "Falsche Abfrage" );
318 return (const SvxLanguageItem
&)*pAttr
;
321 inline const SvxEscapementItem
& SwTxtAttr::GetEscapement() const
323 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_ESCAPEMENT
, "Falsche Abfrage" );
324 return (const SvxEscapementItem
&)*pAttr
;
327 inline const SvxBlinkItem
& SwTxtAttr::GetBlink() const
329 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_BLINK
, "Falsche Abfrage" );
330 return (const SvxBlinkItem
&)*pAttr
;
333 inline const SvxBrushItem
& SwTxtAttr::GetChrBackground() const
335 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_BACKGROUND
, "Falsche Abfrage" );
336 return (const SvxBrushItem
&)*pAttr
;
339 inline const SvxNoHyphenItem
& SwTxtAttr::GetNoHyphenHere() const
341 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_NOHYPHEN
, "Falsche Abfrage" );
342 return (const SvxNoHyphenItem
&)*pAttr
;
345 inline const SwFmtSoftHyph
& SwTxtAttr::GetSoftHyph() const
347 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_SOFTHYPH
, "Falsche Abfrage" );
348 return (const SwFmtSoftHyph
&)*pAttr
;
351 inline const SwFmtHardBlank
& SwTxtAttr::GetHardBlank() const
353 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_HARDBLANK
, "Falsche Abfrage" );
354 return (const SwFmtHardBlank
&)*pAttr
;
357 inline const SwFmtFld
& SwTxtAttr::GetFld() const
359 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_FIELD
, "Falsche Abfrage" );
360 return (const SwFmtFld
&)*pAttr
;
363 inline const SwFmtFtn
& SwTxtAttr::GetFtn() const
365 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_FTN
, "Falsche Abfrage" );
366 return (const SwFmtFtn
&)*pAttr
;
369 inline const SwFmtFlyCnt
& SwTxtAttr::GetFlyCnt() const
371 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_FLYCNT
, "Falsche Abfrage" );
372 return (const SwFmtFlyCnt
&)*pAttr
;
375 inline const SwTOXMark
& SwTxtAttr::GetTOXMark() const
377 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_TOXMARK
, "Falsche Abfrage" );
378 return (const SwTOXMark
&)*pAttr
;
381 inline const SwFmtRefMark
& SwTxtAttr::GetRefMark() const
383 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_REFMARK
, "Falsche Abfrage" );
384 return (const SwFmtRefMark
&)*pAttr
;
387 inline const SwFmtINetFmt
& SwTxtAttr::GetINetFmt() const
389 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_INETFMT
, "Falsche Abfrage" );
390 return (const SwFmtINetFmt
&)*pAttr
;
393 inline const SvXMLAttrContainerItem
& SwTxtAttr::GetXMLAttrContainer() const
395 ASSERT( pAttr
&& pAttr
->Which() == RES_UNKNOWNATR_CONTAINER
,
397 return (const SvXMLAttrContainerItem
&)*pAttr
;
400 inline const SwFmtRuby
& SwTxtAttr::GetRuby() const
402 ASSERT( pAttr
&& pAttr
->Which() == RES_TXTATR_CJK_RUBY
,
404 return (const SwFmtRuby
&)*pAttr
;
406 inline const SvxTwoLinesItem
& SwTxtAttr::Get2Lines() const
408 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_TWO_LINES
,
410 return (const SvxTwoLinesItem
&)*pAttr
;
413 inline const SvxEmphasisMarkItem
& SwTxtAttr::GetEmphasisMark() const
415 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_EMPHASIS_MARK
, "Falsche Abfrage" );
416 return (const SvxEmphasisMarkItem
&)*pAttr
;
419 inline const SvxCharScaleWidthItem
& SwTxtAttr::GetCharScaleW() const
421 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_SCALEW
, "Falsche Abfrage" );
422 return (const SvxCharScaleWidthItem
&)*pAttr
;
425 inline const SvxCharRotateItem
& SwTxtAttr::GetCharRotate() const
427 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_ROTATE
, "Falsche Abfrage" );
428 return (const SvxCharRotateItem
&)*pAttr
;
431 inline const SvxCharReliefItem
& SwTxtAttr::GetCharRelief() const
433 ASSERT( pAttr
&& pAttr
->Which() == RES_CHRATR_RELIEF
, "Falsche Abfrage" );
434 return (const SvxCharReliefItem
&)*pAttr
;
438 // #ifndef _TXATBASE_HXX
439 } //namespace binfilter