bump product version to 5.0.4.1
[LibreOffice.git] / editeng / source / items / textitem.cxx
blob4289446cf1e59631703a17156338dbb2e2351129
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/style/CaseMap.hpp>
21 #include <com/sun/star/awt/FontDescriptor.hpp>
22 #include <com/sun/star/frame/status/FontHeight.hpp>
23 #include <vcl/bitmapex.hxx>
24 #include <tools/stream.hxx>
25 #include <toolkit/helper/vclunohelper.hxx>
26 #include <math.h>
27 #include <rtl/math.hxx>
28 #include <unotools/fontdefs.hxx>
29 #include <vcl/outdev.hxx>
30 #include <editeng/eeitem.hxx>
31 #include <svtools/unitconv.hxx>
33 #include <svl/memberid.hrc>
34 #include <editeng/editids.hrc>
35 #include <editeng/editrids.hrc>
36 #include <vcl/vclenum.hxx>
37 #include <tools/tenccvt.hxx>
38 #include <tools/mapunit.hxx>
40 #include <rtl/ustring.hxx>
41 #include <i18nlangtag/languagetag.hxx>
42 #include <svl/itemset.hxx>
44 #include <svtools/langtab.hxx>
45 #include <svl/itempool.hxx>
46 #include <svtools/ctrltool.hxx>
47 #include <vcl/settings.hxx>
48 #include <vcl/svapp.hxx>
49 #include <com/sun/star/awt/SimpleFontMetric.hpp>
50 #include <com/sun/star/awt/FontWeight.hpp>
51 #include <com/sun/star/awt/FontSlant.hpp>
52 #include <com/sun/star/awt/CharSet.hpp>
53 #include <com/sun/star/awt/FontWidth.hpp>
54 #include <com/sun/star/awt/XFont.hpp>
55 #include <com/sun/star/awt/FontType.hpp>
56 #include <com/sun/star/awt/FontUnderline.hpp>
57 #include <com/sun/star/awt/FontStrikeout.hpp>
58 #include <com/sun/star/awt/FontFamily.hpp>
59 #include <com/sun/star/awt/FontPitch.hpp>
60 #include <com/sun/star/lang/Locale.hpp>
61 #include <com/sun/star/text/FontEmphasis.hpp>
62 #include <com/sun/star/i18n/ScriptType.hpp>
63 #include <editeng/rsiditem.hxx>
64 #include <editeng/memberids.hrc>
65 #include <editeng/flstitem.hxx>
66 #include <editeng/fontitem.hxx>
67 #include <editeng/postitem.hxx>
68 #include <editeng/wghtitem.hxx>
69 #include <editeng/fhgtitem.hxx>
70 #include <editeng/fwdtitem.hxx>
71 #include <editeng/udlnitem.hxx>
72 #include <editeng/crossedoutitem.hxx>
73 #include <editeng/shdditem.hxx>
74 #include <editeng/autokernitem.hxx>
75 #include <editeng/wrlmitem.hxx>
76 #include <editeng/contouritem.hxx>
77 #include <editeng/prszitem.hxx>
78 #include <editeng/colritem.hxx>
79 #include <editeng/charsetcoloritem.hxx>
80 #include <editeng/kernitem.hxx>
81 #include <editeng/cmapitem.hxx>
82 #include <editeng/escapementitem.hxx>
83 #include <editeng/langitem.hxx>
84 #include <editeng/nlbkitem.hxx>
85 #include <editeng/nhypitem.hxx>
86 #include <editeng/lcolitem.hxx>
87 #include <editeng/blinkitem.hxx>
88 #include <editeng/emphasismarkitem.hxx>
89 #include <editeng/twolinesitem.hxx>
90 #include <editeng/scripttypeitem.hxx>
91 #include <editeng/charrotateitem.hxx>
92 #include <editeng/charscaleitem.hxx>
93 #include <editeng/charreliefitem.hxx>
94 #include <editeng/itemtype.hxx>
95 #include <editeng/eerdll.hxx>
96 #include <libxml/xmlwriter.h>
98 #define STORE_UNICODE_MAGIC_MARKER 0xFE331188
100 using namespace ::com::sun::star;
101 using namespace ::com::sun::star::text;
103 bool SvxFontItem::bEnableStoreUnicodeNames = false;
105 // STATIC DATA -----------------------------------------------------------
109 TYPEINIT1(SvxFontListItem, SfxPoolItem);
110 TYPEINIT1_FACTORY(SvxFontItem, SfxPoolItem, new SvxFontItem(0));
111 TYPEINIT1_FACTORY(SvxPostureItem, SfxEnumItem, new SvxPostureItem(ITALIC_NONE, 0));
112 TYPEINIT1_FACTORY(SvxWeightItem, SfxEnumItem, new SvxWeightItem(WEIGHT_NORMAL, 0));
113 TYPEINIT1_FACTORY(SvxFontHeightItem, SfxPoolItem, new SvxFontHeightItem(240, 100, 0));
114 TYPEINIT1_FACTORY(SvxFontWidthItem, SfxPoolItem, new SvxFontWidthItem(0, 100, 0));
115 TYPEINIT1_FACTORY(SvxTextLineItem, SfxEnumItem, new SvxTextLineItem(UNDERLINE_NONE, 0));
116 TYPEINIT1_FACTORY(SvxUnderlineItem, SfxEnumItem, new SvxUnderlineItem(UNDERLINE_NONE, 0));
117 TYPEINIT1_FACTORY(SvxOverlineItem, SfxEnumItem, new SvxOverlineItem(UNDERLINE_NONE, 0));
118 TYPEINIT1_FACTORY(SvxCrossedOutItem, SfxEnumItem, new SvxCrossedOutItem(STRIKEOUT_NONE, 0));
119 TYPEINIT1_FACTORY(SvxShadowedItem, SfxBoolItem, new SvxShadowedItem(false, 0));
120 TYPEINIT1_FACTORY(SvxAutoKernItem, SfxBoolItem, new SvxAutoKernItem(false, 0));
121 TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(false, 0));
122 TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(false, 0));
123 TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0));
124 TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0));
125 // XXX: Should 2nd argoment of next line SfxColorItem or SfxPoolItem?
126 TYPEINIT1_FACTORY(SvxBackgroundColorItem, SvxColorItem, new SvxBackgroundColorItem(0));
127 TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0));
128 TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0));
129 TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0));
130 TYPEINIT1_FACTORY(SvxEscapementItem, SfxPoolItem, new SvxEscapementItem(0));
131 TYPEINIT1_FACTORY(SvxLanguageItem, SfxEnumItem, new SvxLanguageItem(LANGUAGE_GERMAN, 0));
132 TYPEINIT1_FACTORY(SvxNoLinebreakItem, SfxBoolItem, new SvxNoLinebreakItem(true, 0));
133 TYPEINIT1_FACTORY(SvxNoHyphenItem, SfxBoolItem, new SvxNoHyphenItem(true, 0));
134 TYPEINIT1_FACTORY(SvxLineColorItem, SvxColorItem, new SvxLineColorItem(0));
135 TYPEINIT1_FACTORY(SvxBlinkItem, SfxBoolItem, new SvxBlinkItem(false, 0));
136 TYPEINIT1_FACTORY(SvxEmphasisMarkItem, SfxUInt16Item, new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0));
137 TYPEINIT1_FACTORY(SvxTwoLinesItem, SfxPoolItem, new SvxTwoLinesItem(true, 0, 0, 0));
138 TYPEINIT1_FACTORY(SvxScriptTypeItem, SfxUInt16Item, new SvxScriptTypeItem);
139 TYPEINIT1_FACTORY(SvxCharRotateItem, SfxUInt16Item, new SvxCharRotateItem(0, false, 0));
140 TYPEINIT1_FACTORY(SvxCharScaleWidthItem, SfxUInt16Item, new SvxCharScaleWidthItem(100, 0));
141 TYPEINIT1_FACTORY(SvxCharReliefItem, SfxEnumItem, new SvxCharReliefItem(RELIEF_NONE, 0));
142 TYPEINIT1_FACTORY(SvxRsidItem, SfxUInt32Item, new SvxRsidItem(0, 0));
144 TYPEINIT1(SvxScriptSetItem, SfxSetItem );
147 // class SvxFontListItem -------------------------------------------------
149 SvxFontListItem::SvxFontListItem( const FontList* pFontLst,
150 const sal_uInt16 nId ) :
151 SfxPoolItem( nId ),
152 pFontList( pFontLst )
154 if ( pFontList )
156 sal_Int32 nCount = pFontList->GetFontNameCount();
157 aFontNameSeq.realloc( nCount );
159 for ( sal_uInt16 i = 0; i < nCount; i++ )
160 aFontNameSeq[i] = pFontList->GetFontName(i).GetName();
166 SvxFontListItem::SvxFontListItem( const SvxFontListItem& rItem ) :
168 SfxPoolItem( rItem ),
169 pFontList( rItem.GetFontList() ),
170 aFontNameSeq( rItem.aFontNameSeq )
176 SfxPoolItem* SvxFontListItem::Clone( SfxItemPool* ) const
178 return new SvxFontListItem( *this );
183 bool SvxFontListItem::operator==( const SfxPoolItem& rAttr ) const
185 DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
187 return( pFontList == static_cast<const SvxFontListItem&>(rAttr).pFontList );
190 bool SvxFontListItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
192 rVal <<= aFontNameSeq;
193 return true;
198 bool SvxFontListItem::GetPresentation
200 SfxItemPresentation /*ePres*/,
201 SfxMapUnit /*eCoreUnit*/,
202 SfxMapUnit /*ePresUnit*/,
203 OUString& rText, const IntlWrapper * /*pIntl*/
204 ) const
206 rText.clear();
207 return false;
210 // class SvxFontItem -----------------------------------------------------
212 SvxFontItem::SvxFontItem( const sal_uInt16 nId ) :
213 SfxPoolItem( nId )
215 eFamily = FAMILY_SWISS;
216 ePitch = PITCH_VARIABLE;
217 eTextEncoding = RTL_TEXTENCODING_DONTKNOW;
222 SvxFontItem::SvxFontItem( const FontFamily eFam, const OUString& aName,
223 const OUString& aStName, const FontPitch eFontPitch,
224 const rtl_TextEncoding eFontTextEncoding, const sal_uInt16 nId ) :
226 SfxPoolItem( nId ),
228 aFamilyName(aName),
229 aStyleName(aStName)
231 eFamily = eFam;
232 ePitch = eFontPitch;
233 eTextEncoding = eFontTextEncoding;
237 SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont)
239 aFamilyName = rFont.GetFamilyName();
240 aStyleName = rFont.GetStyleName();
241 eFamily = rFont.GetFamily();
242 ePitch = rFont.GetPitch();
243 eTextEncoding = rFont.GetCharSet();
244 return *this;
248 bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
250 nMemberId &= ~CONVERT_TWIPS;
251 switch(nMemberId)
253 case 0:
255 com::sun::star::awt::FontDescriptor aFontDescriptor;
256 aFontDescriptor.Name = aFamilyName;
257 aFontDescriptor.StyleName = aStyleName;
258 aFontDescriptor.Family = (sal_Int16)(eFamily);
259 aFontDescriptor.CharSet = (sal_Int16)(eTextEncoding);
260 aFontDescriptor.Pitch = (sal_Int16)(ePitch);
261 rVal <<= aFontDescriptor;
263 break;
264 case MID_FONT_FAMILY_NAME:
265 rVal <<= aFamilyName;
266 break;
267 case MID_FONT_STYLE_NAME:
268 rVal <<= aStyleName;
269 break;
270 case MID_FONT_FAMILY : rVal <<= (sal_Int16)(eFamily); break;
271 case MID_FONT_CHAR_SET : rVal <<= (sal_Int16)(eTextEncoding); break;
272 case MID_FONT_PITCH : rVal <<= (sal_Int16)(ePitch); break;
274 return true;
277 bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
279 nMemberId &= ~CONVERT_TWIPS;
280 switch(nMemberId)
282 case 0:
284 com::sun::star::awt::FontDescriptor aFontDescriptor;
285 if ( !( rVal >>= aFontDescriptor ))
286 return false;
288 aFamilyName = aFontDescriptor.Name;
289 aStyleName = aFontDescriptor.StyleName;
290 eFamily = (FontFamily)aFontDescriptor.Family;
291 eTextEncoding = (rtl_TextEncoding)aFontDescriptor.CharSet;
292 ePitch = (FontPitch)aFontDescriptor.Pitch;
294 break;
295 case MID_FONT_FAMILY_NAME :
297 OUString aStr;
298 if(!(rVal >>= aStr))
299 return false;
300 aFamilyName = aStr;
302 break;
303 case MID_FONT_STYLE_NAME:
305 OUString aStr;
306 if(!(rVal >>= aStr))
307 return false;
308 aStyleName = aStr;
310 break;
311 case MID_FONT_FAMILY :
313 sal_Int16 nFamily = sal_Int16();
314 if(!(rVal >>= nFamily))
315 return false;
316 eFamily = (FontFamily)nFamily;
318 break;
319 case MID_FONT_CHAR_SET :
321 sal_Int16 nSet = sal_Int16();
322 if(!(rVal >>= nSet))
323 return false;
324 eTextEncoding = (rtl_TextEncoding)nSet;
326 break;
327 case MID_FONT_PITCH :
329 sal_Int16 nPitch = sal_Int16();
330 if(!(rVal >>= nPitch))
331 return false;
332 ePitch = (FontPitch)nPitch;
334 break;
336 return true;
341 bool SvxFontItem::operator==( const SfxPoolItem& rAttr ) const
343 DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
345 const SvxFontItem& rItem = static_cast<const SvxFontItem&>(rAttr);
347 bool bRet = ( eFamily == rItem.eFamily &&
348 aFamilyName == rItem.aFamilyName &&
349 aStyleName == rItem.aStyleName );
351 if ( bRet )
353 if ( ePitch != rItem.ePitch || eTextEncoding != rItem.eTextEncoding )
355 bRet = false;
356 DBG_WARNING( "FontItem::operator==(): only pitch or rtl_TextEncoding different ");
359 return bRet;
364 SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const
366 return new SvxFontItem( *this );
371 SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
373 bool bToBats = IsStarSymbol( GetFamilyName() );
375 rStrm.WriteUChar( GetFamily() ).WriteUChar( GetPitch() )
376 .WriteUChar( bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet()) );
378 OUString aStoreFamilyName( GetFamilyName() );
379 if( bToBats )
380 aStoreFamilyName = "StarBats";
381 rStrm.WriteUniOrByteString(aStoreFamilyName, rStrm.GetStreamCharSet());
382 rStrm.WriteUniOrByteString(GetStyleName(), rStrm.GetStreamCharSet());
384 // cach for EditEngine, only set while creating clipboard stream.
385 if ( bEnableStoreUnicodeNames )
387 sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
388 rStrm.WriteUInt32( nMagic );
389 rStrm.WriteUniOrByteString( aStoreFamilyName, RTL_TEXTENCODING_UNICODE );
390 rStrm.WriteUniOrByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE );
393 return rStrm;
398 SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
400 sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding;
401 OUString aName, aStyle;
402 rStrm.ReadUChar( _eFamily );
403 rStrm.ReadUChar( eFontPitch );
404 rStrm.ReadUChar( eFontTextEncoding );
406 // UNICODE: rStrm >> aName;
407 aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
409 // UNICODE: rStrm >> aStyle;
410 aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
412 // Set the "correct" textencoding
413 eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding );
415 // at some point, the StarBats changes from ANSI font to SYMBOL font
416 if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName == "StarBats" )
417 eFontTextEncoding = RTL_TEXTENCODING_SYMBOL;
419 // Check if we have stored unicode
420 sal_Size nStreamPos = rStrm.Tell();
421 sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
422 rStrm.ReadUInt32( nMagic );
423 if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
425 aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
426 aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
428 else
430 rStrm.Seek( nStreamPos );
435 return new SvxFontItem( (FontFamily)_eFamily, aName, aStyle,
436 (FontPitch)eFontPitch, (rtl_TextEncoding)eFontTextEncoding, Which() );
441 bool SvxFontItem::GetPresentation
443 SfxItemPresentation /*ePres*/,
444 SfxMapUnit /*eCoreUnit*/,
445 SfxMapUnit /*ePresUnit*/,
446 OUString& rText, const IntlWrapper * /*pIntl*/
447 ) const
449 rText = aFamilyName;
450 return true;
455 void SvxFontItem::EnableStoreUnicodeNames( bool bEnable )
457 bEnableStoreUnicodeNames = bEnable;
460 void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const
462 xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontItem"));
463 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
464 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("familyName"), BAD_CAST(aFamilyName.toUtf8().getStr()));
465 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("styleName"), BAD_CAST(aStyleName.toUtf8().getStr()));
466 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("family"), BAD_CAST(OString::number(eFamily).getStr()));
467 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pitch"), BAD_CAST(OString::number(ePitch).getStr()));
468 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("textEncoding"), BAD_CAST(OString::number(eTextEncoding).getStr()));
469 xmlTextWriterEndElement(pWriter);
472 // class SvxPostureItem --------------------------------------------------
474 SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) :
475 SfxEnumItem( nId, (sal_uInt16)ePosture )
481 SfxPoolItem* SvxPostureItem::Clone( SfxItemPool * ) const
483 return new SvxPostureItem( *this );
488 sal_uInt16 SvxPostureItem::GetValueCount() const
490 return ITALIC_NORMAL + 1; // ITALIC_NONE also belongs here
495 SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
497 rStrm.WriteUChar( GetValue() );
498 return rStrm;
503 SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const
505 sal_uInt8 nPosture;
506 rStrm.ReadUChar( nPosture );
507 return new SvxPostureItem( (const FontItalic)nPosture, Which() );
512 bool SvxPostureItem::GetPresentation
514 SfxItemPresentation /*ePres*/,
515 SfxMapUnit /*eCoreUnit*/,
516 SfxMapUnit /*ePresUnit*/,
517 OUString& rText, const IntlWrapper * /*pIntl*/
518 ) const
520 rText = GetValueTextByPos( GetValue() );
521 return true;
526 OUString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos ) const
528 DBG_ASSERT( nPos <= (sal_uInt16)ITALIC_NORMAL, "enum overflow!" );
530 FontItalic eItalic = (FontItalic)nPos;
531 sal_uInt16 nId = 0;
533 switch ( eItalic )
535 case ITALIC_NONE: nId = RID_SVXITEMS_ITALIC_NONE; break;
536 case ITALIC_OBLIQUE: nId = RID_SVXITEMS_ITALIC_OBLIQUE; break;
537 case ITALIC_NORMAL: nId = RID_SVXITEMS_ITALIC_NORMAL; break;
538 default: ;//prevent warning
541 return nId ? EE_RESSTR(nId) : OUString();
544 bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
546 nMemberId &= ~CONVERT_TWIPS;
547 switch( nMemberId )
549 case MID_ITALIC:
550 rVal = Bool2Any(GetBoolValue());
551 break;
552 case MID_POSTURE:
553 rVal <<= (awt::FontSlant)GetValue(); // values from awt::FontSlant and FontItalic are equal
554 break;
556 return true;
559 bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
561 nMemberId &= ~CONVERT_TWIPS;
562 switch( nMemberId )
564 case MID_ITALIC:
565 SetBoolValue(Any2Bool(rVal));
566 break;
567 case MID_POSTURE:
569 awt::FontSlant eSlant;
570 if(!(rVal >>= eSlant))
572 sal_Int32 nValue = 0;
573 if(!(rVal >>= nValue))
574 return false;
576 eSlant = (awt::FontSlant)nValue;
578 SetValue((sal_uInt16)eSlant);
581 return true;
585 bool SvxPostureItem::HasBoolValue() const
587 return true;
592 bool SvxPostureItem::GetBoolValue() const
594 return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE );
599 void SvxPostureItem::SetBoolValue( bool bVal )
601 SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) );
604 void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const
606 xmlTextWriterStartElement(pWriter, BAD_CAST("svxPostureItem"));
607 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
608 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%d", GetValue());
609 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
610 xmlTextWriterEndElement(pWriter);
613 // class SvxWeightItem ---------------------------------------------------
615 SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) :
616 SfxEnumItem( nId, (sal_uInt16)eWght )
624 bool SvxWeightItem::HasBoolValue() const
626 return true;
631 bool SvxWeightItem::GetBoolValue() const
633 return (FontWeight)GetValue() >= WEIGHT_BOLD;
638 void SvxWeightItem::SetBoolValue( bool bVal )
640 SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) );
645 sal_uInt16 SvxWeightItem::GetValueCount() const
647 return WEIGHT_BLACK; // WEIGHT_DONTKNOW does not belong
652 SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const
654 return new SvxWeightItem( *this );
659 SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
661 rStrm.WriteUChar( GetValue() );
662 return rStrm;
667 SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const
669 sal_uInt8 nWeight;
670 rStrm.ReadUChar( nWeight );
671 return new SvxWeightItem( (FontWeight)nWeight, Which() );
676 bool SvxWeightItem::GetPresentation
678 SfxItemPresentation /*ePres*/,
679 SfxMapUnit /*eCoreUnit*/,
680 SfxMapUnit /*ePresUnit*/,
681 OUString& rText, const IntlWrapper * /*pIntl*/
682 ) const
684 rText = GetValueTextByPos( GetValue() );
685 return true;
690 OUString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos ) const
692 DBG_ASSERT( nPos <= (sal_uInt16)WEIGHT_BLACK, "enum overflow!" );
693 return EE_RESSTR(RID_SVXITEMS_WEIGHT_BEGIN + nPos);
696 bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
698 nMemberId &= ~CONVERT_TWIPS;
699 switch( nMemberId )
701 case MID_BOLD :
702 rVal = Bool2Any(GetBoolValue());
703 break;
704 case MID_WEIGHT:
706 rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight)GetValue() ) );
708 break;
710 return true;
713 bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
715 nMemberId &= ~CONVERT_TWIPS;
716 switch( nMemberId )
718 case MID_BOLD :
719 SetBoolValue(Any2Bool(rVal));
720 break;
721 case MID_WEIGHT:
723 double fValue = 0;
724 if(!(rVal >>= fValue))
726 sal_Int32 nValue = 0;
727 if(!(rVal >>= nValue))
728 return false;
729 fValue = (float)nValue;
731 SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) );
733 break;
735 return true;
738 void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
740 xmlTextWriterStartElement(pWriter, BAD_CAST("svxWeightItem"));
741 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
742 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%d", GetValue());
743 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
744 xmlTextWriterEndElement(pWriter);
747 // class SvxFontHeightItem -----------------------------------------------
749 SvxFontHeightItem::SvxFontHeightItem( const sal_uLong nSz,
750 const sal_uInt16 nPrp,
751 const sal_uInt16 nId ) :
752 SfxPoolItem( nId )
754 SetHeight( nSz,nPrp ); // calculate in percentage
759 SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const
761 return new SvxFontHeightItem( *this );
766 SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
768 rStrm.WriteUInt16( GetHeight() );
770 if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
771 rStrm.WriteUInt16( GetProp() ).WriteUInt16( GetPropUnit() );
772 else
774 // When exporting to the old versions the relative information is lost
775 // when there is no percentage
776 sal_uInt16 _nProp = GetProp();
777 if( SFX_MAPUNIT_RELATIVE != GetPropUnit() )
778 _nProp = 100;
779 rStrm.WriteUInt16( _nProp );
781 return rStrm;
786 SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
787 sal_uInt16 nVersion ) const
789 sal_uInt16 nsize, nprop = 0, nPropUnit = SFX_MAPUNIT_RELATIVE;
791 rStrm.ReadUInt16( nsize );
793 if( FONTHEIGHT_16_VERSION <= nVersion )
794 rStrm.ReadUInt16( nprop );
795 else
797 sal_uInt8 nP;
798 rStrm .ReadUChar( nP );
799 nprop = (sal_uInt16)nP;
802 if( FONTHEIGHT_UNIT_VERSION <= nVersion )
803 rStrm.ReadUInt16( nPropUnit );
805 SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
806 pItem->SetProp( nprop, (SfxMapUnit)nPropUnit );
807 return pItem;
812 bool SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const
814 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
815 return GetHeight() == static_cast<const SvxFontHeightItem&>(rItem).GetHeight() &&
816 GetProp() == static_cast<const SvxFontHeightItem&>(rItem).GetProp() &&
817 GetPropUnit() == static_cast<const SvxFontHeightItem&>(rItem).GetPropUnit();
820 bool SvxFontHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
822 // In StarOne is the uno::Any always 1/100mm. Through the MemberId it is
823 // controlled if the value in the Item should be 1/100mm or Twips.
825 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
826 nMemberId &= ~CONVERT_TWIPS;
827 switch( nMemberId )
829 case 0:
831 ::com::sun::star::frame::status::FontHeight aFontHeight;
833 // Point (i.e. Twips) is asked for, thus re-calculate if
834 // CONVERT_TWIPS is not set.
835 if( bConvert )
837 aFontHeight.Height = (float)( nHeight / 20.0 );
839 else
841 double fPoints = convertMm100ToTwip(nHeight) / 20.0;
842 float fRoundPoints =
843 static_cast<float>(::rtl::math::round(fPoints, 1));
844 aFontHeight.Height = fRoundPoints;
847 aFontHeight.Prop = (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
849 float fRet = (float)(short)nProp;
850 switch( ePropUnit )
852 case SFX_MAPUNIT_RELATIVE:
853 fRet = 0.;
854 break;
855 case SFX_MAPUNIT_100TH_MM:
856 fRet = convertMm100ToTwip(fRet);
857 fRet /= 20.;
858 break;
859 case SFX_MAPUNIT_POINT:
861 break;
862 case SFX_MAPUNIT_TWIP:
863 fRet /= 20.;
864 break;
865 default: ;//prevent warning
867 aFontHeight.Diff = fRet;
868 rVal <<= aFontHeight;
870 break;
871 case MID_FONTHEIGHT:
873 // Point (i.e. Twips) is asked for, thus re-calculate if
874 // CONVERT_TWIPS is not set.
875 if( bConvert )
877 rVal <<= (float)( nHeight / 20.0 );
879 else
881 double fPoints = convertMm100ToTwip(nHeight) / 20.0;
882 float fRoundPoints =
883 static_cast<float>(::rtl::math::round(fPoints, 1));
884 rVal <<= fRoundPoints;
887 break;
888 case MID_FONTHEIGHT_PROP:
889 rVal <<= (sal_Int16)(SFX_MAPUNIT_RELATIVE == ePropUnit ? nProp : 100);
890 break;
891 case MID_FONTHEIGHT_DIFF:
893 float fRet = (float)(short)nProp;
894 switch( ePropUnit )
896 case SFX_MAPUNIT_RELATIVE:
897 fRet = 0.;
898 break;
899 case SFX_MAPUNIT_100TH_MM:
900 fRet = convertMm100ToTwip(fRet);
901 fRet /= 20.;
902 break;
903 case SFX_MAPUNIT_POINT:
905 break;
906 case SFX_MAPUNIT_TWIP:
907 fRet /= 20.;
908 break;
909 default: ;//prevent warning
911 rVal <<= fRet;
913 break;
915 return true;
918 // Try to reconstruct the original height input value from the modified height
919 // and the prop data; this seems somewhat futile given the various ways how the
920 // modified height is calculated (with and without conversion between twips and
921 // 100th mm; with an additional eCoreMetric input in one of the SetHeight
922 // overloads), and indeed known to occasionally produce nRet values that would
923 // be negative, so just guard against negative results here and throw the hands
924 // up in despair:
925 static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, SfxMapUnit eProp, bool bCoreInTwip)
927 sal_uInt32 nRet = nHeight;
928 short nDiff = 0;
929 switch( eProp )
931 case SFX_MAPUNIT_RELATIVE:
932 nRet *= 100;
933 nRet /= nProp;
934 break;
935 case SFX_MAPUNIT_POINT:
937 short nTemp = (short)nProp;
938 nDiff = nTemp * 20;
939 if(!bCoreInTwip)
940 nDiff = (short)convertTwipToMm100((long)(nDiff));
942 break;
943 case SFX_MAPUNIT_100TH_MM:
944 //then the core is surely also in 1/100 mm
945 nDiff = (short)nProp;
946 break;
947 case SFX_MAPUNIT_TWIP:
948 // Here surely TWIP
949 nDiff = ((short)nProp);
950 break;
951 default: ;//prevent warning
953 nRet = (nDiff < 0 || nRet >= static_cast<unsigned short>(nDiff))
954 ? nRet - nDiff : 0;
955 //TODO: overflow in case nDiff < 0 and nRet - nDiff > SAL_MAX_UINT32
957 return nRet;
960 bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
962 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
963 nMemberId &= ~CONVERT_TWIPS;
964 switch( nMemberId )
966 case 0:
968 ::com::sun::star::frame::status::FontHeight aFontHeight;
969 if ( rVal >>= aFontHeight )
971 // Height
972 ePropUnit = SFX_MAPUNIT_RELATIVE;
973 nProp = 100;
974 double fPoint = aFontHeight.Height;
975 if( fPoint < 0. || fPoint > 10000. )
976 return false;
978 nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips
979 if (!bConvert)
980 nHeight = convertTwipToMm100(nHeight); // Convert, if the item contains 1/100mm
982 nProp = aFontHeight.Prop;
984 else
985 return false;
987 break;
988 case MID_FONTHEIGHT:
990 ePropUnit = SFX_MAPUNIT_RELATIVE;
991 nProp = 100;
992 double fPoint = 0;
993 if(!(rVal >>= fPoint))
995 sal_Int32 nValue = 0;
996 if(!(rVal >>= nValue))
997 return false;
998 fPoint = (float)nValue;
1000 if(fPoint < 0. || fPoint > 10000.)
1001 return false;
1003 nHeight = (long)( fPoint * 20.0 + 0.5 ); // Twips
1004 if (!bConvert)
1005 nHeight = convertTwipToMm100(nHeight); // Convert, if the item contains 1/100mm
1007 break;
1008 case MID_FONTHEIGHT_PROP:
1010 sal_Int16 nNew = sal_Int16();
1011 if(!(rVal >>= nNew))
1012 return true;
1014 nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
1016 nHeight *= nNew;
1017 nHeight /= 100;
1018 nProp = nNew;
1019 ePropUnit = SFX_MAPUNIT_RELATIVE;
1021 break;
1022 case MID_FONTHEIGHT_DIFF:
1024 nHeight = lcl_GetRealHeight_Impl(nHeight, nProp, ePropUnit, bConvert);
1025 float fValue = 0;
1026 if(!(rVal >>= fValue))
1028 sal_Int32 nValue = 0;
1029 if(!(rVal >>= nValue))
1030 return false;
1031 fValue = (float)nValue;
1033 sal_Int16 nCoreDiffValue = (sal_Int16)(fValue * 20.);
1034 nHeight += bConvert ? nCoreDiffValue : convertTwipToMm100(nCoreDiffValue);
1035 nProp = (sal_uInt16)((sal_Int16)fValue);
1036 ePropUnit = SFX_MAPUNIT_POINT;
1038 break;
1040 return true;
1045 bool SvxFontHeightItem::GetPresentation
1047 SfxItemPresentation /*ePres*/,
1048 SfxMapUnit eCoreUnit,
1049 SfxMapUnit /*ePresUnit*/,
1050 OUString& rText, const IntlWrapper *pIntl
1051 ) const
1053 if( SFX_MAPUNIT_RELATIVE != ePropUnit )
1055 rText = OUString::number( (short)nProp ) +
1056 " " + EE_RESSTR( GetMetricId( ePropUnit ) );
1057 if( 0 <= (short)nProp )
1058 rText = "+" + rText;
1060 else if( 100 == nProp )
1062 rText = GetMetricText( (long)nHeight,
1063 eCoreUnit, SFX_MAPUNIT_POINT, pIntl ) +
1064 " " + EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
1066 else
1067 rText = OUString::number( nProp ) + "%";
1068 return true;
1073 sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const
1075 return (nFileVersion <= SOFFICE_FILEFORMAT_40)
1076 ? FONTHEIGHT_16_VERSION
1077 : FONTHEIGHT_UNIT_VERSION;
1082 bool SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv )
1084 nHeight = (sal_uInt32)Scale( nHeight, nMult, nDiv );
1085 return true;
1090 bool SvxFontHeightItem::HasMetrics() const
1092 return true;
1095 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp,
1096 SfxMapUnit eUnit )
1098 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1100 if( SFX_MAPUNIT_RELATIVE != eUnit )
1101 nHeight = nNewHeight + ::ItemToControl( (short)nNewProp, eUnit,
1102 FUNIT_TWIP );
1103 else if( 100 != nNewProp )
1104 nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
1105 else
1106 nHeight = nNewHeight;
1108 nProp = nNewProp;
1109 ePropUnit = eUnit;
1112 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
1113 SfxMapUnit eMetric, SfxMapUnit eCoreMetric )
1115 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1117 if( SFX_MAPUNIT_RELATIVE != eMetric )
1118 nHeight = nNewHeight +
1119 ::ControlToItem( ::ItemToControl((short)nNewProp, eMetric,
1120 FUNIT_TWIP ), FUNIT_TWIP,
1121 eCoreMetric );
1122 else if( 100 != nNewProp )
1123 nHeight = sal_uInt32(( nNewHeight * nNewProp ) / 100 );
1124 else
1125 nHeight = nNewHeight;
1127 nProp = nNewProp;
1128 ePropUnit = eMetric;
1131 void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
1133 xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontHeightItem"));
1134 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1135 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr()));
1136 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr()));
1137 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number(ePropUnit).getStr()));
1138 xmlTextWriterEndElement(pWriter);
1141 // class SvxFontWidthItem -----------------------------------------------
1143 SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) :
1144 SfxPoolItem( nId )
1146 nWidth = nSz;
1147 nProp = nPrp;
1152 SfxPoolItem* SvxFontWidthItem::Clone( SfxItemPool * ) const
1154 return new SvxFontWidthItem( *this );
1159 SvStream& SvxFontWidthItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1161 rStrm.WriteUInt16( GetWidth() ).WriteUInt16( GetProp() );
1162 return rStrm;
1167 bool SvxFontWidthItem::ScaleMetrics( long nMult, long nDiv )
1169 nWidth = (sal_uInt16)Scale( nWidth, nMult, nDiv );
1170 return true;
1175 bool SvxFontWidthItem::HasMetrics() const
1177 return true;
1182 SfxPoolItem* SvxFontWidthItem::Create( SvStream& rStrm,
1183 sal_uInt16 /*nVersion*/ ) const
1185 sal_uInt16 nS;
1186 sal_uInt16 nP;
1188 rStrm.ReadUInt16( nS );
1189 rStrm.ReadUInt16( nP );
1190 SvxFontWidthItem* pItem = new SvxFontWidthItem( 0, nP, Which() );
1191 pItem->SetWidthValue( nS );
1192 return pItem;
1197 bool SvxFontWidthItem::operator==( const SfxPoolItem& rItem ) const
1199 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
1200 return GetWidth() == static_cast<const SvxFontWidthItem&>(rItem).GetWidth() &&
1201 GetProp() == static_cast<const SvxFontWidthItem&>(rItem).GetProp();
1204 bool SvxFontWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1206 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1207 nMemberId &= ~CONVERT_TWIPS;
1208 switch(nMemberId)
1210 case MID_FONTWIDTH:
1211 rVal <<= (sal_Int16)(nWidth);
1212 break;
1213 case MID_FONTWIDTH_PROP:
1214 rVal <<= (sal_Int16)(nProp);
1215 break;
1217 return true;
1220 bool SvxFontWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1222 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1223 nMemberId &= ~CONVERT_TWIPS;
1224 sal_Int16 nVal = sal_Int16();
1225 if(!(rVal >>= nVal))
1226 return false;
1228 switch(nMemberId)
1230 case MID_FONTWIDTH:
1231 nProp = nVal;
1232 break;
1233 case MID_FONTWIDTH_PROP:
1234 nWidth = nVal;
1235 break;
1237 return true;
1242 bool SvxFontWidthItem::GetPresentation
1244 SfxItemPresentation /*ePres*/,
1245 SfxMapUnit eCoreUnit,
1246 SfxMapUnit /*ePresUnit*/,
1247 OUString& rText, const IntlWrapper *pIntl
1248 ) const
1250 if ( 100 == nProp )
1252 rText = GetMetricText( (long)nWidth,
1253 eCoreUnit, SFX_MAPUNIT_POINT, pIntl ) +
1254 " " + EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
1256 else
1257 rText = OUString::number( nProp ) + "%";
1258 return true;
1261 // class SvxTextLineItem ------------------------------------------------
1263 SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt, const sal_uInt16 nId )
1264 : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT )
1270 bool SvxTextLineItem::HasBoolValue() const
1272 return true;
1277 bool SvxTextLineItem::GetBoolValue() const
1279 return (FontUnderline)GetValue() != UNDERLINE_NONE;
1284 void SvxTextLineItem::SetBoolValue( bool bVal )
1286 SetValue( (sal_uInt16)(bVal ? UNDERLINE_SINGLE : UNDERLINE_NONE) );
1291 SfxPoolItem* SvxTextLineItem::Clone( SfxItemPool * ) const
1293 SvxTextLineItem* pNew = new SvxTextLineItem( *this );
1294 pNew->SetColor( GetColor() );
1295 return pNew;
1300 sal_uInt16 SvxTextLineItem::GetValueCount() const
1302 return UNDERLINE_DOTTED + 1; // UNDERLINE_NONE also belongs here
1307 SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1309 rStrm.WriteUChar( GetValue() );
1310 return rStrm;
1315 SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const
1317 sal_uInt8 nState;
1318 rStrm.ReadUChar( nState );
1319 return new SvxTextLineItem( (FontUnderline)nState, Which() );
1324 bool SvxTextLineItem::GetPresentation
1326 SfxItemPresentation /*ePres*/,
1327 SfxMapUnit /*eCoreUnit*/,
1328 SfxMapUnit /*ePresUnit*/,
1329 OUString& rText, const IntlWrapper * /*pIntl*/
1330 ) const
1332 rText = GetValueTextByPos( GetValue() );
1333 if( !mColor.GetTransparency() )
1334 rText = rText + OUString(cpDelim) + ::GetColorString( mColor );
1335 return true;
1340 OUString SvxTextLineItem::GetValueTextByPos( sal_uInt16 /*nPos*/ ) const
1342 OSL_FAIL("SvxTextLineItem::GetValueTextByPos: Pure virtual method");
1343 return OUString();
1346 bool SvxTextLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1348 nMemberId &= ~CONVERT_TWIPS;
1349 switch(nMemberId)
1351 case MID_TEXTLINED:
1352 rVal = Bool2Any(GetBoolValue());
1353 break;
1354 case MID_TL_STYLE:
1355 rVal <<= (sal_Int16)(GetValue());
1356 break;
1357 case MID_TL_COLOR:
1358 rVal <<= (sal_Int32)( mColor.GetColor() );
1359 break;
1360 case MID_TL_HASCOLOR:
1361 rVal = Bool2Any( !mColor.GetTransparency() );
1362 break;
1364 return true;
1368 bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1370 nMemberId &= ~CONVERT_TWIPS;
1371 bool bRet = true;
1372 switch(nMemberId)
1374 case MID_TEXTLINED:
1375 SetBoolValue(Any2Bool(rVal));
1376 break;
1377 case MID_TL_STYLE:
1379 sal_Int32 nValue = 0;
1380 if(!(rVal >>= nValue))
1381 bRet = false;
1382 else
1383 SetValue((sal_Int16)nValue);
1385 break;
1386 case MID_TL_COLOR:
1388 sal_Int32 nCol = 0;
1389 if( !( rVal >>= nCol ) )
1390 bRet = false;
1391 else
1393 // Keep transparence, because it contains the information
1394 // whether the font color or the stored color should be used
1395 sal_uInt8 nTrans = mColor.GetTransparency();
1396 mColor = Color( nCol );
1397 mColor.SetTransparency( nTrans );
1400 break;
1401 case MID_TL_HASCOLOR:
1402 mColor.SetTransparency( Any2Bool( rVal ) ? 0 : 0xff );
1403 break;
1405 return bRet;
1408 bool SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const
1410 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
1411 return SfxEnumItem::operator==( rItem ) &&
1412 GetColor() == static_cast<const SvxTextLineItem&>(rItem).GetColor();
1415 // class SvxUnderlineItem ------------------------------------------------
1417 SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt, const sal_uInt16 nId )
1418 : SvxTextLineItem( eSt, nId )
1424 SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
1426 SvxUnderlineItem* pNew = new SvxUnderlineItem( *this );
1427 pNew->SetColor( GetColor() );
1428 return pNew;
1433 SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const
1435 sal_uInt8 nState;
1436 rStrm.ReadUChar( nState );
1437 return new SvxUnderlineItem( (FontUnderline)nState, Which() );
1442 OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
1444 DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
1445 return EE_RESSTR(RID_SVXITEMS_UL_BEGIN + nPos);
1448 // class SvxOverlineItem ------------------------------------------------
1450 SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt, const sal_uInt16 nId )
1451 : SvxTextLineItem( eSt, nId )
1457 SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const
1459 SvxOverlineItem* pNew = new SvxOverlineItem( *this );
1460 pNew->SetColor( GetColor() );
1461 return pNew;
1466 SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const
1468 sal_uInt8 nState;
1469 rStrm.ReadUChar( nState );
1470 return new SvxOverlineItem( (FontUnderline)nState, Which() );
1475 OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
1477 DBG_ASSERT( nPos <= (sal_uInt16)UNDERLINE_BOLDWAVE, "enum overflow!" );
1478 return EE_RESSTR(RID_SVXITEMS_OL_BEGIN + nPos);
1481 // class SvxCrossedOutItem -----------------------------------------------
1483 SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId )
1484 : SfxEnumItem( nId, (sal_uInt16)eSt )
1490 bool SvxCrossedOutItem::HasBoolValue() const
1492 return true;
1497 bool SvxCrossedOutItem::GetBoolValue() const
1499 return (FontStrikeout)GetValue() != STRIKEOUT_NONE;
1504 void SvxCrossedOutItem::SetBoolValue( bool bVal )
1506 SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) );
1511 sal_uInt16 SvxCrossedOutItem::GetValueCount() const
1513 return STRIKEOUT_DOUBLE + 1; // STRIKEOUT_NONE belongs also here
1518 SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const
1520 return new SvxCrossedOutItem( *this );
1525 SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1527 rStrm.WriteUChar( GetValue() );
1528 return rStrm;
1533 SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const
1535 sal_uInt8 eCross;
1536 rStrm.ReadUChar( eCross );
1537 return new SvxCrossedOutItem( (FontStrikeout)eCross, Which() );
1542 bool SvxCrossedOutItem::GetPresentation
1544 SfxItemPresentation /*ePres*/,
1545 SfxMapUnit /*eCoreUnit*/,
1546 SfxMapUnit /*ePresUnit*/,
1547 OUString& rText, const IntlWrapper * /*pIntl*/
1548 ) const
1550 rText = GetValueTextByPos( GetValue() );
1551 return true;
1556 OUString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos ) const
1558 DBG_ASSERT( nPos <= (sal_uInt16)STRIKEOUT_X, "enum overflow!" );
1559 return EE_RESSTR(RID_SVXITEMS_STRIKEOUT_BEGIN + nPos);
1562 bool SvxCrossedOutItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1564 nMemberId &= ~CONVERT_TWIPS;
1565 switch(nMemberId)
1567 case MID_CROSSED_OUT:
1568 rVal = Bool2Any(GetBoolValue());
1569 break;
1570 case MID_CROSS_OUT:
1571 rVal <<= (sal_Int16)(GetValue());
1572 break;
1574 return true;
1577 bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1579 nMemberId &= ~CONVERT_TWIPS;
1580 switch(nMemberId)
1582 case MID_CROSSED_OUT:
1583 SetBoolValue(Any2Bool(rVal));
1584 break;
1585 case MID_CROSS_OUT:
1587 sal_Int32 nValue = 0;
1588 if(!(rVal >>= nValue))
1589 return false;
1590 SetValue((sal_Int16)nValue);
1592 break;
1594 return true;
1596 // class SvxShadowedItem -------------------------------------------------
1598 SvxShadowedItem::SvxShadowedItem( const bool bShadowed, const sal_uInt16 nId ) :
1599 SfxBoolItem( nId, bShadowed )
1605 SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const
1607 return new SvxShadowedItem( *this );
1612 SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1614 rStrm.WriteBool( GetValue() );
1615 return rStrm;
1620 SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const
1622 sal_uInt8 nState;
1623 rStrm.ReadUChar( nState );
1624 return new SvxShadowedItem( nState, Which() );
1629 bool SvxShadowedItem::GetPresentation
1631 SfxItemPresentation /*ePres*/,
1632 SfxMapUnit /*eCoreUnit*/,
1633 SfxMapUnit /*ePresUnit*/,
1634 OUString& rText, const IntlWrapper * /*pIntl*/
1635 ) const
1637 sal_uInt16 nId = RID_SVXITEMS_SHADOWED_FALSE;
1639 if ( GetValue() )
1640 nId = RID_SVXITEMS_SHADOWED_TRUE;
1641 rText = EE_RESSTR(nId);
1642 return true;
1645 // class SvxAutoKernItem -------------------------------------------------
1647 SvxAutoKernItem::SvxAutoKernItem( const bool bAutoKern, const sal_uInt16 nId ) :
1648 SfxBoolItem( nId, bAutoKern )
1654 SfxPoolItem* SvxAutoKernItem::Clone( SfxItemPool * ) const
1656 return new SvxAutoKernItem( *this );
1661 SvStream& SvxAutoKernItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1663 rStrm.WriteBool( GetValue() );
1664 return rStrm;
1669 SfxPoolItem* SvxAutoKernItem::Create(SvStream& rStrm, sal_uInt16) const
1671 sal_uInt8 nState;
1672 rStrm.ReadUChar( nState );
1673 return new SvxAutoKernItem( nState, Which() );
1678 bool SvxAutoKernItem::GetPresentation
1680 SfxItemPresentation /*ePres*/,
1681 SfxMapUnit /*eCoreUnit*/,
1682 SfxMapUnit /*ePresUnit*/,
1683 OUString& rText, const IntlWrapper * /*pIntl*/
1684 ) const
1686 sal_uInt16 nId = RID_SVXITEMS_AUTOKERN_FALSE;
1688 if ( GetValue() )
1689 nId = RID_SVXITEMS_AUTOKERN_TRUE;
1690 rText = EE_RESSTR(nId);
1691 return true;
1694 // class SvxWordLineModeItem ---------------------------------------------
1696 SvxWordLineModeItem::SvxWordLineModeItem( const bool bWordLineMode,
1697 const sal_uInt16 nId ) :
1698 SfxBoolItem( nId, bWordLineMode )
1704 SfxPoolItem* SvxWordLineModeItem::Clone( SfxItemPool * ) const
1706 return new SvxWordLineModeItem( *this );
1711 SvStream& SvxWordLineModeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1713 rStrm.WriteBool( GetValue() );
1714 return rStrm;
1719 SfxPoolItem* SvxWordLineModeItem::Create(SvStream& rStrm, sal_uInt16) const
1721 bool bValue;
1722 rStrm.ReadCharAsBool( bValue );
1723 return new SvxWordLineModeItem( bValue, Which() );
1728 bool SvxWordLineModeItem::GetPresentation
1730 SfxItemPresentation /*ePres*/,
1731 SfxMapUnit /*eCoreUnit*/,
1732 SfxMapUnit /*ePresUnit*/,
1733 OUString& rText, const IntlWrapper * /*pIntl*/
1734 ) const
1736 sal_uInt16 nId = RID_SVXITEMS_WORDLINE_FALSE;
1738 if ( GetValue() )
1739 nId = RID_SVXITEMS_WORDLINE_TRUE;
1740 rText = EE_RESSTR(nId);
1741 return true;
1744 // class SvxContourItem --------------------------------------------------
1746 SvxContourItem::SvxContourItem( const bool bContoured, const sal_uInt16 nId ) :
1747 SfxBoolItem( nId, bContoured )
1753 SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const
1755 return new SvxContourItem( *this );
1760 SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1762 rStrm.WriteBool( GetValue() );
1763 return rStrm;
1768 SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const
1770 bool bValue;
1771 rStrm.ReadCharAsBool( bValue );
1772 return new SvxContourItem( bValue, Which() );
1777 bool SvxContourItem::GetPresentation
1779 SfxItemPresentation /*ePres*/,
1780 SfxMapUnit /*eCoreUnit*/,
1781 SfxMapUnit /*ePresUnit*/,
1782 OUString& rText, const IntlWrapper * /*pIntl*/
1783 ) const
1785 sal_uInt16 nId = RID_SVXITEMS_CONTOUR_FALSE;
1787 if ( GetValue() )
1788 nId = RID_SVXITEMS_CONTOUR_TRUE;
1789 rText = EE_RESSTR(nId);
1790 return true;
1793 // class SvxPropSizeItem -------------------------------------------------
1795 SvxPropSizeItem::SvxPropSizeItem( const sal_uInt16 nPercent, const sal_uInt16 nId ) :
1796 SfxUInt16Item( nId, nPercent )
1802 SfxPoolItem* SvxPropSizeItem::Clone( SfxItemPool * ) const
1804 return new SvxPropSizeItem( *this );
1809 SvStream& SvxPropSizeItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
1811 rStrm.WriteUInt16( GetValue() );
1812 return rStrm;
1817 SfxPoolItem* SvxPropSizeItem::Create(SvStream& rStrm, sal_uInt16) const
1819 sal_uInt16 nSize;
1820 rStrm.ReadUInt16( nSize );
1821 return new SvxPropSizeItem( nSize, Which() );
1826 bool SvxPropSizeItem::GetPresentation
1828 SfxItemPresentation /*ePres*/,
1829 SfxMapUnit /*eCoreUnit*/,
1830 SfxMapUnit /*ePresUnit*/,
1831 OUString& rText, const IntlWrapper * /*pIntl*/
1832 ) const
1834 rText.clear();
1835 return false;
1838 // class SvxBackgroundColorItem -----------------------------------------
1840 SvxBackgroundColorItem::SvxBackgroundColorItem( const sal_uInt16 nId ) :
1841 SvxColorItem( nId )
1847 SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol,
1848 const sal_uInt16 nId ) :
1849 SvxColorItem( rCol, nId )
1853 SvxBackgroundColorItem::SvxBackgroundColorItem(SvStream& rStrm, const sal_uInt16 nId)
1854 : SvxColorItem(nId)
1856 Color aColor;
1857 aColor.Read(rStrm);
1858 SetValue(aColor);
1861 SvxBackgroundColorItem::SvxBackgroundColorItem( const SvxBackgroundColorItem& rCopy ) :
1862 SvxColorItem( rCopy )
1866 SfxPoolItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const
1868 return new SvxBackgroundColorItem(*this);
1871 SvStream& SvxBackgroundColorItem::Store(SvStream& rStrm, sal_uInt16) const
1873 GetValue().Write(rStrm);
1874 return rStrm;
1877 SfxPoolItem* SvxBackgroundColorItem::Create(SvStream& rStrm, sal_uInt16 ) const
1879 return new SvxBackgroundColorItem( rStrm, Which() );
1882 bool SvxBackgroundColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1884 nMemberId &= ~CONVERT_TWIPS;
1885 Color aColor = SvxColorItem::GetValue();
1887 switch( nMemberId )
1889 case MID_GRAPHIC_TRANSPARENT:
1891 rVal <<= Bool2Any (aColor.GetTransparency() == 0xff);
1892 break;
1894 default:
1896 rVal <<= (sal_Int32)(aColor.GetColor());
1897 break;
1900 return true;
1903 bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1905 nMemberId &= ~CONVERT_TWIPS;
1906 sal_Int32 nColor = 0;
1907 Color aColor = SvxColorItem::GetValue();
1909 switch( nMemberId )
1911 case MID_GRAPHIC_TRANSPARENT:
1913 aColor.SetTransparency( Any2Bool( rVal ) ? 0xff : 0 );
1914 SvxColorItem::SetValue( aColor );
1915 break;
1917 default:
1919 if(!(rVal >>= nColor))
1920 return false;
1921 SvxColorItem::SetValue( Color(nColor) );
1922 break;
1925 return true;
1928 // class SvxColorItem ----------------------------------------------------
1929 SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
1930 SfxPoolItem( nId ),
1931 mColor( COL_BLACK )
1935 SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
1936 SfxPoolItem( nId ),
1937 mColor( rCol )
1941 SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
1942 SfxPoolItem( nId )
1944 Color aColor;
1945 ReadColor( rStrm, aColor );
1946 mColor = aColor;
1949 SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) :
1950 SfxPoolItem( rCopy ),
1951 mColor( rCopy.mColor )
1955 SvxColorItem::~SvxColorItem()
1959 sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
1961 DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
1962 SOFFICE_FILEFORMAT_40==nFFVer ||
1963 SOFFICE_FILEFORMAT_50==nFFVer,
1964 "SvxColorItem: Is there a new file format? ");
1965 return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0;
1968 bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
1970 DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
1972 return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor;
1975 bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
1977 rVal <<= (sal_Int32)(mColor.GetColor());
1978 return true;
1981 bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
1983 sal_Int32 nColor = 0;
1984 if(!(rVal >>= nColor))
1985 return false;
1987 mColor.SetColor( nColor );
1988 return true;
1991 SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const
1993 return new SvxColorItem( *this );
1996 SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
1998 if( VERSION_USEAUTOCOLOR == nItemVersion &&
1999 COL_AUTO == mColor.GetColor() )
2000 WriteColor( rStrm, Color( COL_BLACK ) );
2001 else
2002 WriteColor( rStrm, mColor );
2003 return rStrm;
2006 SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const
2008 return new SvxColorItem( rStrm, Which() );
2011 bool SvxColorItem::GetPresentation
2013 SfxItemPresentation /*ePres*/,
2014 SfxMapUnit /*eCoreUnit*/,
2015 SfxMapUnit /*ePresUnit*/,
2016 OUString& rText, const IntlWrapper * /*pIntl*/
2017 ) const
2019 rText = ::GetColorString( mColor );
2020 return true;
2025 void SvxColorItem::SetValue( const Color& rNewCol )
2027 mColor = rNewCol;
2030 // class SvxCharSetColorItem ---------------------------------------------
2032 SvxCharSetColorItem::SvxCharSetColorItem( const sal_uInt16 nId ) :
2033 SvxColorItem( nId ),
2035 eFrom( RTL_TEXTENCODING_DONTKNOW )
2041 SvxCharSetColorItem::SvxCharSetColorItem( const Color& rCol,
2042 const rtl_TextEncoding _eFrom,
2043 const sal_uInt16 nId ) :
2044 SvxColorItem( rCol, nId ),
2046 eFrom( _eFrom )
2053 SfxPoolItem* SvxCharSetColorItem::Clone( SfxItemPool * ) const
2055 return new SvxCharSetColorItem( *this );
2060 SvStream& SvxCharSetColorItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2062 rStrm.WriteUChar( GetSOStoreTextEncoding(GetCharSet()) );
2063 WriteColor( rStrm, GetValue() );
2064 return rStrm;
2069 SfxPoolItem* SvxCharSetColorItem::Create(SvStream& rStrm, sal_uInt16) const
2071 sal_uInt8 cSet;
2072 Color aColor;
2073 rStrm.ReadUChar( cSet );
2074 ReadColor( rStrm, aColor );
2075 return new SvxCharSetColorItem( aColor, (rtl_TextEncoding)cSet, Which() );
2080 bool SvxCharSetColorItem::GetPresentation
2082 SfxItemPresentation /*ePres*/,
2083 SfxMapUnit /*eCoreUnit*/,
2084 SfxMapUnit /*ePresUnit*/,
2085 OUString& rText, const IntlWrapper * /*pIntl*/
2086 ) const
2088 rText.clear();
2089 return false;
2092 // class SvxKerningItem --------------------------------------------------
2094 SvxKerningItem::SvxKerningItem( const short nKern, const sal_uInt16 nId ) :
2095 SfxInt16Item( nId, nKern )
2101 SfxPoolItem* SvxKerningItem::Clone( SfxItemPool * ) const
2103 return new SvxKerningItem( *this );
2108 SvStream& SvxKerningItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2110 rStrm.WriteInt16( GetValue() );
2111 return rStrm;
2116 bool SvxKerningItem::ScaleMetrics( long nMult, long nDiv )
2118 SetValue( (sal_Int16)Scale( GetValue(), nMult, nDiv ) );
2119 return true;
2124 bool SvxKerningItem::HasMetrics() const
2126 return true;
2131 SfxPoolItem* SvxKerningItem::Create(SvStream& rStrm, sal_uInt16) const
2133 short nValue;
2134 rStrm.ReadInt16( nValue );
2135 return new SvxKerningItem( nValue, Which() );
2140 bool SvxKerningItem::GetPresentation
2142 SfxItemPresentation ePres,
2143 SfxMapUnit eCoreUnit,
2144 SfxMapUnit /*ePresUnit*/,
2145 OUString& rText, const IntlWrapper *pIntl
2146 ) const
2148 switch ( ePres )
2150 case SFX_ITEM_PRESENTATION_NAMELESS:
2151 rText = GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ) +
2152 " " + EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
2153 return true;
2154 case SFX_ITEM_PRESENTATION_COMPLETE:
2156 rText = EE_RESSTR(RID_SVXITEMS_KERNING_COMPLETE);
2157 sal_uInt16 nId = 0;
2159 if ( GetValue() > 0 )
2160 nId = RID_SVXITEMS_KERNING_EXPANDED;
2161 else if ( GetValue() < 0 )
2162 nId = RID_SVXITEMS_KERNING_CONDENSED;
2164 if ( nId )
2165 rText += EE_RESSTR(nId);
2166 rText = rText +
2167 GetMetricText( (long)GetValue(), eCoreUnit, SFX_MAPUNIT_POINT, pIntl ) +
2168 " " + EE_RESSTR(GetMetricId(SFX_MAPUNIT_POINT));
2169 return true;
2171 default: ; //prevent warning
2173 return false;
2176 bool SvxKerningItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2178 sal_Int16 nVal = GetValue();
2179 if(nMemberId & CONVERT_TWIPS)
2180 nVal = (sal_Int16)convertTwipToMm100(nVal);
2181 rVal <<= nVal;
2182 return true;
2185 bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
2187 sal_Int16 nVal = sal_Int16();
2188 if(!(rVal >>= nVal))
2189 return false;
2190 if(nMemberId & CONVERT_TWIPS)
2191 nVal = (sal_Int16)convertMm100ToTwip(nVal);
2192 SetValue(nVal);
2193 return true;
2196 // class SvxCaseMapItem --------------------------------------------------
2198 SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) :
2199 SfxEnumItem( nId, (sal_uInt16)eMap )
2205 sal_uInt16 SvxCaseMapItem::GetValueCount() const
2207 return SVX_CASEMAP_END; // SVX_CASEMAP_KAPITAELCHEN + 1
2212 SfxPoolItem* SvxCaseMapItem::Clone( SfxItemPool * ) const
2214 return new SvxCaseMapItem( *this );
2219 SvStream& SvxCaseMapItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2221 rStrm.WriteUChar( GetValue() );
2222 return rStrm;
2227 SfxPoolItem* SvxCaseMapItem::Create(SvStream& rStrm, sal_uInt16) const
2229 sal_uInt8 cMap;
2230 rStrm.ReadUChar( cMap );
2231 return new SvxCaseMapItem( (const SvxCaseMap)cMap, Which() );
2236 bool SvxCaseMapItem::GetPresentation
2238 SfxItemPresentation /*ePres*/,
2239 SfxMapUnit /*eCoreUnit*/,
2240 SfxMapUnit /*ePresUnit*/,
2241 OUString& rText, const IntlWrapper * /*pIntl*/
2242 ) const
2244 rText = GetValueTextByPos( GetValue() );
2245 return true;
2250 OUString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos ) const
2252 DBG_ASSERT( nPos < (sal_uInt16)SVX_CASEMAP_END, "enum overflow!" );
2253 return EE_RESSTR(RID_SVXITEMS_CASEMAP_BEGIN + nPos);
2256 bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
2258 sal_Int16 nRet = style::CaseMap::NONE;
2259 switch( GetValue() )
2261 case SVX_CASEMAP_VERSALIEN : nRet = style::CaseMap::UPPERCASE; break;
2262 case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break;
2263 case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break;
2264 case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break;
2266 rVal <<= (sal_Int16)(nRet);
2267 return true;
2270 bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
2272 sal_uInt16 nVal = sal_uInt16();
2273 if(!(rVal >>= nVal))
2274 return false;
2276 switch( nVal )
2278 case style::CaseMap::NONE : nVal = SVX_CASEMAP_NOT_MAPPED ; break;
2279 case style::CaseMap::UPPERCASE: nVal = SVX_CASEMAP_VERSALIEN ; break;
2280 case style::CaseMap::LOWERCASE: nVal = SVX_CASEMAP_GEMEINE ; break;
2281 case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break;
2282 case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break;
2284 SetValue(nVal);
2285 return true;
2288 // class SvxEscapementItem -----------------------------------------------
2290 SvxEscapementItem::SvxEscapementItem( const sal_uInt16 nId ) :
2291 SfxEnumItemInterface( nId ),
2293 nEsc ( 0 ),
2294 nProp ( 100 )
2300 SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape,
2301 const sal_uInt16 nId ) :
2302 SfxEnumItemInterface( nId ),
2303 nProp( 100 )
2305 SetEscapement( eEscape );
2306 if( nEsc )
2307 nProp = 58;
2312 SvxEscapementItem::SvxEscapementItem( const short _nEsc,
2313 const sal_uInt8 _nProp,
2314 const sal_uInt16 nId ) :
2315 SfxEnumItemInterface( nId ),
2316 nEsc ( _nEsc ),
2317 nProp ( _nProp )
2323 bool SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const
2325 DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
2327 return( nEsc == static_cast<const SvxEscapementItem&>(rAttr).nEsc &&
2328 nProp == static_cast<const SvxEscapementItem&>(rAttr).nProp );
2333 SfxPoolItem* SvxEscapementItem::Clone( SfxItemPool * ) const
2335 return new SvxEscapementItem( *this );
2340 SvStream& SvxEscapementItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2342 short _nEsc = GetEsc();
2343 if( SOFFICE_FILEFORMAT_31 == rStrm.GetVersion() )
2345 if( DFLT_ESC_AUTO_SUPER == _nEsc )
2346 _nEsc = DFLT_ESC_SUPER;
2347 else if( DFLT_ESC_AUTO_SUB == _nEsc )
2348 _nEsc = DFLT_ESC_SUB;
2350 rStrm.WriteUChar( GetProp() )
2351 .WriteInt16( _nEsc );
2352 return rStrm;
2357 SfxPoolItem* SvxEscapementItem::Create(SvStream& rStrm, sal_uInt16) const
2359 sal_uInt8 _nProp;
2360 short _nEsc;
2361 rStrm.ReadUChar( _nProp ).ReadInt16( _nEsc );
2362 return new SvxEscapementItem( _nEsc, _nProp, Which() );
2367 sal_uInt16 SvxEscapementItem::GetValueCount() const
2369 return SVX_ESCAPEMENT_END; // SVX_ESCAPEMENT_SUBSCRIPT + 1
2374 bool SvxEscapementItem::GetPresentation
2376 SfxItemPresentation /*ePres*/,
2377 SfxMapUnit /*eCoreUnit*/,
2378 SfxMapUnit /*ePresUnit*/,
2379 OUString& rText, const IntlWrapper * /*pIntl*/
2380 ) const
2382 rText = GetValueTextByPos( GetEnumValue() );
2384 if ( nEsc != 0 )
2386 if( DFLT_ESC_AUTO_SUPER == nEsc || DFLT_ESC_AUTO_SUB == nEsc )
2387 rText += EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO);
2388 else
2389 rText = rText + OUString::number( nEsc ) + "%";
2391 return true;
2396 OUString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos ) const
2398 DBG_ASSERT( nPos < (sal_uInt16)SVX_ESCAPEMENT_END, "enum overflow!" );
2399 return EE_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN + nPos);
2404 sal_uInt16 SvxEscapementItem::GetEnumValue() const
2406 if ( nEsc < 0 )
2407 return SVX_ESCAPEMENT_SUBSCRIPT;
2408 else if ( nEsc > 0 )
2409 return SVX_ESCAPEMENT_SUPERSCRIPT;
2410 return SVX_ESCAPEMENT_OFF;
2415 void SvxEscapementItem::SetEnumValue( sal_uInt16 nVal )
2417 SetEscapement( (const SvxEscapement)nVal );
2420 bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2422 nMemberId &= ~CONVERT_TWIPS;
2423 switch(nMemberId)
2425 case MID_ESC:
2426 rVal <<= (sal_Int16)(nEsc);
2427 break;
2428 case MID_ESC_HEIGHT:
2429 rVal <<= (sal_Int8)(nProp);
2430 break;
2431 case MID_AUTO_ESC:
2432 rVal = Bool2Any(DFLT_ESC_AUTO_SUB == nEsc || DFLT_ESC_AUTO_SUPER == nEsc);
2433 break;
2435 return true;
2438 bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2440 nMemberId &= ~CONVERT_TWIPS;
2441 switch(nMemberId)
2443 case MID_ESC:
2445 sal_Int16 nVal = sal_Int16();
2446 if( (rVal >>= nVal) && (std::abs(nVal) <= 101))
2447 nEsc = nVal;
2448 else
2449 return false;
2451 break;
2452 case MID_ESC_HEIGHT:
2454 sal_Int8 nVal = sal_Int8();
2455 if( (rVal >>= nVal) && (nVal <= 100))
2456 nProp = nVal;
2457 else
2458 return false;
2460 break;
2461 case MID_AUTO_ESC:
2463 bool bVal = Any2Bool(rVal);
2464 if(bVal)
2466 if(nEsc < 0)
2467 nEsc = DFLT_ESC_AUTO_SUB;
2468 else
2469 nEsc = DFLT_ESC_AUTO_SUPER;
2471 else
2472 if(DFLT_ESC_AUTO_SUPER == nEsc )
2473 --nEsc;
2474 else if(DFLT_ESC_AUTO_SUB == nEsc)
2475 ++nEsc;
2477 break;
2479 return true;
2482 // class SvxLanguageItem -------------------------------------------------
2484 SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId )
2485 : SfxEnumItem( nId , eLang )
2491 sal_uInt16 SvxLanguageItem::GetValueCount() const
2493 // #i50205# got rid of class International
2494 SAL_WARN( "editeng.items", "SvxLanguageItem::GetValueCount: supposed to return a count of what?");
2495 // FIXME: previously returned LANGUAGE_COUNT from tools/intn.hxx which was wrong anyway.
2496 // Could be SvtLanguageTable::GetEntryCount() (all locales with resource string)?
2497 // Could be LocaleDataWrapper::getInstalledLanguageTypes() (all locales with locale data)?
2498 return 0;
2503 SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const
2505 return new SvxLanguageItem( *this );
2510 SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2512 rStrm.WriteUInt16( GetValue() );
2513 return rStrm;
2518 SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const
2520 sal_uInt16 nValue;
2521 rStrm.ReadUInt16( nValue );
2522 return new SvxLanguageItem( (LanguageType)nValue, Which() );
2527 bool SvxLanguageItem::GetPresentation
2529 SfxItemPresentation /*ePres*/,
2530 SfxMapUnit /*eCoreUnit*/,
2531 SfxMapUnit /*ePresUnit*/,
2532 OUString& rText, const IntlWrapper * /*pIntl*/
2533 ) const
2535 rText = SvtLanguageTable::GetLanguageString( (LanguageType)GetValue() );
2536 return true;
2539 bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2541 nMemberId &= ~CONVERT_TWIPS;
2542 switch(nMemberId)
2544 case MID_LANG_INT: // for basic conversions!
2545 rVal <<= (sal_Int16)(GetValue());
2546 break;
2547 case MID_LANG_LOCALE:
2548 lang::Locale aRet( LanguageTag( GetValue()).getLocale( false));
2549 rVal <<= aRet;
2550 break;
2552 return true;
2555 bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2557 nMemberId &= ~CONVERT_TWIPS;
2558 switch(nMemberId)
2560 case MID_LANG_INT: // for basic conversions!
2562 sal_Int32 nValue = 0;
2563 if(!(rVal >>= nValue))
2564 return false;
2566 SetValue((sal_Int16)nValue);
2568 break;
2569 case MID_LANG_LOCALE:
2571 lang::Locale aLocale;
2572 if(!(rVal >>= aLocale))
2573 return false;
2575 SetValue( LanguageTag::convertToLanguageType( aLocale, false));
2577 break;
2579 return true;
2582 // class SvxNoLinebreakItem ----------------------------------------------
2583 SvxNoLinebreakItem::SvxNoLinebreakItem( const bool bBreak, const sal_uInt16 nId ) :
2584 SfxBoolItem( nId, bBreak )
2590 SfxPoolItem* SvxNoLinebreakItem::Clone( SfxItemPool* ) const
2592 return new SvxNoLinebreakItem( *this );
2597 SvStream& SvxNoLinebreakItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2599 rStrm.WriteBool( GetValue() );
2600 return rStrm;
2605 SfxPoolItem* SvxNoLinebreakItem::Create(SvStream& rStrm, sal_uInt16) const
2607 bool bValue;
2608 rStrm.ReadCharAsBool( bValue );
2609 return new SvxNoLinebreakItem( bValue, Which() );
2614 bool SvxNoLinebreakItem::GetPresentation
2616 SfxItemPresentation /*ePres*/,
2617 SfxMapUnit /*eCoreUnit*/,
2618 SfxMapUnit /*ePresUnit*/,
2619 OUString& rText, const IntlWrapper * /*pIntl*/
2620 ) const
2622 rText.clear();
2623 return false;
2626 // class SvxNoHyphenItem -------------------------------------------------
2628 SvxNoHyphenItem::SvxNoHyphenItem( const bool bHyphen, const sal_uInt16 nId ) :
2629 SfxBoolItem( nId , bHyphen )
2635 SfxPoolItem* SvxNoHyphenItem::Clone( SfxItemPool* ) const
2637 return new SvxNoHyphenItem( *this );
2642 SvStream& SvxNoHyphenItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2644 rStrm.WriteBool( GetValue() );
2645 return rStrm;
2650 SfxPoolItem* SvxNoHyphenItem::Create( SvStream& rStrm, sal_uInt16 ) const
2652 bool bValue;
2653 rStrm.ReadCharAsBool( bValue );
2654 return new SvxNoHyphenItem( bValue, Which() );
2659 bool SvxNoHyphenItem::GetPresentation
2661 SfxItemPresentation /*ePres*/,
2662 SfxMapUnit /*eCoreUnit*/,
2663 SfxMapUnit /*ePresUnit*/,
2664 OUString& rText, const IntlWrapper * /*pIntl*/
2665 ) const
2667 rText.clear();
2668 return false;
2672 * Dummy item for ToolBox controls:
2677 // class SvxLineColorItem (== SvxColorItem)
2680 SvxLineColorItem::SvxLineColorItem( const sal_uInt16 nId ) :
2681 SvxColorItem( nId )
2687 SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem &rCopy ) :
2688 SvxColorItem( rCopy )
2694 SvxLineColorItem::~SvxLineColorItem()
2700 bool SvxLineColorItem::GetPresentation
2702 SfxItemPresentation ePres,
2703 SfxMapUnit eCoreUnit,
2704 SfxMapUnit ePresUnit,
2705 OUString& rText,
2706 const IntlWrapper * pIntlWrapper
2707 ) const
2709 return SvxColorItem::GetPresentation( ePres, eCoreUnit, ePresUnit,
2710 rText, pIntlWrapper );
2713 // class SvxBlinkItem -------------------------------------------------
2716 SvxBlinkItem::SvxBlinkItem( const bool bBlink, const sal_uInt16 nId ) :
2717 SfxBoolItem( nId, bBlink )
2723 SfxPoolItem* SvxBlinkItem::Clone( SfxItemPool * ) const
2725 return new SvxBlinkItem( *this );
2730 SvStream& SvxBlinkItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
2732 rStrm.WriteBool( GetValue() );
2733 return rStrm;
2738 SfxPoolItem* SvxBlinkItem::Create(SvStream& rStrm, sal_uInt16) const
2740 sal_uInt8 nState;
2741 rStrm.ReadUChar( nState );
2742 return new SvxBlinkItem( nState, Which() );
2747 bool SvxBlinkItem::GetPresentation
2749 SfxItemPresentation /*ePres*/,
2750 SfxMapUnit /*eCoreUnit*/,
2751 SfxMapUnit /*ePresUnit*/,
2752 OUString& rText, const IntlWrapper * /*pIntl*/
2753 ) const
2755 sal_uInt16 nId = RID_SVXITEMS_BLINK_FALSE;
2757 if ( GetValue() )
2758 nId = RID_SVXITEMS_BLINK_TRUE;
2759 rText = EE_RESSTR(nId);
2760 return true;
2763 // class SvxEmphaisMarkItem ---------------------------------------------------
2765 SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue,
2766 const sal_uInt16 nId )
2767 : SfxUInt16Item( nId, nValue )
2773 SfxPoolItem* SvxEmphasisMarkItem::Clone( SfxItemPool * ) const
2775 return new SvxEmphasisMarkItem( *this );
2780 SvStream& SvxEmphasisMarkItem::Store( SvStream& rStrm,
2781 sal_uInt16 /*nItemVersion*/ ) const
2783 rStrm.WriteUInt16( GetValue() );
2784 return rStrm;
2789 SfxPoolItem* SvxEmphasisMarkItem::Create( SvStream& rStrm, sal_uInt16 ) const
2791 sal_uInt16 nValue;
2792 rStrm.ReadUInt16( nValue );
2793 return new SvxEmphasisMarkItem( (FontEmphasisMark)nValue, Which() );
2798 bool SvxEmphasisMarkItem::GetPresentation
2800 SfxItemPresentation /*ePres*/,
2801 SfxMapUnit /*eCoreUnit*/,
2802 SfxMapUnit /*ePresUnit*/,
2803 OUString& rText,
2804 const IntlWrapper * /*pIntl*/
2805 ) const
2807 sal_uInt16 nVal = GetValue();
2808 rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE +
2809 ( EMPHASISMARK_STYLE & nVal ));
2810 sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal )
2811 ? RID_SVXITEMS_EMPHASIS_ABOVE_POS
2812 : ( EMPHASISMARK_POS_BELOW & nVal )
2813 ? RID_SVXITEMS_EMPHASIS_BELOW_POS
2814 : 0;
2815 if( nId )
2816 rText += EE_RESSTR( nId );
2817 return true;
2822 bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2824 nMemberId &= ~CONVERT_TWIPS;
2825 switch( nMemberId )
2827 case MID_EMPHASIS:
2829 sal_Int16 nValue = GetValue();
2830 sal_Int16 nRet = 0;
2831 switch(nValue & EMPHASISMARK_STYLE)
2833 case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break;
2834 case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break;
2835 case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break;
2836 case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break;
2837 case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break;
2839 if(nRet && nValue & EMPHASISMARK_POS_BELOW)
2840 nRet += 10;
2841 rVal <<= nRet;
2843 break;
2845 return true;
2848 bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2850 nMemberId &= ~CONVERT_TWIPS;
2851 bool bRet = true;
2852 switch( nMemberId )
2854 case MID_EMPHASIS:
2856 sal_Int32 nValue = -1;
2857 rVal >>= nValue;
2858 switch(nValue)
2860 case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break;
2861 case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break;
2862 case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break;
2863 case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break;
2864 case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break;
2865 case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break;
2866 case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break;
2867 case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break;
2868 case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break;
2869 default: return false;
2871 SetValue( (sal_Int16)nValue );
2873 break;
2875 return bRet;
2878 sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const
2880 DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
2881 SOFFICE_FILEFORMAT_40==nFFVer ||
2882 SOFFICE_FILEFORMAT_50==nFFVer,
2883 "SvxEmphasisMarkItem: Is there a new file format? ");
2885 return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
2889 /*************************************************************************
2890 |* class SvxTwoLinesItem
2891 *************************************************************************/
2893 SvxTwoLinesItem::SvxTwoLinesItem( bool bFlag, sal_Unicode nStartBracket,
2894 sal_Unicode nEndBracket, sal_uInt16 nW )
2895 : SfxPoolItem( nW ),
2896 cStartBracket( nStartBracket ), cEndBracket( nEndBracket ), bOn( bFlag )
2900 SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem& rAttr )
2901 : SfxPoolItem( rAttr.Which() ),
2902 cStartBracket( rAttr.cStartBracket ),
2903 cEndBracket( rAttr.cEndBracket ),
2904 bOn( rAttr.bOn )
2908 SvxTwoLinesItem::~SvxTwoLinesItem()
2912 bool SvxTwoLinesItem::operator==( const SfxPoolItem& rAttr ) const
2914 DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "not equal attribute types" );
2915 return bOn == static_cast<const SvxTwoLinesItem&>(rAttr).bOn &&
2916 cStartBracket == static_cast<const SvxTwoLinesItem&>(rAttr).cStartBracket &&
2917 cEndBracket == static_cast<const SvxTwoLinesItem&>(rAttr).cEndBracket;
2920 SfxPoolItem* SvxTwoLinesItem::Clone( SfxItemPool* ) const
2922 return new SvxTwoLinesItem( *this );
2925 bool SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any& rVal,
2926 sal_uInt8 nMemberId ) const
2928 nMemberId &= ~CONVERT_TWIPS;
2929 bool bRet = true;
2930 switch( nMemberId )
2932 case MID_TWOLINES:
2933 rVal = Bool2Any( bOn );
2934 break;
2935 case MID_START_BRACKET:
2937 OUString s;
2938 if( cStartBracket )
2939 s = OUString( cStartBracket );
2940 rVal <<= s;
2942 break;
2943 case MID_END_BRACKET:
2945 OUString s;
2946 if( cEndBracket )
2947 s = OUString( cEndBracket );
2948 rVal <<= s;
2950 break;
2951 default:
2952 bRet = false;
2953 break;
2955 return bRet;
2958 bool SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any& rVal,
2959 sal_uInt8 nMemberId )
2961 nMemberId &= ~CONVERT_TWIPS;
2962 bool bRet = false;
2963 OUString s;
2964 switch( nMemberId )
2966 case MID_TWOLINES:
2967 bOn = Any2Bool( rVal );
2968 bRet = true;
2969 break;
2970 case MID_START_BRACKET:
2971 if( rVal >>= s )
2973 cStartBracket = s.isEmpty() ? 0 : s[ 0 ];
2974 bRet = true;
2976 break;
2977 case MID_END_BRACKET:
2978 if( rVal >>= s )
2980 cEndBracket = s.isEmpty() ? 0 : s[ 0 ];
2981 bRet = true;
2983 break;
2985 return bRet;
2988 bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/,
2989 SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
2990 OUString &rText, const IntlWrapper* /*pIntl*/ ) const
2992 if( !GetValue() )
2993 rText = EE_RESSTR( RID_SVXITEMS_TWOLINES_OFF );
2994 else
2996 rText = EE_RESSTR( RID_SVXITEMS_TWOLINES );
2997 if( GetStartBracket() )
2998 rText = OUString(GetStartBracket()) + rText;
2999 if( GetEndBracket() )
3000 rText += OUString(GetEndBracket());
3002 return true;
3006 SfxPoolItem* SvxTwoLinesItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/) const
3008 bool _bOn;
3009 sal_Unicode cStart, cEnd;
3010 rStrm.ReadCharAsBool( _bOn ).ReadUInt16( cStart ).ReadUInt16( cEnd );
3011 return new SvxTwoLinesItem( _bOn, cStart, cEnd, Which() );
3014 SvStream& SvxTwoLinesItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
3016 rStrm.WriteBool( GetValue() ).WriteUInt16( GetStartBracket() ).WriteUInt16( GetEndBracket() );
3017 return rStrm;
3020 sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const
3022 DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
3023 SOFFICE_FILEFORMAT_40==nFFVer ||
3024 SOFFICE_FILEFORMAT_50==nFFVer,
3025 "SvxTwoLinesItem: Gibt es ein neues Fileformat?" );
3027 return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3031 /*************************************************************************
3032 |* class SvxCharRotateItem
3033 *************************************************************************/
3035 SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue,
3036 bool bFitIntoLine,
3037 const sal_uInt16 nW )
3038 : SfxUInt16Item( nW, nValue ), bFitToLine( bFitIntoLine )
3042 SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const
3044 return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() );
3047 SfxPoolItem* SvxCharRotateItem::Create( SvStream& rStrm, sal_uInt16 ) const
3049 sal_uInt16 nVal;
3050 bool b;
3051 rStrm.ReadUInt16( nVal ).ReadCharAsBool( b );
3052 return new SvxCharRotateItem( nVal, b, Which() );
3055 SvStream& SvxCharRotateItem::Store( SvStream & rStrm, sal_uInt16 ) const
3057 bool bFlag = IsFitToLine();
3058 rStrm.WriteUInt16( GetValue() ).WriteBool( bFlag );
3059 return rStrm;
3062 sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const
3064 return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3067 bool SvxCharRotateItem::GetPresentation(
3068 SfxItemPresentation /*ePres*/,
3069 SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
3070 OUString &rText, const IntlWrapper* ) const
3072 if( !GetValue() )
3073 rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE_OFF );
3074 else
3076 rText = EE_RESSTR( RID_SVXITEMS_CHARROTATE );
3077 rText = rText.replaceFirst( "$(ARG1)",
3078 OUString::number( GetValue() / 10 ));
3079 if( IsFitToLine() )
3080 rText += EE_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE );
3082 return true;
3085 bool SvxCharRotateItem::QueryValue( com::sun::star::uno::Any& rVal,
3086 sal_uInt8 nMemberId ) const
3088 nMemberId &= ~CONVERT_TWIPS;
3089 bool bRet = true;
3090 switch( nMemberId )
3092 case MID_ROTATE:
3093 rVal <<= (sal_Int16)GetValue();
3094 break;
3095 case MID_FITTOLINE:
3096 rVal = Bool2Any( IsFitToLine() );
3097 break;
3098 default:
3099 bRet = false;
3100 break;
3102 return bRet;
3105 bool SvxCharRotateItem::PutValue( const com::sun::star::uno::Any& rVal,
3106 sal_uInt8 nMemberId )
3108 nMemberId &= ~CONVERT_TWIPS;
3109 bool bRet = true;
3110 switch( nMemberId )
3112 case MID_ROTATE:
3114 sal_Int16 nVal = 0;
3115 if((rVal >>= nVal) && (0 == nVal || 900 == nVal || 2700 == nVal))
3116 SetValue( (sal_uInt16)nVal );
3117 else
3118 bRet = false;
3119 break;
3122 case MID_FITTOLINE:
3123 SetFitToLine( Any2Bool( rVal ) );
3124 break;
3125 default:
3126 bRet = false;
3128 return bRet;
3131 bool SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const
3133 DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
3134 return SfxUInt16Item::operator==( rItem ) &&
3135 IsFitToLine() == static_cast<const SvxCharRotateItem&>(rItem).IsFitToLine();
3138 void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const
3140 xmlTextWriterStartElement(pWriter, BAD_CAST("svxCharRotateItem"));
3141 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
3142 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
3143 xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fitToLine"), BAD_CAST(OString::boolean(IsFitToLine()).getStr()));
3144 xmlTextWriterEndElement(pWriter);
3147 /*************************************************************************
3148 |* class SvxCharScaleItem
3149 *************************************************************************/
3151 SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue,
3152 const sal_uInt16 nW )
3153 : SfxUInt16Item( nW, nValue )
3157 SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const
3159 return new SvxCharScaleWidthItem( GetValue(), Which() );
3162 SfxPoolItem* SvxCharScaleWidthItem::Create( SvStream& rStrm, sal_uInt16 ) const
3164 sal_uInt16 nVal;
3165 rStrm.ReadUInt16( nVal );
3166 SvxCharScaleWidthItem* pItem = new SvxCharScaleWidthItem( nVal, Which() );
3168 if ( Which() == EE_CHAR_FONTWIDTH )
3170 // Was a SvxFontWidthItem in 5.2
3171 // sal_uInt16 nFixWidth, sal_uInt16 nPropWidth.
3172 // nFixWidth has never been used...
3173 rStrm.ReadUInt16( nVal );
3174 sal_uInt16 nTest;
3175 rStrm.ReadUInt16( nTest );
3176 if ( nTest == 0x1234 )
3177 pItem->SetValue( nVal );
3178 else
3179 rStrm.SeekRel( -2*(long)sizeof(sal_uInt16) );
3182 return pItem;
3185 SvStream& SvxCharScaleWidthItem::Store( SvStream& rStream, sal_uInt16 nVer ) const
3187 SvStream& rRet = SfxUInt16Item::Store( rStream, nVer );
3188 if ( Which() == EE_CHAR_FONTWIDTH )
3190 // see comment in Create()....
3191 rRet.SeekRel( -1*(long)sizeof(sal_uInt16) );
3192 rRet.WriteUInt16( 0 );
3193 rRet.WriteUInt16( GetValue() );
3194 // Really ugly, but not a problem for reading the doc in 5.2
3195 rRet.WriteUInt16( 0x1234 );
3197 return rRet;
3201 sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const
3203 return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3206 bool SvxCharScaleWidthItem::GetPresentation(
3207 SfxItemPresentation /*ePres*/,
3208 SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
3209 OUString &rText, const IntlWrapper* ) const
3211 if( !GetValue() )
3212 rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE_OFF );
3213 else
3215 rText = EE_RESSTR( RID_SVXITEMS_CHARSCALE );
3216 rText = rText.replaceFirst( "$(ARG1)",
3217 OUString::number( GetValue() ));
3219 return true;
3222 bool SvxCharScaleWidthItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
3224 // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
3225 // where we still want this to be a sal_Int16
3226 sal_Int16 nValue = sal_Int16();
3227 if (rVal >>= nValue)
3229 SetValue( (sal_uInt16) nValue );
3230 return true;
3233 OSL_TRACE( "SvxCharScaleWidthItem::PutValue - Wrong type!" );
3234 return false;
3237 bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
3239 // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
3240 // where we still want this to be a sal_Int16
3241 rVal <<= (sal_Int16)GetValue();
3242 return true;
3245 /*************************************************************************
3246 |* class SvxCharReliefItem
3247 *************************************************************************/
3249 SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue,
3250 const sal_uInt16 nId )
3251 : SfxEnumItem( nId, (sal_uInt16)eValue )
3255 SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const
3257 return new SvxCharReliefItem( *this );
3260 SfxPoolItem* SvxCharReliefItem::Create(SvStream & rStrm, sal_uInt16) const
3262 sal_uInt16 nVal;
3263 rStrm.ReadUInt16( nVal );
3264 return new SvxCharReliefItem( (FontRelief)nVal, Which() );
3267 SvStream& SvxCharReliefItem::Store(SvStream & rStrm, sal_uInt16 /*nIVer*/) const
3269 sal_uInt16 nVal = GetValue();
3270 rStrm.WriteUInt16( nVal );
3271 return rStrm;
3274 sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const
3276 return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
3279 OUString SvxCharReliefItem::GetValueTextByPos( sal_uInt16 nPos ) const
3281 DBG_ASSERT( nPos < RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE,
3282 "enum overflow" );
3283 return EE_RESSTR(RID_SVXITEMS_RELIEF_BEGIN + nPos);
3286 sal_uInt16 SvxCharReliefItem::GetValueCount() const
3288 return RID_SVXITEMS_RELIEF_ENGRAVED - RID_SVXITEMS_RELIEF_NONE;
3291 bool SvxCharReliefItem::GetPresentation
3293 SfxItemPresentation /*ePres*/,
3294 SfxMapUnit /*eCoreUnit*/,
3295 SfxMapUnit /*ePresUnit*/,
3296 OUString& rText, const IntlWrapper * /*pIntl*/
3297 ) const
3299 rText = GetValueTextByPos( GetValue() );
3300 return true;
3303 bool SvxCharReliefItem::PutValue( const com::sun::star::uno::Any& rVal,
3304 sal_uInt8 nMemberId )
3306 nMemberId &= ~CONVERT_TWIPS;
3307 bool bRet = true;
3308 switch( nMemberId )
3310 case MID_RELIEF:
3312 sal_Int16 nVal = -1;
3313 rVal >>= nVal;
3314 if(nVal >= 0 && nVal <= RELIEF_ENGRAVED)
3315 SetValue( (sal_uInt16)nVal );
3316 else
3317 bRet = false;
3319 break;
3320 default:
3321 bRet = false;
3322 break;
3324 return bRet;
3327 bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal,
3328 sal_uInt8 nMemberId ) const
3330 nMemberId &= ~CONVERT_TWIPS;
3331 bool bRet = true;
3332 switch( nMemberId )
3334 case MID_RELIEF:
3335 rVal <<= (sal_Int16)GetValue();
3336 break;
3337 default:
3338 bRet = false;
3339 break;
3341 return bRet;
3344 /*************************************************************************
3345 |* class SvxScriptTypeItemItem
3346 *************************************************************************/
3348 SvxScriptTypeItem::SvxScriptTypeItem( SvtScriptType nType )
3349 : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, static_cast<sal_uInt16>(nType) )
3352 SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const
3354 return new SvxScriptTypeItem( static_cast<SvtScriptType>(GetValue()) );
3357 /*************************************************************************
3358 |* class SvxScriptSetItem
3359 *************************************************************************/
3361 SvxScriptSetItem::SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool )
3362 : SfxSetItem( nSlotId, new SfxItemSet( rPool,
3363 SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONT ))
3365 sal_uInt16 nLatin, nAsian, nComplex;
3366 GetWhichIds( nLatin, nAsian, nComplex );
3367 GetItemSet().MergeRange( nLatin, nLatin );
3368 GetItemSet().MergeRange( nAsian, nAsian );
3369 GetItemSet().MergeRange( nComplex, nComplex );
3370 GetItemSet().MergeRange( SID_ATTR_CHAR_SCRIPTTYPE, SID_ATTR_CHAR_SCRIPTTYPE );
3373 SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const
3375 SvxScriptSetItem* p = new SvxScriptSetItem( Which(), *GetItemSet().GetPool() );
3376 p->GetItemSet().Put( GetItemSet(), false );
3377 return p;
3380 SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const
3382 return 0;
3385 const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet(
3386 const SfxItemSet& rSet, sal_uInt16 nId )
3388 const SfxPoolItem* pI;
3389 SfxItemState eSt = rSet.GetItemState( nId, false, &pI );
3390 if( SfxItemState::SET != eSt )
3391 pI = SfxItemState::DEFAULT == eSt ? &rSet.Get( nId ) : 0;
3392 return pI;
3395 const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, SvtScriptType nScript )
3397 sal_uInt16 nLatin, nAsian, nComplex;
3398 GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex );
3400 const SfxPoolItem *pRet, *pAsn, *pCmplx;
3401 if (nScript == SvtScriptType::ASIAN)
3403 pRet = GetItemOfScriptSet( rSet, nAsian );
3404 } else if (nScript == SvtScriptType::COMPLEX)
3406 pRet = GetItemOfScriptSet( rSet, nComplex );
3407 } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::ASIAN))
3409 if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3410 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
3411 *pRet != *pAsn )
3412 pRet = 0;
3413 } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::COMPLEX))
3415 if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3416 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3417 *pRet != *pCmplx )
3418 pRet = 0;
3419 } else if (nScript == (SvtScriptType::ASIAN|SvtScriptType::COMPLEX))
3421 if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) ||
3422 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3423 *pRet != *pCmplx )
3424 pRet = 0;
3425 } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::ASIAN|SvtScriptType::COMPLEX))
3427 if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
3428 0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
3429 0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
3430 *pRet != *pAsn || *pRet != *pCmplx )
3431 pRet = 0;
3432 } else {
3433 //no one valid -> match to latin
3434 pRet = GetItemOfScriptSet( rSet, nLatin );
3436 return pRet;
3439 const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( SvtScriptType nScript ) const
3441 return GetItemOfScript( Which(), GetItemSet(), nScript );
3444 void SvxScriptSetItem::PutItemForScriptType( SvtScriptType nScriptType,
3445 const SfxPoolItem& rItem )
3447 sal_uInt16 nLatin, nAsian, nComplex;
3448 GetWhichIds( nLatin, nAsian, nComplex );
3450 SfxPoolItem* pCpy = rItem.Clone();
3451 if( SvtScriptType::LATIN & nScriptType )
3453 pCpy->SetWhich( nLatin );
3454 GetItemSet().Put( *pCpy );
3456 if( SvtScriptType::ASIAN & nScriptType )
3458 pCpy->SetWhich( nAsian );
3459 GetItemSet().Put( *pCpy );
3461 if( SvtScriptType::COMPLEX & nScriptType )
3463 pCpy->SetWhich( nComplex );
3464 GetItemSet().Put( *pCpy );
3466 delete pCpy;
3469 void SvxScriptSetItem::GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex )
3471 const SfxItemPool& rPool = *rSet.GetPool();
3472 GetSlotIds( nSlotId, rLatin, rAsian, rComplex );
3473 rLatin = rPool.GetWhich( rLatin );
3474 rAsian = rPool.GetWhich( rAsian );
3475 rComplex = rPool.GetWhich( rComplex );
3478 void SvxScriptSetItem::GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
3479 sal_uInt16& rComplex ) const
3481 GetWhichIds( Which(), GetItemSet(), rLatin, rAsian, rComplex );
3484 void SvxScriptSetItem::GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin,
3485 sal_uInt16& rAsian, sal_uInt16& rComplex )
3487 switch( nSlotId )
3489 default:
3490 DBG_ASSERT( false, "wrong SlotId for class SvxScriptSetItem" );
3491 // no break - default to font - Id Range !!
3493 case SID_ATTR_CHAR_FONT:
3494 rLatin = SID_ATTR_CHAR_FONT;
3495 rAsian = SID_ATTR_CHAR_CJK_FONT;
3496 rComplex = SID_ATTR_CHAR_CTL_FONT;
3497 break;
3498 case SID_ATTR_CHAR_FONTHEIGHT:
3499 rLatin = SID_ATTR_CHAR_FONTHEIGHT;
3500 rAsian = SID_ATTR_CHAR_CJK_FONTHEIGHT;
3501 rComplex = SID_ATTR_CHAR_CTL_FONTHEIGHT;
3502 break;
3503 case SID_ATTR_CHAR_WEIGHT:
3504 rLatin = SID_ATTR_CHAR_WEIGHT;
3505 rAsian = SID_ATTR_CHAR_CJK_WEIGHT;
3506 rComplex = SID_ATTR_CHAR_CTL_WEIGHT;
3507 break;
3508 case SID_ATTR_CHAR_POSTURE:
3509 rLatin = SID_ATTR_CHAR_POSTURE;
3510 rAsian = SID_ATTR_CHAR_CJK_POSTURE;
3511 rComplex = SID_ATTR_CHAR_CTL_POSTURE;
3512 break;
3513 case SID_ATTR_CHAR_LANGUAGE:
3514 rLatin = SID_ATTR_CHAR_LANGUAGE;
3515 rAsian = SID_ATTR_CHAR_CJK_LANGUAGE;
3516 rComplex = SID_ATTR_CHAR_CTL_LANGUAGE;
3517 break;
3518 case SID_ATTR_CHAR_SHADOWED:
3519 rLatin = SID_ATTR_CHAR_SHADOWED;
3520 rAsian = SID_ATTR_CHAR_SHADOWED;
3521 rComplex = SID_ATTR_CHAR_SHADOWED;
3522 break;
3523 case SID_ATTR_CHAR_STRIKEOUT:
3524 rLatin = SID_ATTR_CHAR_STRIKEOUT;
3525 rAsian = SID_ATTR_CHAR_STRIKEOUT;
3526 rComplex = SID_ATTR_CHAR_STRIKEOUT;
3527 break;
3531 void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex )
3533 const sal_uInt16 nItemCnt = 3;
3535 static struct
3537 DefaultFontType nFontType;
3538 sal_uInt16 nLanguage;
3540 aOutTypeArr[ nItemCnt ] =
3542 { DefaultFontType::LATIN_TEXT, LANGUAGE_ENGLISH_US },
3543 { DefaultFontType::CJK_TEXT, LANGUAGE_ENGLISH_US },
3544 { DefaultFontType::CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA }
3547 SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex };
3549 for ( sal_uInt16 n = 0; n < nItemCnt; ++n )
3551 vcl::Font aFont( OutputDevice::GetDefaultFont( aOutTypeArr[ n ].nFontType,
3552 aOutTypeArr[ n ].nLanguage,
3553 GetDefaultFontFlags::OnlyOne, 0 ) );
3554 SvxFontItem* pItem = aItemArr[ n ];
3555 pItem->SetFamily( aFont.GetFamily() );
3556 pItem->SetFamilyName( aFont.GetName() );
3557 pItem->SetStyleName( OUString() );
3558 pItem->SetPitch( aFont.GetPitch());
3559 pItem->SetCharSet(aFont.GetCharSet());
3564 bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const
3566 rVal <<= ( (sal_uInt32)GetValue() );
3567 return true;
3570 bool SvxRsidItem::PutValue( const uno::Any& rVal, sal_uInt8 )
3572 sal_uInt32 nRsid = 0;
3573 if( !( rVal >>= nRsid ) )
3574 return false;
3576 SetValue( nRsid );
3577 return true;
3580 SfxPoolItem* SvxRsidItem::Clone( SfxItemPool * ) const
3582 return new SvxRsidItem( *this );
3585 SfxPoolItem* SvxRsidItem::Create(SvStream& rIn, sal_uInt16 ) const
3587 return new SvxRsidItem( rIn, Which() );
3590 void SvxRsidItem::dumpAsXml(xmlTextWriterPtr pWriter) const
3592 xmlTextWriterStartElement(pWriter, BAD_CAST("svxRsidItem"));
3593 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
3594 xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%" SAL_PRIuUINT32, GetValue());
3595 xmlTextWriterEndElement(pWriter);
3598 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */