1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: textitem.cxx,v $
10 * $Revision: 1.74.86.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
35 #include <com/sun/star/style/CaseMap.hpp>
36 #include <com/sun/star/awt/FontDescriptor.hpp>
37 #include <com/sun/star/frame/status/FontHeight.hpp>
38 #include <vcl/bitmapex.hxx>
39 #include <tools/stream.hxx>
40 #include <toolkit/unohlp.hxx>
42 #include <rtl/math.hxx>
44 #include <svx/eeitem.hxx>
46 #include <basic/sbx.hxx>
47 #define GLOBALOVERFLOW3
50 #include <svtools/memberid.hrc>
51 #include <svx/svxids.hrc>
52 #include <svx/svxitems.hrc>
53 #include <vcl/vclenum.hxx>
54 #include <tools/bigint.hxx>
55 #include <tools/tenccvt.hxx>
57 #include <rtl/ustring.hxx>
58 #include <i18npool/mslangid.hxx>
59 #include <svtools/itemset.hxx>
61 #include <svtools/langtab.hxx>
62 #include <svtools/itempool.hxx>
63 #include <svtools/ctrltool.hxx>
64 #include <vcl/settings.hxx>
65 #include <vcl/svapp.hxx>
66 #include <com/sun/star/style/CaseMap.hpp>
67 #include <com/sun/star/awt/SimpleFontMetric.hpp>
68 #include <com/sun/star/awt/FontWeight.hpp>
69 #include <com/sun/star/awt/FontSlant.hpp>
70 #include <com/sun/star/awt/CharSet.hpp>
71 #include <com/sun/star/awt/FontDescriptor.hpp>
72 #include <com/sun/star/awt/FontWidth.hpp>
73 #include <com/sun/star/awt/XFont.hpp>
74 #include <com/sun/star/awt/FontType.hpp>
75 #include <com/sun/star/awt/FontUnderline.hpp>
76 #include <com/sun/star/awt/FontStrikeout.hpp>
77 #include <com/sun/star/awt/FontFamily.hpp>
78 #include <com/sun/star/awt/FontPitch.hpp>
79 #include <com/sun/star/lang/Locale.hpp>
80 #include <com/sun/star/text/FontEmphasis.hpp>
81 #include <com/sun/star/i18n/ScriptType.hpp>
82 #include <svx/unomid.hxx>
85 #include "flstitem.hxx"
86 #include "fontitem.hxx"
87 #include <svx/postitem.hxx>
88 #include <svx/wghtitem.hxx>
89 #include <svx/fhgtitem.hxx>
90 #include "fwdtitem.hxx"
91 #include <svx/udlnitem.hxx>
92 #include <svx/crsditem.hxx>
93 #include <svx/shdditem.hxx>
94 #include <svx/akrnitem.hxx>
95 #include <svx/wrlmitem.hxx>
96 #include <svx/cntritem.hxx>
97 #include <svx/prszitem.hxx>
98 #include <svx/colritem.hxx>
99 #include <svx/cscoitem.hxx>
100 #include <svx/kernitem.hxx>
101 #include <svx/cmapitem.hxx>
102 #include <svx/escpitem.hxx>
103 #include <svx/langitem.hxx>
104 #include "nlbkitem.hxx"
105 #include <svx/nhypitem.hxx>
106 #include <svx/lcolitem.hxx>
107 #include <svx/blnkitem.hxx>
108 #include <svx/emphitem.hxx>
109 #include <svx/twolinesitem.hxx>
110 #include <svx/scripttypeitem.hxx>
111 #include <svx/charrotateitem.hxx>
112 #include <svx/charscaleitem.hxx>
113 #include <svx/charreliefitem.hxx>
114 #include <svx/itemtype.hxx>
115 #include <svx/dialmgr.hxx>
116 #include "dlgutil.hxx"
119 #include <tools/tenccvt.hxx>
121 #define STORE_UNICODE_MAGIC_MARKER 0xFE331188
123 using namespace ::rtl
;
124 using namespace ::com::sun::star
;
125 using namespace ::com::sun::star::text
;
127 // Konvertierung fuer UNO
128 #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
129 #define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
130 #define TWIP_TO_MM100_UNSIGNED(TWIP) ((((TWIP)*127L+36L)/72L))
131 #define MM100_TO_TWIP_UNSIGNED(MM100) ((((MM100)*72L+63L)/127L))
133 BOOL
SvxFontItem::bEnableStoreUnicodeNames
= FALSE
;
135 // STATIC DATA -----------------------------------------------------------
137 // -----------------------------------------------------------------------
139 TYPEINIT1(SvxFontListItem
, SfxPoolItem
);
140 TYPEINIT1_FACTORY(SvxFontItem
, SfxPoolItem
, new SvxFontItem(0));
141 TYPEINIT1_FACTORY(SvxPostureItem
, SfxEnumItem
, new SvxPostureItem(ITALIC_NONE
, 0));
142 TYPEINIT1_FACTORY(SvxWeightItem
, SfxEnumItem
, new SvxWeightItem(WEIGHT_NORMAL
, 0));
143 TYPEINIT1_FACTORY(SvxFontHeightItem
, SfxPoolItem
, new SvxFontHeightItem(240, 100, 0));
144 TYPEINIT1_FACTORY(SvxFontWidthItem
, SfxPoolItem
, new SvxFontWidthItem(0, 100, 0));
145 TYPEINIT1_FACTORY(SvxTextLineItem
, SfxEnumItem
, new SvxTextLineItem(UNDERLINE_NONE
, 0));
146 TYPEINIT1_FACTORY(SvxUnderlineItem
, SfxEnumItem
, new SvxUnderlineItem(UNDERLINE_NONE
, 0));
147 TYPEINIT1_FACTORY(SvxOverlineItem
, SfxEnumItem
, new SvxOverlineItem(UNDERLINE_NONE
, 0));
148 TYPEINIT1_FACTORY(SvxCrossedOutItem
, SfxEnumItem
, new SvxCrossedOutItem(STRIKEOUT_NONE
, 0));
149 TYPEINIT1_FACTORY(SvxShadowedItem
, SfxBoolItem
, new SvxShadowedItem(sal_False
, 0));
150 TYPEINIT1_FACTORY(SvxAutoKernItem
, SfxBoolItem
, new SvxAutoKernItem(sal_False
, 0));
151 TYPEINIT1_FACTORY(SvxWordLineModeItem
, SfxBoolItem
, new SvxWordLineModeItem(sal_False
, 0));
152 TYPEINIT1_FACTORY(SvxContourItem
, SfxBoolItem
, new SvxContourItem(sal_False
, 0));
153 TYPEINIT1_FACTORY(SvxPropSizeItem
, SfxUInt16Item
, new SvxPropSizeItem(100, 0));
154 TYPEINIT1_FACTORY(SvxColorItem
, SfxPoolItem
, new SvxColorItem(0));
155 TYPEINIT1_FACTORY(SvxCharSetColorItem
, SvxColorItem
, new SvxCharSetColorItem(0));
156 TYPEINIT1_FACTORY(SvxKerningItem
, SfxInt16Item
, new SvxKerningItem(0, 0));
157 TYPEINIT1_FACTORY(SvxCaseMapItem
, SfxEnumItem
, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED
, 0));
158 TYPEINIT1_FACTORY(SvxEscapementItem
, SfxPoolItem
, new SvxEscapementItem(0));
159 TYPEINIT1_FACTORY(SvxLanguageItem
, SfxEnumItem
, new SvxLanguageItem(LANGUAGE_GERMAN
, 0));
160 TYPEINIT1_FACTORY(SvxNoLinebreakItem
, SfxBoolItem
, new SvxNoLinebreakItem(sal_True
, 0));
161 TYPEINIT1_FACTORY(SvxNoHyphenItem
, SfxBoolItem
, new SvxNoHyphenItem(sal_True
, 0));
162 TYPEINIT1_FACTORY(SvxLineColorItem
, SvxColorItem
, new SvxLineColorItem(0));
163 TYPEINIT1_FACTORY(SvxBlinkItem
, SfxBoolItem
, new SvxBlinkItem(sal_False
, 0));
164 TYPEINIT1_FACTORY(SvxEmphasisMarkItem
, SfxUInt16Item
, new SvxEmphasisMarkItem(EMPHASISMARK_NONE
, 0));
165 TYPEINIT1_FACTORY(SvxTwoLinesItem
, SfxPoolItem
, new SvxTwoLinesItem(sal_True
, 0, 0, 0));
166 TYPEINIT1_FACTORY(SvxScriptTypeItem
, SfxUInt16Item
, new SvxScriptTypeItem
);
167 TYPEINIT1_FACTORY(SvxCharRotateItem
, SfxUInt16Item
, new SvxCharRotateItem(0, sal_False
, 0));
168 TYPEINIT1_FACTORY(SvxCharScaleWidthItem
, SfxUInt16Item
, new SvxCharScaleWidthItem(100, 0));
169 TYPEINIT1_FACTORY(SvxCharReliefItem
, SfxEnumItem
, new SvxCharReliefItem(RELIEF_NONE
, 0));
172 TYPEINIT1(SvxScriptSetItem
, SfxSetItem
);
175 // class SvxFontListItem -------------------------------------------------
177 SvxFontListItem::SvxFontListItem( const FontList
* pFontLst
,
180 pFontList( pFontLst
)
184 sal_Int32 nCount
= pFontList
->GetFontNameCount();
185 aFontNameSeq
.realloc( nCount
);
187 for ( USHORT i
= 0; i
< nCount
; i
++ )
188 aFontNameSeq
[i
] = pFontList
->GetFontName(i
).GetName();
192 // -----------------------------------------------------------------------
194 SvxFontListItem::SvxFontListItem( const SvxFontListItem
& rItem
) :
196 SfxPoolItem( rItem
),
197 pFontList( rItem
.GetFontList() ),
198 aFontNameSeq( rItem
.aFontNameSeq
)
202 // -----------------------------------------------------------------------
204 SfxPoolItem
* SvxFontListItem::Clone( SfxItemPool
* ) const
206 return new SvxFontListItem( *this );
209 // -----------------------------------------------------------------------
211 int SvxFontListItem::operator==( const SfxPoolItem
& rAttr
) const
213 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
215 return( pFontList
== ((SvxFontListItem
&)rAttr
).pFontList
);
218 sal_Bool
SvxFontListItem::QueryValue( com::sun::star::uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
220 rVal
<<= aFontNameSeq
;
224 //------------------------------------------------------------------------
226 SfxItemPresentation
SvxFontListItem::GetPresentation
228 SfxItemPresentation
/*ePres*/,
229 SfxMapUnit
/*eCoreUnit*/,
230 SfxMapUnit
/*ePresUnit*/,
231 XubString
& rText
, const IntlWrapper
* /*pIntl*/
235 return SFX_ITEM_PRESENTATION_NONE
;
238 // class SvxFontItem -----------------------------------------------------
240 SvxFontItem::SvxFontItem( const USHORT nId
) :
243 eFamily
= FAMILY_SWISS
;
244 ePitch
= PITCH_VARIABLE
;
245 eTextEncoding
= RTL_TEXTENCODING_DONTKNOW
;
248 // -----------------------------------------------------------------------
250 SvxFontItem::SvxFontItem( const FontFamily eFam
, const XubString
& aName
,
251 const XubString
& aStName
, const FontPitch eFontPitch
,
252 const rtl_TextEncoding eFontTextEncoding
, const USHORT nId
) :
261 eTextEncoding
= eFontTextEncoding
;
264 // -----------------------------------------------------------------------
266 sal_Bool
SvxFontItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
268 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
269 nMemberId
&= ~CONVERT_TWIPS
;
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
;
283 case MID_FONT_FAMILY_NAME
:
284 rVal
<<= OUString(aFamilyName
.GetBuffer());
286 case MID_FONT_STYLE_NAME
:
287 rVal
<<= OUString(aStyleName
.GetBuffer());
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;
295 // -----------------------------------------------------------------------
296 sal_Bool
SvxFontItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
298 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
299 nMemberId
&= ~CONVERT_TWIPS
;
304 com::sun::star::awt::FontDescriptor aFontDescriptor
;
305 if ( !( rVal
>>= aFontDescriptor
))
308 aFamilyName
= aFontDescriptor
.Name
;
309 aStyleName
= aFontDescriptor
.StyleName
;
310 eFamily
= (FontFamily
)aFontDescriptor
.Family
;
311 eTextEncoding
= (rtl_TextEncoding
)aFontDescriptor
.CharSet
;
312 ePitch
= (FontPitch
)aFontDescriptor
.Pitch
;
315 case MID_FONT_FAMILY_NAME
:
320 aFamilyName
= aStr
.getStr();
323 case MID_FONT_STYLE_NAME
:
328 aStyleName
= aStr
.getStr();
331 case MID_FONT_FAMILY
:
333 sal_Int16 nFamily
= sal_Int16();
334 if(!(rVal
>>= nFamily
))
336 eFamily
= (FontFamily
)nFamily
;
339 case MID_FONT_CHAR_SET
:
341 sal_Int16 nSet
= sal_Int16();
344 eTextEncoding
= (rtl_TextEncoding
)nSet
;
347 case MID_FONT_PITCH
:
349 sal_Int16 nPitch
= sal_Int16();
350 if(!(rVal
>>= nPitch
))
352 ePitch
= (FontPitch
)nPitch
;
359 // -----------------------------------------------------------------------
361 int SvxFontItem::operator==( const SfxPoolItem
& rAttr
) const
363 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
365 const SvxFontItem
& rItem
= (const SvxFontItem
&)rAttr
;
367 int bRet
= ( eFamily
== rItem
.eFamily
&&
368 aFamilyName
== rItem
.aFamilyName
&&
369 aStyleName
== rItem
.aStyleName
);
373 if ( ePitch
!= rItem
.ePitch
|| eTextEncoding
!= rItem
.eTextEncoding
)
376 DBG_WARNING( "FontItem::operator==(): nur Pitch oder rtl_TextEncoding unterschiedlich" );
382 // -----------------------------------------------------------------------
384 SfxPoolItem
* SvxFontItem::Clone( SfxItemPool
* ) const
386 return new SvxFontItem( *this );
389 // -----------------------------------------------------------------------
391 SvStream
& SvxFontItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
394 GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
395 GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 );
397 // #90477# rStrm << (BYTE) GetFamily()
398 // << (BYTE) GetPitch()
399 // << (BYTE)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() ) );
400 rStrm
<< (BYTE
) GetFamily() << (BYTE
) GetPitch()
401 << (BYTE
)(bToBats
? RTL_TEXTENCODING_SYMBOL
: GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16
)rStrm
.GetVersion()));
403 String
aStoreFamilyName( GetFamilyName() );
405 aStoreFamilyName
= String( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US
);
406 rStrm
.WriteByteString(aStoreFamilyName
);
407 rStrm
.WriteByteString(GetStyleName());
409 // #96441# Kach for EditEngine, only set while creating clipboard stream.
410 if ( bEnableStoreUnicodeNames
)
412 sal_uInt32 nMagic
= STORE_UNICODE_MAGIC_MARKER
;
414 rStrm
.WriteByteString( aStoreFamilyName
, RTL_TEXTENCODING_UNICODE
);
415 rStrm
.WriteByteString( GetStyleName(), RTL_TEXTENCODING_UNICODE
);
421 // -----------------------------------------------------------------------
423 SfxPoolItem
* SvxFontItem::Create(SvStream
& rStrm
, USHORT
) const
425 BYTE _eFamily
, eFontPitch
, eFontTextEncoding
;
426 String aName
, aStyle
;
429 rStrm
>> eFontTextEncoding
;
431 // UNICODE: rStrm >> aName;
432 rStrm
.ReadByteString(aName
);
434 // UNICODE: rStrm >> aStyle;
435 rStrm
.ReadByteString(aStyle
);
437 // Task 91008/90471: set the "correct" textencoding
438 eFontTextEncoding
= (BYTE
)GetSOLoadTextEncoding( eFontTextEncoding
, (USHORT
)rStrm
.GetVersion() );
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
;
444 // Check if we have stored unicode
445 sal_Size nStreamPos
= rStrm
.Tell();
446 sal_uInt32 nMagic
= STORE_UNICODE_MAGIC_MARKER
;
448 if ( nMagic
== STORE_UNICODE_MAGIC_MARKER
)
450 rStrm
.ReadByteString( aName
, RTL_TEXTENCODING_UNICODE
);
451 rStrm
.ReadByteString( aStyle
, RTL_TEXTENCODING_UNICODE
);
455 rStrm
.Seek( nStreamPos
);
460 return new SvxFontItem( (FontFamily
)_eFamily
, aName
, aStyle
,
461 (FontPitch
)eFontPitch
, (rtl_TextEncoding
)eFontTextEncoding
, Which() );
464 //------------------------------------------------------------------------
466 SfxItemPresentation
SvxFontItem::GetPresentation
468 SfxItemPresentation ePres
,
469 SfxMapUnit
/*eCoreUnit*/,
470 SfxMapUnit
/*ePresUnit*/,
471 XubString
& rText
, const IntlWrapper
* /*pIntl*/
476 case SFX_ITEM_PRESENTATION_NONE
:
479 case SFX_ITEM_PRESENTATION_NAMELESS
:
480 case SFX_ITEM_PRESENTATION_COMPLETE
:
483 default: ; //prevent warning
485 return SFX_ITEM_PRESENTATION_NONE
;
488 //------------------------------------------------------------------------
490 void SvxFontItem::EnableStoreUnicodeNames( BOOL bEnable
)
492 bEnableStoreUnicodeNames
= bEnable
;
495 // class SvxPostureItem --------------------------------------------------
497 SvxPostureItem::SvxPostureItem( const FontItalic ePosture
, const USHORT nId
) :
498 SfxEnumItem( nId
, (USHORT
)ePosture
)
502 // -----------------------------------------------------------------------
504 SfxPoolItem
* SvxPostureItem::Clone( SfxItemPool
* ) const
506 return new SvxPostureItem( *this );
509 // -----------------------------------------------------------------------
511 USHORT
SvxPostureItem::GetValueCount() const
513 return ITALIC_NORMAL
+ 1; // auch ITALIC_NONE geh"ort dazu
516 // -----------------------------------------------------------------------
518 SvStream
& SvxPostureItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
520 rStrm
<< (BYTE
)GetValue();
524 // -----------------------------------------------------------------------
526 SfxPoolItem
* SvxPostureItem::Create(SvStream
& rStrm
, USHORT
) const
530 return new SvxPostureItem( (const FontItalic
)nPosture
, Which() );
533 //------------------------------------------------------------------------
535 SfxItemPresentation
SvxPostureItem::GetPresentation
537 SfxItemPresentation ePres
,
538 SfxMapUnit
/*eCoreUnit*/,
539 SfxMapUnit
/*ePresUnit*/,
540 XubString
& rText
, const IntlWrapper
* /*pIntl*/
545 case SFX_ITEM_PRESENTATION_NONE
:
548 case SFX_ITEM_PRESENTATION_NAMELESS
:
549 case SFX_ITEM_PRESENTATION_COMPLETE
:
550 rText
= GetValueTextByPos( GetValue() );
552 default: ;//prevent warning
554 return SFX_ITEM_PRESENTATION_NONE
;
557 // -----------------------------------------------------------------------
559 XubString
SvxPostureItem::GetValueTextByPos( USHORT nPos
) const
561 DBG_ASSERT( nPos
<= (USHORT
)ITALIC_NORMAL
, "enum overflow!" );
564 FontItalic eItalic
= (FontItalic
)nPos
;
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
576 sTxt
= SVX_RESSTR( nId
);
581 /*-----------------13.03.98 14:28-------------------
583 --------------------------------------------------*/
584 sal_Bool
SvxPostureItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
586 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
587 nMemberId
&= ~CONVERT_TWIPS
;
591 rVal
= Bool2Any(GetBoolValue());
594 rVal
<<= (awt::FontSlant
)GetValue(); // Werte von awt::FontSlant und FontItalic sind gleich
599 /*-----------------13.03.98 14:28-------------------
601 --------------------------------------------------*/
602 sal_Bool
SvxPostureItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
604 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
605 nMemberId
&= ~CONVERT_TWIPS
;
609 SetBoolValue(Any2Bool(rVal
));
613 awt::FontSlant eSlant
;
614 if(!(rVal
>>= eSlant
))
616 sal_Int32 nValue
= 0;
617 if(!(rVal
>>= nValue
))
620 eSlant
= (awt::FontSlant
)nValue
;
622 SetValue((USHORT
)eSlant
);
627 // -----------------------------------------------------------------------
629 int SvxPostureItem::HasBoolValue() const
634 // -----------------------------------------------------------------------
636 sal_Bool
SvxPostureItem::GetBoolValue() const
638 return ( (FontItalic
)GetValue() >= ITALIC_OBLIQUE
);
641 // -----------------------------------------------------------------------
643 void SvxPostureItem::SetBoolValue( sal_Bool bVal
)
645 SetValue( (USHORT
)(bVal
? ITALIC_NORMAL
: ITALIC_NONE
) );
648 // class SvxWeightItem ---------------------------------------------------
650 SvxWeightItem::SvxWeightItem( const FontWeight eWght
, const USHORT nId
) :
651 SfxEnumItem( nId
, (USHORT
)eWght
)
657 // -----------------------------------------------------------------------
659 int SvxWeightItem::HasBoolValue() const
664 // -----------------------------------------------------------------------
666 sal_Bool
SvxWeightItem::GetBoolValue() const
668 return (FontWeight
)GetValue() >= WEIGHT_BOLD
;
671 // -----------------------------------------------------------------------
673 void SvxWeightItem::SetBoolValue( sal_Bool bVal
)
675 SetValue( (USHORT
)(bVal
? WEIGHT_BOLD
: WEIGHT_NORMAL
) );
678 // -----------------------------------------------------------------------
680 USHORT
SvxWeightItem::GetValueCount() const
682 return WEIGHT_BLACK
; // WEIGHT_DONTKNOW geh"ort nicht dazu
685 // -----------------------------------------------------------------------
687 SfxPoolItem
* SvxWeightItem::Clone( SfxItemPool
* ) const
689 return new SvxWeightItem( *this );
692 // -----------------------------------------------------------------------
694 SvStream
& SvxWeightItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
696 rStrm
<< (BYTE
)GetValue();
700 // -----------------------------------------------------------------------
702 SfxPoolItem
* SvxWeightItem::Create(SvStream
& rStrm
, USHORT
) const
706 return new SvxWeightItem( (FontWeight
)nWeight
, Which() );
709 //------------------------------------------------------------------------
711 SfxItemPresentation
SvxWeightItem::GetPresentation
713 SfxItemPresentation ePres
,
714 SfxMapUnit
/*eCoreUnit*/,
715 SfxMapUnit
/*ePresUnit*/,
716 XubString
& rText
, const IntlWrapper
* /*pIntl*/
721 case SFX_ITEM_PRESENTATION_NONE
:
724 case SFX_ITEM_PRESENTATION_NAMELESS
:
725 case SFX_ITEM_PRESENTATION_COMPLETE
:
726 rText
= GetValueTextByPos( GetValue() );
728 default: ;//prevent warning
730 return SFX_ITEM_PRESENTATION_NONE
;
733 // -----------------------------------------------------------------------
735 XubString
SvxWeightItem::GetValueTextByPos( USHORT nPos
) const
737 DBG_ASSERT( nPos
<= (USHORT
)WEIGHT_BLACK
, "enum overflow!" );
738 return SVX_RESSTR( RID_SVXITEMS_WEIGHT_BEGIN
+ nPos
);
741 /*-----------------13.03.98 14:18-------------------
743 --------------------------------------------------*/
744 sal_Bool
SvxWeightItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
746 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
747 nMemberId
&= ~CONVERT_TWIPS
;
751 rVal
= Bool2Any(GetBoolValue());
755 rVal
<<= (float)( VCLUnoHelper::ConvertFontWeight( (FontWeight
)GetValue() ) );
761 /*-----------------13.03.98 14:18-------------------
763 --------------------------------------------------*/
764 sal_Bool
SvxWeightItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
766 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
767 nMemberId
&= ~CONVERT_TWIPS
;
771 SetBoolValue(Any2Bool(rVal
));
776 if(!(rVal
>>= fValue
))
778 sal_Int32 nValue
= 0;
779 if(!(rVal
>>= nValue
))
781 fValue
= (float)nValue
;
783 SetValue( (USHORT
)VCLUnoHelper::ConvertFontWeight((float)fValue
) );
790 // class SvxFontHeightItem -----------------------------------------------
792 SvxFontHeightItem::SvxFontHeightItem( const ULONG nSz
,
797 SetHeight( nSz
,nPrp
); // mit den Prozenten rechnen
800 // -----------------------------------------------------------------------
802 SfxPoolItem
* SvxFontHeightItem::Clone( SfxItemPool
* ) const
804 return new SvxFontHeightItem( *this );
807 // -----------------------------------------------------------------------
809 SvStream
& SvxFontHeightItem::Store( SvStream
& rStrm
, USHORT nItemVersion
) const
811 rStrm
<< (USHORT
)GetHeight();
813 if( FONTHEIGHT_UNIT_VERSION
<= nItemVersion
)
814 rStrm
<< GetProp() << (USHORT
)GetPropUnit();
817 // JP 30.06.98: beim Export in alte Versionen geht die relative
818 // Angabe verloren, wenn es keine Prozentuale ist
819 USHORT _nProp
= GetProp();
820 if( SFX_MAPUNIT_RELATIVE
!= GetPropUnit() )
827 // -----------------------------------------------------------------------
829 SfxPoolItem
* SvxFontHeightItem::Create( SvStream
& rStrm
,
830 USHORT nVersion
) const
832 USHORT nsize
, nprop
= 0, nPropUnit
= SFX_MAPUNIT_RELATIVE
;
836 if( FONTHEIGHT_16_VERSION
<= nVersion
)
845 if( FONTHEIGHT_UNIT_VERSION
<= nVersion
)
848 SvxFontHeightItem
* pItem
= new SvxFontHeightItem( nsize
, 100, Which() );
849 pItem
->SetProp( nprop
, (SfxMapUnit
)nPropUnit
);
853 // -----------------------------------------------------------------------
855 int SvxFontHeightItem::operator==( const SfxPoolItem
& rItem
) const
857 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
858 return GetHeight() == ((SvxFontHeightItem
&)rItem
).GetHeight() &&
859 GetProp() == ((SvxFontHeightItem
&)rItem
).GetProp() &&
860 GetPropUnit() == ((SvxFontHeightItem
&)rItem
).GetPropUnit();
863 /*-----------------13.03.98 14:53-------------------
865 --------------------------------------------------*/
866 sal_Bool
SvxFontHeightItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
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.
871 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
872 nMemberId
&= ~CONVERT_TWIPS
;
877 ::com::sun::star::frame::status::FontHeight aFontHeight
;
879 // Point (also Twips) sind gefragt,
880 // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist
883 long nTwips
= bConvert
? nHeight
: MM100_TO_TWIP_UNSIGNED(nHeight
);
884 aFontHeight
.Height
= (float)( nTwips
/ 20.0 );
888 double fPoints
= MM100_TO_TWIP_UNSIGNED(nHeight
) / 20.0;
890 static_cast<float>(::rtl::math::round(fPoints
, 1));
891 aFontHeight
.Height
= fRoundPoints
;
894 aFontHeight
.Prop
= (sal_Int16
)(SFX_MAPUNIT_RELATIVE
== ePropUnit
? nProp
: 100);
896 float fRet
= (float)(short)nProp
;
899 case SFX_MAPUNIT_RELATIVE
:
902 case SFX_MAPUNIT_100TH_MM
:
903 fRet
= MM100_TO_TWIP(fRet
);
906 case SFX_MAPUNIT_POINT
:
909 case SFX_MAPUNIT_TWIP
:
912 default: ;//prevent warning
914 aFontHeight
.Diff
= fRet
;
915 rVal
<<= aFontHeight
;
920 // Point (also Twips) sind gefragt,
921 // also umrechnen, wenn CONVERT_TWIPS nicht gesetzt ist
924 long nTwips
= bConvert
? nHeight
: MM100_TO_TWIP_UNSIGNED(nHeight
);
925 rVal
<<= (float)( nTwips
/ 20.0 );
929 double fPoints
= MM100_TO_TWIP_UNSIGNED(nHeight
) / 20.0;
931 static_cast<float>(::rtl::math::round(fPoints
, 1));
932 rVal
<<= fRoundPoints
;
936 case MID_FONTHEIGHT_PROP
:
937 rVal
<<= (sal_Int16
)(SFX_MAPUNIT_RELATIVE
== ePropUnit
? nProp
: 100);
939 case MID_FONTHEIGHT_DIFF
:
941 float fRet
= (float)(short)nProp
;
944 case SFX_MAPUNIT_RELATIVE
:
947 case SFX_MAPUNIT_100TH_MM
:
948 fRet
= MM100_TO_TWIP(fRet
);
951 case SFX_MAPUNIT_POINT
:
954 case SFX_MAPUNIT_TWIP
:
957 default: ;//prevent warning
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
)
970 sal_uInt32 nRet
= nHeight
;
974 case SFX_MAPUNIT_RELATIVE
:
978 case SFX_MAPUNIT_POINT
:
980 short nTemp
= (short)nProp
;
983 nDiff
= (short)TWIP_TO_MM100((long)(nDiff
));
986 case SFX_MAPUNIT_100TH_MM
:
987 //dann ist die Core doch wohl auch in 1/100 mm
988 nDiff
= (short)nProp
;
990 case SFX_MAPUNIT_TWIP
:
991 // hier doch sicher TWIP
992 nDiff
= ((short)nProp
);
994 default: ;//prevent warning
1001 /*-----------------13.03.98 14:53-------------------
1003 --------------------------------------------------*/
1004 sal_Bool
SvxFontHeightItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1006 sal_Bool bConvert
= 0!=(nMemberId
&CONVERT_TWIPS
);
1007 nMemberId
&= ~CONVERT_TWIPS
;
1012 ::com::sun::star::frame::status::FontHeight aFontHeight
;
1013 if ( rVal
>>= aFontHeight
)
1016 ePropUnit
= SFX_MAPUNIT_RELATIVE
;
1018 double fPoint
= aFontHeight
.Height
;
1019 if( fPoint
< 0. || fPoint
> 10000. )
1022 nHeight
= (long)( fPoint
* 20.0 + 0.5 ); // Twips
1024 nHeight
= TWIP_TO_MM100_UNSIGNED(nHeight
); // umrechnen, wenn das Item 1/100mm enthaelt
1026 nProp
= aFontHeight
.Prop
;
1032 case MID_FONTHEIGHT
:
1034 ePropUnit
= SFX_MAPUNIT_RELATIVE
;
1037 if(!(rVal
>>= fPoint
))
1039 sal_Int32 nValue
= 0;
1040 if(!(rVal
>>= nValue
))
1042 fPoint
= (float)nValue
;
1044 if(fPoint
< 0. || fPoint
> 10000.)
1047 nHeight
= (long)( fPoint
* 20.0 + 0.5 ); // Twips
1049 nHeight
= TWIP_TO_MM100_UNSIGNED(nHeight
); // umrechnen, wenn das Item 1/100mm enthaelt
1052 case MID_FONTHEIGHT_PROP
:
1054 sal_Int16 nNew
= sal_Int16();
1055 if(!(rVal
>>= nNew
))
1058 nHeight
= lcl_GetRealHeight_Impl(nHeight
, nProp
, ePropUnit
, bConvert
);
1063 ePropUnit
= SFX_MAPUNIT_RELATIVE
;
1066 case MID_FONTHEIGHT_DIFF
:
1068 nHeight
= lcl_GetRealHeight_Impl(nHeight
, nProp
, ePropUnit
, bConvert
);
1070 if(!(rVal
>>= fValue
))
1072 sal_Int32 nValue
= 0;
1073 if(!(rVal
>>= nValue
))
1075 fValue
= (float)nValue
;
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
;
1087 //------------------------------------------------------------------------
1089 SfxItemPresentation
SvxFontHeightItem::GetPresentation
1091 SfxItemPresentation ePres
,
1092 SfxMapUnit eCoreUnit
,
1093 SfxMapUnit
/*ePresUnit*/,
1094 XubString
& rText
, const IntlWrapper
*pIntl
1100 case SFX_ITEM_PRESENTATION_NONE
:
1103 case SFX_ITEM_PRESENTATION_NAMELESS
:
1104 case SFX_ITEM_PRESENTATION_COMPLETE
:
1106 if( SFX_MAPUNIT_RELATIVE
!= ePropUnit
)
1108 ( rText
= String::CreateFromInt32( (short)nProp
) ) +=
1109 SVX_RESSTR( GetMetricId( ePropUnit
) );
1110 if( 0 <= (short)nProp
)
1111 rText
.Insert( sal_Unicode('+'), 0 );
1113 else if( 100 == nProp
)
1115 rText
= GetMetricText( (long)nHeight
,
1116 eCoreUnit
, SFX_MAPUNIT_POINT
, pIntl
);
1117 rText
+= SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT
));
1120 ( rText
= String::CreateFromInt32( nProp
)) += sal_Unicode('%');
1123 default: ; //prevent warning
1126 return SFX_ITEM_PRESENTATION_NONE
;
1129 // -----------------------------------------------------------------------
1131 USHORT
SvxFontHeightItem::GetVersion(USHORT nFileVersion
) const
1133 return (nFileVersion
<= SOFFICE_FILEFORMAT_40
)
1134 ? FONTHEIGHT_16_VERSION
1135 : FONTHEIGHT_UNIT_VERSION
;
1138 // -----------------------------------------------------------------------
1140 int SvxFontHeightItem::ScaleMetrics( long nMult
, long nDiv
)
1142 nHeight
= (sal_uInt32
)Scale( nHeight
, nMult
, nDiv
);
1146 // -----------------------------------------------------------------------
1148 int SvxFontHeightItem::HasMetrics() const
1153 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight
, const USHORT nNewProp
,
1156 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1159 if( SFX_MAPUNIT_RELATIVE
!= eUnit
)
1160 nHeight
= nNewHeight
+ ::ItemToControl( (short)nNewProp
, eUnit
,
1163 #endif // !SVX_LIGHT
1164 if( 100 != nNewProp
)
1165 nHeight
= sal_uInt32(( nNewHeight
* nNewProp
) / 100 );
1167 nHeight
= nNewHeight
;
1173 void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight
, USHORT nNewProp
,
1174 SfxMapUnit eMetric
, SfxMapUnit eCoreMetric
)
1176 DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
1179 if( SFX_MAPUNIT_RELATIVE
!= eMetric
)
1180 nHeight
= nNewHeight
+
1181 ::ControlToItem( ::ItemToControl((short)nNewProp
, eMetric
,
1182 SFX_FUNIT_TWIP
), SFX_FUNIT_TWIP
,
1185 #endif // !SVX_LIGHT
1186 if( 100 != nNewProp
)
1187 nHeight
= sal_uInt32(( nNewHeight
* nNewProp
) / 100 );
1189 nHeight
= nNewHeight
;
1192 ePropUnit
= eMetric
;
1195 // class SvxFontWidthItem -----------------------------------------------
1197 SvxFontWidthItem::SvxFontWidthItem( const USHORT nSz
, const USHORT nPrp
, const USHORT nId
) :
1204 // -----------------------------------------------------------------------
1206 SfxPoolItem
* SvxFontWidthItem::Clone( SfxItemPool
* ) const
1208 return new SvxFontWidthItem( *this );
1211 // -----------------------------------------------------------------------
1213 SvStream
& SvxFontWidthItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1215 rStrm
<< GetWidth() << GetProp();
1219 // -----------------------------------------------------------------------
1221 int SvxFontWidthItem::ScaleMetrics( long nMult
, long nDiv
)
1223 nWidth
= (USHORT
)Scale( nWidth
, nMult
, nDiv
);
1227 // -----------------------------------------------------------------------
1229 int SvxFontWidthItem::HasMetrics() const
1234 // -----------------------------------------------------------------------
1236 SfxPoolItem
* SvxFontWidthItem::Create( SvStream
& rStrm
,
1237 USHORT
/*nVersion*/ ) const
1244 SvxFontWidthItem
* pItem
= new SvxFontWidthItem( 0, nP
, Which() );
1245 pItem
->SetWidthValue( nS
);
1249 // -----------------------------------------------------------------------
1251 int SvxFontWidthItem::operator==( const SfxPoolItem
& rItem
) const
1253 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1254 return GetWidth() == ((SvxFontWidthItem
&)rItem
).GetWidth() &&
1255 GetProp() == ((SvxFontWidthItem
&)rItem
).GetProp();
1258 /*-----------------13.03.98 16:03-------------------
1260 --------------------------------------------------*/
1261 sal_Bool
SvxFontWidthItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1263 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1264 nMemberId
&= ~CONVERT_TWIPS
;
1268 rVal
<<= (sal_Int16
)(nWidth
);
1270 case MID_FONTWIDTH_PROP
:
1271 rVal
<<= (sal_Int16
)(nProp
);
1276 /*-----------------13.03.98 16:03-------------------
1278 --------------------------------------------------*/
1279 sal_Bool
SvxFontWidthItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1281 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1282 nMemberId
&= ~CONVERT_TWIPS
;
1283 sal_Int16 nVal
= sal_Int16();
1284 if(!(rVal
>>= nVal
))
1292 case MID_FONTWIDTH_PROP
:
1299 //------------------------------------------------------------------------
1301 SfxItemPresentation
SvxFontWidthItem::GetPresentation
1303 SfxItemPresentation ePres
,
1304 SfxMapUnit eCoreUnit
,
1305 SfxMapUnit
/*ePresUnit*/,
1306 XubString
& rText
, const IntlWrapper
*pIntl
1312 case SFX_ITEM_PRESENTATION_NONE
:
1315 case SFX_ITEM_PRESENTATION_NAMELESS
:
1316 case SFX_ITEM_PRESENTATION_COMPLETE
:
1320 rText
= GetMetricText( (long)nWidth
,
1321 eCoreUnit
, SFX_MAPUNIT_POINT
, pIntl
);
1322 rText
+= SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT
));
1325 ( rText
= String::CreateFromInt32( nProp
)) += sal_Unicode('%');
1328 default: ; //prevent warning
1331 return SFX_ITEM_PRESENTATION_NONE
;
1334 // class SvxTextLineItem ------------------------------------------------
1336 SvxTextLineItem::SvxTextLineItem( const FontUnderline eSt
, const USHORT nId
)
1337 : SfxEnumItem( nId
, (USHORT
)eSt
), mColor( COL_TRANSPARENT
)
1341 // -----------------------------------------------------------------------
1343 int SvxTextLineItem::HasBoolValue() const
1348 // -----------------------------------------------------------------------
1350 sal_Bool
SvxTextLineItem::GetBoolValue() const
1352 return (FontUnderline
)GetValue() != UNDERLINE_NONE
;
1355 // -----------------------------------------------------------------------
1357 void SvxTextLineItem::SetBoolValue( sal_Bool bVal
)
1359 SetValue( (USHORT
)(bVal
? UNDERLINE_SINGLE
: UNDERLINE_NONE
) );
1362 // -----------------------------------------------------------------------
1364 SfxPoolItem
* SvxTextLineItem::Clone( SfxItemPool
* ) const
1366 SvxTextLineItem
* pNew
= new SvxTextLineItem( *this );
1367 pNew
->SetColor( GetColor() );
1371 // -----------------------------------------------------------------------
1373 USHORT
SvxTextLineItem::GetValueCount() const
1375 return UNDERLINE_DOTTED
+ 1; // auch UNDERLINE_NONE geh"ort dazu
1378 // -----------------------------------------------------------------------
1380 SvStream
& SvxTextLineItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1382 rStrm
<< (BYTE
)GetValue();
1386 // -----------------------------------------------------------------------
1388 SfxPoolItem
* SvxTextLineItem::Create(SvStream
& rStrm
, USHORT
) const
1392 return new SvxTextLineItem( (FontUnderline
)nState
, Which() );
1395 //------------------------------------------------------------------------
1397 SfxItemPresentation
SvxTextLineItem::GetPresentation
1399 SfxItemPresentation ePres
,
1400 SfxMapUnit
/*eCoreUnit*/,
1401 SfxMapUnit
/*ePresUnit*/,
1402 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1408 case SFX_ITEM_PRESENTATION_NONE
:
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
);
1417 default: ; //prevent warning
1420 return SFX_ITEM_PRESENTATION_NONE
;
1423 // -----------------------------------------------------------------------
1425 XubString
SvxTextLineItem::GetValueTextByPos( USHORT
/*nPos*/ ) const
1427 DBG_ERROR("SvxTextLineItem::GetValueTextByPos: Pure virtual method");
1431 /*-----------------13.03.98 16:25-------------------
1433 --------------------------------------------------*/
1434 sal_Bool
SvxTextLineItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1436 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1437 nMemberId
&= ~CONVERT_TWIPS
;
1441 rVal
= Bool2Any(GetBoolValue());
1444 rVal
<<= (sal_Int16
)(GetValue());
1447 rVal
<<= (sal_Int32
)( mColor
.GetColor() );
1449 case MID_TL_HASCOLOR
:
1450 rVal
= Bool2Any( !mColor
.GetTransparency() );
1456 /*-----------------13.03.98 16:28-------------------
1458 --------------------------------------------------*/
1459 sal_Bool
SvxTextLineItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1461 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1462 nMemberId
&= ~CONVERT_TWIPS
;
1463 sal_Bool bRet
= sal_True
;
1467 SetBoolValue(Any2Bool(rVal
));
1471 sal_Int32 nValue
= 0;
1472 if(!(rVal
>>= nValue
))
1475 SetValue((sal_Int16
)nValue
);
1481 if( !( rVal
>>= nCol
) )
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
);
1493 case MID_TL_HASCOLOR
:
1494 mColor
.SetTransparency( Any2Bool( rVal
) ? 0 : 0xff );
1500 int SvxTextLineItem::operator==( const SfxPoolItem
& rItem
) const
1502 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
1503 return SfxEnumItem::operator==( rItem
) &&
1504 GetColor() == ((SvxTextLineItem
&)rItem
).GetColor();
1507 // class SvxUnderlineItem ------------------------------------------------
1509 SvxUnderlineItem::SvxUnderlineItem( const FontUnderline eSt
, const USHORT nId
)
1510 : SvxTextLineItem( eSt
, nId
)
1514 //------------------------------------------------------------------------
1516 SfxPoolItem
* SvxUnderlineItem::Clone( SfxItemPool
* ) const
1518 SvxUnderlineItem
* pNew
= new SvxUnderlineItem( *this );
1519 pNew
->SetColor( GetColor() );
1523 // -----------------------------------------------------------------------
1525 SfxPoolItem
* SvxUnderlineItem::Create(SvStream
& rStrm
, USHORT
) const
1529 return new SvxUnderlineItem( (FontUnderline
)nState
, Which() );
1532 // -----------------------------------------------------------------------
1534 XubString
SvxUnderlineItem::GetValueTextByPos( USHORT nPos
) const
1536 DBG_ASSERT( nPos
<= (USHORT
)UNDERLINE_BOLDWAVE
, "enum overflow!" );
1537 return SVX_RESSTR( RID_SVXITEMS_UL_BEGIN
+ nPos
);
1540 // class SvxOverlineItem ------------------------------------------------
1542 SvxOverlineItem::SvxOverlineItem( const FontUnderline eSt
, const USHORT nId
)
1543 : SvxTextLineItem( eSt
, nId
)
1547 //------------------------------------------------------------------------
1549 SfxPoolItem
* SvxOverlineItem::Clone( SfxItemPool
* ) const
1551 SvxOverlineItem
* pNew
= new SvxOverlineItem( *this );
1552 pNew
->SetColor( GetColor() );
1556 // -----------------------------------------------------------------------
1558 SfxPoolItem
* SvxOverlineItem::Create(SvStream
& rStrm
, USHORT
) const
1562 return new SvxOverlineItem( (FontUnderline
)nState
, Which() );
1565 // -----------------------------------------------------------------------
1567 XubString
SvxOverlineItem::GetValueTextByPos( USHORT nPos
) const
1569 DBG_ASSERT( nPos
<= (USHORT
)UNDERLINE_BOLDWAVE
, "enum overflow!" );
1570 return SVX_RESSTR( RID_SVXITEMS_OL_BEGIN
+ nPos
);
1573 // class SvxCrossedOutItem -----------------------------------------------
1575 SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt
, const USHORT nId
)
1576 : SfxEnumItem( nId
, (USHORT
)eSt
)
1580 // -----------------------------------------------------------------------
1582 int SvxCrossedOutItem::HasBoolValue() const
1587 // -----------------------------------------------------------------------
1589 sal_Bool
SvxCrossedOutItem::GetBoolValue() const
1591 return (FontStrikeout
)GetValue() != STRIKEOUT_NONE
;
1594 // -----------------------------------------------------------------------
1596 void SvxCrossedOutItem::SetBoolValue( sal_Bool bVal
)
1598 SetValue( (USHORT
)(bVal
? STRIKEOUT_SINGLE
: STRIKEOUT_NONE
) );
1601 // -----------------------------------------------------------------------
1603 USHORT
SvxCrossedOutItem::GetValueCount() const
1605 return STRIKEOUT_DOUBLE
+ 1; // auch STRIKEOUT_NONE geh"ort dazu
1608 // -----------------------------------------------------------------------
1610 SfxPoolItem
* SvxCrossedOutItem::Clone( SfxItemPool
* ) const
1612 return new SvxCrossedOutItem( *this );
1615 // -----------------------------------------------------------------------
1617 SvStream
& SvxCrossedOutItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1619 rStrm
<< (BYTE
)GetValue();
1623 // -----------------------------------------------------------------------
1625 SfxPoolItem
* SvxCrossedOutItem::Create(SvStream
& rStrm
, USHORT
) const
1629 return new SvxCrossedOutItem( (FontStrikeout
)eCross
, Which() );
1632 //------------------------------------------------------------------------
1634 SfxItemPresentation
SvxCrossedOutItem::GetPresentation
1636 SfxItemPresentation ePres
,
1637 SfxMapUnit
/*eCoreUnit*/,
1638 SfxMapUnit
/*ePresUnit*/,
1639 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1644 case SFX_ITEM_PRESENTATION_NONE
:
1647 case SFX_ITEM_PRESENTATION_NAMELESS
:
1648 case SFX_ITEM_PRESENTATION_COMPLETE
:
1649 rText
= GetValueTextByPos( GetValue() );
1651 default: ;//prevent warning
1653 return SFX_ITEM_PRESENTATION_NONE
;
1656 // -----------------------------------------------------------------------
1658 XubString
SvxCrossedOutItem::GetValueTextByPos( USHORT nPos
) const
1660 DBG_ASSERT( nPos
<= (USHORT
)STRIKEOUT_X
, "enum overflow!" );
1661 return SVX_RESSTR( RID_SVXITEMS_STRIKEOUT_BEGIN
+ nPos
);
1664 /*-----------------13.03.98 16:28-------------------
1666 --------------------------------------------------*/
1667 sal_Bool
SvxCrossedOutItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
1669 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1670 nMemberId
&= ~CONVERT_TWIPS
;
1673 case MID_CROSSED_OUT
:
1674 rVal
= Bool2Any(GetBoolValue());
1677 rVal
<<= (sal_Int16
)(GetValue());
1682 /*-----------------13.03.98 16:29-------------------
1684 --------------------------------------------------*/
1685 sal_Bool
SvxCrossedOutItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
1687 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1688 nMemberId
&= ~CONVERT_TWIPS
;
1691 case MID_CROSSED_OUT
:
1692 SetBoolValue(Any2Bool(rVal
));
1696 sal_Int32 nValue
= 0;
1697 if(!(rVal
>>= nValue
))
1699 SetValue((sal_Int16
)nValue
);
1705 // class SvxShadowedItem -------------------------------------------------
1707 SvxShadowedItem::SvxShadowedItem( const sal_Bool bShadowed
, const USHORT nId
) :
1708 SfxBoolItem( nId
, bShadowed
)
1712 // -----------------------------------------------------------------------
1714 SfxPoolItem
* SvxShadowedItem::Clone( SfxItemPool
* ) const
1716 return new SvxShadowedItem( *this );
1719 // -----------------------------------------------------------------------
1721 SvStream
& SvxShadowedItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1723 rStrm
<< (BYTE
) GetValue();
1727 // -----------------------------------------------------------------------
1729 SfxPoolItem
* SvxShadowedItem::Create(SvStream
& rStrm
, USHORT
) const
1733 return new SvxShadowedItem( nState
, Which() );
1736 //------------------------------------------------------------------------
1738 SfxItemPresentation
SvxShadowedItem::GetPresentation
1740 SfxItemPresentation ePres
,
1741 SfxMapUnit
/*eCoreUnit*/,
1742 SfxMapUnit
/*ePresUnit*/,
1743 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1748 case SFX_ITEM_PRESENTATION_NONE
:
1751 case SFX_ITEM_PRESENTATION_NAMELESS
:
1752 case SFX_ITEM_PRESENTATION_COMPLETE
:
1754 USHORT nId
= RID_SVXITEMS_SHADOWED_FALSE
;
1757 nId
= RID_SVXITEMS_SHADOWED_TRUE
;
1758 rText
= SVX_RESSTR(nId
);
1761 default: ; //prevent warning
1763 return SFX_ITEM_PRESENTATION_NONE
;
1766 // class SvxAutoKernItem -------------------------------------------------
1768 SvxAutoKernItem::SvxAutoKernItem( const sal_Bool bAutoKern
, const USHORT nId
) :
1769 SfxBoolItem( nId
, bAutoKern
)
1773 // -----------------------------------------------------------------------
1775 SfxPoolItem
* SvxAutoKernItem::Clone( SfxItemPool
* ) const
1777 return new SvxAutoKernItem( *this );
1780 // -----------------------------------------------------------------------
1782 SvStream
& SvxAutoKernItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1784 rStrm
<< (BYTE
) GetValue();
1788 // -----------------------------------------------------------------------
1790 SfxPoolItem
* SvxAutoKernItem::Create(SvStream
& rStrm
, USHORT
) const
1794 return new SvxAutoKernItem( nState
, Which() );
1797 //------------------------------------------------------------------------
1799 SfxItemPresentation
SvxAutoKernItem::GetPresentation
1801 SfxItemPresentation ePres
,
1802 SfxMapUnit
/*eCoreUnit*/,
1803 SfxMapUnit
/*ePresUnit*/,
1804 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1809 case SFX_ITEM_PRESENTATION_NONE
:
1812 case SFX_ITEM_PRESENTATION_NAMELESS
:
1813 case SFX_ITEM_PRESENTATION_COMPLETE
:
1815 USHORT nId
= RID_SVXITEMS_AUTOKERN_FALSE
;
1818 nId
= RID_SVXITEMS_AUTOKERN_TRUE
;
1819 rText
= SVX_RESSTR(nId
);
1822 default: ; //prevent warning
1824 return SFX_ITEM_PRESENTATION_NONE
;
1827 // class SvxWordLineModeItem ---------------------------------------------
1829 SvxWordLineModeItem::SvxWordLineModeItem( const sal_Bool bWordLineMode
,
1830 const USHORT nId
) :
1831 SfxBoolItem( nId
, bWordLineMode
)
1835 // -----------------------------------------------------------------------
1837 SfxPoolItem
* SvxWordLineModeItem::Clone( SfxItemPool
* ) const
1839 return new SvxWordLineModeItem( *this );
1842 // -----------------------------------------------------------------------
1844 SvStream
& SvxWordLineModeItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1846 rStrm
<< (sal_Bool
) GetValue();
1850 // -----------------------------------------------------------------------
1852 SfxPoolItem
* SvxWordLineModeItem::Create(SvStream
& rStrm
, USHORT
) const
1856 return new SvxWordLineModeItem( bValue
, Which() );
1859 //------------------------------------------------------------------------
1861 SfxItemPresentation
SvxWordLineModeItem::GetPresentation
1863 SfxItemPresentation ePres
,
1864 SfxMapUnit
/*eCoreUnit*/,
1865 SfxMapUnit
/*ePresUnit*/,
1866 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1871 case SFX_ITEM_PRESENTATION_NONE
:
1874 case SFX_ITEM_PRESENTATION_NAMELESS
:
1875 case SFX_ITEM_PRESENTATION_COMPLETE
:
1877 USHORT nId
= RID_SVXITEMS_WORDLINE_FALSE
;
1880 nId
= RID_SVXITEMS_WORDLINE_TRUE
;
1881 rText
= SVX_RESSTR(nId
);
1884 default: ; //prevent warning
1886 return SFX_ITEM_PRESENTATION_NONE
;
1889 // class SvxContourItem --------------------------------------------------
1891 SvxContourItem::SvxContourItem( const sal_Bool bContoured
, const USHORT nId
) :
1892 SfxBoolItem( nId
, bContoured
)
1896 // -----------------------------------------------------------------------
1898 SfxPoolItem
* SvxContourItem::Clone( SfxItemPool
* ) const
1900 return new SvxContourItem( *this );
1903 // -----------------------------------------------------------------------
1905 SvStream
& SvxContourItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1907 rStrm
<< (sal_Bool
) GetValue();
1911 // -----------------------------------------------------------------------
1913 SfxPoolItem
* SvxContourItem::Create(SvStream
& rStrm
, USHORT
) const
1917 return new SvxContourItem( bValue
, Which() );
1920 //------------------------------------------------------------------------
1922 SfxItemPresentation
SvxContourItem::GetPresentation
1924 SfxItemPresentation ePres
,
1925 SfxMapUnit
/*eCoreUnit*/,
1926 SfxMapUnit
/*ePresUnit*/,
1927 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1932 case SFX_ITEM_PRESENTATION_NONE
:
1935 case SFX_ITEM_PRESENTATION_NAMELESS
:
1936 case SFX_ITEM_PRESENTATION_COMPLETE
:
1938 USHORT nId
= RID_SVXITEMS_CONTOUR_FALSE
;
1941 nId
= RID_SVXITEMS_CONTOUR_TRUE
;
1942 rText
= SVX_RESSTR(nId
);
1945 default: ; //prevent warning
1947 return SFX_ITEM_PRESENTATION_NONE
;
1950 // class SvxPropSizeItem -------------------------------------------------
1952 SvxPropSizeItem::SvxPropSizeItem( const USHORT nPercent
, const USHORT nId
) :
1953 SfxUInt16Item( nId
, nPercent
)
1957 // -----------------------------------------------------------------------
1959 SfxPoolItem
* SvxPropSizeItem::Clone( SfxItemPool
* ) const
1961 return new SvxPropSizeItem( *this );
1964 // -----------------------------------------------------------------------
1966 SvStream
& SvxPropSizeItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
1968 rStrm
<< (USHORT
) GetValue();
1972 // -----------------------------------------------------------------------
1974 SfxPoolItem
* SvxPropSizeItem::Create(SvStream
& rStrm
, USHORT
) const
1978 return new SvxPropSizeItem( nSize
, Which() );
1981 //------------------------------------------------------------------------
1983 SfxItemPresentation
SvxPropSizeItem::GetPresentation
1985 SfxItemPresentation
/*ePres*/,
1986 SfxMapUnit
/*eCoreUnit*/,
1987 SfxMapUnit
/*ePresUnit*/,
1988 XubString
& rText
, const IntlWrapper
* /*pIntl*/
1992 return SFX_ITEM_PRESENTATION_NONE
;
1995 // class SvxColorItem ----------------------------------------------------
1997 SvxColorItem::SvxColorItem( const USHORT nId
) :
2003 // -----------------------------------------------------------------------
2005 SvxColorItem::SvxColorItem( const Color
& rCol
, const USHORT nId
) :
2011 // -----------------------------------------------------------------------
2013 SvxColorItem::SvxColorItem( SvStream
&rStrm
, const USHORT nId
) :
2021 // -----------------------------------------------------------------------
2023 SvxColorItem::SvxColorItem( const SvxColorItem
&rCopy
) :
2024 SfxPoolItem( rCopy
),
2025 mColor( rCopy
.mColor
)
2029 // -----------------------------------------------------------------------
2031 SvxColorItem::~SvxColorItem()
2035 // -----------------------------------------------------------------------
2036 USHORT
SvxColorItem::GetVersion( USHORT nFFVer
) const
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;
2045 // -----------------------------------------------------------------------
2047 int SvxColorItem::operator==( const SfxPoolItem
& rAttr
) const
2049 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
2051 return mColor
== ( (const SvxColorItem
&)rAttr
).mColor
;
2054 // -----------------------------------------------------------------------
2056 sal_Bool
SvxColorItem::QueryValue( uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
2058 rVal
<<= (sal_Int32
)(mColor
.GetColor());
2062 // -----------------------------------------------------------------------
2064 sal_Bool
SvxColorItem::PutValue( const uno::Any
& rVal
, BYTE
/*nMemberId*/ )
2066 sal_Int32 nColor
= 0;
2067 if(!(rVal
>>= nColor
))
2070 mColor
.SetColor( nColor
);
2074 // -----------------------------------------------------------------------
2076 SfxPoolItem
* SvxColorItem::Clone( SfxItemPool
* ) const
2078 return new SvxColorItem( *this );
2081 // -----------------------------------------------------------------------
2083 SvStream
& SvxColorItem::Store( SvStream
& rStrm
, USHORT nItemVersion
) const
2085 if( VERSION_USEAUTOCOLOR
== nItemVersion
&&
2086 COL_AUTO
== mColor
.GetColor() )
2087 rStrm
<< Color( COL_BLACK
);
2093 // -----------------------------------------------------------------------
2095 SfxPoolItem
* SvxColorItem::Create(SvStream
& rStrm
, USHORT
/*nVer*/ ) const
2097 return new SvxColorItem( rStrm
, Which() );
2100 //------------------------------------------------------------------------
2102 SfxItemPresentation
SvxColorItem::GetPresentation
2104 SfxItemPresentation ePres
,
2105 SfxMapUnit
/*eCoreUnit*/,
2106 SfxMapUnit
/*ePresUnit*/,
2107 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2113 case SFX_ITEM_PRESENTATION_NONE
:
2116 case SFX_ITEM_PRESENTATION_NAMELESS
:
2117 case SFX_ITEM_PRESENTATION_COMPLETE
:
2118 rText
= ::GetColorString( mColor
);
2120 default: ; //prevent warning
2123 return SFX_ITEM_PRESENTATION_NONE
;
2126 // -----------------------------------------------------------------------
2128 void SvxColorItem::SetValue( const Color
& rNewCol
)
2133 // class SvxCharSetColorItem ---------------------------------------------
2135 SvxCharSetColorItem::SvxCharSetColorItem( const USHORT nId
) :
2136 SvxColorItem( nId
),
2138 eFrom( RTL_TEXTENCODING_DONTKNOW
)
2142 // -----------------------------------------------------------------------
2144 SvxCharSetColorItem::SvxCharSetColorItem( const Color
& rCol
,
2145 const rtl_TextEncoding _eFrom
,
2146 const USHORT nId
) :
2147 SvxColorItem( rCol
, nId
),
2154 // -----------------------------------------------------------------------
2156 SfxPoolItem
* SvxCharSetColorItem::Clone( SfxItemPool
* ) const
2158 return new SvxCharSetColorItem( *this );
2161 // -----------------------------------------------------------------------
2163 SvStream
& SvxCharSetColorItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2165 // #90477# rStrm << (BYTE) GetStoreCharSet( GetCharSet(), (USHORT)rStrm.GetVersion() )
2167 rStrm
<< (BYTE
)GetSOStoreTextEncoding(GetCharSet(), (sal_uInt16
)rStrm
.GetVersion())
2172 // -----------------------------------------------------------------------
2174 SfxPoolItem
* SvxCharSetColorItem::Create(SvStream
& rStrm
, USHORT
) const
2178 rStrm
>> cSet
>> aColor
;
2179 return new SvxCharSetColorItem( aColor
, (rtl_TextEncoding
)cSet
, Which() );
2182 //------------------------------------------------------------------------
2184 SfxItemPresentation
SvxCharSetColorItem::GetPresentation
2186 SfxItemPresentation
/*ePres*/,
2187 SfxMapUnit
/*eCoreUnit*/,
2188 SfxMapUnit
/*ePresUnit*/,
2189 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2193 return SFX_ITEM_PRESENTATION_NONE
;
2196 // class SvxKerningItem --------------------------------------------------
2198 SvxKerningItem::SvxKerningItem( const short nKern
, const USHORT nId
) :
2199 SfxInt16Item( nId
, nKern
)
2203 // -----------------------------------------------------------------------
2205 SfxPoolItem
* SvxKerningItem::Clone( SfxItemPool
* ) const
2207 return new SvxKerningItem( *this );
2210 // -----------------------------------------------------------------------
2212 SvStream
& SvxKerningItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2214 rStrm
<< (short) GetValue();
2218 // -----------------------------------------------------------------------
2220 int SvxKerningItem::ScaleMetrics( long nMult
, long nDiv
)
2222 SetValue( (sal_Int16
)Scale( GetValue(), nMult
, nDiv
) );
2226 // -----------------------------------------------------------------------
2228 int SvxKerningItem::HasMetrics() const
2233 // -----------------------------------------------------------------------
2235 SfxPoolItem
* SvxKerningItem::Create(SvStream
& rStrm
, USHORT
) const
2239 return new SvxKerningItem( nValue
, Which() );
2242 //------------------------------------------------------------------------
2244 SfxItemPresentation
SvxKerningItem::GetPresentation
2246 SfxItemPresentation ePres
,
2247 SfxMapUnit eCoreUnit
,
2248 SfxMapUnit
/*ePresUnit*/,
2249 XubString
& rText
, const IntlWrapper
*pIntl
2255 case SFX_ITEM_PRESENTATION_NONE
:
2258 case SFX_ITEM_PRESENTATION_NAMELESS
:
2259 rText
= GetMetricText( (long)GetValue(), eCoreUnit
, SFX_MAPUNIT_POINT
, pIntl
);
2260 rText
+= SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT
));
2262 case SFX_ITEM_PRESENTATION_COMPLETE
:
2264 rText
= SVX_RESSTR(RID_SVXITEMS_KERNING_COMPLETE
);
2267 if ( GetValue() > 0 )
2268 nId
= RID_SVXITEMS_KERNING_EXPANDED
;
2269 else if ( GetValue() < 0 )
2270 nId
= RID_SVXITEMS_KERNING_CONDENSED
;
2273 rText
+= SVX_RESSTR(nId
);
2274 rText
+= GetMetricText( (long)GetValue(), eCoreUnit
, SFX_MAPUNIT_POINT
, pIntl
);
2275 rText
+= SVX_RESSTR(GetMetricId(SFX_MAPUNIT_POINT
));
2278 default: ; //prevent warning
2281 return SFX_ITEM_PRESENTATION_NONE
;
2283 /* -----------------------------19.02.01 12:21--------------------------------
2285 ---------------------------------------------------------------------------*/
2286 sal_Bool
SvxKerningItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2288 sal_Int16 nVal
= GetValue();
2289 if(nMemberId
& CONVERT_TWIPS
)
2290 nVal
= (sal_Int16
)TWIP_TO_MM100(nVal
);
2294 // -----------------------------------------------------------------------
2295 sal_Bool
SvxKerningItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
2297 sal_Int16 nVal
= sal_Int16();
2298 if(!(rVal
>>= nVal
))
2300 if(nMemberId
& CONVERT_TWIPS
)
2301 nVal
= (sal_Int16
)MM100_TO_TWIP(nVal
);
2306 // class SvxCaseMapItem --------------------------------------------------
2308 SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap
, const USHORT nId
) :
2309 SfxEnumItem( nId
, (USHORT
)eMap
)
2313 // -----------------------------------------------------------------------
2315 USHORT
SvxCaseMapItem::GetValueCount() const
2317 return SVX_CASEMAP_END
; // SVX_CASEMAP_KAPITAELCHEN + 1
2320 // -----------------------------------------------------------------------
2322 SfxPoolItem
* SvxCaseMapItem::Clone( SfxItemPool
* ) const
2324 return new SvxCaseMapItem( *this );
2327 // -----------------------------------------------------------------------
2329 SvStream
& SvxCaseMapItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2331 rStrm
<< (BYTE
) GetValue();
2335 // -----------------------------------------------------------------------
2337 SfxPoolItem
* SvxCaseMapItem::Create(SvStream
& rStrm
, USHORT
) const
2341 return new SvxCaseMapItem( (const SvxCaseMap
)cMap
, Which() );
2344 //------------------------------------------------------------------------
2346 SfxItemPresentation
SvxCaseMapItem::GetPresentation
2348 SfxItemPresentation ePres
,
2349 SfxMapUnit
/*eCoreUnit*/,
2350 SfxMapUnit
/*ePresUnit*/,
2351 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2356 case SFX_ITEM_PRESENTATION_NONE
:
2359 case SFX_ITEM_PRESENTATION_NAMELESS
:
2360 case SFX_ITEM_PRESENTATION_COMPLETE
:
2361 rText
= GetValueTextByPos( GetValue() );
2363 default: ; //prevent warning
2365 return SFX_ITEM_PRESENTATION_NONE
;
2368 // -----------------------------------------------------------------------
2370 XubString
SvxCaseMapItem::GetValueTextByPos( USHORT nPos
) const
2372 DBG_ASSERT( nPos
< (USHORT
)SVX_CASEMAP_END
, "enum overflow!" );
2373 return SVX_RESSTR( RID_SVXITEMS_CASEMAP_BEGIN
+ nPos
);
2376 /*-----------------13.03.98 16:29-------------------
2378 --------------------------------------------------*/
2379 sal_Bool
SvxCaseMapItem::QueryValue( uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
2381 sal_Int16 nRet
= style::CaseMap::NONE
;
2382 switch( GetValue() )
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;
2390 rVal
<<= (sal_Int16
)(nRet
);
2393 /*-----------------13.03.98 16:29-------------------
2395 --------------------------------------------------*/
2396 sal_Bool
SvxCaseMapItem::PutValue( const uno::Any
& rVal
, BYTE
/*nMemberId*/ )
2398 sal_uInt16 nVal
= sal_uInt16();
2399 if(!(rVal
>>= nVal
))
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;
2414 // class SvxEscapementItem -----------------------------------------------
2416 SvxEscapementItem::SvxEscapementItem( const USHORT nId
) :
2417 SfxEnumItemInterface( nId
),
2424 // -----------------------------------------------------------------------
2426 SvxEscapementItem::SvxEscapementItem( const SvxEscapement eEscape
,
2427 const USHORT nId
) :
2428 SfxEnumItemInterface( nId
),
2431 SetEscapement( eEscape
);
2436 // -----------------------------------------------------------------------
2438 SvxEscapementItem::SvxEscapementItem( const short _nEsc
,
2440 const USHORT nId
) :
2441 SfxEnumItemInterface( nId
),
2447 // -----------------------------------------------------------------------
2449 int SvxEscapementItem::operator==( const SfxPoolItem
& rAttr
) const
2451 DBG_ASSERT( SfxPoolItem::operator==(rAttr
), "unequal types" );
2453 return( nEsc
== ((SvxEscapementItem
&)rAttr
).nEsc
&&
2454 nProp
== ((SvxEscapementItem
&)rAttr
).nProp
);
2457 // -----------------------------------------------------------------------
2459 SfxPoolItem
* SvxEscapementItem::Clone( SfxItemPool
* ) const
2461 return new SvxEscapementItem( *this );
2464 // -----------------------------------------------------------------------
2466 SvStream
& SvxEscapementItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2468 short _nEsc
= GetEsc();
2469 if( SOFFICE_FILEFORMAT_31
== rStrm
.GetVersion() )
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
;
2476 rStrm
<< (BYTE
) GetProp()
2481 // -----------------------------------------------------------------------
2483 SfxPoolItem
* SvxEscapementItem::Create(SvStream
& rStrm
, USHORT
) const
2487 rStrm
>> _nProp
>> _nEsc
;
2488 return new SvxEscapementItem( _nEsc
, _nProp
, Which() );
2491 // -----------------------------------------------------------------------
2493 USHORT
SvxEscapementItem::GetValueCount() const
2495 return SVX_ESCAPEMENT_END
; // SVX_ESCAPEMENT_SUBSCRIPT + 1
2498 //------------------------------------------------------------------------
2500 SfxItemPresentation
SvxEscapementItem::GetPresentation
2502 SfxItemPresentation ePres
,
2503 SfxMapUnit
/*eCoreUnit*/,
2504 SfxMapUnit
/*ePresUnit*/,
2505 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2510 case SFX_ITEM_PRESENTATION_NONE
:
2513 case SFX_ITEM_PRESENTATION_NAMELESS
:
2514 case SFX_ITEM_PRESENTATION_COMPLETE
:
2516 rText
= GetValueTextByPos( GetEnumValue() );
2520 if( DFLT_ESC_AUTO_SUPER
== nEsc
|| DFLT_ESC_AUTO_SUB
== nEsc
)
2521 rText
+= String( SVX_RESSTR(RID_SVXITEMS_ESCAPEMENT_AUTO
) );
2523 ( rText
+= String::CreateFromInt32( nEsc
)) += sal_Unicode('%');
2527 default: ; //prevent warning
2529 return SFX_ITEM_PRESENTATION_NONE
;
2532 // -----------------------------------------------------------------------
2534 XubString
SvxEscapementItem::GetValueTextByPos( USHORT nPos
) const
2536 DBG_ASSERT( nPos
< (USHORT
)SVX_ESCAPEMENT_END
, "enum overflow!" );
2537 return SVX_RESSTR(RID_SVXITEMS_ESCAPEMENT_BEGIN
+ nPos
);
2540 // -----------------------------------------------------------------------
2542 USHORT
SvxEscapementItem::GetEnumValue() const
2545 return SVX_ESCAPEMENT_SUBSCRIPT
;
2546 else if ( nEsc
> 0 )
2547 return SVX_ESCAPEMENT_SUPERSCRIPT
;
2548 return SVX_ESCAPEMENT_OFF
;
2551 // -----------------------------------------------------------------------
2553 void SvxEscapementItem::SetEnumValue( USHORT nVal
)
2555 SetEscapement( (const SvxEscapement
)nVal
);
2558 /*-----------------13.03.98 17:05-------------------
2560 --------------------------------------------------*/
2561 sal_Bool
SvxEscapementItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2563 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2564 nMemberId
&= ~CONVERT_TWIPS
;
2568 rVal
<<= (sal_Int16
)(nEsc
);
2570 case MID_ESC_HEIGHT
:
2571 rVal
<<= (sal_Int8
)(nProp
);
2574 rVal
= Bool2Any(DFLT_ESC_AUTO_SUB
== nEsc
|| DFLT_ESC_AUTO_SUPER
== nEsc
);
2579 /*-----------------13.03.98 17:05-------------------
2581 --------------------------------------------------*/
2582 sal_Bool
SvxEscapementItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
2584 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2585 nMemberId
&= ~CONVERT_TWIPS
;
2590 sal_Int16 nVal
= sal_Int16();
2591 if( (rVal
>>= nVal
) && (Abs(nVal
) <= 101))
2597 case MID_ESC_HEIGHT
:
2599 sal_Int8 nVal
= sal_Int8();
2600 if( (rVal
>>= nVal
) && (nVal
<= 100))
2608 BOOL bVal
= Any2Bool(rVal
);
2612 nEsc
= DFLT_ESC_AUTO_SUB
;
2614 nEsc
= DFLT_ESC_AUTO_SUPER
;
2617 if(DFLT_ESC_AUTO_SUPER
== nEsc
)
2619 else if(DFLT_ESC_AUTO_SUB
== nEsc
)
2627 // class SvxLanguageItem -------------------------------------------------
2629 SvxLanguageItem::SvxLanguageItem( const LanguageType eLang
, const USHORT nId
)
2630 : SfxEnumItem( nId
, eLang
)
2634 // -----------------------------------------------------------------------
2636 USHORT
SvxLanguageItem::GetValueCount() const
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)?
2646 // -----------------------------------------------------------------------
2648 SfxPoolItem
* SvxLanguageItem::Clone( SfxItemPool
* ) const
2650 return new SvxLanguageItem( *this );
2653 // -----------------------------------------------------------------------
2655 SvStream
& SvxLanguageItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2657 rStrm
<< (USHORT
) GetValue();
2661 // -----------------------------------------------------------------------
2663 SfxPoolItem
* SvxLanguageItem::Create(SvStream
& rStrm
, USHORT
) const
2667 return new SvxLanguageItem( (LanguageType
)nValue
, Which() );
2670 //------------------------------------------------------------------------
2672 SfxItemPresentation
SvxLanguageItem::GetPresentation
2674 SfxItemPresentation ePres
,
2675 SfxMapUnit
/*eCoreUnit*/,
2676 SfxMapUnit
/*ePresUnit*/,
2677 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2683 case SFX_ITEM_PRESENTATION_NONE
:
2686 case SFX_ITEM_PRESENTATION_NAMELESS
:
2687 case SFX_ITEM_PRESENTATION_COMPLETE
:
2689 SvtLanguageTable aLangTable
;
2690 rText
= aLangTable
.GetString( (LanguageType
)GetValue() );
2693 default: ; //prevent warning
2695 #endif // !SVX_LIGHT
2696 return SFX_ITEM_PRESENTATION_NONE
;
2699 /*-----------------14.03.98 14:13-------------------
2701 --------------------------------------------------*/
2702 sal_Bool
SvxLanguageItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
2704 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2705 nMemberId
&= ~CONVERT_TWIPS
;
2708 case MID_LANG_INT
: // for basic conversions!
2709 rVal
<<= (sal_Int16
)(GetValue());
2711 case MID_LANG_LOCALE
:
2712 lang::Locale
aRet( MsLangId::convertLanguageToLocale( GetValue(), false));
2718 /*-----------------14.03.98 14:13-------------------
2720 --------------------------------------------------*/
2721 sal_Bool
SvxLanguageItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
2723 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2724 nMemberId
&= ~CONVERT_TWIPS
;
2727 case MID_LANG_INT
: // for basic conversions!
2729 sal_Int32 nValue
= 0;
2730 if(!(rVal
>>= nValue
))
2733 SetValue((sal_Int16
)nValue
);
2736 case MID_LANG_LOCALE
:
2738 lang::Locale aLocale
;
2739 if(!(rVal
>>= aLocale
))
2742 if (aLocale
.Language
.getLength() || aLocale
.Country
.getLength())
2743 SetValue(MsLangId::convertLocaleToLanguage( aLocale
));
2745 SetValue(LANGUAGE_NONE
);
2752 // class SvxNoLinebreakItem ----------------------------------------------
2753 SvxNoLinebreakItem::SvxNoLinebreakItem( const sal_Bool bBreak
, const USHORT nId
) :
2754 SfxBoolItem( nId
, bBreak
)
2758 // -----------------------------------------------------------------------
2760 SfxPoolItem
* SvxNoLinebreakItem::Clone( SfxItemPool
* ) const
2762 return new SvxNoLinebreakItem( *this );
2765 // -----------------------------------------------------------------------
2767 SvStream
& SvxNoLinebreakItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2769 rStrm
<< (sal_Bool
)GetValue();
2773 // -----------------------------------------------------------------------
2775 SfxPoolItem
* SvxNoLinebreakItem::Create(SvStream
& rStrm
, USHORT
) const
2779 return new SvxNoLinebreakItem( bValue
, Which() );
2782 //------------------------------------------------------------------------
2784 SfxItemPresentation
SvxNoLinebreakItem::GetPresentation
2786 SfxItemPresentation
/*ePres*/,
2787 SfxMapUnit
/*eCoreUnit*/,
2788 SfxMapUnit
/*ePresUnit*/,
2789 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2793 return SFX_ITEM_PRESENTATION_NONE
;
2796 // class SvxNoHyphenItem -------------------------------------------------
2798 SvxNoHyphenItem::SvxNoHyphenItem( const sal_Bool bHyphen
, const USHORT nId
) :
2799 SfxBoolItem( nId
, bHyphen
)
2803 // -----------------------------------------------------------------------
2805 SfxPoolItem
* SvxNoHyphenItem::Clone( SfxItemPool
* ) const
2807 return new SvxNoHyphenItem( *this );
2810 // -----------------------------------------------------------------------
2812 SvStream
& SvxNoHyphenItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2814 rStrm
<< (sal_Bool
) GetValue();
2818 // -----------------------------------------------------------------------
2820 SfxPoolItem
* SvxNoHyphenItem::Create( SvStream
& rStrm
, USHORT
) const
2824 return new SvxNoHyphenItem( bValue
, Which() );
2827 //------------------------------------------------------------------------
2829 SfxItemPresentation
SvxNoHyphenItem::GetPresentation
2831 SfxItemPresentation
/*ePres*/,
2832 SfxMapUnit
/*eCoreUnit*/,
2833 SfxMapUnit
/*ePresUnit*/,
2834 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2838 return SFX_ITEM_PRESENTATION_NONE
;
2842 * Dummy-Item fuer ToolBox-Controls:
2846 // -----------------------------------------------------------------------
2847 // class SvxLineColorItem (== SvxColorItem)
2848 // -----------------------------------------------------------------------
2850 SvxLineColorItem::SvxLineColorItem( const USHORT nId
) :
2855 // -----------------------------------------------------------------------
2857 SvxLineColorItem::SvxLineColorItem( const Color
& rCol
, const USHORT nId
) :
2858 SvxColorItem( rCol
, nId
)
2862 // -----------------------------------------------------------------------
2864 SvxLineColorItem::SvxLineColorItem( SvStream
&rStrm
, const USHORT nId
) :
2865 SvxColorItem( rStrm
, nId
)
2869 // -----------------------------------------------------------------------
2871 SvxLineColorItem::SvxLineColorItem( const SvxLineColorItem
&rCopy
) :
2872 SvxColorItem( rCopy
)
2876 // -----------------------------------------------------------------------
2878 SvxLineColorItem::~SvxLineColorItem()
2882 //------------------------------------------------------------------------
2884 SfxItemPresentation
SvxLineColorItem::GetPresentation
2886 SfxItemPresentation ePres
,
2887 SfxMapUnit eCoreUnit
,
2888 SfxMapUnit ePresUnit
,
2890 const IntlWrapper
* pIntlWrapper
2893 return SvxColorItem::GetPresentation( ePres
, eCoreUnit
, ePresUnit
,
2894 rText
, pIntlWrapper
);
2897 // class SvxBlinkItem -------------------------------------------------
2900 SvxBlinkItem::SvxBlinkItem( const sal_Bool bBlink
, const USHORT nId
) :
2901 SfxBoolItem( nId
, bBlink
)
2905 // -----------------------------------------------------------------------
2907 SfxPoolItem
* SvxBlinkItem::Clone( SfxItemPool
* ) const
2909 return new SvxBlinkItem( *this );
2912 // -----------------------------------------------------------------------
2914 SvStream
& SvxBlinkItem::Store( SvStream
& rStrm
, USHORT
/*nItemVersion*/ ) const
2916 rStrm
<< (BYTE
) GetValue();
2920 // -----------------------------------------------------------------------
2922 SfxPoolItem
* SvxBlinkItem::Create(SvStream
& rStrm
, USHORT
) const
2926 return new SvxBlinkItem( nState
, Which() );
2929 // -----------------------------------------------------------------------
2931 SfxItemPresentation
SvxBlinkItem::GetPresentation
2933 SfxItemPresentation ePres
,
2934 SfxMapUnit
/*eCoreUnit*/,
2935 SfxMapUnit
/*ePresUnit*/,
2936 XubString
& rText
, const IntlWrapper
* /*pIntl*/
2941 case SFX_ITEM_PRESENTATION_NONE
:
2944 case SFX_ITEM_PRESENTATION_NAMELESS
:
2945 case SFX_ITEM_PRESENTATION_COMPLETE
:
2947 USHORT nId
= RID_SVXITEMS_BLINK_FALSE
;
2950 nId
= RID_SVXITEMS_BLINK_TRUE
;
2951 rText
= SVX_RESSTR(nId
);
2954 default: ; //prevent warning
2956 return SFX_ITEM_PRESENTATION_NONE
;
2959 // class SvxEmphaisMarkItem ---------------------------------------------------
2961 SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue
,
2963 : SfxUInt16Item( nId
, nValue
)
2967 // -----------------------------------------------------------------------
2969 SfxPoolItem
* SvxEmphasisMarkItem::Clone( SfxItemPool
* ) const
2971 return new SvxEmphasisMarkItem( *this );
2974 // -----------------------------------------------------------------------
2976 SvStream
& SvxEmphasisMarkItem::Store( SvStream
& rStrm
,
2977 USHORT
/*nItemVersion*/ ) const
2979 rStrm
<< (sal_uInt16
)GetValue();
2983 // -----------------------------------------------------------------------
2985 SfxPoolItem
* SvxEmphasisMarkItem::Create( SvStream
& rStrm
, USHORT
) const
2989 return new SvxEmphasisMarkItem( (FontEmphasisMark
)nValue
, Which() );
2992 //------------------------------------------------------------------------
2994 SfxItemPresentation
SvxEmphasisMarkItem::GetPresentation
2996 SfxItemPresentation ePres
,
2997 SfxMapUnit
/*eCoreUnit*/,
2998 SfxMapUnit
/*ePresUnit*/,
3000 const IntlWrapper
* /*pIntl*/
3005 case SFX_ITEM_PRESENTATION_NONE
:
3008 case SFX_ITEM_PRESENTATION_NAMELESS
:
3009 case SFX_ITEM_PRESENTATION_COMPLETE
:
3011 sal_uInt16 nVal
= GetValue();
3012 rText
= SVX_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE
+
3013 ( EMPHASISMARK_STYLE
& nVal
));
3014 USHORT nId
= ( EMPHASISMARK_POS_ABOVE
& nVal
)
3015 ? RID_SVXITEMS_EMPHASIS_ABOVE_POS
3016 : ( EMPHASISMARK_POS_BELOW
& nVal
)
3017 ? RID_SVXITEMS_EMPHASIS_BELOW_POS
3020 rText
+= SVX_RESSTR( nId
);
3023 default: ; //prevent warning
3025 return SFX_ITEM_PRESENTATION_NONE
;
3028 // -----------------------------------------------------------------------
3030 sal_Bool
SvxEmphasisMarkItem::QueryValue( uno::Any
& rVal
, BYTE nMemberId
) const
3032 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3033 nMemberId
&= ~CONVERT_TWIPS
;
3038 sal_Int16 nValue
= GetValue();
3040 switch(nValue
& EMPHASISMARK_STYLE
)
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;
3048 if(nRet
&& nValue
& EMPHASISMARK_POS_BELOW
)
3057 sal_Bool
SvxEmphasisMarkItem::PutValue( const uno::Any
& rVal
, BYTE nMemberId
)
3059 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3060 nMemberId
&= ~CONVERT_TWIPS
;
3061 sal_Bool bRet
= sal_True
;
3066 sal_Int32 nValue
= -1;
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
;
3081 SetValue( (sal_Int16
)nValue
);
3088 USHORT
SvxEmphasisMarkItem::GetVersion( USHORT nFFVer
) const
3090 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
3091 SOFFICE_FILEFORMAT_40
==nFFVer
||
3092 SOFFICE_FILEFORMAT_50
==nFFVer
,
3093 "SvxEmphasisMarkItem: Gibt es ein neues Fileformat?" );
3095 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
3099 /*************************************************************************
3100 |* class SvxTwoLinesItem
3101 *************************************************************************/
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
)
3110 SvxTwoLinesItem::SvxTwoLinesItem( const SvxTwoLinesItem
& rAttr
)
3111 : SfxPoolItem( rAttr
.Which() ),
3112 cStartBracket( rAttr
.cStartBracket
),
3113 cEndBracket( rAttr
.cEndBracket
),
3118 SvxTwoLinesItem::~SvxTwoLinesItem()
3122 int SvxTwoLinesItem::operator==( const SfxPoolItem
& rAttr
) const
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
;
3130 SfxPoolItem
* SvxTwoLinesItem::Clone( SfxItemPool
* ) const
3132 return new SvxTwoLinesItem( *this );
3135 sal_Bool
SvxTwoLinesItem::QueryValue( com::sun::star::uno::Any
& rVal
,
3136 BYTE nMemberId
) const
3138 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3139 nMemberId
&= ~CONVERT_TWIPS
;
3140 sal_Bool bRet
= sal_True
;
3144 rVal
= Bool2Any( bOn
);
3146 case MID_START_BRACKET
:
3150 s
= OUString( cStartBracket
);
3154 case MID_END_BRACKET
:
3158 s
= OUString( cEndBracket
);
3169 sal_Bool
SvxTwoLinesItem::PutValue( const com::sun::star::uno::Any
& rVal
,
3172 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3173 nMemberId
&= ~CONVERT_TWIPS
;
3174 sal_Bool bRet
= sal_False
;
3179 bOn
= Any2Bool( rVal
);
3182 case MID_START_BRACKET
:
3185 cStartBracket
= s
.getLength() ? s
[ 0 ] : 0;
3189 case MID_END_BRACKET
:
3192 cEndBracket
= s
.getLength() ? s
[ 0 ] : 0;
3200 SfxItemPresentation
SvxTwoLinesItem::GetPresentation( SfxItemPresentation ePres
,
3201 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
3202 String
&rText
, const IntlWrapper
* /*pIntl*/ ) const
3206 case SFX_ITEM_PRESENTATION_NONE
:
3209 case SFX_ITEM_PRESENTATION_NAMELESS
:
3210 case SFX_ITEM_PRESENTATION_COMPLETE
:
3213 rText
= SVX_RESSTR( RID_SVXITEMS_TWOLINES_OFF
);
3216 rText
= SVX_RESSTR( RID_SVXITEMS_TWOLINES
);
3217 if( GetStartBracket() )
3218 rText
.Insert( GetStartBracket(), 0 );
3219 if( GetEndBracket() )
3220 rText
+= GetEndBracket();
3224 default: ; //prevent warning
3226 return SFX_ITEM_PRESENTATION_NONE
;
3230 SfxPoolItem
* SvxTwoLinesItem::Create( SvStream
& rStrm
, USHORT
/*nVer*/) const
3233 sal_Unicode cStart
, cEnd
;
3234 rStrm
>> _bOn
>> cStart
>> cEnd
;
3235 return new SvxTwoLinesItem( _bOn
, cStart
, cEnd
, Which() );
3238 SvStream
& SvxTwoLinesItem::Store(SvStream
& rStrm
, USHORT
/*nIVer*/) const
3240 rStrm
<< GetValue() << GetStartBracket() << GetEndBracket();
3244 USHORT
SvxTwoLinesItem::GetVersion( USHORT nFFVer
) const
3246 DBG_ASSERT( SOFFICE_FILEFORMAT_31
==nFFVer
||
3247 SOFFICE_FILEFORMAT_40
==nFFVer
||
3248 SOFFICE_FILEFORMAT_50
==nFFVer
,
3249 "SvxTwoLinesItem: Gibt es ein neues Fileformat?" );
3251 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
3255 /*************************************************************************
3256 |* class SvxCharRotateItem
3257 *************************************************************************/
3259 SvxCharRotateItem::SvxCharRotateItem( sal_uInt16 nValue
,
3260 sal_Bool bFitIntoLine
,
3261 const sal_uInt16 nW
)
3262 : SfxUInt16Item( nW
, nValue
), bFitToLine( bFitIntoLine
)
3266 SfxPoolItem
* SvxCharRotateItem::Clone( SfxItemPool
* ) const
3268 return new SvxCharRotateItem( GetValue(), IsFitToLine(), Which() );
3271 SfxPoolItem
* SvxCharRotateItem::Create( SvStream
& rStrm
, USHORT
) const
3276 return new SvxCharRotateItem( nVal
, b
, Which() );
3279 SvStream
& SvxCharRotateItem::Store( SvStream
& rStrm
, USHORT
) const
3281 sal_Bool bFlag
= IsFitToLine();
3282 rStrm
<< GetValue() << bFlag
;
3286 USHORT
SvxCharRotateItem::GetVersion( USHORT nFFVer
) const
3288 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
3291 SfxItemPresentation
SvxCharRotateItem::GetPresentation(
3292 SfxItemPresentation ePres
,
3293 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
3294 String
&rText
, const IntlWrapper
* ) const
3298 case SFX_ITEM_PRESENTATION_NONE
:
3301 case SFX_ITEM_PRESENTATION_NAMELESS
:
3302 case SFX_ITEM_PRESENTATION_COMPLETE
:
3305 rText
= SVX_RESSTR( RID_SVXITEMS_CHARROTATE_OFF
);
3308 rText
= SVX_RESSTR( RID_SVXITEMS_CHARROTATE
);
3309 rText
.SearchAndReplaceAscii( "$(ARG1)",
3310 String::CreateFromInt32( GetValue() / 10 ));
3312 rText
+= SVX_RESSTR( RID_SVXITEMS_CHARROTATE_FITLINE
);
3316 default: ; //prevent warning
3318 return SFX_ITEM_PRESENTATION_NONE
;
3321 sal_Bool
SvxCharRotateItem::QueryValue( com::sun::star::uno::Any
& rVal
,
3322 BYTE nMemberId
) const
3324 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3325 nMemberId
&= ~CONVERT_TWIPS
;
3326 sal_Bool bRet
= sal_True
;
3330 rVal
<<= (sal_Int16
)GetValue();
3333 rVal
= Bool2Any( IsFitToLine() );
3342 sal_Bool
SvxCharRotateItem::PutValue( const com::sun::star::uno::Any
& rVal
,
3345 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3346 nMemberId
&= ~CONVERT_TWIPS
;
3347 sal_Bool bRet
= sal_True
;
3353 if((rVal
>>= nVal
) && (0 == nVal
|| 900 == nVal
|| 2700 == nVal
))
3354 SetValue( (USHORT
)nVal
);
3361 SetFitToLine( Any2Bool( rVal
) );
3369 int SvxCharRotateItem::operator==( const SfxPoolItem
& rItem
) const
3371 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal type" );
3372 return SfxUInt16Item::operator==( rItem
) &&
3373 IsFitToLine() == ((const SvxCharRotateItem
&)rItem
).IsFitToLine();
3377 /*************************************************************************
3378 |* class SvxCharScaleItem
3379 *************************************************************************/
3381 SvxCharScaleWidthItem::SvxCharScaleWidthItem( sal_uInt16 nValue
,
3382 const sal_uInt16 nW
)
3383 : SfxUInt16Item( nW
, nValue
)
3387 SfxPoolItem
* SvxCharScaleWidthItem::Clone( SfxItemPool
* ) const
3389 return new SvxCharScaleWidthItem( GetValue(), Which() );
3392 SfxPoolItem
* SvxCharScaleWidthItem::Create( SvStream
& rStrm
, USHORT
) const
3396 SvxCharScaleWidthItem
* pItem
= new SvxCharScaleWidthItem( nVal
, Which() );
3398 if ( Which() == EE_CHAR_FONTWIDTH
)
3400 // #87271#: Was a SvxFontWidthItem in 5.2
3401 // USHORT nFixWidth, USHORT nPropWidth.
3402 // nFixWidth has never been used...
3406 if ( nTest
== 0x1234 )
3407 pItem
->SetValue( nVal
);
3409 rStrm
.SeekRel( -2*(long)sizeof(sal_uInt16
) );
3415 SvStream
& SvxCharScaleWidthItem::Store( SvStream
& rStream
, USHORT nVer
) const
3417 SvStream
& rRet
= SfxUInt16Item::Store( rStream
, nVer
);
3418 if ( Which() == EE_CHAR_FONTWIDTH
)
3420 // see comment in Create()....
3421 rRet
.SeekRel( -1*(long)sizeof(USHORT
) );
3424 // Really ugly, but not a problem for reading the doc in 5.2
3425 rRet
<< (USHORT
)0x1234;
3431 USHORT
SvxCharScaleWidthItem::GetVersion( USHORT nFFVer
) const
3433 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
3436 SfxItemPresentation
SvxCharScaleWidthItem::GetPresentation(
3437 SfxItemPresentation ePres
,
3438 SfxMapUnit
/*eCoreMetric*/, SfxMapUnit
/*ePresMetric*/,
3439 String
&rText
, const IntlWrapper
* ) const
3443 case SFX_ITEM_PRESENTATION_NONE
:
3446 case SFX_ITEM_PRESENTATION_NAMELESS
:
3447 case SFX_ITEM_PRESENTATION_COMPLETE
:
3450 rText
= SVX_RESSTR( RID_SVXITEMS_CHARSCALE_OFF
);
3453 rText
= SVX_RESSTR( RID_SVXITEMS_CHARSCALE
);
3454 rText
.SearchAndReplaceAscii( "$(ARG1)",
3455 String::CreateFromInt32( GetValue() ));
3459 default: ; //prevent warning
3461 return SFX_ITEM_PRESENTATION_NONE
;
3464 sal_Bool
SvxCharScaleWidthItem::PutValue( const uno::Any
& rVal
, BYTE
/*nMemberId*/ )
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
)
3471 SetValue( (UINT16
) nValue
);
3475 DBG_ERROR( "SvxCharScaleWidthItem::PutValue - Wrong type!" );
3479 sal_Bool
SvxCharScaleWidthItem::QueryValue( uno::Any
& rVal
, BYTE
/*nMemberId*/ ) const
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();
3487 /*************************************************************************
3488 |* class SvxCharReliefItem
3489 *************************************************************************/
3491 SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue
,
3492 const sal_uInt16 nId
)
3493 : SfxEnumItem( nId
, (USHORT
)eValue
)
3497 SfxPoolItem
* SvxCharReliefItem::Clone( SfxItemPool
* ) const
3499 return new SvxCharReliefItem( *this );
3502 SfxPoolItem
* SvxCharReliefItem::Create(SvStream
& rStrm
, USHORT
) const
3506 return new SvxCharReliefItem( (FontRelief
)nVal
, Which() );
3509 SvStream
& SvxCharReliefItem::Store(SvStream
& rStrm
, USHORT
/*nIVer*/) const
3511 sal_uInt16 nVal
= GetValue();
3516 USHORT
SvxCharReliefItem::GetVersion( USHORT nFFVer
) const
3518 return SOFFICE_FILEFORMAT_50
> nFFVer
? USHRT_MAX
: 0;
3521 String
SvxCharReliefItem::GetValueTextByPos( USHORT nPos
) const
3523 DBG_ASSERT( RID_SVXITEMS_RELIEF_ENGRAVED
- RID_SVXITEMS_RELIEF_NONE
,
3525 return String( SVX_RES( RID_SVXITEMS_RELIEF_BEGIN
+ nPos
));
3528 USHORT
SvxCharReliefItem::GetValueCount() const
3530 return RID_SVXITEMS_RELIEF_ENGRAVED
- RID_SVXITEMS_RELIEF_NONE
;
3533 SfxItemPresentation
SvxCharReliefItem::GetPresentation
3535 SfxItemPresentation ePres
,
3536 SfxMapUnit
/*eCoreUnit*/,
3537 SfxMapUnit
/*ePresUnit*/,
3538 XubString
& rText
, const IntlWrapper
* /*pIntl*/
3541 SfxItemPresentation eRet
= ePres
;
3544 case SFX_ITEM_PRESENTATION_NONE
:
3548 case SFX_ITEM_PRESENTATION_NAMELESS
:
3549 case SFX_ITEM_PRESENTATION_COMPLETE
:
3550 rText
= GetValueTextByPos( GetValue() );
3554 eRet
= SFX_ITEM_PRESENTATION_NONE
;
3559 sal_Bool
SvxCharReliefItem::PutValue( const com::sun::star::uno::Any
& rVal
,
3562 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3563 nMemberId
&= ~CONVERT_TWIPS
;
3564 sal_Bool bRet
= sal_True
;
3569 sal_Int16 nVal
= -1;
3571 if(nVal
>= 0 && nVal
<= RELIEF_ENGRAVED
)
3572 SetValue( (USHORT
)nVal
);
3584 sal_Bool
SvxCharReliefItem::QueryValue( com::sun::star::uno::Any
& rVal
,
3585 BYTE nMemberId
) const
3587 // sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3588 nMemberId
&= ~CONVERT_TWIPS
;
3589 sal_Bool bRet
= sal_True
;
3593 rVal
<<= (sal_Int16
)GetValue();
3602 /*************************************************************************
3603 |* class SvxScriptTypeItemItem
3604 *************************************************************************/
3606 SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType
)
3607 : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE
, nType
)
3610 SfxPoolItem
* SvxScriptTypeItem::Clone( SfxItemPool
* ) const
3612 return new SvxScriptTypeItem( GetValue() );
3615 /*************************************************************************
3616 |* class SvxScriptSetItem
3617 *************************************************************************/
3619 SvxScriptSetItem::SvxScriptSetItem( USHORT nSlotId
, SfxItemPool
& rPool
)
3620 : SfxSetItem( nSlotId
, new SfxItemSet( rPool
,
3621 SID_ATTR_CHAR_FONT
, SID_ATTR_CHAR_FONT
))
3623 USHORT nLatin
, nAsian
, nComplex
;
3624 GetWhichIds( nLatin
, nAsian
, nComplex
);
3626 USHORT 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
;
3633 GetItemSet().SetRanges( aIds
);
3636 SfxPoolItem
* SvxScriptSetItem::Clone( SfxItemPool
* ) const
3638 SvxScriptSetItem
* p
= new SvxScriptSetItem( Which(), *GetItemSet().GetPool() );
3639 p
->GetItemSet().Put( GetItemSet(), FALSE
);
3643 SfxPoolItem
* SvxScriptSetItem::Create( SvStream
&, USHORT
) const
3648 const SfxPoolItem
* SvxScriptSetItem::GetItemOfScriptSet(
3649 const SfxItemSet
& rSet
, USHORT nId
)
3651 const SfxPoolItem
* pI
;
3652 SfxItemState eSt
= rSet
.GetItemState( nId
, FALSE
, &pI
);
3653 if( SFX_ITEM_SET
!= eSt
)
3654 pI
= SFX_ITEM_DEFAULT
== eSt
? &rSet
.Get( nId
) : 0;
3658 const SfxPoolItem
* SvxScriptSetItem::GetItemOfScript( USHORT nSlotId
, const SfxItemSet
& rSet
, USHORT nScript
)
3660 USHORT nLatin
, nAsian
, nComplex
;
3661 GetWhichIds( nSlotId
, rSet
, nLatin
, nAsian
, nComplex
);
3663 const SfxPoolItem
*pRet
, *pAsn
, *pCmplx
;
3666 default: //no one valid -> match to latin
3667 // case SCRIPTTYPE_LATIN:
3668 pRet
= GetItemOfScriptSet( rSet
, nLatin
);
3670 case SCRIPTTYPE_ASIAN
:
3671 pRet
= GetItemOfScriptSet( rSet
, nAsian
);
3673 case SCRIPTTYPE_COMPLEX
:
3674 pRet
= GetItemOfScriptSet( rSet
, nComplex
);
3677 case SCRIPTTYPE_LATIN
|SCRIPTTYPE_ASIAN
:
3678 if( 0 == (pRet
= GetItemOfScriptSet( rSet
, nLatin
)) ||
3679 0 == (pAsn
= GetItemOfScriptSet( rSet
, nAsian
)) ||
3684 case SCRIPTTYPE_LATIN
|SCRIPTTYPE_COMPLEX
:
3685 if( 0 == (pRet
= GetItemOfScriptSet( rSet
, nLatin
)) ||
3686 0 == (pCmplx
= GetItemOfScriptSet( rSet
, nComplex
)) ||
3691 case SCRIPTTYPE_ASIAN
|SCRIPTTYPE_COMPLEX
:
3692 if( 0 == (pRet
= GetItemOfScriptSet( rSet
, nAsian
)) ||
3693 0 == (pCmplx
= GetItemOfScriptSet( rSet
, nComplex
)) ||
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
)
3709 const SfxPoolItem
* SvxScriptSetItem::GetItemOfScript( USHORT nScript
) const
3711 return GetItemOfScript( Which(), GetItemSet(), nScript
);
3714 void SvxScriptSetItem::PutItemForScriptType( USHORT nScriptType
,
3715 const SfxPoolItem
& rItem
)
3717 USHORT nLatin
, nAsian
, nComplex
;
3718 GetWhichIds( nLatin
, nAsian
, nComplex
);
3720 SfxPoolItem
* pCpy
= rItem
.Clone();
3721 if( SCRIPTTYPE_LATIN
& nScriptType
)
3723 pCpy
->SetWhich( nLatin
);
3724 GetItemSet().Put( *pCpy
);
3726 if( SCRIPTTYPE_ASIAN
& nScriptType
)
3728 pCpy
->SetWhich( nAsian
);
3729 GetItemSet().Put( *pCpy
);
3731 if( SCRIPTTYPE_COMPLEX
& nScriptType
)
3733 pCpy
->SetWhich( nComplex
);
3734 GetItemSet().Put( *pCpy
);
3739 void SvxScriptSetItem::GetWhichIds( USHORT nSlotId
, const SfxItemSet
& rSet
, USHORT
& rLatin
, USHORT
& rAsian
, USHORT
& rComplex
)
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
);
3748 void SvxScriptSetItem::GetWhichIds( USHORT
& rLatin
, USHORT
& rAsian
,
3749 USHORT
& rComplex
) const
3751 GetWhichIds( Which(), GetItemSet(), rLatin
, rAsian
, rComplex
);
3754 void SvxScriptSetItem::GetSlotIds( USHORT nSlotId
, USHORT
& rLatin
,
3755 USHORT
& rAsian
, USHORT
& rComplex
)
3760 DBG_ASSERT( FALSE
, "wrong SlotId for class SvxScriptSetItem" );
3761 // no break - default to font - Id Range !!
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
;
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
;
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
;
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
;
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
;
3791 void GetDefaultFonts( SvxFontItem
& rLatin
, SvxFontItem
& rAsian
, SvxFontItem
& rComplex
)
3793 const USHORT nItemCnt
= 3;
3800 aOutTypeArr
[ nItemCnt
] =
3802 { DEFAULTFONT_LATIN_TEXT
, LANGUAGE_ENGLISH_US
},
3803 { DEFAULTFONT_CJK_TEXT
, LANGUAGE_ENGLISH_US
},
3804 { DEFAULTFONT_CTL_TEXT
, LANGUAGE_ARABIC_SAUDI_ARABIA
}
3807 SvxFontItem
* aItemArr
[ nItemCnt
] = { &rLatin
, &rAsian
, &rComplex
};
3809 for ( USHORT n
= 0; n
< nItemCnt
; ++n
)
3811 Font
aFont( OutputDevice::GetDefaultFont( aOutTypeArr
[ n
].nFontType
,
3812 aOutTypeArr
[ n
].nLanguage
,
3813 DEFAULTFONT_FLAGS_ONLYONE
, 0 ) );
3814 SvxFontItem
* pItem
= aItemArr
[ n
];
3815 pItem
->GetFamily() = aFont
.GetFamily();
3816 pItem
->GetFamilyName() = aFont
.GetName();
3817 pItem
->GetStyleName().Erase();
3818 pItem
->GetPitch() = aFont
.GetPitch();
3819 pItem
->GetCharSet() = aFont
.GetCharSet();
3824 USHORT
GetI18NScriptTypeOfLanguage( USHORT nLang
)
3826 return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang
) );
3829 USHORT
GetItemScriptType( short nI18NType
)
3831 switch ( nI18NType
)
3833 case i18n::ScriptType::LATIN
: return SCRIPTTYPE_LATIN
;
3834 case i18n::ScriptType::ASIAN
: return SCRIPTTYPE_ASIAN
;
3835 case i18n::ScriptType::COMPLEX
: return SCRIPTTYPE_COMPLEX
;
3840 short GetI18NScriptType( USHORT nItemType
)
3842 switch ( nItemType
)
3844 case SCRIPTTYPE_LATIN
: return i18n::ScriptType::LATIN
;
3845 case SCRIPTTYPE_ASIAN
: return i18n::ScriptType::ASIAN
;
3846 case SCRIPTTYPE_COMPLEX
: return i18n::ScriptType::COMPLEX
;