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