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