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: editattr.hxx,v $
10 * $Revision: 1.13.212.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 ************************************************************************/
34 #include <svx/eeitem.hxx>
40 class SvxShadowedItem
;
41 class SvxEscapementItem
;
43 class SvxCrossedOutItem
;
44 class SvxUnderlineItem
;
45 class SvxOverlineItem
;
46 class SvxFontHeightItem
;
47 class SvxCharScaleWidthItem
;
49 class SvxAutoKernItem
;
51 class SvxCharSetColorItem
;
52 class SvxWordLineModeItem
;
54 class SvxLanguageItem
;
55 class SvxEmphasisMarkItem
;
56 class SvxCharReliefItem
;
57 #include <svtools/poolitem.hxx>
62 #define CH_FEATURE_OLD (BYTE) 0xFF
63 #define CH_FEATURE (sal_Unicode) 0x01
65 // DEF_METRIC: Bei meinem Pool sollte immer die DefMetric bei
66 // GetMetric( nWhich ) ankommen!
67 // => Zum ermitteln der DefMetrik einfach ein GetMetric( 0 )
70 \f// -------------------------------------------------------------------------
72 // -------------------------------------------------------------------------
77 EditAttrib( const EditAttrib
& ) {;}
80 const SfxPoolItem
* pItem
;
82 EditAttrib( const SfxPoolItem
& rAttr
);
83 virtual ~EditAttrib();
86 // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!!
87 void RemoveFromPool( SfxItemPool
& rPool
);
89 USHORT
Which() const { return pItem
->Which(); }
90 const SfxPoolItem
* GetItem() const { return pItem
; }
93 \f// -------------------------------------------------------------------------
94 // class EditCharAttrib
95 // -------------------------------------------------------------------------
96 // bFeature: Attribut darf nicht expandieren/schrumfen, Laenge immer 1
97 // bEdge: Attribut expandiert nicht, wenn genau an der Kante expandiert werden soll
98 class EditCharAttrib
: public EditAttrib
108 EditCharAttrib( const SfxPoolItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
110 USHORT
& GetStart() { return nStart
; }
111 USHORT
& GetEnd() { return nEnd
; }
113 USHORT
GetStart() const { return nStart
; }
114 USHORT
GetEnd() const { return nEnd
; }
116 inline USHORT
GetLen() const;
118 inline void MoveForward( USHORT nDiff
);
119 inline void MoveBackward( USHORT nDiff
);
121 inline void Expand( USHORT nDiff
);
122 inline void Collaps( USHORT nDiff
);
124 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
126 BOOL
IsIn( USHORT nIndex
)
127 { return ( ( nStart
<= nIndex
) && ( nEnd
>= nIndex
) ); }
128 BOOL
IsInside( USHORT nIndex
)
129 { return ( ( nStart
< nIndex
) && ( nEnd
> nIndex
) ); }
131 { return nStart
== nEnd
; }
133 BOOL
IsFeature() const { return bFeature
; }
134 void SetFeature( BOOL b
) { bFeature
= b
; }
136 BOOL
IsEdge() const { return bEdge
; }
137 void SetEdge( BOOL b
) { bEdge
= b
; }
140 inline USHORT
EditCharAttrib::GetLen() const
142 DBG_ASSERT( nEnd
>= nStart
, "EditCharAttrib: nEnd < nStart!" );
146 inline void EditCharAttrib::MoveForward( USHORT nDiff
)
148 DBG_ASSERT( ((long)nEnd
+ nDiff
) <= 0xFFFF, "EditCharAttrib: MoveForward?!" );
149 nStart
= nStart
+ nDiff
;
153 inline void EditCharAttrib::MoveBackward( USHORT nDiff
)
155 DBG_ASSERT( ((long)nStart
- nDiff
) >= 0, "EditCharAttrib: MoveBackward?!" );
156 nStart
= nStart
- nDiff
;
160 inline void EditCharAttrib::Expand( USHORT nDiff
)
162 DBG_ASSERT( ( ((long)nEnd
+ nDiff
) <= (long)0xFFFF ), "EditCharAttrib: Expand?!" );
163 DBG_ASSERT( !bFeature
, "Bitte keine Features expandieren!" );
167 inline void EditCharAttrib::Collaps( USHORT nDiff
)
169 DBG_ASSERT( (long)nEnd
- nDiff
>= (long)nStart
, "EditCharAttrib: Collaps?!" );
170 DBG_ASSERT( !bFeature
, "Bitte keine Features schrumpfen!" );
174 \f// -------------------------------------------------------------------------
175 // class EditCharAttribFont
176 // -------------------------------------------------------------------------
177 class EditCharAttribFont
: public EditCharAttrib
180 EditCharAttribFont( const SvxFontItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
182 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
185 \f// -------------------------------------------------------------------------
186 // class EditCharAttribWeight
187 // -------------------------------------------------------------------------
188 class EditCharAttribWeight
: public EditCharAttrib
191 EditCharAttribWeight( const SvxWeightItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
193 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
195 \f// -------------------------------------------------------------------------
196 // class EditCharAttribItalic
197 // -------------------------------------------------------------------------
198 class EditCharAttribItalic
: public EditCharAttrib
201 EditCharAttribItalic( const SvxPostureItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
203 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
206 \f// -------------------------------------------------------------------------
207 // class EditCharAttribShadow
208 // -------------------------------------------------------------------------
209 class EditCharAttribShadow
: public EditCharAttrib
212 EditCharAttribShadow( const SvxShadowedItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
214 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
217 \f// -------------------------------------------------------------------------
218 // class EditCharAttribEscapement
219 // -------------------------------------------------------------------------
220 class EditCharAttribEscapement
: public EditCharAttrib
223 EditCharAttribEscapement( const SvxEscapementItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
225 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
228 \f// -------------------------------------------------------------------------
229 // class EditCharAttribOutline
230 // -------------------------------------------------------------------------
231 class EditCharAttribOutline
: public EditCharAttrib
234 EditCharAttribOutline( const SvxContourItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
236 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
239 \f// -------------------------------------------------------------------------
240 // class EditCharAttribStrikeout
241 // -------------------------------------------------------------------------
242 class EditCharAttribStrikeout
: public EditCharAttrib
245 EditCharAttribStrikeout( const SvxCrossedOutItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
247 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
250 \f// -------------------------------------------------------------------------
251 // class EditCharAttribUnderline
252 // -------------------------------------------------------------------------
253 class EditCharAttribUnderline
: public EditCharAttrib
256 EditCharAttribUnderline( const SvxUnderlineItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
258 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
261 // -------------------------------------------------------------------------
262 // class EditCharAttribOverline
263 // -------------------------------------------------------------------------
264 class EditCharAttribOverline
: public EditCharAttrib
267 EditCharAttribOverline( const SvxOverlineItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
269 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
272 // -------------------------------------------------------------------------
273 // class EditCharAttribEmphasisMark
274 // -------------------------------------------------------------------------
275 class EditCharAttribEmphasisMark
: public EditCharAttrib
278 EditCharAttribEmphasisMark( const SvxEmphasisMarkItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
280 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
283 // -------------------------------------------------------------------------
284 // class EditCharAttribRelief
285 // -------------------------------------------------------------------------
286 class EditCharAttribRelief
: public EditCharAttrib
289 EditCharAttribRelief( const SvxCharReliefItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
291 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
294 \f// -------------------------------------------------------------------------
295 // class EditCharAttribFontHeight
296 // -------------------------------------------------------------------------
297 class EditCharAttribFontHeight
: public EditCharAttrib
300 EditCharAttribFontHeight( const SvxFontHeightItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
302 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
305 \f// -------------------------------------------------------------------------
306 // class EditCharAttribFontWidth
307 // -------------------------------------------------------------------------
308 class EditCharAttribFontWidth
: public EditCharAttrib
311 EditCharAttribFontWidth( const SvxCharScaleWidthItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
313 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
316 \f// -------------------------------------------------------------------------
317 // class EditCharAttribColor
318 // -------------------------------------------------------------------------
319 class EditCharAttribColor
: public EditCharAttrib
322 EditCharAttribColor( const SvxColorItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
324 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
327 \f// -------------------------------------------------------------------------
328 // class EditCharAttribLanguage
329 // -------------------------------------------------------------------------
330 class EditCharAttribLanguage
: public EditCharAttrib
333 EditCharAttribLanguage( const SvxLanguageItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
335 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
338 \f// -------------------------------------------------------------------------
339 // class EditCharAttribTab
340 // -------------------------------------------------------------------------
341 class EditCharAttribTab
: public EditCharAttrib
344 EditCharAttribTab( const SfxVoidItem
& rAttr
, USHORT nPos
);
346 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
349 \f// -------------------------------------------------------------------------
350 // class EditCharAttribLineBreak
351 // -------------------------------------------------------------------------
352 class EditCharAttribLineBreak
: public EditCharAttrib
355 EditCharAttribLineBreak( const SfxVoidItem
& rAttr
, USHORT nPos
);
357 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
360 \f// -------------------------------------------------------------------------
361 // class EditCharAttribField
362 // -------------------------------------------------------------------------
363 class EditCharAttribField
: public EditCharAttrib
365 XubString aFieldValue
;
369 EditCharAttribField
& operator = ( const EditCharAttribField
& rAttr
) const;
372 EditCharAttribField( const SvxFieldItem
& rAttr
, USHORT nPos
);
373 EditCharAttribField( const EditCharAttribField
& rAttr
);
374 ~EditCharAttribField();
376 BOOL
operator == ( const EditCharAttribField
& rAttr
) const;
377 BOOL
operator != ( const EditCharAttribField
& rAttr
) const
378 { return !(operator == ( rAttr
) ); }
380 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
381 Color
*& GetTxtColor() { return pTxtColor
; }
382 Color
*& GetFldColor() { return pFldColor
; }
384 const XubString
& GetFieldValue() const { return aFieldValue
; }
385 XubString
& GetFieldValue() { return aFieldValue
; }
390 delete pTxtColor
; pTxtColor
= 0;
391 delete pFldColor
; pFldColor
= 0;
395 \f// -------------------------------------------------------------------------
396 // class EditCharAttribPairKerning
397 // -------------------------------------------------------------------------
398 class EditCharAttribPairKerning
: public EditCharAttrib
401 EditCharAttribPairKerning( const SvxAutoKernItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
403 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
406 \f// -------------------------------------------------------------------------
407 // class EditCharAttribKerning
408 // -------------------------------------------------------------------------
409 class EditCharAttribKerning
: public EditCharAttrib
412 EditCharAttribKerning( const SvxKerningItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
414 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
417 \f// -------------------------------------------------------------------------
418 // class EditCharAttribWordLineMode
419 // -------------------------------------------------------------------------
420 class EditCharAttribWordLineMode
: public EditCharAttrib
423 EditCharAttribWordLineMode( const SvxWordLineModeItem
& rAttr
, USHORT nStart
, USHORT nEnd
);
425 virtual void SetFont( SvxFont
& rFont
, OutputDevice
* pOutDev
);
429 #endif // _EDITATTR_HXX