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