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