xref: /trunk/main/editeng/source/items/textitem.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_editeng.hxx"
30 
31 // include ---------------------------------------------------------------
32 #include <com/sun/star/style/CaseMap.hpp>
33 #include <com/sun/star/awt/FontDescriptor.hpp>
34 #include <com/sun/star/frame/status/FontHeight.hpp>
35 #include <vcl/bitmapex.hxx>
36 #include <tools/stream.hxx>
37 #include <toolkit/unohlp.hxx>
38 #include <math.h>
39 #include <rtl/math.hxx>
40 #include <unotools/fontdefs.hxx>
41 #include <vcl/outdev.hxx>
42 #include <editeng/eeitem.hxx>
43 #include <svtools/unitconv.hxx>
44 
45 #define GLOBALOVERFLOW3
46 
47 #include <svl/memberid.hrc>
48 #include <editeng/editids.hrc>
49 #include <editeng/editrids.hrc>
50 #include <vcl/vclenum.hxx>
51 #include <tools/bigint.hxx>
52 #include <tools/tenccvt.hxx>
53 
54 #include <rtl/ustring.hxx>
55 #include <i18npool/mslangid.hxx>
56 #include <svl/itemset.hxx>
57 
58 #include <svtools/langtab.hxx>
59 #include <svl/itempool.hxx>
60 #include <svtools/ctrltool.hxx>
61 #include <vcl/settings.hxx>
62 #include <vcl/svapp.hxx>
63 #include <com/sun/star/style/CaseMap.hpp>
64 #include <com/sun/star/awt/SimpleFontMetric.hpp>
65 #include <com/sun/star/awt/FontWeight.hpp>
66 #include <com/sun/star/awt/FontSlant.hpp>
67 #include <com/sun/star/awt/CharSet.hpp>
68 #include <com/sun/star/awt/FontDescriptor.hpp>
69 #include <com/sun/star/awt/FontWidth.hpp>
70 #include <com/sun/star/awt/XFont.hpp>
71 #include <com/sun/star/awt/FontType.hpp>
72 #include <com/sun/star/awt/FontUnderline.hpp>
73 #include <com/sun/star/awt/FontStrikeout.hpp>
74 #include <com/sun/star/awt/FontFamily.hpp>
75 #include <com/sun/star/awt/FontPitch.hpp>
76 #include <com/sun/star/lang/Locale.hpp>
77 #include <com/sun/star/text/FontEmphasis.hpp>
78 #include <com/sun/star/i18n/ScriptType.hpp>
79 #include <editeng/memberids.hrc>
80 #include <editeng/flstitem.hxx>
81 #include <editeng/fontitem.hxx>
82 #include <editeng/postitem.hxx>
83 #include <editeng/wghtitem.hxx>
84 #include <editeng/fhgtitem.hxx>
85 #include <editeng/fwdtitem.hxx>
86 #include <editeng/udlnitem.hxx>
87 #include <editeng/crsditem.hxx>
88 #include <editeng/shdditem.hxx>
89 #include <editeng/akrnitem.hxx>
90 #include <editeng/wrlmitem.hxx>
91 #include <editeng/cntritem.hxx>
92 #include <editeng/prszitem.hxx>
93 #include <editeng/colritem.hxx>
94 #include <editeng/cscoitem.hxx>
95 #include <editeng/kernitem.hxx>
96 #include <editeng/cmapitem.hxx>
97 #include <editeng/escpitem.hxx>
98 #include <editeng/langitem.hxx>
99 #include <editeng/nlbkitem.hxx>
100 #include <editeng/nhypitem.hxx>
101 #include <editeng/lcolitem.hxx>
102 #include <editeng/blnkitem.hxx>
103 #include <editeng/emphitem.hxx>
104 #include <editeng/twolinesitem.hxx>
105 #include <editeng/scripttypeitem.hxx>
106 #include <editeng/charrotateitem.hxx>
107 #include <editeng/charscaleitem.hxx>
108 #include <editeng/charreliefitem.hxx>
109 #include <editeng/itemtype.hxx>
110 #include <editeng/eerdll.hxx>
111 
112 // #90477#
113 #include <tools/tenccvt.hxx>
114 
115 #define STORE_UNICODE_MAGIC_MARKER  0xFE331188
116 
117 using namespace ::rtl;
118 using namespace ::com::sun::star;
119 using namespace ::com::sun::star::text;
120 
121 // Konvertierung fuer UNO
122 #define TWIP_TO_MM100(TWIP)     ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
123 #define MM100_TO_TWIP(MM100)    ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
124 #define TWIP_TO_MM100_UNSIGNED(TWIP)     ((((TWIP)*127L+36L)/72L))
125 #define MM100_TO_TWIP_UNSIGNED(MM100)    ((((MM100)*72L+63L)/127L))
126 
127 sal_Bool SvxFontItem::bEnableStoreUnicodeNames = sal_False;
128 
129 // STATIC DATA -----------------------------------------------------------
130 
131 // -----------------------------------------------------------------------
132 
133 TYPEINIT1(SvxFontListItem, SfxPoolItem);
134 TYPEINIT1_FACTORY(SvxFontItem, SfxPoolItem, new SvxFontItem(0));
135 TYPEINIT1_FACTORY(SvxPostureItem, SfxEnumItem, new SvxPostureItem(ITALIC_NONE, 0));
136 TYPEINIT1_FACTORY(SvxWeightItem, SfxEnumItem, new SvxWeightItem(WEIGHT_NORMAL, 0));
137 TYPEINIT1_FACTORY(SvxFontHeightItem, SfxPoolItem, new SvxFontHeightItem(240, 100, 0));
138 TYPEINIT1_FACTORY(SvxFontWidthItem, SfxPoolItem, new SvxFontWidthItem(0, 100, 0));
139 TYPEINIT1_FACTORY(SvxTextLineItem, SfxEnumItem, new SvxTextLineItem(UNDERLINE_NONE, 0));
140 TYPEINIT1_FACTORY(SvxUnderlineItem, SfxEnumItem, new SvxUnderlineItem(UNDERLINE_NONE, 0));
141 TYPEINIT1_FACTORY(SvxOverlineItem, SfxEnumItem, new SvxOverlineItem(UNDERLINE_NONE, 0));
142 TYPEINIT1_FACTORY(SvxCrossedOutItem, SfxEnumItem, new SvxCrossedOutItem(STRIKEOUT_NONE, 0));
143 TYPEINIT1_FACTORY(SvxShadowedItem, SfxBoolItem, new SvxShadowedItem(sal_False, 0));
144 TYPEINIT1_FACTORY(SvxAutoKernItem, SfxBoolItem, new SvxAutoKernItem(sal_False, 0));
145 TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(sal_False, 0));
146 TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(sal_False, 0));
147 TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0));
148 TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0));
149 TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0));
150 TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0));
151 TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0));
152 TYPEINIT1_FACTORY(SvxEscapementItem, SfxPoolItem, new SvxEscapementItem(0));
153 TYPEINIT1_FACTORY(SvxLanguageItem, SfxEnumItem, new SvxLanguageItem(LANGUAGE_GERMAN, 0));
154 TYPEINIT1_FACTORY(SvxNoLinebreakItem, SfxBoolItem, new SvxNoLinebreakItem(sal_True, 0));
155 TYPEINIT1_FACTORY(SvxNoHyphenItem, SfxBoolItem, new SvxNoHyphenItem(sal_True, 0));
156 TYPEINIT1_FACTORY(SvxLineColorItem, SvxColorItem, new SvxLineColorItem(0));
157 TYPEINIT1_FACTORY(SvxBlinkItem, SfxBoolItem, new SvxBlinkItem(sal_False, 0));
158 TYPEINIT1_FACTORY(SvxEmphasisMarkItem, SfxUInt16Item, new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0));
159 TYPEINIT1_FACTORY(SvxTwoLinesItem, SfxPoolItem, new SvxTwoLinesItem(sal_True, 0, 0, 0));
160 TYPEINIT1_FACTORY(SvxScriptTypeItem, SfxUInt16Item, new SvxScriptTypeItem);
161 TYPEINIT1_FACTORY(SvxCharRotateItem, SfxUInt16Item, new SvxCharRotateItem(0, sal_False, 0));
162 TYPEINIT1_FACTORY(SvxCharScaleWidthItem, SfxUInt16Item, new SvxCharScaleWidthItem(100, 0));
163 TYPEINIT1_FACTORY(SvxCharReliefItem, SfxEnumItem, new SvxCharReliefItem(RELIEF_NONE, 0));
164 
165 
166 TYPEINIT1(SvxScriptSetItem, SfxSetItem );
167 
168 
169 // class SvxFontListItem -------------------------------------------------
170 
171 SvxFontListItem::SvxFontListItem( const FontList* pFontLst,
172                                   const sal_uInt16 nId ) :
173     SfxPoolItem( nId ),
174     pFontList( pFontLst )
175 {
176     if ( pFontList )
177     {
178         sal_Int32 nCount = pFontList->GetFontNameCount();
179         aFontNameSeq.realloc( nCount );
180 
181         for ( sal_uInt16 i = 0; i < nCount; i++ )
182             aFontNameSeq[i] = pFontList->GetFontName(i).GetName();
183     }
184 }
185 
186 // -----------------------------------------------------------------------
187 
188 SvxFontListItem::SvxFontListItem( const SvxFontListItem& rItem ) :
189 
190     SfxPoolItem( rItem ),
191     pFontList( rItem.GetFontList() ),
192     aFontNameSeq( rItem.aFontNameSeq )
193 {
194 }
195 
196 // -----------------------------------------------------------------------
197 
198 SfxPoolItem* SvxFontListItem::Clone( SfxItemPool* ) const
199 {
200     return new SvxFontListItem( *this );
201 }
202 
203 // -----------------------------------------------------------------------
204 
205 int SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const
206 {
207     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
208 
209     return( pFontList == ((SvxFontListItem&)rAttr).pFontList );
210 }
211 
212 sal_Bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
213 {
214     rVal <<= aFontNameSeq;
215     return sal_True;
216 }
217 
218 //------------------------------------------------------------------------
219 
220 SfxItemPresentation SvxFontListItem::GetPresentation
221 (
222     SfxItemPresentation /*ePres*/,
223     SfxMapUnit          /*eCoreUnit*/,
224     SfxMapUnit          /*ePresUnit*/,
225     XubString&          rText, const IntlWrapper * /*pIntl*/
226 )   const
227 {
228     rText.Erase();
229     return SFX_ITEM_PRESENTATION_NONE;
230 }
231 
232 // class SvxFontItem -----------------------------------------------------
233 
234 SvxFontItem::SvxFontItem( const sal_uInt16 nId ) :
235     SfxPoolItem( nId )
236 {
237     eFamily = FAMILY_SWISS;
238     ePitch = PITCH_VARIABLE;
239     eTextEncoding = RTL_TEXTENCODING_DONTKNOW;
240 }
241 
242 // -----------------------------------------------------------------------
243 
244 SvxFontItem::SvxFontItem( const FontFamily eFam, const XubString& aName,
245                   const XubString& aStName, const FontPitch eFontPitch,
246                   const rtl_TextEncoding eFontTextEncoding, const sal_uInt16 nId ) :
247 
248     SfxPoolItem( nId ),
249 
250     aFamilyName(aName),
251     aStyleName(aStName)
252 {
253     eFamily = eFam;
254     ePitch = eFontPitch;
255     eTextEncoding = eFontTextEncoding;
256 }
257 
258 // -----------------------------------------------------------------------
259 SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont)
260 {
261     aFamilyName =  rFont.GetFamilyName();
262     aStyleName =   rFont.GetStyleName();
263     eFamily =      rFont.GetFamily();
264     ePitch =   rFont.GetPitch();
265     eTextEncoding = rFont.GetCharSet();
266     return *this;
267 }
268 // -----------------------------------------------------------------------
269 
270 sal_Bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
271 {
272 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
273     nMemberId &= ~CONVERT_TWIPS;
274     switch(nMemberId)
275     {
276         case 0:
277         {
278             com::sun::star::awt::FontDescriptor aFontDescriptor;
279             aFontDescriptor.Name = aFamilyName.GetBuffer();
280             aFontDescriptor.StyleName = aStyleName.GetBuffer();
281             aFontDescriptor.Family = (sal_Int16)(eFamily);
282             aFontDescriptor.CharSet = (sal_Int16)(eTextEncoding);
283             aFontDescriptor.Pitch = (sal_Int16)(ePitch);
284             rVal <<= aFontDescriptor;
285         }
286         break;
287         case MID_FONT_FAMILY_NAME   :
288             rVal <<= OUString(aFamilyName.GetBuffer());
289         break;
290         case MID_FONT_STYLE_NAME:
291             rVal <<= OUString(aStyleName.GetBuffer());
292         break;
293         case MID_FONT_FAMILY    : rVal <<= (sal_Int16)(eFamily);    break;
294         case MID_FONT_CHAR_SET  : rVal <<= (sal_Int16)(eTextEncoding);  break;
295         case MID_FONT_PITCH     : rVal <<= (sal_Int16)(ePitch); break;
296     }
297     return sal_True;
298 }
299 // -----------------------------------------------------------------------
300 sal_Bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
301 {
302 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
303     nMemberId &= ~CONVERT_TWIPS;
304     switch(nMemberId)
305     {
306         case 0:
307         {
308             com::sun::star::awt::FontDescriptor aFontDescriptor;
309             if ( !( rVal >>= aFontDescriptor ))
310                 return sal_False;
311 
312             aFamilyName = aFontDescriptor.Name;
313             aStyleName = aFontDescriptor.StyleName;
314             eFamily = (FontFamily)aFontDescriptor.Family;
315             eTextEncoding = (rtl_TextEncoding)aFontDescriptor.CharSet;
316             ePitch = (FontPitch)aFontDescriptor.Pitch;
317         }
318         break;
319         case MID_FONT_FAMILY_NAME   :
320         {
321             OUString aStr;
322             if(!(rVal >>= aStr))
323                 return sal_False;
324             aFamilyName = aStr.getStr();
325         }
326         break;
327         case MID_FONT_STYLE_NAME:
328         {
329             OUString aStr;
330             if(!(rVal >>= aStr))
331                 return sal_False;
332             aStyleName = aStr.getStr();
333         }
334         break;
335         case MID_FONT_FAMILY :
336         {
337             sal_Int16 nFamily = sal_Int16();
338             if(!(rVal >>= nFamily))
339                 return sal_False;
340             eFamily = (FontFamily)nFamily;
341         }
342         break;
343         case MID_FONT_CHAR_SET  :
344         {
345             sal_Int16 nSet = sal_Int16();
346             if(!(rVal >>= nSet))
347                 return sal_False;
348             eTextEncoding = (rtl_TextEncoding)nSet;
349         }
350         break;
351         case MID_FONT_PITCH     :
352         {
353             sal_Int16 nPitch = sal_Int16();
354             if(!(rVal >>= nPitch))
355                 return sal_False;
356             ePitch =  (FontPitch)nPitch;
357         }
358         break;
359     }
360     return sal_True;
361 }
362 
363 // -----------------------------------------------------------------------
364 
365 int SvxFontItem::operator==( const SfxPoolItem& rAttr ) const
366 {
367     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
368 
369     const SvxFontItem& rItem = (const SvxFontItem&)rAttr;
370 
371     int bRet = ( eFamily == rItem.eFamily &&
372                  aFamilyName == rItem.aFamilyName &&
373                  aStyleName == rItem.aStyleName );
374 
375     if ( bRet )
376     {
377         if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding )
378         {
379             bRet = sal_False;
380             DBG_WARNING( "FontItem::operator==(): nur Pitch oder rtl_TextEncoding unterschiedlich" );
381         }
382     }
383     return bRet;
384 }
385 
386 // -----------------------------------------------------------------------
387 
388 SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const
389 {
390     return new SvxFontItem( *this );
391 }
392 
393 // -----------------------------------------------------------------------
394 
395 SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
396 {
397     sal_Bool bToBats =
398         GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
399         GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 );
400 
401     // #90477# rStrm << (sal_uInt8) GetFamily()
402     //    << (sal_uInt8) GetPitch()
403     //    << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() ) );
404     rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch()
405           << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion()));
406 
407     String aStoreFamilyName( GetFamilyName() );
408     if( bToBats )
409         aStoreFamilyName = String( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US );
410     rStrm.WriteByteString(aStoreFamilyName);
411     rStrm.WriteByteString(GetStyleName());
412 
413     // #96441# Kach for EditEngine, only set while creating clipboard stream.
414     if ( bEnableStoreUnicodeNames )
415     {
416         sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
417         rStrm << nMagic;
418         rStrm.WriteByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE );
419         rStrm.WriteByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE );
420     }
421 
422     return rStrm;
423 }
424 
425 // -----------------------------------------------------------------------
426 
427 SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
428 {
429     sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding;
430     String aName, aStyle;
431     rStrm >> _eFamily;
432     rStrm >> eFontPitch;
433     rStrm >> eFontTextEncoding;
434 
435     // UNICODE: rStrm >> aName;
436     rStrm.ReadByteString(aName);
437 
438     // UNICODE: rStrm >> aStyle;
439     rStrm.ReadByteString(aStyle);
440 
441     // Task 91008/90471: set the "correct" textencoding
442     eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() );
443 
444     // irgendwann wandelte sich der StarBats vom ANSI- zum SYMBOL-Font
445     if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName.EqualsAscii("StarBats") )
446         eFontTextEncoding = RTL_TEXTENCODING_SYMBOL;
447 
448     // Check if we have stored unicode
449     sal_Size nStreamPos = rStrm.Tell();
450     sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
451     rStrm >> nMagic;
452     if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
453     {
454         rStrm.ReadByteString( aName, RTL_TEXTENCODING_UNICODE );
455         rStrm.ReadByteString( aStyle, RTL_TEXTENCODING_UNICODE );
456     }
457     else
458     {
459         rStrm.Seek( nStreamPos );
460     }
461 
462 
463 
464     return new SvxFontItem( (FontFamily)_eFamily, aName, aStyle,
465                             (FontPitch)eFontPitch, (rtl_TextEncoding)eFontTextEncoding, Which() );
466 }
467 
468 //------------------------------------------------------------------------
469 
470 SfxItemPresentation SvxFontItem::GetPresentation
471 (
472     SfxItemPresentation ePres,
473     SfxMapUnit          /*eCoreUnit*/,
474     SfxMapUnit          /*ePresUnit*/,
475     XubString&          rText, const IntlWrapper * /*pIntl*/
476 )   const
477 {
478     switch ( ePres )
479     {
480         case SFX_ITEM_PRESENTATION_NONE:
481             rText.Erase();
482             return ePres;
483         case SFX_ITEM_PRESENTATION_NAMELESS:
484         case SFX_ITEM_PRESENTATION_COMPLETE:
485             rText = aFamilyName;
486             return ePres;
487         default: ; //prevent warning
488     }
489     return SFX_ITEM_PRESENTATION_NONE;
490 }
491 
492 //------------------------------------------------------------------------
493 
494 void SvxFontItem::EnableStoreUnicodeNames( sal_Bool bEnable )
495 {
496     bEnableStoreUnicodeNames = bEnable;
497 }
498 
499 // class SvxPostureItem --------------------------------------------------
500 
501 SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) :
502     SfxEnumItem( nId, (sal_uInt16)ePosture )
503 {
504 }
505 
506 // -----------------------------------------------------------------------
507 
508 SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const
509 {
510     return new SvxPostureItem( *this );
511 }
512 
513 // -----------------------------------------------------------------------
514 
515 sal_uInt16 SvxPostureItem::GetValueCount() const
516 {
517     return ITALIC_NORMAL + 1;   // auch ITALIC_NONE geh"ort dazu
518 }
519 
520 // -----------------------------------------------------------------------
521 
522 SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
523 {
524     rStrm << (sal_uInt8)GetValue();
525     return rStrm;
526 }
527 
528 // -----------------------------------------------------------------------
529 
530 SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const
531 {
532     sal_uInt8 nPosture;
533     rStrm >> nPosture;
534     return new SvxPostureItem( (const FontItalic)nPosture, Which() );
535 }
536 
537 //------------------------------------------------------------------------
538 
539 SfxItemPresentation SvxPostureItem::GetPresentation
540 (
541     SfxItemPresentation ePres,
542     SfxMapUnit          /*eCoreUnit*/,
543     SfxMapUnit          /*ePresUnit*/,
544     XubString&          rText, const IntlWrapper * /*pIntl*/
545 )   const
546 {
547     switch ( ePres )
548     {
549         case SFX_ITEM_PRESENTATION_NONE:
550             rText.Erase();
551             return ePres;
552         case SFX_ITEM_PRESENTATION_NAMELESS:
553         case SFX_ITEM_PRESENTATION_COMPLETE:
554             rText = GetValueTextByPos( GetValue() );
555             return ePres;
556         default: ;//prevent warning
557     }
558     return SFX_ITEM_PRESENTATION_NONE;
559 }
560 
561 // -----------------------------------------------------------------------
562 
563 XubString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const
564 {
565     DBG_ASSERT( nPos <= (sal_uInt16)ITALIC_NORMAL, "enum overflow!" );
566 
567     XubString sTxt;
568     FontItalic eItalic = (FontItalic)nPos;
569     sal_uInt16 nId = 0;
570 
571     switch ( eItalic )
572     {
573         case ITALIC_NONE:       nId = RID_SVXITEMS_ITALIC_NONE;     break;
574         case ITALIC_OBLIQUE:    nId = RID_SVXITEMS_ITALIC_OBLIQUE;  break;
575         case ITALIC_NORMAL:     nId = RID_SVXITEMS_ITALIC_NORMAL;   break;
576         default: ;//prevent warning
577     }
578 
579     if ( nId )
580         sTxt = EditResId( nId );
581     return sTxt;
582 }
583 
584 
585 /*-----------------13.03.98 14:28-------------------
586 
587 --------------------------------------------------*/
588 sal_Bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
589 {
590 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
591     nMemberId &= ~CONVERT_TWIPS;
592     switch( nMemberId )
593     {
594         case MID_ITALIC:
595             rVal = Bool2Any(GetBoolValue());
596             break;
597         case MID_POSTURE:
598             rVal <<= (awt::FontSlant)GetValue();    // Werte von awt::FontSlant und FontItalic sind gleich
599             break;
600     }
601     return sal_True;
602 }
603 /*-----------------13.03.98 14:28-------------------
604 
605 --------------------------------------------------*/
606 sal_Bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
607 {
608 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
609     nMemberId &= ~CONVERT_TWIPS;
610     switch( nMemberId )
611     {
612         case MID_ITALIC:
613             SetBoolValue(Any2Bool(rVal));
614         break;
615         case MID_POSTURE:
616         {
617             awt::FontSlant eSlant;
618             if(!(rVal >>= eSlant))
619             {
620                 sal_Int32 nValue = 0;
621                 if(!(rVal >>= nValue))
622                     return sal_False;
623 
624                 eSlant = (awt::FontSlant)nValue;
625             }
626             SetValue((sal_uInt16)eSlant);
627         }
628     }
629     return sal_True;
630 }
631 // -----------------------------------------------------------------------
632 
633 int SvxPostureItem::HasBoolValue() const
634 {
635     return sal_True;
636 }
637 
638 // -----------------------------------------------------------------------
639 
640 sal_Bool SvxPostureItem::GetBoolValue() const
641 {
642     return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE );
643 }
644 
645 // -----------------------------------------------------------------------
646 
647 void SvxPostureItem::SetBoolValue( sal_Bool bVal )
648 {
649     SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) );
650 }
651 
652 // class SvxWeightItem ---------------------------------------------------
653 
654 SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) :
655     SfxEnumItem( nId, (sal_uInt16)eWght )
656 {
657 }
658 
659 
660 
661 // -----------------------------------------------------------------------
662 
663 int SvxWeightItem::HasBoolValue() const
664 {
665     return sal_True;
666 }
667 
668 // -----------------------------------------------------------------------
669 
670 sal_Bool SvxWeightItem::GetBoolValue() const
671 {
672     return  (FontWeight)GetValue() >= WEIGHT_BOLD;
673 }
674 
675 // -----------------------------------------------------------------------
676 
677 void SvxWeightItem::SetBoolValue( sal_Bool bVal )
678 {
679     SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) );
680 }
681 
682 // -----------------------------------------------------------------------
683 
684 sal_uInt16 SvxWeightItem::GetValueCount() const
685 {
686     return WEIGHT_BLACK;    // WEIGHT_DONTKNOW geh"ort nicht dazu
687 }
688 
689 // -----------------------------------------------------------------------
690 
691 SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const
692 {
693     return new SvxWeightItem( *this );
694 }
695 
696 // -----------------------------------------------------------------------
697 
698 SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
699 {
700     rStrm << (sal_uInt8)GetValue();
701     return rStrm;
702 }
703 
704 // -----------------------------------------------------------------------
705 
706 SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const
707 {
708     sal_uInt8 nWeight;
709     rStrm >> nWeight;
710     return new SvxWeightItem( (FontWeight)nWeight, Which() );
711 }
712 
713 //------------------------------------------------------------------------
714 
715 SfxItemPresentation SvxWeightItem::GetPresentation
716 (
717     SfxItemPresentation ePres,
718     SfxMapUnit          /*eCoreUnit*/,
719     SfxMapUnit          /*ePresUnit*/,
720     XubString&          rText, const IntlWrapper * /*pIntl*/
721 )   const
722 {
723     switch ( ePres )
724     {
725         case SFX_ITEM_PRESENTATION_NONE:
726             rText.Erase();
727             return ePres;
728         case SFX_ITEM_PRESENTATION_NAMELESS:
729         case SFX_ITEM_PRESENTATION_COMPLETE:
730             rText = GetValueTextByPos( GetValue() );
731             return ePres;
732         default: ;//prevent warning
733     }
734     return SFX_ITEM_PRESENTATION_NONE;
735 }
736 
737 // -----------------------------------------------------------------------
738 
739 XubString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const
740 {
741     DBG_ASSERT( nPos <= (sal_uInt16)WEIGHT_BLACK, "enum overflow!" );
742     return EE_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN + nPos );
743 }
744 
745 /*-----------------13.03.98 14:18-------------------
746 
747 --------------------------------------------------*/
748 sal_Bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
749 {
750 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
751     nMemberId &= ~CONVERT_TWIPS;
752     switch( nMemberId )
753     {
754         case MID_BOLD   :
755             rVal = Bool2Any(GetBoolValue());
756         break;
757         case MID_WEIGHT:
758         {
759             rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight)GetValue() ) );
760         }
761         break;
762     }
763     return sal_True;
764 }
765 /*-----------------13.03.98 14:18-------------------
766 
767 --------------------------------------------------*/
768 sal_Bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
769 {
770 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
771     nMemberId &= ~CONVERT_TWIPS;
772     switch( nMemberId )
773     {
774         case MID_BOLD   :
775             SetBoolValue(Any2Bool(rVal));
776         break;
777         case MID_WEIGHT:
778         {
779             double fValue = 0;
780             if(!(rVal >>= fValue))
781             {
782                 sal_Int32 nValue = 0;
783                 if(!(rVal >>= nValue))
784                     return sal_False;
785                 fValue = (float)nValue;
786             }
787             SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) );
788         }
789         break;
790     }
791     return sal_True;
792 }
793 
794 // class SvxFontHeightItem -----------------------------------------------
795 
796 SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
797                                       const sal_uInt16 nPrp,
798                                       const sal_uInt16 nId ) :
799     SfxPoolItem( nId )
800 {
801     SetHeight( nSz,nPrp );  // mit den Prozenten rechnen
802 }
803 
804 // -----------------------------------------------------------------------
805 
806 SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const
807 {
808     return new SvxFontHeightItem( *this );
809 }
810 
811 // -----------------------------------------------------------------------
812 
813 SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
814 {
815     rStrm << (sal_uInt16)GetHeight();
816 
817     if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
818         rStrm << GetProp() << (sal_uInt16)GetPropUnit();
819     else
820     {
821         // JP 30.06.98: beim Export in alte Versionen geht die relative
822         // Angabe verloren, wenn es keine Prozentuale ist
823         sal_uInt16 _nProp = GetProp();
824         if( SFX_MAPUNIT_RELATIVE != GetPropUnit() )
825             _nProp = 100;
826         rStrm << _nProp;
827     }
828     return rStrm;
829 }
830 
831 // -----------------------------------------------------------------------
832 
833 SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
834                                                  sal_uInt16 nVersion ) const
835 {
836     sal_uInt16 nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE;
837 
838     rStrm >> nsize;
839 
840     if( FONTHEIGHT_16_VERSION <= nVersion )
841         rStrm >> nprop;
842     else
843     {
844         sal_uInt8 nP;
845         rStrm  >> nP;
846         nprop = (sal_uInt16)nP;
847     }
848 
849     if( FONTHEIGHT_UNIT_VERSION <= nVersion )
850         rStrm >> nPropUnit;
851 
852     SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
853     pItem->SetProp( nprop, (SfxMapUnit)nPropUnit );
854     return pItem;
855 }
856 
857 // -----------------------------------------------------------------------
858 
859 int SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const
860 {
861     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
862     return GetHeight() == ((SvxFontHeightItem&)rItem).GetHeight() &&
863             GetProp() == ((SvxFontHeightItem&)rItem).GetProp() &&
864             GetPropUnit() == ((SvxFontHeightItem&)rItem).GetPropUnit();
865 }
866 
867 /*-----------------13.03.98 14:53-------------------
868 
869 --------------------------------------------------*/
870 sal_Bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
871 {
872     //  In StarOne sind im uno::Any immer 1/100mm. Ueber die MemberId wird
873     //  gesteuert, ob der Wert im Item 1/100mm oder Twips sind.
874 
875     sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
876     nMemberId &= ~CONVERT_TWIPS;
877     switch( nMemberId )
878     {
879         case 0:
880         {
881             ::com::sun::star::frame::status::FontHeight aFontHeight;
882 
883             //  Point (also Twips) sind gefragt,
884             //  also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist
885             if( bConvert )
886             {
887                 long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight);
888                 aFontHeight.Height = (float)( nTwips / 20.0 );
889             }
890             else
891             {
892                 double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0;
893                 float fRoundPoints =
894                     static_cast<float>(::rtl::math::round(fPoints, 1));
895                 aFontHeight.Height = fRoundPoints;
896             }
897 
898             aFontHeight.Prop = (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
899 
900             float fRet = (float)(short)nProp;
901             switch( ePropUnit )
902             {
903                 case SFX_MAPUNIT_RELATIVE:
904                     fRet = 0.;
905                 break;
906                 case SFX_MAPUNIT_100TH_MM:
907                     fRet = MM100_TO_TWIP(fRet);
908                     fRet /= 20.;
909                 break;
910                 case SFX_MAPUNIT_POINT:
911 
912                 break;
913                 case SFX_MAPUNIT_TWIP:
914                     fRet /= 20.;
915                 break;
916                 default: ;//prevent warning
917             }
918             aFontHeight.Diff = fRet;
919             rVal <<= aFontHeight;
920         }
921         break;
922         case MID_FONTHEIGHT:
923         {
924             //  Point (also Twips) sind gefragt,
925             //  also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist
926             if( bConvert )
927             {
928                 long nTwips = bConvert ? nHeight : MM100_TO_TWIP_UNSIGNED(nHeight);
929                 rVal <<= (float)( nTwips / 20.0 );
930             }
931             else
932             {
933                 double fPoints = MM100_TO_TWIP_UNSIGNED(nHeight) / 20.0;
934                 float fRoundPoints =
935                     static_cast<float>(::rtl::math::round(fPoints, 1));
936                 rVal <<= fRoundPoints;
937             }
938         }
939         break;
940         case MID_FONTHEIGHT_PROP:
941             rVal <<= (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
942         break;
943         case MID_FONTHEIGHT_DIFF:
944         {
945             float fRet = (float)(short)nProp;
946             switch( ePropUnit )
947             {
948                 case SFX_MAPUNIT_RELATIVE:
949                     fRet = 0.;
950                 break;
951                 case SFX_MAPUNIT_100TH_MM:
952                     fRet = MM100_TO_TWIP(fRet);
953                     fRet /= 20.;
954                 break;
955                 case SFX_MAPUNIT_POINT:
956 
957                 break;
958                 case SFX_MAPUNIT_TWIP:
959                     fRet /= 20.;
960                 break;
961                 default: ;//prevent warning
962             }
963             rVal <<= fRet;
964         }
965         break;
966     }
967     return sal_True;
968 }
969 /* -----------------01.07.98 13:43-------------------
970  *  Relative Abweichung aus der Hoehe herausrechnen
971  * --------------------------------------------------*/
972 sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUnit eProp, sal_Bool bCoreInTwip)
973 {
974     sal_uInt32 nRet = nHeight;
975     short nDiff = 0;
976     switch( eProp )
977     {
978         case SFX_MAPUNIT_RELATIVE:
979             nRet *= 100;
980             nRet /= nProp;
981         break;
982         case SFX_MAPUNIT_POINT:
983         {
984             short nTemp = (short)nProp;
985             nDiff = nTemp * 20;
986             if(!bCoreInTwip)
987                 nDiff = (short)TWIP_TO_MM100((long)(nDiff));
988         }
989         break;
990         case SFX_MAPUNIT_100TH_MM:
991             //dann ist die Core doch wohl auch in 1/100 mm
992             nDiff = (short)nProp;
993         break;
994         case SFX_MAPUNIT_TWIP:
995             // hier doch sicher TWIP
996             nDiff = ((short)nProp);
997         break;
998         default: ;//prevent warning
999     }
1000     nRet -= nDiff;
1001 
1002     return nRet;
1003 }
1004 
1005 /*-----------------13.03.98 14:53-------------------
1006 
1007 --------------------------------------------------*/
1008 sal_Bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1009 {
1010     sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1011     nMemberId &= ~CONVERT_TWIPS;
1012     switch( nMemberId )
1013     {
1014         case 0:
1015         {
1016             ::com::sun::star::frame::status::FontHeight aFontHeight;
1017             if ( rVal >>= aFontHeight )
1018             {
1019                 // Height
1020                 ePropUnit = SFX_MAPUNIT_RELATIVE;
1021                 nProp = 100;
1022                 double fPoint = aFontHeight.Height;
1023                 if( fPoint < 0. || fPoint > 10000. )
1024                     return sal_False;
1025 
1026                 nHeight = (long)( fPoint * 20.0 + 0.5 );        // Twips
1027                 if (!bConvert)
1028                     nHeight = TWIP_TO_MM100_UNSIGNED(nHeight);  // umrechnen, wenn das Item 1/100mm enthaelt
1029 
1030                 nProp = aFontHeight.Prop;
1031             }
1032             else
1033                 return sal_False;
1034         }
1035         break;
1036         case MID_FONTHEIGHT:
1037         {
1038             ePropUnit = SFX_MAPUNIT_RELATIVE;
1039             nProp = 100;
1040             double fPoint = 0;
1041             if(!(rVal >>= fPoint))
1042             {
1043                 sal_Int32 nValue = 0;
1044                 if(!(rVal >>= nValue))
1045                     return sal_False;
1046                 fPoint = (float)nValue;
1047             }
1048             if(fPoint < 0. || fPoint > 10000.)
1049                     return sal_False;
1050 
1051             nHeight = (long)( fPoint * 20.0 + 0.5 );        // Twips
1052             if (!bConvert)
1053                 nHeight = TWIP_TO_MM100_UNSIGNED(nHeight);  // umrechnen, wenn das Item 1/100mm enthaelt
1054         }
1055         break;
1056         case MID_FONTHEIGHT_PROP:
1057         {
1058             sal_Int16 nNew = sal_Int16();
1059             if(!(rVal >>= nNew))
1060                 return sal_True;
1061 
1062             nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
1063 
1064             nHeight *= nNew;
1065             nHeight /= 100;
1066             nProp = nNew;
1067             ePropUnit = SFX_MAPUNIT_RELATIVE;
1068         }
1069         break;
1070         case MID_FONTHEIGHT_DIFF:
1071         {
1072             nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
1073             float fValue = 0;
1074             if(!(rVal >>= fValue))
1075             {
1076                 sal_Int32 nValue = 0;
1077                 if(!(rVal >>= nValue))
1078                     return sal_False;
1079                 fValue = (float)nValue;
1080             }
1081             sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.);
1082             nHeight += bConvert ? nCoreDiffValue : TWIP_TO_MM100(nCoreDiffValue);
1083             nProp = (sal_uInt16)((sal_Int16)fValue);
1084             ePropUnit = SFX_MAPUNIT_POINT;
1085         }
1086         break;
1087     }
1088     return sal_True;
1089 }
1090 
1091 //------------------------------------------------------------------------
1092 
1093 SfxItemPresentation SvxFontHeightItem::GetPresentation
1094 (
1095     SfxItemPresentation ePres,
1096     SfxMapUnit          eCoreUnit,
1097     SfxMapUnit          /*ePresUnit*/,
1098     XubString&          rText, const IntlWrapper *pIntl
1099 )   const
1100 {
1101 #ifndef SVX_LIGHT
1102     switch ( ePres )
1103     {
1104         case SFX_ITEM_PRESENTATION_NONE:
1105             rText.Erase();
1106             return ePres;
1107         case SFX_ITEM_PRESENTATION_NAMELESS:
1108         case SFX_ITEM_PRESENTATION_COMPLETE:
1109         {
1110             if( SFX_MAPUNIT_RELATIVE != ePropUnit )
1111             {
1112                 ( rText = String::CreateFromInt32( (short)nProp ) ) +=
1113                         EE_RESSTR( GetMetricId( ePropUnit ) );
1114                 if( 0 <= (short)nProp )
1115                     rText.Insert( sal_Unicode('+'), 0 );
1116             }
1117             else if( 100 == nProp )
1118             {
1119                 rText = GetMetricText( (long)nHeight,
1120                                         eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
1121                 rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
1122             }
1123             else
1124                 ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%');
1125             return ePres;
1126         }
1127         default: ; //prevent warning
1128     }
1129 #endif
1130     return SFX_ITEM_PRESENTATION_NONE;
1131 }
1132 
1133 // -----------------------------------------------------------------------
1134 
1135 sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const
1136 {
1137     return (nFileVersion <= SOFFICE_FILEFORMAT_40)
1138                ? FONTHEIGHT_16_VERSION
1139                : FONTHEIGHT_UNIT_VERSION;
1140 }
1141 
1142 // -----------------------------------------------------------------------
1143 
1144 int SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv )
1145 {
1146     nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv );
1147     return 1;
1148 }
1149 
1150 // -----------------------------------------------------------------------
1151 
1152 int SvxFontHeightItem::HasMetrics() const
1153 {
1154     return 1;
1155 }
1156 
1157 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp,
1158                                     SfxMapUnit eUnit )
1159 {
1160     DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1161 
1162 #ifndef SVX_LIGHT
1163     if( SFX_MAPUNIT_RELATIVE != eUnit )
1164         nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit,
1165                                                 SFX_FUNIT_TWIP );
1166     else
1167 #endif // !SVX_LIGHT
1168     if( 100 != nNewProp )
1169         nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
1170     else
1171         nHeight = nNewHeight;
1172 
1173     nProp = nNewProp;
1174     ePropUnit = eUnit;
1175 }
1176 
1177 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
1178                                  SfxMapUnit eMetric, SfxMapUnit eCoreMetric )
1179 {
1180     DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1181 
1182 #ifndef SVX_LIGHT
1183     if( SFX_MAPUNIT_RELATIVE != eMetric )
1184         nHeight = nNewHeight +
1185                 ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric,
1186                                         SFX_FUNIT_TWIP ), SFX_FUNIT_TWIP,
1187                                         eCoreMetric );
1188     else
1189 #endif // !SVX_LIGHT
1190     if( 100 != nNewProp )
1191         nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
1192     else
1193         nHeight = nNewHeight;
1194 
1195     nProp = nNewProp;
1196     ePropUnit = eMetric;
1197 }
1198 
1199 // class SvxFontWidthItem -----------------------------------------------
1200 
1201 SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) :
1202     SfxPoolItem( nId )
1203 {
1204     nWidth = nSz;
1205     nProp = nPrp;
1206 }
1207 
1208 // -----------------------------------------------------------------------
1209 
1210 SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const
1211 {
1212     return new SvxFontWidthItem( *this );
1213 }
1214 
1215 // -----------------------------------------------------------------------
1216 
1217 SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1218 {
1219     rStrm << GetWidth() << GetProp();
1220     return rStrm;
1221 }
1222 
1223 // -----------------------------------------------------------------------
1224 
1225 int SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv )
1226 {
1227     nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv );
1228     return 1;
1229 }
1230 
1231 // -----------------------------------------------------------------------
1232 
1233 int SvxFontWidthItem::HasMetrics() const
1234 {
1235     return 1;
1236 }
1237 
1238 // -----------------------------------------------------------------------
1239 
1240 SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm,
1241                                                  sal_uInt16 /*nVersion*/ ) const
1242 {
1243     sal_uInt16 nS;
1244     sal_uInt16 nP;
1245 
1246     rStrm >> nS;
1247     rStrm >> nP;
1248     SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() );
1249     pItem->SetWidthValue( nS );
1250     return pItem;
1251 }
1252 
1253 // -----------------------------------------------------------------------
1254 
1255 int SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const
1256 {
1257     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
1258     return GetWidth() == ((SvxFontWidthItem&)rItem).GetWidth() &&
1259             GetProp() == ((SvxFontWidthItem&)rItem).GetProp();
1260 }
1261 
1262 /*-----------------13.03.98 16:03-------------------
1263 
1264 --------------------------------------------------*/
1265 sal_Bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1266 {
1267 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1268     nMemberId &= ~CONVERT_TWIPS;
1269     switch(nMemberId)
1270     {
1271         case MID_FONTWIDTH:
1272             rVal <<= (sal_Int16)(nWidth);
1273         break;
1274         case MID_FONTWIDTH_PROP:
1275             rVal <<= (sal_Int16)(nProp);
1276         break;
1277     }
1278     return sal_True;
1279 }
1280 /*-----------------13.03.98 16:03-------------------
1281 
1282 --------------------------------------------------*/
1283 sal_Bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1284 {
1285 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1286     nMemberId &= ~CONVERT_TWIPS;
1287     sal_Int16 nVal = sal_Int16();
1288     if(!(rVal >>= nVal))
1289         return sal_False;
1290 
1291     switch(nMemberId)
1292     {
1293         case MID_FONTWIDTH:
1294             nProp = nVal;
1295         break;
1296         case MID_FONTWIDTH_PROP:
1297             nWidth = nVal;
1298         break;
1299     }
1300     return sal_True;
1301 }
1302 
1303 //------------------------------------------------------------------------
1304 
1305 SfxItemPresentation SvxFontWidthItem::GetPresentation
1306 (
1307     SfxItemPresentation ePres,
1308     SfxMapUnit          eCoreUnit,
1309     SfxMapUnit          /*ePresUnit*/,
1310     XubString&          rText, const IntlWrapper *pIntl
1311 )   const
1312 {
1313 #ifndef SVX_LIGHT
1314     switch ( ePres )
1315     {
1316         case SFX_ITEM_PRESENTATION_NONE:
1317             rText.Erase();
1318             return ePres;
1319         case SFX_ITEM_PRESENTATION_NAMELESS:
1320         case SFX_ITEM_PRESENTATION_COMPLETE:
1321         {
1322             if ( 100 == nProp )
1323             {
1324                 rText = GetMetricText( (long)nWidth,
1325                                         eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
1326                 rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
1327             }
1328             else
1329                 ( rText = String::CreateFromInt32( nProp )) += sal_Unicode('%');
1330             return ePres;
1331         }
1332         default: ; //prevent warning
1333     }
1334 #endif
1335     return SFX_ITEM_PRESENTATION_NONE;
1336 }
1337 
1338 // class SvxTextLineItem ------------------------------------------------
1339 
1340 SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId )
1341     : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT )
1342 {
1343 }
1344 
1345 // -----------------------------------------------------------------------
1346 
1347 int SvxTextLineItem::HasBoolValue() const
1348 {
1349     return sal_True;
1350 }
1351 
1352 // -----------------------------------------------------------------------
1353 
1354 sal_Bool SvxTextLineItem::GetBoolValue() const
1355 {
1356     return  (FontUnderline)GetValue() != UNDERLINE_NONE;
1357 }
1358 
1359 // -----------------------------------------------------------------------
1360 
1361 void SvxTextLineItem::SetBoolValue( sal_Bool bVal )
1362 {
1363     SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) );
1364 }
1365 
1366 // -----------------------------------------------------------------------
1367 
1368 SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const
1369 {
1370     SvxTextLineItem* pNew = new SvxTextLineItem( *this );
1371     pNew->SetColor( GetColor() );
1372     return pNew;
1373 }
1374 
1375 // -----------------------------------------------------------------------
1376 
1377 sal_uInt16 SvxTextLineItem::GetValueCount() const
1378 {
1379     return UNDERLINE_DOTTED + 1;    // auch UNDERLINE_NONE geh"ort dazu
1380 }
1381 
1382 // -----------------------------------------------------------------------
1383 
1384 SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1385 {
1386     rStrm << (sal_uInt8)GetValue();
1387     return rStrm;
1388 }
1389 
1390 // -----------------------------------------------------------------------
1391 
1392 SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const
1393 {
1394     sal_uInt8 nState;
1395     rStrm >> nState;
1396     return new SvxTextLineItem(  (FontUnderline)nState, Which() );
1397 }
1398 
1399 //------------------------------------------------------------------------
1400 
1401 SfxItemPresentation SvxTextLineItem::GetPresentation
1402 (
1403     SfxItemPresentation ePres,
1404     SfxMapUnit          /*eCoreUnit*/,
1405     SfxMapUnit          /*ePresUnit*/,
1406     XubString&          rText, const IntlWrapper * /*pIntl*/
1407 )   const
1408 {
1409 #ifndef SVX_LIGHT
1410     switch ( ePres )
1411     {
1412         case SFX_ITEM_PRESENTATION_NONE:
1413             rText.Erase();
1414             return ePres;
1415         case SFX_ITEM_PRESENTATION_NAMELESS:
1416         case SFX_ITEM_PRESENTATION_COMPLETE:
1417             rText = GetValueTextByPos( GetValue() );
1418             if( !mColor.GetTransparency() )
1419                 ( rText += cpDelim ) += ::GetColorString( mColor );
1420             return ePres;
1421         default: ; //prevent warning
1422     }
1423 #endif
1424     return SFX_ITEM_PRESENTATION_NONE;
1425 }
1426 
1427 // -----------------------------------------------------------------------
1428 
1429 XubString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const
1430 {
1431     DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method");
1432     return XubString();
1433 }
1434 
1435 /*-----------------13.03.98 16:25-------------------
1436 
1437 --------------------------------------------------*/
1438 sal_Bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1439 {
1440 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1441     nMemberId &= ~CONVERT_TWIPS;
1442     switch(nMemberId)
1443     {
1444     case MID_TEXTLINED:
1445         rVal = Bool2Any(GetBoolValue());
1446         break;
1447     case MID_TL_STYLE:
1448         rVal <<= (sal_Int16)(GetValue());
1449         break;
1450     case MID_TL_COLOR:
1451         rVal <<= (sal_Int32)( mColor.GetColor() );
1452         break;
1453     case MID_TL_HASCOLOR:
1454         rVal = Bool2Any( !mColor.GetTransparency() );
1455         break;
1456     }
1457     return sal_True;
1458 
1459 }
1460 /*-----------------13.03.98 16:28-------------------
1461 
1462 --------------------------------------------------*/
1463 sal_Bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1464 {
1465 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1466     nMemberId &= ~CONVERT_TWIPS;
1467     sal_Bool bRet = sal_True;
1468     switch(nMemberId)
1469     {
1470     case MID_TEXTLINED:
1471         SetBoolValue(Any2Bool(rVal));
1472     break;
1473     case MID_TL_STYLE:
1474     {
1475         sal_Int32 nValue = 0;
1476         if(!(rVal >>= nValue))
1477             bRet = sal_False;
1478         else
1479             SetValue((sal_Int16)nValue);
1480     }
1481     break;
1482     case MID_TL_COLOR:
1483     {
1484         sal_Int32 nCol = 0;
1485         if( !( rVal >>= nCol ) )
1486             bRet = sal_False;
1487         else
1488         {
1489             // Keep transparence, because it contains the information
1490             // whether the font color or the stored color should be used
1491             sal_uInt8 nTrans = mColor.GetTransparency();
1492             mColor = Color( nCol );
1493             mColor.SetTransparency( nTrans );
1494         }
1495     }
1496     break;
1497     case MID_TL_HASCOLOR:
1498         mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff );
1499     break;
1500     }
1501     return bRet;
1502 }
1503 
1504 int SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const
1505 {
1506     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
1507     return SfxEnumItem::operator==( rItem ) &&
1508            GetColor() == ((SvxTextLineItem&)rItem).GetColor();
1509 }
1510 
1511 // class SvxUnderlineItem ------------------------------------------------
1512 
1513 SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId )
1514     : SvxTextLineItem( eSt, nId )
1515 {
1516 }
1517 
1518 //------------------------------------------------------------------------
1519 
1520 SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
1521 {
1522     SvxUnderlineItem* pNew = new SvxUnderlineItem( *this );
1523     pNew->SetColor( GetColor() );
1524     return pNew;
1525 }
1526 
1527 // -----------------------------------------------------------------------
1528 
1529 SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const
1530 {
1531     sal_uInt8 nState;
1532     rStrm >> nState;
1533     return new SvxUnderlineItem(  (FontUnderline)nState, Which() );
1534 }
1535 
1536 // -----------------------------------------------------------------------
1537 
1538 XubString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
1539 {
1540     DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
1541     return EE_RESSTR( RID_SVXITEMS_UL_BEGIN + nPos );
1542 }
1543 
1544 // class SvxOverlineItem ------------------------------------------------
1545 
1546 SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId )
1547     : SvxTextLineItem( eSt, nId )
1548 {
1549 }
1550 
1551 //------------------------------------------------------------------------
1552 
1553 SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const
1554 {
1555     SvxOverlineItem* pNew = new SvxOverlineItem( *this );
1556     pNew->SetColor( GetColor() );
1557     return pNew;
1558 }
1559 
1560 // -----------------------------------------------------------------------
1561 
1562 SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const
1563 {
1564     sal_uInt8 nState;
1565     rStrm >> nState;
1566     return new SvxOverlineItem(  (FontUnderline)nState, Which() );
1567 }
1568 
1569 // -----------------------------------------------------------------------
1570 
1571 XubString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
1572 {
1573     DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
1574     return EE_RESSTR( RID_SVXITEMS_OL_BEGIN + nPos );
1575 }
1576 
1577 // class SvxCrossedOutItem -----------------------------------------------
1578 
1579 SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId )
1580     : SfxEnumItem( nId, (sal_uInt16)eSt )
1581 {
1582 }
1583 
1584 // -----------------------------------------------------------------------
1585 
1586 int SvxCrossedOutItem::HasBoolValue() const
1587 {
1588     return sal_True;
1589 }
1590 
1591 // -----------------------------------------------------------------------
1592 
1593 sal_Bool SvxCrossedOutItem::GetBoolValue() const
1594 {
1595     return (FontStrikeout)GetValue() != STRIKEOUT_NONE;
1596 }
1597 
1598 // -----------------------------------------------------------------------
1599 
1600 void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal )
1601 {
1602     SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) );
1603 }
1604 
1605 // -----------------------------------------------------------------------
1606 
1607 sal_uInt16 SvxCrossedOutItem::GetValueCount() const
1608 {
1609     return STRIKEOUT_DOUBLE + 1;    // auch STRIKEOUT_NONE geh"ort dazu
1610 }
1611 
1612 // -----------------------------------------------------------------------
1613 
1614 SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const
1615 {
1616     return new SvxCrossedOutItem( *this );
1617 }
1618 
1619 // -----------------------------------------------------------------------
1620 
1621 SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1622 {
1623     rStrm << (sal_uInt8)GetValue();
1624     return rStrm;
1625 }
1626 
1627 // -----------------------------------------------------------------------
1628 
1629 SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const
1630 {
1631     sal_uInt8 eCross;
1632     rStrm >> eCross;
1633     return new SvxCrossedOutItem(  (FontStrikeout)eCross, Which() );
1634 }
1635 
1636 //------------------------------------------------------------------------
1637 
1638 SfxItemPresentation SvxCrossedOutItem::GetPresentation
1639 (
1640     SfxItemPresentation ePres,
1641     SfxMapUnit          /*eCoreUnit*/,
1642     SfxMapUnit          /*ePresUnit*/,
1643     XubString&          rText, const IntlWrapper * /*pIntl*/
1644 )   const
1645 {
1646     switch ( ePres )
1647     {
1648         case SFX_ITEM_PRESENTATION_NONE:
1649             rText.Erase();
1650             return ePres;
1651         case SFX_ITEM_PRESENTATION_NAMELESS:
1652         case SFX_ITEM_PRESENTATION_COMPLETE:
1653             rText = GetValueTextByPos( GetValue() );
1654             return ePres;
1655         default: ;//prevent warning
1656     }
1657     return SFX_ITEM_PRESENTATION_NONE;
1658 }
1659 
1660 // -----------------------------------------------------------------------
1661 
1662 XubString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const
1663 {
1664     DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" );
1665     return EE_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN + nPos );
1666 }
1667 
1668 /*-----------------13.03.98 16:28-------------------
1669 
1670 --------------------------------------------------*/
1671 sal_Bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1672 {
1673 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1674     nMemberId &= ~CONVERT_TWIPS;
1675     switch(nMemberId)
1676     {
1677         case MID_CROSSED_OUT:
1678             rVal = Bool2Any(GetBoolValue());
1679         break;
1680         case MID_CROSS_OUT:
1681             rVal <<= (sal_Int16)(GetValue());
1682         break;
1683     }
1684     return sal_True;
1685 }
1686 /*-----------------13.03.98 16:29-------------------
1687 
1688 --------------------------------------------------*/
1689 sal_Bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1690 {
1691 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1692     nMemberId &= ~CONVERT_TWIPS;
1693     switch(nMemberId)
1694     {
1695         case MID_CROSSED_OUT:
1696             SetBoolValue(Any2Bool(rVal));
1697         break;
1698         case MID_CROSS_OUT:
1699         {
1700             sal_Int32 nValue = 0;
1701             if(!(rVal >>= nValue))
1702                 return sal_False;
1703             SetValue((sal_Int16)nValue);
1704         }
1705         break;
1706     }
1707     return sal_True;
1708 }
1709 // class SvxShadowedItem -------------------------------------------------
1710 
1711 SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed, const sal_uInt16 nId ) :
1712     SfxBoolItem( nId, bShadowed )
1713 {
1714 }
1715 
1716 // -----------------------------------------------------------------------
1717 
1718 SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const
1719 {
1720     return new SvxShadowedItem( *this );
1721 }
1722 
1723 // -----------------------------------------------------------------------
1724 
1725 SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1726 {
1727     rStrm << (sal_uInt8) GetValue();
1728     return rStrm;
1729 }
1730 
1731 // -----------------------------------------------------------------------
1732 
1733 SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const
1734 {
1735     sal_uInt8 nState;
1736     rStrm >> nState;
1737     return new SvxShadowedItem( nState, Which() );
1738 }
1739 
1740 //------------------------------------------------------------------------
1741 
1742 SfxItemPresentation SvxShadowedItem::GetPresentation
1743 (
1744     SfxItemPresentation ePres,
1745     SfxMapUnit          /*eCoreUnit*/,
1746     SfxMapUnit          /*ePresUnit*/,
1747     XubString&          rText, const IntlWrapper * /*pIntl*/
1748 )   const
1749 {
1750     switch ( ePres )
1751     {
1752         case SFX_ITEM_PRESENTATION_NONE:
1753             rText.Erase();
1754             return ePres;
1755         case SFX_ITEM_PRESENTATION_NAMELESS:
1756         case SFX_ITEM_PRESENTATION_COMPLETE:
1757         {
1758             sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE;
1759 
1760             if ( GetValue() )
1761                 nId = RID_SVXITEMS_SHADOWED_TRUE;
1762             rText = EE_RESSTR(nId);
1763             return ePres;
1764         }
1765         default: ; //prevent warning
1766     }
1767     return SFX_ITEM_PRESENTATION_NONE;
1768 }
1769 
1770 // class SvxAutoKernItem -------------------------------------------------
1771 
1772 SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern, const sal_uInt16 nId ) :
1773     SfxBoolItem( nId, bAutoKern )
1774 {
1775 }
1776 
1777 // -----------------------------------------------------------------------
1778 
1779 SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const
1780 {
1781     return new SvxAutoKernItem( *this );
1782 }
1783 
1784 // -----------------------------------------------------------------------
1785 
1786 SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1787 {
1788     rStrm << (sal_uInt8) GetValue();
1789     return rStrm;
1790 }
1791 
1792 // -----------------------------------------------------------------------
1793 
1794 SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const
1795 {
1796     sal_uInt8 nState;
1797     rStrm >> nState;
1798     return new SvxAutoKernItem( nState, Which() );
1799 }
1800 
1801 //------------------------------------------------------------------------
1802 
1803 SfxItemPresentation SvxAutoKernItem::GetPresentation
1804 (
1805     SfxItemPresentation ePres,
1806     SfxMapUnit          /*eCoreUnit*/,
1807     SfxMapUnit          /*ePresUnit*/,
1808     XubString&          rText, const IntlWrapper * /*pIntl*/
1809 )   const
1810 {
1811     switch ( ePres )
1812     {
1813         case SFX_ITEM_PRESENTATION_NONE:
1814             rText.Erase();
1815             return ePres;
1816         case SFX_ITEM_PRESENTATION_NAMELESS:
1817         case SFX_ITEM_PRESENTATION_COMPLETE:
1818         {
1819             sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE;
1820 
1821             if ( GetValue() )
1822                 nId = RID_SVXITEMS_AUTOKERN_TRUE;
1823             rText = EE_RESSTR(nId);
1824             return ePres;
1825         }
1826         default: ; //prevent warning
1827     }
1828     return SFX_ITEM_PRESENTATION_NONE;
1829 }
1830 
1831 // class SvxWordLineModeItem ---------------------------------------------
1832 
1833 SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode,
1834                                           const sal_uInt16 nId ) :
1835     SfxBoolItem( nId, bWordLineMode )
1836 {
1837 }
1838 
1839 // -----------------------------------------------------------------------
1840 
1841 SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const
1842 {
1843     return new SvxWordLineModeItem( *this );
1844 }
1845 
1846 // -----------------------------------------------------------------------
1847 
1848 SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1849 {
1850     rStrm << (sal_Bool) GetValue();
1851     return rStrm;
1852 }
1853 
1854 // -----------------------------------------------------------------------
1855 
1856 SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const
1857 {
1858     sal_Bool bValue;
1859     rStrm >> bValue;
1860     return new SvxWordLineModeItem( bValue, Which() );
1861 }
1862 
1863 //------------------------------------------------------------------------
1864 
1865 SfxItemPresentation SvxWordLineModeItem::GetPresentation
1866 (
1867     SfxItemPresentation ePres,
1868     SfxMapUnit          /*eCoreUnit*/,
1869     SfxMapUnit          /*ePresUnit*/,
1870     XubString&          rText, const IntlWrapper * /*pIntl*/
1871 )   const
1872 {
1873     switch ( ePres )
1874     {
1875         case SFX_ITEM_PRESENTATION_NONE:
1876             rText.Erase();
1877             return ePres;
1878         case SFX_ITEM_PRESENTATION_NAMELESS:
1879         case SFX_ITEM_PRESENTATION_COMPLETE:
1880         {
1881             sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE;
1882 
1883             if ( GetValue() )
1884                 nId = RID_SVXITEMS_WORDLINE_TRUE;
1885             rText = EE_RESSTR(nId);
1886             return ePres;
1887         }
1888         default: ; //prevent warning
1889     }
1890     return SFX_ITEM_PRESENTATION_NONE;
1891 }
1892 
1893 // class SvxContourItem --------------------------------------------------
1894 
1895 SvxContourItem::SvxContourItem( const sal_Bool bContoured, const sal_uInt16 nId ) :
1896     SfxBoolItem( nId, bContoured )
1897 {
1898 }
1899 
1900 // -----------------------------------------------------------------------
1901 
1902 SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const
1903 {
1904     return new SvxContourItem( *this );
1905 }
1906 
1907 // -----------------------------------------------------------------------
1908 
1909 SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1910 {
1911     rStrm << (sal_Bool) GetValue();
1912     return rStrm;
1913 }
1914 
1915 // -----------------------------------------------------------------------
1916 
1917 SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const
1918 {
1919     sal_Bool bValue;
1920     rStrm >> bValue;
1921     return new SvxContourItem( bValue, Which() );
1922 }
1923 
1924 //------------------------------------------------------------------------
1925 
1926 SfxItemPresentation SvxContourItem::GetPresentation
1927 (
1928     SfxItemPresentation ePres,
1929     SfxMapUnit          /*eCoreUnit*/,
1930     SfxMapUnit          /*ePresUnit*/,
1931     XubString&          rText, const IntlWrapper * /*pIntl*/
1932 )   const
1933 {
1934     switch ( ePres )
1935     {
1936         case SFX_ITEM_PRESENTATION_NONE:
1937             rText.Erase();
1938             return ePres;
1939         case SFX_ITEM_PRESENTATION_NAMELESS:
1940         case SFX_ITEM_PRESENTATION_COMPLETE:
1941         {
1942             sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE;
1943 
1944             if ( GetValue() )
1945                 nId = RID_SVXITEMS_CONTOUR_TRUE;
1946             rText = EE_RESSTR(nId);
1947             return ePres;
1948         }
1949         default: ; //prevent warning
1950     }
1951     return SFX_ITEM_PRESENTATION_NONE;
1952 }
1953 
1954 // class SvxPropSizeItem -------------------------------------------------
1955 
1956 SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) :
1957     SfxUInt16Item( nId, nPercent )
1958 {
1959 }
1960 
1961 // -----------------------------------------------------------------------
1962 
1963 SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const
1964 {
1965     return new SvxPropSizeItem( *this );
1966 }
1967 
1968 // -----------------------------------------------------------------------
1969 
1970 SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1971 {
1972     rStrm << (sal_uInt16) GetValue();
1973     return rStrm;
1974 }
1975 
1976 // -----------------------------------------------------------------------
1977 
1978 SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const
1979 {
1980     sal_uInt16 nSize;
1981     rStrm >> nSize;
1982     return new SvxPropSizeItem( nSize, Which() );
1983 }
1984 
1985 //------------------------------------------------------------------------
1986 
1987 SfxItemPresentation SvxPropSizeItem::GetPresentation
1988 (
1989     SfxItemPresentation /*ePres*/,
1990     SfxMapUnit          /*eCoreUnit*/,
1991     SfxMapUnit          /*ePresUnit*/,
1992     XubString&          rText, const IntlWrapper * /*pIntl*/
1993 )   const
1994 {
1995     rText.Erase();
1996     return SFX_ITEM_PRESENTATION_NONE;
1997 }
1998 
1999 // class SvxColorItem ----------------------------------------------------
2000 
2001 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
2002     SfxPoolItem( nId ),
2003     mColor( COL_BLACK )
2004 {
2005 }
2006 
2007 // -----------------------------------------------------------------------
2008 
2009 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
2010     SfxPoolItem( nId ),
2011     mColor( rCol )
2012 {
2013 }
2014 
2015 // -----------------------------------------------------------------------
2016 
2017 SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
2018     SfxPoolItem( nId )
2019 {
2020     Color aColor;
2021     rStrm >> aColor;
2022     mColor = aColor;
2023 }
2024 
2025 // -----------------------------------------------------------------------
2026 
2027 SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) :
2028     SfxPoolItem( rCopy ),
2029     mColor( rCopy.mColor )
2030 {
2031 }
2032 
2033 // -----------------------------------------------------------------------
2034 
2035 SvxColorItem::~SvxColorItem()
2036 {
2037 }
2038 
2039 // -----------------------------------------------------------------------
2040 sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
2041 {
2042     DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
2043             SOFFICE_FILEFORMAT_40==nFFVer ||
2044             SOFFICE_FILEFORMAT_50==nFFVer,
2045             "SvxColorItem: Gibt es ein neues Fileformat?" );
2046     return  SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0;
2047 }
2048 
2049 // -----------------------------------------------------------------------
2050 
2051 int SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
2052 {
2053     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
2054 
2055     return  mColor == ( (const SvxColorItem&)rAttr ).mColor;
2056 }
2057 
2058 // -----------------------------------------------------------------------
2059 
2060 sal_Bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
2061 {
2062     rVal <<= (sal_Int32)(mColor.GetColor());
2063     return sal_True;
2064 }
2065 
2066 // -----------------------------------------------------------------------
2067 
2068 sal_Bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
2069 {
2070     sal_Int32 nColor = 0;
2071     if(!(rVal >>= nColor))
2072         return sal_False;
2073 
2074     mColor.SetColor( nColor );
2075     return sal_True;
2076 }
2077 
2078 // -----------------------------------------------------------------------
2079 
2080 SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const
2081 {
2082     return new SvxColorItem( *this );
2083 }
2084 
2085 // -----------------------------------------------------------------------
2086 
2087 SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
2088 {
2089     if( VERSION_USEAUTOCOLOR == nItemVersion &&
2090         COL_AUTO == mColor.GetColor() )
2091         rStrm << Color( COL_BLACK );
2092     else
2093         rStrm << mColor;
2094     return rStrm;
2095 }
2096 
2097 // -----------------------------------------------------------------------
2098 
2099 SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const
2100 {
2101     return new SvxColorItem( rStrm, Which() );
2102 }
2103 
2104 //------------------------------------------------------------------------
2105 
2106 SfxItemPresentation SvxColorItem::GetPresentation
2107 (
2108     SfxItemPresentation ePres,
2109     SfxMapUnit          /*eCoreUnit*/,
2110     SfxMapUnit          /*ePresUnit*/,
2111     XubString&          rText, const IntlWrapper * /*pIntl*/
2112 )   const
2113 {
2114 #ifndef SVX_LIGHT
2115     switch ( ePres )
2116     {
2117         case SFX_ITEM_PRESENTATION_NONE:
2118             rText.Erase();
2119             return ePres;
2120         case SFX_ITEM_PRESENTATION_NAMELESS:
2121         case SFX_ITEM_PRESENTATION_COMPLETE:
2122             rText = ::GetColorString( mColor );
2123             return ePres;
2124         default: ; //prevent warning
2125     }
2126 #endif
2127     return SFX_ITEM_PRESENTATION_NONE;
2128 }
2129 
2130 // -----------------------------------------------------------------------
2131 
2132 void SvxColorItem::SetValue( const Color& rNewCol )
2133 {
2134     mColor = rNewCol;
2135 }
2136 
2137 // class SvxCharSetColorItem ---------------------------------------------
2138 
2139 SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) :
2140     SvxColorItem( nId ),
2141 
2142     eFrom( RTL_TEXTENCODING_DONTKNOW )
2143 {
2144 }
2145 
2146 // -----------------------------------------------------------------------
2147 
2148 SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol,
2149                                           const rtl_TextEncoding _eFrom,
2150                                           const sal_uInt16 nId ) :
2151     SvxColorItem( rCol, nId ),
2152 
2153     eFrom( _eFrom )
2154 {
2155 }
2156 
2157 
2158 // -----------------------------------------------------------------------
2159 
2160 SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const
2161 {
2162     return new SvxCharSetColorItem( *this );
2163 }
2164 
2165 // -----------------------------------------------------------------------
2166 
2167 SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2168 {
2169     // #90477# rStrm << (sal_uInt8) GetStoreCharSet( GetCharSet(), (sal_uInt16)rStrm.GetVersion() )
2170     //    << GetValue();
2171     rStrm << (sal_uInt8)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16)rStrm.GetVersion())
2172           << GetValue();
2173     return rStrm;
2174 }
2175 
2176 // -----------------------------------------------------------------------
2177 
2178 SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const
2179 {
2180     sal_uInt8 cSet;
2181     Color aColor;
2182     rStrm >> cSet >> aColor;
2183     return new SvxCharSetColorItem( aColor,  (rtl_TextEncoding)cSet, Which() );
2184 }
2185 
2186 //------------------------------------------------------------------------
2187 
2188 SfxItemPresentation SvxCharSetColorItem::GetPresentation
2189 (
2190     SfxItemPresentation /*ePres*/,
2191     SfxMapUnit          /*eCoreUnit*/,
2192     SfxMapUnit          /*ePresUnit*/,
2193     XubString&          rText, const IntlWrapper * /*pIntl*/
2194 )   const
2195 {
2196     rText.Erase();
2197     return SFX_ITEM_PRESENTATION_NONE;
2198 }
2199 
2200 // class SvxKerningItem --------------------------------------------------
2201 
2202 SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) :
2203     SfxInt16Item( nId, nKern )
2204 {
2205 }
2206 
2207 // -----------------------------------------------------------------------
2208 
2209 SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const
2210 {
2211     return new SvxKerningItem( *this );
2212 }
2213 
2214 // -----------------------------------------------------------------------
2215 
2216 SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2217 {
2218     rStrm << (short) GetValue();
2219     return rStrm;
2220 }
2221 
2222 // -----------------------------------------------------------------------
2223 
2224 int SvxKerningItem::ScaleMetrics( long nMult, long nDiv )
2225 {
2226     SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) );
2227     return 1;
2228 }
2229 
2230 // -----------------------------------------------------------------------
2231 
2232 int SvxKerningItem::HasMetrics() const
2233 {
2234     return 1;
2235 }
2236 
2237 // -----------------------------------------------------------------------
2238 
2239 SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const
2240 {
2241     short nValue;
2242     rStrm >> nValue;
2243     return new SvxKerningItem( nValue, Which() );
2244 }
2245 
2246 //------------------------------------------------------------------------
2247 
2248 SfxItemPresentation SvxKerningItem::GetPresentation
2249 (
2250     SfxItemPresentation ePres,
2251     SfxMapUnit          eCoreUnit,
2252     SfxMapUnit          /*ePresUnit*/,
2253     XubString&          rText, const IntlWrapper *pIntl
2254 )   const
2255 {
2256 #ifndef SVX_LIGHT
2257     switch ( ePres )
2258     {
2259         case SFX_ITEM_PRESENTATION_NONE:
2260             rText.Erase();
2261             return ePres;
2262         case SFX_ITEM_PRESENTATION_NAMELESS:
2263             rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
2264             rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
2265             return ePres;
2266         case SFX_ITEM_PRESENTATION_COMPLETE:
2267         {
2268             rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE);
2269             sal_uInt16 nId = 0;
2270 
2271             if ( GetValue() > 0 )
2272                 nId = RID_SVXITEMS_KERNING_EXPANDED;
2273             else if ( GetValue() < 0 )
2274                 nId = RID_SVXITEMS_KERNING_CONDENSED;
2275 
2276             if ( nId )
2277                 rText += EE_RESSTR(nId);
2278             rText += GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl );
2279             rText += EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
2280             return ePres;
2281         }
2282         default: ; //prevent warning
2283     }
2284 #endif
2285     return SFX_ITEM_PRESENTATION_NONE;
2286 }
2287 /* -----------------------------19.02.01 12:21--------------------------------
2288 
2289  ---------------------------------------------------------------------------*/
2290 sal_Bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2291 {
2292     sal_Int16 nVal = GetValue();
2293     if(nMemberId & CONVERT_TWIPS)
2294         nVal = (sal_Int16)TWIP_TO_MM100(nVal);
2295     rVal <<= nVal;
2296     return sal_True;
2297 }
2298 // -----------------------------------------------------------------------
2299 sal_Bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
2300 {
2301     sal_Int16 nVal = sal_Int16();
2302     if(!(rVal >>= nVal))
2303         return sal_False;
2304     if(nMemberId & CONVERT_TWIPS)
2305         nVal = (sal_Int16)MM100_TO_TWIP(nVal);
2306     SetValue(nVal);
2307     return sal_True;
2308 }
2309 
2310 // class SvxCaseMapItem --------------------------------------------------
2311 
2312 SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) :
2313     SfxEnumItem( nId, (sal_uInt16)eMap )
2314 {
2315 }
2316 
2317 // -----------------------------------------------------------------------
2318 
2319 sal_uInt16 SvxCaseMapItem::GetValueCount() const
2320 {
2321     return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1
2322 }
2323 
2324 // -----------------------------------------------------------------------
2325 
2326 SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const
2327 {
2328     return new SvxCaseMapItem( *this );
2329 }
2330 
2331 // -----------------------------------------------------------------------
2332 
2333 SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2334 {
2335     rStrm << (sal_uInt8) GetValue();
2336     return rStrm;
2337 }
2338 
2339 // -----------------------------------------------------------------------
2340 
2341 SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const
2342 {
2343     sal_uInt8 cMap;
2344     rStrm >> cMap;
2345     return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() );
2346 }
2347 
2348 //------------------------------------------------------------------------
2349 
2350 SfxItemPresentation SvxCaseMapItem::GetPresentation
2351 (
2352     SfxItemPresentation ePres,
2353     SfxMapUnit          /*eCoreUnit*/,
2354     SfxMapUnit          /*ePresUnit*/,
2355     XubString&          rText, const IntlWrapper * /*pIntl*/
2356 )   const
2357 {
2358     switch ( ePres )
2359     {
2360         case SFX_ITEM_PRESENTATION_NONE:
2361             rText.Erase();
2362             return ePres;
2363         case SFX_ITEM_PRESENTATION_NAMELESS:
2364         case SFX_ITEM_PRESENTATION_COMPLETE:
2365             rText = GetValueTextByPos( GetValue() );
2366             return ePres;
2367         default: ; //prevent warning
2368     }
2369     return SFX_ITEM_PRESENTATION_NONE;
2370 }
2371 
2372 // -----------------------------------------------------------------------
2373 
2374 XubString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const
2375 {
2376     DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" );
2377     return EE_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN + nPos );
2378 }
2379 
2380 /*-----------------13.03.98 16:29-------------------
2381 
2382 --------------------------------------------------*/
2383 sal_Bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
2384 {
2385     sal_Int16 nRet = style::CaseMap::NONE;
2386     switch( GetValue() )
2387     {
2388 //      case SVX_CASEMAP_NOT_MAPPED  :      nRet = style::CaseMap::NONE     ; break;
2389         case SVX_CASEMAP_VERSALIEN   :      nRet = style::CaseMap::UPPERCASE; break;
2390         case SVX_CASEMAP_GEMEINE     :      nRet = style::CaseMap::LOWERCASE; break;
2391         case SVX_CASEMAP_TITEL       :      nRet = style::CaseMap::TITLE    ; break;
2392         case SVX_CASEMAP_KAPITAELCHEN:      nRet = style::CaseMap::SMALLCAPS; break;
2393     }
2394     rVal <<= (sal_Int16)(nRet);
2395     return sal_True;
2396 }
2397 /*-----------------13.03.98 16:29-------------------
2398 
2399 --------------------------------------------------*/
2400 sal_Bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
2401 {
2402     sal_uInt16 nVal = sal_uInt16();
2403     if(!(rVal >>= nVal))
2404         return sal_False;
2405 
2406     switch( nVal )
2407     {
2408     case style::CaseMap::NONE    :  nVal = SVX_CASEMAP_NOT_MAPPED  ; break;
2409     case style::CaseMap::UPPERCASE:  nVal = SVX_CASEMAP_VERSALIEN   ; break;
2410     case style::CaseMap::LOWERCASE:  nVal = SVX_CASEMAP_GEMEINE     ; break;
2411     case style::CaseMap::TITLE    :  nVal = SVX_CASEMAP_TITEL       ; break;
2412     case style::CaseMap::SMALLCAPS:  nVal = SVX_CASEMAP_KAPITAELCHEN; break;
2413     }
2414     SetValue(nVal);
2415     return sal_True;
2416 }
2417 
2418 // class SvxEscapementItem -----------------------------------------------
2419 
2420 SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) :
2421     SfxEnumItemInterface( nId ),
2422 
2423     nEsc    ( 0 ),
2424     nProp   ( 100 )
2425 {
2426 }
2427 
2428 // -----------------------------------------------------------------------
2429 
2430 SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape,
2431                                       const sal_uInt16 nId ) :
2432     SfxEnumItemInterface( nId ),
2433     nProp( 100 )
2434 {
2435     SetEscapement( eEscape );
2436     if( nEsc )
2437         nProp = 58;
2438 }
2439 
2440 // -----------------------------------------------------------------------
2441 
2442 SvxEscapementItem::SvxEscapementItem( const short _nEsc,
2443                                       const sal_uInt8 _nProp,
2444                                       const sal_uInt16 nId ) :
2445     SfxEnumItemInterface( nId ),
2446     nEsc    ( _nEsc ),
2447     nProp   ( _nProp )
2448 {
2449 }
2450 
2451 // -----------------------------------------------------------------------
2452 
2453 int SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const
2454 {
2455     DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
2456 
2457     return( nEsc  == ((SvxEscapementItem&)rAttr).nEsc &&
2458             nProp == ((SvxEscapementItem&)rAttr).nProp );
2459 }
2460 
2461 // -----------------------------------------------------------------------
2462 
2463 SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const
2464 {
2465     return new SvxEscapementItem( *this );
2466 }
2467 
2468 // -----------------------------------------------------------------------
2469 
2470 SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2471 {
2472     short _nEsc = GetEsc();
2473     if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() )
2474     {
2475         if( DFLT_ESC_AUTO_SUPER == _nEsc )
2476             _nEsc = DFLT_ESC_SUPER;
2477         else if( DFLT_ESC_AUTO_SUB == _nEsc )
2478             _nEsc = DFLT_ESC_SUB;
2479     }
2480     rStrm << (sal_uInt8) GetProp()
2481           << (short) _nEsc;
2482     return rStrm;
2483 }
2484 
2485 // -----------------------------------------------------------------------
2486 
2487 SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const
2488 {
2489     sal_uInt8 _nProp;
2490     short _nEsc;
2491     rStrm >> _nProp >> _nEsc;
2492     return new SvxEscapementItem( _nEsc, _nProp, Which() );
2493 }
2494 
2495 // -----------------------------------------------------------------------
2496 
2497 sal_uInt16 SvxEscapementItem::GetValueCount() const
2498 {
2499     return SVX_ESCAPEMENT_END;  // SVX_ESCAPEMENT_SUBSCRIPT + 1
2500 }
2501 
2502 //------------------------------------------------------------------------
2503 
2504 SfxItemPresentation SvxEscapementItem::GetPresentation
2505 (
2506     SfxItemPresentation ePres,
2507     SfxMapUnit          /*eCoreUnit*/,
2508     SfxMapUnit          /*ePresUnit*/,
2509     XubString&          rText, const IntlWrapper * /*pIntl*/
2510 )   const
2511 {
2512     switch ( ePres )
2513     {
2514         case SFX_ITEM_PRESENTATION_NONE:
2515             rText.Erase();
2516             return ePres;
2517         case SFX_ITEM_PRESENTATION_NAMELESS:
2518         case SFX_ITEM_PRESENTATION_COMPLETE:
2519         {
2520             rText = GetValueTextByPos( GetEnumValue() );
2521 
2522             if ( nEsc != 0 )
2523             {
2524                 if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
2525                     rText += String( EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO) );
2526                 else
2527                     ( rText += String::CreateFromInt32( nEsc )) += sal_Unicode('%');
2528             }
2529             return ePres;
2530         }
2531         default: ; //prevent warning
2532     }
2533     return SFX_ITEM_PRESENTATION_NONE;
2534 }
2535 
2536 // -----------------------------------------------------------------------
2537 
2538 XubString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const
2539 {
2540     DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" );
2541     return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos);
2542 }
2543 
2544 // -----------------------------------------------------------------------
2545 
2546 sal_uInt16 SvxEscapementItem::GetEnumValue() const
2547 {
2548     if ( nEsc < 0 )
2549         return SVX_ESCAPEMENT_SUBSCRIPT;
2550     else if ( nEsc > 0 )
2551         return SVX_ESCAPEMENT_SUPERSCRIPT;
2552     return SVX_ESCAPEMENT_OFF;
2553 }
2554 
2555 // -----------------------------------------------------------------------
2556 
2557 void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal )
2558 {
2559     SetEscapement( (const SvxEscapement)nVal );
2560 }
2561 
2562 /*-----------------13.03.98 17:05-------------------
2563 
2564 --------------------------------------------------*/
2565 sal_Bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2566 {
2567 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2568     nMemberId &= ~CONVERT_TWIPS;
2569     switch(nMemberId)
2570     {
2571         case MID_ESC:
2572             rVal <<= (sal_Int16)(nEsc);
2573         break;
2574         case MID_ESC_HEIGHT:
2575             rVal <<= (sal_Int8)(nProp);
2576         break;
2577         case MID_AUTO_ESC:
2578             rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc);
2579         break;
2580     }
2581     return sal_True;
2582 }
2583 /*-----------------13.03.98 17:05-------------------
2584 
2585 --------------------------------------------------*/
2586 sal_Bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2587 {
2588 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2589     nMemberId &= ~CONVERT_TWIPS;
2590     switch(nMemberId)
2591     {
2592         case MID_ESC:
2593         {
2594             sal_Int16 nVal = sal_Int16();
2595             if( (rVal >>= nVal) && (Abs(nVal) <= 101))
2596                 nEsc = nVal;
2597             else
2598                 return sal_False;
2599         }
2600         break;
2601         case MID_ESC_HEIGHT:
2602         {
2603             sal_Int8 nVal = sal_Int8();
2604             if( (rVal >>= nVal) && (nVal <= 100))
2605                 nProp = nVal;
2606             else
2607                 return sal_False;
2608         }
2609         break;
2610         case MID_AUTO_ESC:
2611         {
2612             sal_Bool bVal = Any2Bool(rVal);
2613             if(bVal)
2614             {
2615                 if(nEsc < 0)
2616                     nEsc = DFLT_ESC_AUTO_SUB;
2617                 else
2618                     nEsc = DFLT_ESC_AUTO_SUPER;
2619             }
2620             else
2621                 if(DFLT_ESC_AUTO_SUPER == nEsc )
2622                     --nEsc;
2623                 else if(DFLT_ESC_AUTO_SUB == nEsc)
2624                     ++nEsc;
2625         }
2626         break;
2627     }
2628     return sal_True;
2629 }
2630 
2631 // class SvxLanguageItem -------------------------------------------------
2632 
2633 SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId )
2634     : SfxEnumItem( nId , eLang )
2635 {
2636 }
2637 
2638 // -----------------------------------------------------------------------
2639 
2640 sal_uInt16 SvxLanguageItem::GetValueCount() const
2641 {
2642     // #i50205# got rid of class International
2643     DBG_ERRORFILE("SvxLanguageItem::GetValueCount: supposed to return a count of what?");
2644     // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway.
2645     // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)?
2646     // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)?
2647     return 0;
2648 }
2649 
2650 // -----------------------------------------------------------------------
2651 
2652 SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const
2653 {
2654     return new SvxLanguageItem( *this );
2655 }
2656 
2657 // -----------------------------------------------------------------------
2658 
2659 SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2660 {
2661     rStrm << (sal_uInt16) GetValue();
2662     return rStrm;
2663 }
2664 
2665 // -----------------------------------------------------------------------
2666 
2667 SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const
2668 {
2669     sal_uInt16 nValue;
2670     rStrm >> nValue;
2671     return new SvxLanguageItem( (LanguageType)nValue, Which() );
2672 }
2673 
2674 //------------------------------------------------------------------------
2675 
2676 SfxItemPresentation SvxLanguageItem::GetPresentation
2677 (
2678     SfxItemPresentation ePres,
2679     SfxMapUnit          /*eCoreUnit*/,
2680     SfxMapUnit          /*ePresUnit*/,
2681     XubString&          rText, const IntlWrapper * /*pIntl*/
2682 )   const
2683 {
2684 #ifndef SVX_LIGHT
2685     switch ( ePres )
2686     {
2687         case SFX_ITEM_PRESENTATION_NONE:
2688             rText.Erase();
2689             return ePres;
2690         case SFX_ITEM_PRESENTATION_NAMELESS:
2691         case SFX_ITEM_PRESENTATION_COMPLETE:
2692         {
2693             SvtLanguageTable aLangTable;
2694             rText = aLangTable.GetString( (LanguageType)GetValue() );
2695             return ePres;
2696         }
2697         default: ; //prevent warning
2698     }
2699 #endif // !SVX_LIGHT
2700     return SFX_ITEM_PRESENTATION_NONE;
2701 }
2702 
2703 /*-----------------14.03.98 14:13-------------------
2704 
2705 --------------------------------------------------*/
2706 sal_Bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2707 {
2708 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2709     nMemberId &= ~CONVERT_TWIPS;
2710     switch(nMemberId)
2711     {
2712         case MID_LANG_INT:  // for basic conversions!
2713             rVal <<= (sal_Int16)(GetValue());
2714         break;
2715         case MID_LANG_LOCALE:
2716             lang::Locale aRet( MsLangId::convertLanguageToLocale( GetValue(), false));
2717             rVal <<= aRet;
2718         break;
2719     }
2720     return sal_True;
2721 }
2722 /*-----------------14.03.98 14:13-------------------
2723 
2724 --------------------------------------------------*/
2725 sal_Bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2726 {
2727 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2728     nMemberId &= ~CONVERT_TWIPS;
2729     switch(nMemberId)
2730     {
2731         case MID_LANG_INT:  // for basic conversions!
2732         {
2733             sal_Int32 nValue = 0;
2734             if(!(rVal >>= nValue))
2735                 return sal_False;
2736 
2737             SetValue((sal_Int16)nValue);
2738         }
2739         break;
2740         case MID_LANG_LOCALE:
2741         {
2742             lang::Locale aLocale;
2743             if(!(rVal >>= aLocale))
2744                 return sal_False;
2745 
2746             if (aLocale.Language.getLength() || aLocale.Country.getLength())
2747                 SetValue(MsLangId::convertLocaleToLanguage( aLocale ));
2748             else
2749                 SetValue(LANGUAGE_NONE);
2750         }
2751         break;
2752     }
2753     return sal_True;
2754 }
2755 
2756 // class SvxNoLinebreakItem ----------------------------------------------
2757 SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak, const sal_uInt16 nId ) :
2758       SfxBoolItem( nId, bBreak )
2759 {
2760 }
2761 
2762 // -----------------------------------------------------------------------
2763 
2764 SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const
2765 {
2766     return new SvxNoLinebreakItem( *this );
2767 }
2768 
2769 // -----------------------------------------------------------------------
2770 
2771 SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2772 {
2773     rStrm << (sal_Bool)GetValue();
2774     return rStrm;
2775 }
2776 
2777 // -----------------------------------------------------------------------
2778 
2779 SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const
2780 {
2781     sal_Bool bValue;
2782     rStrm >> bValue;
2783     return new SvxNoLinebreakItem( bValue, Which() );
2784 }
2785 
2786 //------------------------------------------------------------------------
2787 
2788 SfxItemPresentation SvxNoLinebreakItem::GetPresentation
2789 (
2790     SfxItemPresentation /*ePres*/,
2791     SfxMapUnit          /*eCoreUnit*/,
2792     SfxMapUnit          /*ePresUnit*/,
2793     XubString&          rText, const IntlWrapper * /*pIntl*/
2794 )   const
2795 {
2796     rText.Erase();
2797     return SFX_ITEM_PRESENTATION_NONE;
2798 }
2799 
2800 // class SvxNoHyphenItem -------------------------------------------------
2801 
2802 SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen, const sal_uInt16 nId ) :
2803     SfxBoolItem( nId , bHyphen )
2804 {
2805 }
2806 
2807 // -----------------------------------------------------------------------
2808 
2809 SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const
2810 {
2811     return new SvxNoHyphenItem( *this );
2812 }
2813 
2814 // -----------------------------------------------------------------------
2815 
2816 SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2817 {
2818     rStrm << (sal_Bool) GetValue();
2819     return rStrm;
2820 }
2821 
2822 // -----------------------------------------------------------------------
2823 
2824 SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const
2825 {
2826     sal_Bool bValue;
2827     rStrm >> bValue;
2828     return new SvxNoHyphenItem( bValue, Which() );
2829 }
2830 
2831 //------------------------------------------------------------------------
2832 
2833 SfxItemPresentation SvxNoHyphenItem::GetPresentation
2834 (
2835     SfxItemPresentation /*ePres*/,
2836     SfxMapUnit          /*eCoreUnit*/,
2837     SfxMapUnit          /*ePresUnit*/,
2838     XubString&          rText, const IntlWrapper * /*pIntl*/
2839 )   const
2840 {
2841     rText.Erase();
2842     return SFX_ITEM_PRESENTATION_NONE;
2843 }
2844 
2845 /*
2846  * Dummy-Item fuer ToolBox-Controls:
2847  *
2848  */
2849 
2850 // -----------------------------------------------------------------------
2851 // class SvxLineColorItem (== SvxColorItem)
2852 // -----------------------------------------------------------------------
2853 
2854 SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) :
2855     SvxColorItem( nId )
2856 {
2857 }
2858 
2859 // -----------------------------------------------------------------------
2860 
2861 SvxLineColorItem::SvxLineColorItem( const Color& rCol, const sal_uInt16 nId ) :
2862     SvxColorItem( rCol, nId )
2863 {
2864 }
2865 
2866 // -----------------------------------------------------------------------
2867 
2868 SvxLineColorItem::SvxLineColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
2869     SvxColorItem( rStrm, nId )
2870 {
2871 }
2872 
2873 // -----------------------------------------------------------------------
2874 
2875 SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) :
2876     SvxColorItem( rCopy )
2877 {
2878 }
2879 
2880 // -----------------------------------------------------------------------
2881 
2882 SvxLineColorItem::~SvxLineColorItem()
2883 {
2884 }
2885 
2886 //------------------------------------------------------------------------
2887 
2888 SfxItemPresentation SvxLineColorItem::GetPresentation
2889 (
2890     SfxItemPresentation ePres,
2891     SfxMapUnit          eCoreUnit,
2892     SfxMapUnit          ePresUnit,
2893     XubString&          rText,
2894     const IntlWrapper * pIntlWrapper
2895 )   const
2896 {
2897     return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit,
2898                                           rText, pIntlWrapper );
2899 }
2900 
2901 // class SvxBlinkItem -------------------------------------------------
2902 
2903 
2904 SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink, const sal_uInt16 nId ) :
2905     SfxBoolItem( nId, bBlink )
2906 {
2907 }
2908 
2909 // -----------------------------------------------------------------------
2910 
2911 SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const
2912 {
2913     return new SvxBlinkItem( *this );
2914 }
2915 
2916 // -----------------------------------------------------------------------
2917 
2918 SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2919 {
2920     rStrm << (sal_uInt8) GetValue();
2921     return rStrm;
2922 }
2923 
2924 // -----------------------------------------------------------------------
2925 
2926 SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const
2927 {
2928     sal_uInt8 nState;
2929     rStrm >> nState;
2930     return new SvxBlinkItem( nState, Which() );
2931 }
2932 
2933 // -----------------------------------------------------------------------
2934 
2935 SfxItemPresentation SvxBlinkItem::GetPresentation
2936 (
2937     SfxItemPresentation ePres,
2938     SfxMapUnit          /*eCoreUnit*/,
2939     SfxMapUnit          /*ePresUnit*/,
2940     XubString&          rText, const IntlWrapper * /*pIntl*/
2941 )   const
2942 {
2943     switch ( ePres )
2944     {
2945         case SFX_ITEM_PRESENTATION_NONE:
2946             rText.Erase();
2947             return ePres;
2948         case SFX_ITEM_PRESENTATION_NAMELESS:
2949         case SFX_ITEM_PRESENTATION_COMPLETE:
2950         {
2951             sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE;
2952 
2953             if ( GetValue() )
2954                 nId = RID_SVXITEMS_BLINK_TRUE;
2955             rText = EE_RESSTR(nId);
2956             return ePres;
2957         }
2958         default: ; //prevent warning
2959     }
2960     return SFX_ITEM_PRESENTATION_NONE;
2961 }
2962 
2963 // class SvxEmphaisMarkItem ---------------------------------------------------
2964 
2965 SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue,
2966                                         const sal_uInt16 nId )
2967     : SfxUInt16Item( nId, nValue )
2968 {
2969 }
2970 
2971 // -----------------------------------------------------------------------
2972 
2973 SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const
2974 {
2975     return new SvxEmphasisMarkItem( *this );
2976 }
2977 
2978 // -----------------------------------------------------------------------
2979 
2980 SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm,
2981                                      sal_uInt16 /*nItemVersion*/ ) const
2982 {
2983     rStrm << (sal_uInt16)GetValue();
2984     return rStrm;
2985 }
2986 
2987 // -----------------------------------------------------------------------
2988 
2989 SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const
2990 {
2991     sal_uInt16 nValue;
2992     rStrm >> nValue;
2993     return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() );
2994 }
2995 
2996 //------------------------------------------------------------------------
2997 
2998 SfxItemPresentation SvxEmphasisMarkItem::GetPresentation
2999 (
3000     SfxItemPresentation ePres,
3001     SfxMapUnit          /*eCoreUnit*/,
3002     SfxMapUnit          /*ePresUnit*/,
3003     XubString&          rText,
3004     const IntlWrapper * /*pIntl*/
3005 )   const
3006 {
3007     switch ( ePres )
3008     {
3009         case SFX_ITEM_PRESENTATION_NONE:
3010             rText.Erase();
3011             return ePres;
3012         case SFX_ITEM_PRESENTATION_NAMELESS:
3013         case SFX_ITEM_PRESENTATION_COMPLETE:
3014             {
3015                 sal_uInt16 nVal = GetValue();
3016                 rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE +
3017                                         ( EMPHASISMARK_STYLE & nVal ));
3018                 sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal )
3019                                 ? RID_SVXITEMS_EMPHASIS_ABOVE_POS
3020                                 : ( EMPHASISMARK_POS_BELOW & nVal )
3021                                     ? RID_SVXITEMS_EMPHASIS_BELOW_POS
3022                                     : 0;
3023                 if( nId )
3024                     rText += EE_RESSTR( nId );
3025                 return ePres;
3026             }
3027         default: ; //prevent warning
3028     }
3029     return SFX_ITEM_PRESENTATION_NONE;
3030 }
3031 
3032 // -----------------------------------------------------------------------
3033 
3034 sal_Bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
3035 {
3036 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3037     nMemberId &= ~CONVERT_TWIPS;
3038     switch( nMemberId )
3039     {
3040     case MID_EMPHASIS:
3041     {
3042         sal_Int16 nValue = GetValue();
3043         sal_Int16 nRet = 0;
3044         switch(nValue & EMPHASISMARK_STYLE)
3045         {
3046             case EMPHASISMARK_NONE   : nRet = FontEmphasis::NONE;           break;
3047             case EMPHASISMARK_DOT    : nRet = FontEmphasis::DOT_ABOVE;      break;
3048             case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE;   break;
3049             case EMPHASISMARK_DISC   : nRet = FontEmphasis::DISK_ABOVE;     break;
3050             case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE;   break;
3051         }
3052         if(nRet && nValue & EMPHASISMARK_POS_BELOW)
3053             nRet += 10;
3054         rVal <<= nRet;
3055     }
3056     break;
3057     }
3058     return sal_True;
3059 }
3060 
3061 sal_Bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
3062 {
3063 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3064     nMemberId &= ~CONVERT_TWIPS;
3065     sal_Bool bRet = sal_True;
3066     switch( nMemberId )
3067     {
3068     case MID_EMPHASIS:
3069     {
3070         sal_Int32 nValue = -1;
3071         rVal >>= nValue;
3072         switch(nValue)
3073         {
3074             case FontEmphasis::NONE        : nValue = EMPHASISMARK_NONE;   break;
3075             case FontEmphasis::DOT_ABOVE   : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE;    break;
3076             case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break;
3077             case FontEmphasis::DISK_ABOVE  : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE;   break;
3078             case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break;
3079             case FontEmphasis::DOT_BELOW   : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW;    break;
3080             case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break;
3081             case FontEmphasis::DISK_BELOW  : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW;   break;
3082             case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break;
3083             default: return sal_False;
3084         }
3085         SetValue( (sal_Int16)nValue );
3086     }
3087     break;
3088     }
3089     return bRet;
3090 }
3091 
3092 sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const
3093 {
3094     DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
3095             SOFFICE_FILEFORMAT_40==nFFVer ||
3096             SOFFICE_FILEFORMAT_50==nFFVer,
3097             "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" );
3098 
3099     return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3100 }
3101 
3102 
3103 /*************************************************************************
3104 |*    class SvxTwoLinesItem
3105 *************************************************************************/
3106 
3107 SvxTwoLinesItem::SvxTwoLinesItem( sal_Bool bFlag, sal_Unicode nStartBracket,
3108                                     sal_Unicode nEndBracket, sal_uInt16 nW )
3109     : SfxPoolItem( nW ),
3110     cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag )
3111 {
3112 }
3113 
3114 SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr )
3115     : SfxPoolItem( rAttr.Which() ),
3116     cStartBracket( rAttr.cStartBracket ),
3117     cEndBracket( rAttr.cEndBracket ),
3118     bOn( rAttr.bOn )
3119 {
3120 }
3121 
3122 SvxTwoLinesItem::~SvxTwoLinesItem()
3123 {
3124 }
3125 
3126 int SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const
3127 {
3128     DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" );
3129     return bOn == ((SvxTwoLinesItem&)rAttr).bOn &&
3130            cStartBracket == ((SvxTwoLinesItem&)rAttr).cStartBracket &&
3131            cEndBracket == ((SvxTwoLinesItem&)rAttr).cEndBracket;
3132 }
3133 
3134 SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const
3135 {
3136     return new SvxTwoLinesItem( *this );
3137 }
3138 
3139 sal_Bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal,
3140                                 sal_uInt8 nMemberId ) const
3141 {
3142 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3143     nMemberId &= ~CONVERT_TWIPS;
3144     sal_Bool bRet = sal_True;
3145     switch( nMemberId )
3146     {
3147     case MID_TWOLINES:
3148         rVal = Bool2Any( bOn );
3149         break;
3150     case MID_START_BRACKET:
3151         {
3152             OUString s;
3153             if( cStartBracket )
3154                 s = OUString( cStartBracket );
3155             rVal <<= s;
3156         }
3157         break;
3158     case MID_END_BRACKET:
3159         {
3160             OUString s;
3161             if( cEndBracket )
3162                 s = OUString( cEndBracket );
3163             rVal <<= s;
3164         }
3165         break;
3166     default:
3167         bRet = sal_False;
3168         break;
3169     }
3170     return bRet;
3171 }
3172 
3173 sal_Bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal,
3174                                     sal_uInt8 nMemberId )
3175 {
3176 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3177     nMemberId &= ~CONVERT_TWIPS;
3178     sal_Bool bRet = sal_False;
3179     OUString s;
3180     switch( nMemberId )
3181     {
3182     case MID_TWOLINES:
3183         bOn = Any2Bool( rVal );
3184         bRet = sal_True;
3185         break;
3186     case MID_START_BRACKET:
3187         if( rVal >>= s )
3188         {
3189             cStartBracket = s.getLength() ? s[ 0 ] : 0;
3190             bRet = sal_True;
3191         }
3192         break;
3193     case MID_END_BRACKET:
3194         if( rVal >>= s )
3195         {
3196             cEndBracket = s.getLength() ? s[ 0 ] : 0;
3197             bRet = sal_True;
3198         }
3199         break;
3200     }
3201     return bRet;
3202 }
3203 
3204 SfxItemPresentation SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres,
3205                             SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
3206                             String &rText, const IntlWrapper* /*pIntl*/ ) const
3207 {
3208     switch( ePres )
3209     {
3210     case SFX_ITEM_PRESENTATION_NONE:
3211         rText.Erase();
3212         break;
3213     case SFX_ITEM_PRESENTATION_NAMELESS:
3214     case SFX_ITEM_PRESENTATION_COMPLETE:
3215         {
3216             if( !GetValue() )
3217                 rText = EE_RESSTR( RID_SVXITEMS_TWOLINES_OFF );
3218             else
3219             {
3220                 rText = EE_RESSTR( RID_SVXITEMS_TWOLINES );
3221                 if( GetStartBracket() )
3222                     rText.Insert( GetStartBracket(), 0 );
3223                 if( GetEndBracket() )
3224                     rText += GetEndBracket();
3225             }
3226             return ePres;
3227         }
3228         default: ; //prevent warning
3229     }
3230     return SFX_ITEM_PRESENTATION_NONE;
3231 }
3232 
3233 
3234 SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const
3235 {
3236     sal_Bool _bOn;
3237     sal_Unicode cStart, cEnd;
3238     rStrm >> _bOn >> cStart >> cEnd;
3239     return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() );
3240 }
3241 
3242 SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
3243 {
3244     rStrm << GetValue() << GetStartBracket() << GetEndBracket();
3245     return rStrm;
3246 }
3247 
3248 sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const
3249 {
3250     DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
3251             SOFFICE_FILEFORMAT_40==nFFVer ||
3252             SOFFICE_FILEFORMAT_50==nFFVer,
3253             "SvxTwoLinesItem: Gibt es ein neues Fileformat?" );
3254 
3255     return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3256 }
3257 
3258 
3259 /*************************************************************************
3260 |*    class SvxCharRotateItem
3261 *************************************************************************/
3262 
3263 SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue,
3264                                     sal_Bool bFitIntoLine,
3265                                     const sal_uInt16 nW )
3266     : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine )
3267 {
3268 }
3269 
3270 SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const
3271 {
3272     return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() );
3273 }
3274 
3275 SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const
3276 {
3277     sal_uInt16 nVal;
3278     sal_Bool b;
3279     rStrm >> nVal >> b;
3280     return new SvxCharRotateItem( nVal, b, Which() );
3281 }
3282 
3283 SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const
3284 {
3285     sal_Bool bFlag = IsFitToLine();
3286     rStrm << GetValue() << bFlag;
3287     return rStrm;
3288 }
3289 
3290 sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const
3291 {
3292     return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3293 }
3294 
3295 SfxItemPresentation SvxCharRotateItem::GetPresentation(
3296         SfxItemPresentation ePres,
3297         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
3298         String &rText, const IntlWrapper*  ) const
3299 {
3300     switch( ePres )
3301     {
3302     case SFX_ITEM_PRESENTATION_NONE:
3303         rText.Erase();
3304         break;
3305     case SFX_ITEM_PRESENTATION_NAMELESS:
3306     case SFX_ITEM_PRESENTATION_COMPLETE:
3307         {
3308             if( !GetValue() )
3309                 rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE_OFF );
3310             else
3311             {
3312                 rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE );
3313                 rText.SearchAndReplaceAscii( "$(ARG1)",
3314                             String::CreateFromInt32( GetValue() / 10 ));
3315                 if( IsFitToLine() )
3316                     rText += EE_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE );
3317             }
3318             return ePres;
3319         }
3320         default: ; //prevent warning
3321     }
3322     return SFX_ITEM_PRESENTATION_NONE;
3323 }
3324 
3325 sal_Bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal,
3326                                 sal_uInt8 nMemberId ) const
3327 {
3328 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3329     nMemberId &= ~CONVERT_TWIPS;
3330     sal_Bool bRet = sal_True;
3331     switch( nMemberId )
3332     {
3333     case MID_ROTATE:
3334         rVal <<= (sal_Int16)GetValue();
3335         break;
3336     case MID_FITTOLINE:
3337         rVal = Bool2Any( IsFitToLine() );
3338         break;
3339     default:
3340         bRet = sal_False;
3341         break;
3342     }
3343     return bRet;
3344 }
3345 
3346 sal_Bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal,
3347                                     sal_uInt8 nMemberId )
3348 {
3349 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3350     nMemberId &= ~CONVERT_TWIPS;
3351     sal_Bool bRet = sal_True;
3352     switch( nMemberId )
3353     {
3354     case MID_ROTATE:
3355         {
3356             sal_Int16 nVal = 0;
3357             if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal))
3358                 SetValue( (sal_uInt16)nVal );
3359             else
3360                 bRet = sal_False;
3361             break;
3362         }
3363 
3364     case MID_FITTOLINE:
3365         SetFitToLine( Any2Bool( rVal ) );
3366         break;
3367     default:
3368         bRet = sal_False;
3369     }
3370     return bRet;
3371 }
3372 
3373 int SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const
3374 {
3375     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
3376     return SfxUInt16Item::operator==( rItem ) &&
3377            IsFitToLine() == ((const SvxCharRotateItem&)rItem).IsFitToLine();
3378 }
3379 
3380 
3381 /*************************************************************************
3382 |*    class SvxCharScaleItem
3383 *************************************************************************/
3384 
3385 SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue,
3386                                             const sal_uInt16 nW )
3387     : SfxUInt16Item( nW, nValue )
3388 {
3389 }
3390 
3391 SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const
3392 {
3393     return new SvxCharScaleWidthItem( GetValue(), Which() );
3394 }
3395 
3396 SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const
3397 {
3398     sal_uInt16 nVal;
3399     rStrm >> nVal;
3400     SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() );
3401 
3402     if ( Which() == EE_CHAR_FONTWIDTH )
3403     {
3404         // #87271#: Was a SvxFontWidthItem in 5.2
3405         // sal_uInt16 nFixWidth, sal_uInt16 nPropWidth.
3406         // nFixWidth has never been used...
3407         rStrm >> nVal;
3408         sal_uInt16 nTest;
3409         rStrm >> nTest;
3410         if ( nTest == 0x1234 )
3411             pItem->SetValue( nVal );
3412         else
3413             rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) );
3414     }
3415 
3416     return pItem;
3417 }
3418 
3419 SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const
3420 {
3421     SvStream& rRet = SfxUInt16Item::Store( rStream, nVer );
3422     if ( Which() == EE_CHAR_FONTWIDTH )
3423     {
3424         // see comment in Create()....
3425         rRet.SeekRel( -1*(long)sizeof(sal_uInt16) );
3426         rRet << (sal_uInt16)0;
3427         rRet << GetValue();
3428         // Really ugly, but not a problem for reading the doc in 5.2
3429         rRet << (sal_uInt16)0x1234;
3430     }
3431     return rRet;
3432 }
3433 
3434 
3435 sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const
3436 {
3437     return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3438 }
3439 
3440 SfxItemPresentation SvxCharScaleWidthItem::GetPresentation(
3441         SfxItemPresentation ePres,
3442         SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
3443         String &rText, const IntlWrapper*  ) const
3444 {
3445     switch( ePres )
3446     {
3447     case SFX_ITEM_PRESENTATION_NONE:
3448         rText.Erase();
3449         break;
3450     case SFX_ITEM_PRESENTATION_NAMELESS:
3451     case SFX_ITEM_PRESENTATION_COMPLETE:
3452         {
3453             if( !GetValue() )
3454                 rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE_OFF );
3455             else
3456             {
3457                 rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE );
3458                 rText.SearchAndReplaceAscii( "$(ARG1)",
3459                             String::CreateFromInt32( GetValue() ));
3460             }
3461             return ePres;
3462         }
3463         default: ; //prevent warning
3464     }
3465     return SFX_ITEM_PRESENTATION_NONE;
3466 }
3467 
3468 sal_Bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
3469 {
3470     // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
3471     // where we still want this to be a sal_Int16
3472     sal_Int16 nValue = sal_Int16();
3473     if (rVal >>= nValue)
3474     {
3475         SetValue( (sal_uInt16) nValue );
3476         return sal_True;
3477     }
3478 
3479     DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" );
3480     return sal_False;
3481 }
3482 
3483 sal_Bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
3484 {
3485     // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
3486     // where we still want this to be a sal_Int16
3487     rVal <<= (sal_Int16)GetValue();
3488     return sal_True;
3489 }
3490 
3491 /*************************************************************************
3492 |*    class SvxCharReliefItem
3493 *************************************************************************/
3494 
3495 SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue,
3496                                       const sal_uInt16 nId )
3497     : SfxEnumItem( nId, (sal_uInt16)eValue )
3498 {
3499 }
3500 
3501 SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const
3502 {
3503     return new SvxCharReliefItem( *this );
3504 }
3505 
3506 SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const
3507 {
3508     sal_uInt16 nVal;
3509     rStrm >> nVal;
3510     return new SvxCharReliefItem( (FontRelief)nVal, Which() );
3511 }
3512 
3513 SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
3514 {
3515     sal_uInt16 nVal = GetValue();
3516     rStrm << nVal;
3517     return rStrm;
3518 }
3519 
3520 sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const
3521 {
3522     return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3523 }
3524 
3525 String SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const
3526 {
3527     DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE,
3528                     "enum overflow" );
3529     return String( EditResId( RID_SVXITEMS_RELIEF_BEGIN + nPos ));
3530 }
3531 
3532 sal_uInt16 SvxCharReliefItem::GetValueCount() const
3533 {
3534     return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE;
3535 }
3536 
3537 SfxItemPresentation SvxCharReliefItem::GetPresentation
3538 (
3539     SfxItemPresentation ePres,
3540     SfxMapUnit          /*eCoreUnit*/,
3541     SfxMapUnit          /*ePresUnit*/,
3542     XubString&          rText, const IntlWrapper * /*pIntl*/
3543 )   const
3544 {
3545     SfxItemPresentation eRet = ePres;
3546     switch( ePres )
3547     {
3548     case SFX_ITEM_PRESENTATION_NONE:
3549         rText.Erase();
3550         break;
3551 
3552     case SFX_ITEM_PRESENTATION_NAMELESS:
3553     case SFX_ITEM_PRESENTATION_COMPLETE:
3554         rText = GetValueTextByPos( GetValue() );
3555         break;
3556 
3557     default:
3558         eRet = SFX_ITEM_PRESENTATION_NONE;
3559     }
3560     return eRet;
3561 }
3562 
3563 sal_Bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal,
3564                                         sal_uInt8 nMemberId )
3565 {
3566 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3567     nMemberId &= ~CONVERT_TWIPS;
3568     sal_Bool bRet = sal_True;
3569     switch( nMemberId )
3570     {
3571     case MID_RELIEF:
3572         {
3573             sal_Int16 nVal = -1;
3574             rVal >>= nVal;
3575             if(nVal >= 0 && nVal <= RELIEF_ENGRAVED)
3576                 SetValue( (sal_uInt16)nVal );
3577             else
3578                 bRet = sal_False;
3579         }
3580         break;
3581     default:
3582         bRet = sal_False;
3583         break;
3584     }
3585     return bRet;
3586 }
3587 
3588 sal_Bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal,
3589                                         sal_uInt8 nMemberId ) const
3590 {
3591 //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3592     nMemberId &= ~CONVERT_TWIPS;
3593     sal_Bool bRet = sal_True;
3594     switch( nMemberId )
3595     {
3596     case MID_RELIEF:
3597         rVal <<= (sal_Int16)GetValue();
3598         break;
3599     default:
3600         bRet = sal_False;
3601         break;
3602     }
3603     return bRet;
3604 }
3605 
3606 /*************************************************************************
3607 |*    class SvxScriptTypeItemItem
3608 *************************************************************************/
3609 
3610 SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType )
3611     : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType )
3612 {
3613 }
3614 SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const
3615 {
3616     return new SvxScriptTypeItem( GetValue() );
3617 }
3618 
3619 /*************************************************************************
3620 |*    class SvxScriptSetItem
3621 *************************************************************************/
3622 
3623 SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool )
3624     : SfxSetItem( nSlotId, new SfxItemSet( rPool,
3625                         SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT ))
3626 {
3627     sal_uInt16 nLatin, nAsian, nComplex;
3628     GetWhichIds( nLatin, nAsian, nComplex );
3629 
3630     sal_uInt16 aIds[ 9 ] = { 0 };
3631     aIds[ 0 ] = aIds[ 1 ] = nLatin;
3632     aIds[ 2 ] = aIds[ 3 ] = nAsian;
3633     aIds[ 4 ] = aIds[ 5 ] = nComplex;
3634     aIds[ 6 ] = aIds[ 7 ] = SID_ATTR_CHAR_SCRIPTTYPE;
3635     aIds[ 8 ] = 0;
3636 
3637     GetItemSet().SetRanges( aIds );
3638 }
3639 
3640 SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const
3641 {
3642     SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() );
3643     p->GetItemSet().Put( GetItemSet(), sal_False );
3644     return p;
3645 }
3646 
3647 SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const
3648 {
3649     return 0;
3650 }
3651 
3652 const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet(
3653                             const SfxItemSet& rSet, sal_uInt16 nId )
3654 {
3655     const SfxPoolItem* pI;
3656     SfxItemState eSt = rSet.GetItemState( nId, sal_False, &pI );
3657     if( SFX_ITEM_SET != eSt )
3658         pI = SFX_ITEM_DEFAULT == eSt ? &rSet.Get( nId ) : 0;
3659     return pI;
3660 }
3661 
3662 const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript )
3663 {
3664     sal_uInt16 nLatin, nAsian, nComplex;
3665     GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex );
3666 
3667     const SfxPoolItem *pRet, *pAsn, *pCmplx;
3668     switch( nScript )
3669     {
3670     default:                //no one valid -> match to latin
3671     //  case SCRIPTTYPE_LATIN:
3672         pRet = GetItemOfScriptSet( rSet, nLatin );
3673         break;
3674     case SCRIPTTYPE_ASIAN:
3675         pRet = GetItemOfScriptSet( rSet, nAsian );
3676         break;
3677     case SCRIPTTYPE_COMPLEX:
3678         pRet = GetItemOfScriptSet( rSet, nComplex );
3679         break;
3680 
3681     case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN:
3682         if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3683             0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
3684             *pRet != *pAsn )
3685             pRet = 0;
3686         break;
3687 
3688     case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX:
3689         if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3690             0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3691             *pRet != *pCmplx )
3692             pRet = 0;
3693         break;
3694 
3695     case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
3696         if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) ||
3697             0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3698             *pRet != *pCmplx )
3699             pRet = 0;
3700         break;
3701 
3702     case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
3703         if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3704             0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
3705             0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3706             *pRet != *pAsn || *pRet != *pCmplx )
3707             pRet = 0;
3708         break;
3709     }
3710     return pRet;
3711 }
3712 
3713 const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const
3714 {
3715     return GetItemOfScript( Which(), GetItemSet(), nScript );
3716 }
3717 
3718 void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType,
3719                                              const SfxPoolItem& rItem )
3720 {
3721     sal_uInt16 nLatin, nAsian, nComplex;
3722     GetWhichIds( nLatin, nAsian, nComplex );
3723 
3724     SfxPoolItem* pCpy = rItem.Clone();
3725     if( SCRIPTTYPE_LATIN & nScriptType )
3726     {
3727         pCpy->SetWhich( nLatin );
3728         GetItemSet().Put( *pCpy );
3729     }
3730     if( SCRIPTTYPE_ASIAN & nScriptType )
3731     {
3732         pCpy->SetWhich( nAsian );
3733         GetItemSet().Put( *pCpy );
3734     }
3735     if( SCRIPTTYPE_COMPLEX & nScriptType )
3736     {
3737         pCpy->SetWhich( nComplex );
3738         GetItemSet().Put( *pCpy );
3739     }
3740     delete pCpy;
3741 }
3742 
3743 void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex )
3744 {
3745     const SfxItemPool& rPool = *rSet.GetPool();
3746     GetSlotIds( nSlotId, rLatin, rAsian, rComplex );
3747     rLatin = rPool.GetWhich( rLatin );
3748     rAsian = rPool.GetWhich( rAsian );
3749     rComplex = rPool.GetWhich( rComplex );
3750 }
3751 
3752 void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
3753                                     sal_uInt16& rComplex ) const
3754 {
3755     GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex );
3756 }
3757 
3758 void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin,
3759                                     sal_uInt16& rAsian, sal_uInt16& rComplex )
3760 {
3761     switch( nSlotId )
3762     {
3763     default:
3764         DBG_ASSERT( sal_False, "wrong SlotId for class SvxScriptSetItem" );
3765         // no break - default to font - Id Range !!
3766 
3767     case SID_ATTR_CHAR_FONT:
3768         rLatin = SID_ATTR_CHAR_FONT;
3769         rAsian = SID_ATTR_CHAR_CJK_FONT;
3770         rComplex = SID_ATTR_CHAR_CTL_FONT;
3771         break;
3772     case SID_ATTR_CHAR_FONTHEIGHT:
3773         rLatin = SID_ATTR_CHAR_FONTHEIGHT;
3774         rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT;
3775         rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT;
3776         break;
3777     case SID_ATTR_CHAR_WEIGHT:
3778         rLatin = SID_ATTR_CHAR_WEIGHT;
3779         rAsian = SID_ATTR_CHAR_CJK_WEIGHT;
3780         rComplex = SID_ATTR_CHAR_CTL_WEIGHT;
3781         break;
3782     case SID_ATTR_CHAR_POSTURE:
3783         rLatin = SID_ATTR_CHAR_POSTURE;
3784         rAsian = SID_ATTR_CHAR_CJK_POSTURE;
3785         rComplex = SID_ATTR_CHAR_CTL_POSTURE;
3786         break;
3787     case SID_ATTR_CHAR_LANGUAGE:
3788         rLatin = SID_ATTR_CHAR_LANGUAGE;
3789         rAsian = SID_ATTR_CHAR_CJK_LANGUAGE;
3790         rComplex = SID_ATTR_CHAR_CTL_LANGUAGE;
3791         break;
3792     }
3793 }
3794 
3795 void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex )
3796 {
3797     const sal_uInt16 nItemCnt = 3;
3798 
3799     static struct
3800     {
3801         sal_uInt16 nFontType;
3802         sal_uInt16 nLanguage;
3803     }
3804     aOutTypeArr[ nItemCnt ] =
3805     {
3806         {  DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US },
3807         {  DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US },
3808         {  DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA }
3809     };
3810 
3811     SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex };
3812 
3813     for ( sal_uInt16 n = 0; n < nItemCnt; ++n )
3814     {
3815         Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType,
3816                                                   aOutTypeArr[ n ].nLanguage,
3817                                                   DEFAULTFONT_FLAGS_ONLYONE, 0 ) );
3818         SvxFontItem* pItem = aItemArr[ n ];
3819         pItem->SetFamily( aFont.GetFamily() );
3820         pItem->SetFamilyName( aFont.GetName() );
3821         pItem->SetStyleName( String() );
3822         pItem->SetPitch( aFont.GetPitch());
3823         pItem->SetCharSet(aFont.GetCharSet());
3824     }
3825 }
3826 
3827 
3828 sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang )
3829 {
3830     return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) );
3831 }
3832 
3833 sal_uInt16 GetItemScriptType( short nI18NType )
3834 {
3835     switch ( nI18NType )
3836     {
3837         case i18n::ScriptType::LATIN:   return SCRIPTTYPE_LATIN;
3838         case i18n::ScriptType::ASIAN:   return SCRIPTTYPE_ASIAN;
3839         case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX;
3840     }
3841     return 0;
3842 }
3843 
3844 short GetI18NScriptType( sal_uInt16 nItemType )
3845 {
3846     switch ( nItemType )
3847     {
3848         case SCRIPTTYPE_LATIN:      return i18n::ScriptType::LATIN;
3849         case SCRIPTTYPE_ASIAN:      return i18n::ScriptType::ASIAN;
3850         case SCRIPTTYPE_COMPLEX:    return i18n::ScriptType::COMPLEX;
3851     }
3852     return 0;
3853 }
3854