Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "CharacterPropertyItemConverter.hxx"
21 : : #include "SchWhichPairs.hxx"
22 : : #include "macros.hxx"
23 : : #include "ItemPropertyMap.hxx"
24 : : #include "RelativeSizeHelper.hxx"
25 : : #include <editeng/memberids.hrc>
26 : : #include <editeng/eeitem.hxx>
27 : : #include <editeng/udlnitem.hxx>
28 : : #include <editeng/fontitem.hxx>
29 : : #include <editeng/crsditem.hxx>
30 : : #include <editeng/postitem.hxx>
31 : : #include <editeng/wghtitem.hxx>
32 : : #include <editeng/fhgtitem.hxx>
33 : : #include <svl/stritem.hxx>
34 : :
35 : : #include <com/sun/star/beans/XPropertyState.hpp>
36 : : #include <com/sun/star/chart2/XFormattedString.hpp>
37 : :
38 : : using namespace ::com::sun::star;
39 : :
40 : : namespace
41 : : {
42 : 0 : ::comphelper::ItemPropertyMapType & lcl_GetCharacterPropertyPropertyMap()
43 : : {
44 : : static ::comphelper::ItemPropertyMapType aCharacterPropertyMap(
45 : : ::comphelper::MakeItemPropertyMap
46 : : IPM_MAP_ENTRY( EE_CHAR_COLOR, "CharColor", 0 )
47 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_LANGUAGE, "CharLocale", MID_LANG_LOCALE )
[ # # ][ # # ]
48 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CJK, "CharLocaleAsian", MID_LANG_LOCALE )
49 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_LANGUAGE_CTL, "CharLocaleComplex", MID_LANG_LOCALE )
50 : :
51 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_STRIKEOUT, "CharStrikeout", MID_CROSS_OUT )
52 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_WLM, "CharWordMode", 0 )
53 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_SHADOW, "CharShadowed", 0 )
54 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_RELIEF, "CharRelief", 0 )
55 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_OUTLINE, "CharContoured", 0 )
56 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_CHAR_EMPHASISMARK, "CharEmphasis", 0 )
57 : :
58 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_PARA_WRITINGDIR, "WritingMode", 0 )
59 : :
60 [ # # ][ # # ]: 0 : IPM_MAP_ENTRY( EE_PARA_ASIANCJKSPACING, "ParaIsCharacterDistance", 0 )
61 [ # # ][ # # ]: 0 : );
[ # # ][ # # ]
62 : :
63 : 0 : return aCharacterPropertyMap;
64 : : }
65 : : } // anonymous namespace
66 : :
67 : : // ========================================
68 : :
69 : : namespace chart
70 : : {
71 : : namespace wrapper
72 : : {
73 : :
74 : 0 : CharacterPropertyItemConverter::CharacterPropertyItemConverter(
75 : : const uno::Reference< beans::XPropertySet > & rPropertySet,
76 : : SfxItemPool& rItemPool ) :
77 : 0 : ItemConverter( rPropertySet, rItemPool )
78 : 0 : {}
79 : :
80 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
81 : 0 : CharacterPropertyItemConverter::CharacterPropertyItemConverter(
82 : : const uno::Reference< beans::XPropertySet > & rPropertySet,
83 : : SfxItemPool& rItemPool,
84 : : ::std::auto_ptr< awt::Size > pRefSize,
85 : : const ::rtl::OUString & rRefSizePropertyName,
86 : : const uno::Reference< beans::XPropertySet > & rRefSizePropSet ) :
87 : : ItemConverter( rPropertySet, rItemPool ),
88 : : m_pRefSize( pRefSize ),
89 : : m_aRefSizePropertyName( rRefSizePropertyName ),
90 [ # # ]: 0 : m_xRefSizePropSet( rRefSizePropSet.is() ? rRefSizePropSet : rPropertySet )
91 : 0 : {}
92 : : SAL_WNODEPRECATED_DECLARATIONS_POP
93 : :
94 : 0 : CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
95 [ # # ]: 0 : {}
96 : :
97 : 0 : const sal_uInt16 * CharacterPropertyItemConverter::GetWhichPairs() const
98 : : {
99 : 0 : return nCharacterPropertyWhichPairs;
100 : : }
101 : :
102 : 0 : bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
103 : : {
104 [ # # ]: 0 : ::comphelper::ItemPropertyMapType & rMap( lcl_GetCharacterPropertyPropertyMap());
105 [ # # ]: 0 : ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
106 : :
107 [ # # ]: 0 : if( aIt == rMap.end())
108 : 0 : return false;
109 : :
110 : 0 : rOutProperty =(*aIt).second;
111 : 0 : return true;
112 : : }
113 : :
114 : 0 : void CharacterPropertyItemConverter::FillSpecialItem(
115 : : sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
116 : : throw( uno::Exception )
117 : : {
118 [ # # # # : 0 : switch( nWhichId )
# # # #
# ]
119 : : {
120 : : case EE_CHAR_FONTINFO:
121 : : case EE_CHAR_FONTINFO_CJK:
122 : : case EE_CHAR_FONTINFO_CTL:
123 : : {
124 : 0 : ::rtl::OUString aPostfix;
125 [ # # ]: 0 : if( nWhichId == EE_CHAR_FONTINFO_CJK )
126 [ # # ]: 0 : aPostfix = C2U( "Asian" );
127 [ # # ]: 0 : else if( nWhichId == EE_CHAR_FONTINFO_CTL )
128 [ # # ]: 0 : aPostfix = C2U( "Complex" );
129 : :
130 [ # # ]: 0 : SvxFontItem aItem( nWhichId );
131 : :
132 [ # # ][ # # ]: 0 : aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix),
133 [ # # ][ # # ]: 0 : MID_FONT_FAMILY_NAME );
[ # # ]
134 [ # # ][ # # ]: 0 : aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix),
135 [ # # ][ # # ]: 0 : MID_FONT_FAMILY );
[ # # ]
136 [ # # ][ # # ]: 0 : aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix),
137 [ # # ][ # # ]: 0 : MID_FONT_STYLE_NAME );
[ # # ]
138 [ # # ][ # # ]: 0 : aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix),
139 [ # # ][ # # ]: 0 : MID_FONT_CHAR_SET );
[ # # ]
140 [ # # ][ # # ]: 0 : aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix),
141 [ # # ][ # # ]: 0 : MID_FONT_PITCH );
[ # # ]
142 : :
143 [ # # ][ # # ]: 0 : rOutItemSet.Put( aItem );
144 : : }
145 : 0 : break;
146 : :
147 : : case EE_CHAR_UNDERLINE:
148 : : {
149 [ # # ]: 0 : SvxUnderlineItem aItem(UNDERLINE_NONE, EE_CHAR_UNDERLINE);
150 : 0 : bool bModified = false;
151 : :
152 [ # # ][ # # ]: 0 : uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharUnderline" )));
[ # # ][ # # ]
153 [ # # ]: 0 : if( aValue.hasValue())
154 : : {
155 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_STYLE );
156 : 0 : bModified = true;
157 : : }
158 : :
159 [ # # ][ # # ]: 0 : aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ));
[ # # ][ # # ]
160 [ # # ]: 0 : if( aValue.hasValue() &&
[ # # # # ]
161 : 0 : ( *reinterpret_cast< const sal_Bool * >( aValue.getValue()) != sal_False ))
162 : : {
163 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_HASCOLOR );
164 : 0 : bModified = true;
165 : : }
166 : :
167 [ # # ][ # # ]: 0 : aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ));
[ # # ][ # # ]
168 [ # # ]: 0 : if( aValue.hasValue())
169 : : {
170 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_COLOR );
171 : 0 : bModified = true;
172 : : }
173 : :
174 [ # # ]: 0 : if( bModified )
175 [ # # ][ # # ]: 0 : rOutItemSet.Put( aItem );
176 : : }
177 : 0 : break;
178 : :
179 : : case EE_CHAR_OVERLINE:
180 : : {
181 [ # # ]: 0 : SvxOverlineItem aItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
182 : 0 : bool bModified = false;
183 : :
184 [ # # ][ # # ]: 0 : uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharOverline" ) ) );
[ # # ][ # # ]
185 [ # # ]: 0 : if ( aValue.hasValue() )
186 : : {
187 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_STYLE );
188 : 0 : bModified = true;
189 : : }
190 : :
191 [ # # ][ # # ]: 0 : aValue = GetPropertySet()->getPropertyValue( C2U( "CharOverlineHasColor" ) );
[ # # ][ # # ]
192 [ # # ]: 0 : if ( aValue.hasValue() &&
[ # # # # ]
193 : 0 : ( *reinterpret_cast< const sal_Bool* >( aValue.getValue() ) != sal_False ) )
194 : : {
195 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_HASCOLOR );
196 : 0 : bModified = true;
197 : : }
198 : :
199 [ # # ][ # # ]: 0 : aValue = GetPropertySet()->getPropertyValue( C2U( "CharOverlineColor" ) );
[ # # ][ # # ]
200 [ # # ]: 0 : if ( aValue.hasValue() )
201 : : {
202 [ # # ]: 0 : aItem.PutValue( aValue, MID_TL_COLOR );
203 : 0 : bModified = true;
204 : : }
205 : :
206 [ # # ]: 0 : if ( bModified )
207 : : {
208 [ # # ]: 0 : rOutItemSet.Put( aItem );
209 [ # # ]: 0 : }
210 : : }
211 : 0 : break;
212 : :
213 : : case EE_CHAR_ITALIC:
214 : : case EE_CHAR_ITALIC_CJK:
215 : : case EE_CHAR_ITALIC_CTL:
216 : : {
217 : 0 : ::rtl::OUString aPostfix;
218 [ # # ]: 0 : if( nWhichId == EE_CHAR_ITALIC_CJK )
219 [ # # ]: 0 : aPostfix = C2U( "Asian" );
220 [ # # ]: 0 : else if( nWhichId == EE_CHAR_ITALIC_CTL )
221 [ # # ]: 0 : aPostfix = C2U( "Complex" );
222 : :
223 [ # # ]: 0 : SvxPostureItem aItem( ITALIC_NONE, nWhichId );
224 : :
225 [ # # ][ # # ]: 0 : uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix));
[ # # ][ # # ]
226 [ # # ]: 0 : if( aValue.hasValue())
227 : : {
228 [ # # ]: 0 : aItem.PutValue( aValue, MID_POSTURE );
229 [ # # ]: 0 : rOutItemSet.Put( aItem );
230 [ # # ]: 0 : }
231 : : }
232 : 0 : break;
233 : :
234 : : case EE_CHAR_WEIGHT:
235 : : case EE_CHAR_WEIGHT_CJK:
236 : : case EE_CHAR_WEIGHT_CTL:
237 : : {
238 : 0 : ::rtl::OUString aPostfix;
239 [ # # ]: 0 : if( nWhichId == EE_CHAR_WEIGHT_CJK )
240 [ # # ]: 0 : aPostfix = C2U( "Asian" );
241 [ # # ]: 0 : else if( nWhichId == EE_CHAR_WEIGHT_CTL )
242 [ # # ]: 0 : aPostfix = C2U( "Complex" );
243 : :
244 [ # # ]: 0 : SvxWeightItem aItem( WEIGHT_NORMAL, nWhichId );
245 : :
246 [ # # ][ # # ]: 0 : uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix));
[ # # ][ # # ]
247 [ # # ]: 0 : if( aValue.hasValue())
248 : : {
249 [ # # ]: 0 : aItem.PutValue( aValue, MID_WEIGHT );
250 [ # # ]: 0 : rOutItemSet.Put( aItem );
251 [ # # ]: 0 : }
252 : : }
253 : 0 : break;
254 : :
255 : : case EE_CHAR_FONTHEIGHT:
256 : : case EE_CHAR_FONTHEIGHT_CJK:
257 : : case EE_CHAR_FONTHEIGHT_CTL:
258 : : {
259 : 0 : ::rtl::OUString aPostfix;
260 [ # # ]: 0 : if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
261 [ # # ]: 0 : aPostfix = C2U( "Asian" );
262 [ # # ]: 0 : else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
263 [ # # ]: 0 : aPostfix = C2U( "Complex" );
264 : :
265 [ # # ]: 0 : SvxFontHeightItem aItem( 240, 100, nWhichId );
266 : :
267 : : try
268 : : {
269 [ # # ][ # # ]: 0 : uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ));
[ # # ][ # # ]
270 : : float fHeight;
271 [ # # ]: 0 : if( aValue >>= fHeight )
272 : : {
273 [ # # ]: 0 : if( m_pRefSize.get())
274 : : {
275 : 0 : awt::Size aOldRefSize;
276 [ # # ][ # # ]: 0 : if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
[ # # ][ # # ]
[ # # ]
277 : : {
278 : : // calculate font height in view
279 : : fHeight = static_cast< float >(
280 [ # # ]: 0 : RelativeSizeHelper::calculate( fHeight, aOldRefSize, *m_pRefSize ));
281 [ # # ]: 0 : aValue <<= fHeight;
282 : : }
283 : : }
284 : :
285 [ # # ]: 0 : aItem.PutValue( aValue, MID_FONTHEIGHT );
286 [ # # ]: 0 : rOutItemSet.Put( aItem );
287 [ # # ]: 0 : }
288 : : }
289 [ # # ]: 0 : catch( const uno::Exception & ex )
290 : : {
291 : : ASSERT_EXCEPTION( ex );
292 [ # # ]: 0 : }
293 : : }
294 : 0 : break;
295 : :
296 : : case SID_CHAR_DLG_PREVIEW_STRING:
297 : : {
298 [ # # ][ # # ]: 0 : uno::Reference< chart2::XFormattedString > xFormattedString( GetPropertySet(), uno::UNO_QUERY );
299 [ # # ]: 0 : if( xFormattedString.is() )
300 : : {
301 [ # # ][ # # ]: 0 : ::rtl::OUString aString = xFormattedString->getString();
302 [ # # ][ # # ]: 0 : rOutItemSet.Put( SfxStringItem( nWhichId, aString ) );
[ # # ][ # # ]
[ # # ]
303 : : }
304 : : else
305 [ # # ][ # # ]: 0 : rOutItemSet.Put( SfxStringItem( nWhichId, C2U( "" ) ) );
[ # # ][ # # ]
[ # # ][ # # ]
306 : : }
307 : 0 : break;
308 : :
309 : : case EE_PARA_FORBIDDENRULES:
310 : : case EE_PARA_HANGINGPUNCTUATION:
311 : 0 : rOutItemSet.DisableItem( nWhichId );
312 : 0 : break;
313 : : }
314 : 0 : }
315 : :
316 : 0 : bool CharacterPropertyItemConverter::ApplySpecialItem(
317 : : sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
318 : : throw( uno::Exception )
319 : : {
320 : 0 : bool bChanged = false;
321 : 0 : uno::Any aValue;
322 : :
323 [ # # # # : 0 : switch( nWhichId )
# # # ]
324 : : {
325 : : case EE_CHAR_FONTINFO:
326 : : case EE_CHAR_FONTINFO_CJK:
327 : : case EE_CHAR_FONTINFO_CTL:
328 : : {
329 : 0 : ::rtl::OUString aPostfix;
330 [ # # ]: 0 : if( nWhichId == EE_CHAR_FONTINFO_CJK )
331 [ # # ]: 0 : aPostfix = C2U( "Asian" );
332 [ # # ]: 0 : else if( nWhichId == EE_CHAR_FONTINFO_CTL )
333 [ # # ]: 0 : aPostfix = C2U( "Complex" );
334 : :
335 : : const SvxFontItem & rItem =
336 : : static_cast< const SvxFontItem & >(
337 [ # # ]: 0 : rItemSet.Get( nWhichId ));
338 : :
339 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONT_FAMILY_NAME ))
340 : : {
341 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
342 : : {
343 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharFontName" ) + aPostfix, aValue );
[ # # ][ # # ]
344 : 0 : bChanged = true;
345 : : }
346 : : }
347 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONT_FAMILY ))
348 : : {
349 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
350 : : {
351 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharFontFamily" ) + aPostfix, aValue );
[ # # ][ # # ]
352 : 0 : bChanged = true;
353 : : }
354 : : }
355 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONT_STYLE_NAME ))
356 : : {
357 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
358 : : {
359 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharFontStyleName" ) + aPostfix, aValue );
[ # # ][ # # ]
360 : 0 : bChanged = true;
361 : : }
362 : : }
363 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONT_CHAR_SET ))
364 : : {
365 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
366 : : {
367 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharFontCharSet" ) + aPostfix, aValue );
[ # # ][ # # ]
368 : 0 : bChanged = true;
369 : : }
370 : : }
371 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONT_PITCH ))
372 : : {
373 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
374 : : {
375 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharFontPitch" ) + aPostfix, aValue );
[ # # ][ # # ]
376 : 0 : bChanged = true;
377 : : }
378 : 0 : }
379 : : }
380 : 0 : break;
381 : :
382 : : case EE_CHAR_UNDERLINE:
383 : : {
384 : : const SvxUnderlineItem & rItem =
385 : : static_cast< const SvxUnderlineItem & >(
386 [ # # ]: 0 : rItemSet.Get( nWhichId ));
387 : :
388 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_TL_STYLE ))
389 : : {
390 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderline" ) ))
[ # # ][ # # ]
[ # # ]
391 : : {
392 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharUnderline" ), aValue );
[ # # ][ # # ]
393 : 0 : bChanged = true;
394 : : }
395 : : }
396 : :
397 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_TL_COLOR ))
398 : : {
399 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ) ))
[ # # ][ # # ]
[ # # ]
400 : : {
401 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharUnderlineColor" ), aValue );
[ # # ][ # # ]
402 : 0 : bChanged = true;
403 : : }
404 : : }
405 : :
406 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_TL_HASCOLOR ))
407 : : {
408 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ) ))
[ # # ][ # # ]
[ # # ]
409 : : {
410 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharUnderlineHasColor" ), aValue );
[ # # ][ # # ]
411 : 0 : bChanged = true;
412 : : }
413 : : }
414 : : }
415 : 0 : break;
416 : :
417 : : case EE_CHAR_OVERLINE:
418 : : {
419 [ # # ]: 0 : const SvxOverlineItem& rItem = static_cast< const SvxOverlineItem & >( rItemSet.Get( nWhichId ) );
420 : :
421 [ # # ][ # # ]: 0 : if ( rItem.QueryValue( aValue, MID_TL_STYLE ) )
422 : : {
423 [ # # ][ # # ]: 0 : if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverline" ) ) )
[ # # ][ # # ]
[ # # ]
424 : : {
425 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharOverline" ), aValue );
[ # # ][ # # ]
426 : 0 : bChanged = true;
427 : : }
428 : : }
429 : :
430 [ # # ][ # # ]: 0 : if ( rItem.QueryValue( aValue, MID_TL_COLOR ) )
431 : : {
432 [ # # ][ # # ]: 0 : if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverlineColor" ) ) )
[ # # ][ # # ]
[ # # ]
433 : : {
434 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharOverlineColor" ), aValue );
[ # # ][ # # ]
435 : 0 : bChanged = true;
436 : : }
437 : : }
438 : :
439 [ # # ][ # # ]: 0 : if ( rItem.QueryValue( aValue, MID_TL_HASCOLOR ) )
440 : : {
441 [ # # ][ # # ]: 0 : if ( aValue != GetPropertySet()->getPropertyValue( C2U( "CharOverlineHasColor" ) ) )
[ # # ][ # # ]
[ # # ]
442 : : {
443 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharOverlineHasColor" ), aValue );
[ # # ][ # # ]
444 : 0 : bChanged = true;
445 : : }
446 : : }
447 : : }
448 : 0 : break;
449 : :
450 : : case EE_CHAR_ITALIC:
451 : : case EE_CHAR_ITALIC_CJK:
452 : : case EE_CHAR_ITALIC_CTL:
453 : : {
454 : 0 : ::rtl::OUString aPostfix;
455 [ # # ]: 0 : if( nWhichId == EE_CHAR_ITALIC_CJK )
456 [ # # ]: 0 : aPostfix = C2U( "Asian" );
457 [ # # ]: 0 : else if( nWhichId == EE_CHAR_ITALIC_CTL )
458 [ # # ]: 0 : aPostfix = C2U( "Complex" );
459 : :
460 : : const SvxPostureItem & rItem =
461 : : static_cast< const SvxPostureItem & >(
462 [ # # ]: 0 : rItemSet.Get( nWhichId ));
463 : :
464 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_POSTURE ))
465 : : {
466 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) + aPostfix))
[ # # ][ # # ]
[ # # ]
467 : : {
468 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharPosture" ) + aPostfix, aValue );
[ # # ][ # # ]
469 : 0 : bChanged = true;
470 : : }
471 : 0 : }
472 : : }
473 : 0 : break;
474 : :
475 : : case EE_CHAR_WEIGHT:
476 : : case EE_CHAR_WEIGHT_CJK:
477 : : case EE_CHAR_WEIGHT_CTL:
478 : : {
479 : 0 : ::rtl::OUString aPostfix;
480 [ # # ]: 0 : if( nWhichId == EE_CHAR_WEIGHT_CJK )
481 [ # # ]: 0 : aPostfix = C2U( "Asian" );
482 [ # # ]: 0 : else if( nWhichId == EE_CHAR_WEIGHT_CTL )
483 [ # # ]: 0 : aPostfix = C2U( "Complex" );
484 : :
485 : : const SvxWeightItem & rItem =
486 : : static_cast< const SvxWeightItem & >(
487 [ # # ]: 0 : rItemSet.Get( nWhichId ));
488 : :
489 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_WEIGHT ))
490 : : {
491 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) + aPostfix))
[ # # ][ # # ]
[ # # ]
492 : : {
493 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharWeight" ) + aPostfix, aValue );
[ # # ][ # # ]
494 : 0 : bChanged = true;
495 : : }
496 : 0 : }
497 : : }
498 : 0 : break;
499 : :
500 : : case EE_CHAR_FONTHEIGHT:
501 : : case EE_CHAR_FONTHEIGHT_CJK:
502 : : case EE_CHAR_FONTHEIGHT_CTL:
503 : : {
504 : 0 : ::rtl::OUString aPostfix;
505 [ # # ]: 0 : if( nWhichId == EE_CHAR_FONTHEIGHT_CJK )
506 [ # # ]: 0 : aPostfix = C2U( "Asian" );
507 [ # # ]: 0 : else if( nWhichId == EE_CHAR_FONTHEIGHT_CTL )
508 [ # # ]: 0 : aPostfix = C2U( "Complex" );
509 : :
510 : : const SvxFontHeightItem & rItem =
511 : : static_cast< const SvxFontHeightItem & >(
512 [ # # ]: 0 : rItemSet.Get( nWhichId ));
513 : :
514 : : try
515 : : {
516 [ # # ][ # # ]: 0 : if( rItem.QueryValue( aValue, MID_FONTHEIGHT ) )
517 : : {
518 : 0 : bool bSetValue = false;
519 [ # # ][ # # ]: 0 : if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharHeight" ) + aPostfix ))
[ # # ][ # # ]
[ # # ]
520 : 0 : bSetValue = true;
521 : : else
522 : : {
523 [ # # ]: 0 : if( m_pRefSize.get() )
524 : : {
525 : 0 : awt::Size aNewRefSize = *m_pRefSize;
526 : 0 : awt::Size aOldRefSize;
527 [ # # ][ # # ]: 0 : if( GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ) >>= aOldRefSize )
[ # # ][ # # ]
[ # # ]
528 : : {
529 [ # # ][ # # ]: 0 : if( aNewRefSize.Width != aOldRefSize.Width
530 : : || aNewRefSize.Height != aOldRefSize.Height )
531 : 0 : bSetValue = true;
532 : : }
533 : : }
534 : : }
535 [ # # ]: 0 : if( bSetValue )
536 : : {
537 : : // set new reference size only if there was a reference size before (auto-scaling on)
538 [ # # # # ]: 0 : if( m_pRefSize.get() &&
[ # # ]
539 [ # # ][ # # ]: 0 : GetRefSizePropertySet()->getPropertyValue( m_aRefSizePropertyName ).hasValue())
[ # # ][ # # ]
[ # # ]
[ # # # # ]
540 : : {
541 [ # # ][ # # ]: 0 : GetRefSizePropertySet()->setPropertyValue( m_aRefSizePropertyName,
542 [ # # ][ # # ]: 0 : uno::makeAny( *m_pRefSize ));
543 : : }
544 : :
545 [ # # ][ # # ]: 0 : GetPropertySet()->setPropertyValue( C2U( "CharHeight" ) + aPostfix, aValue );
[ # # ][ # # ]
[ # # ]
546 : 0 : bChanged = true;
547 : : }
548 : : }
549 : : }
550 [ # # ]: 0 : catch( const uno::Exception & ex )
551 : : {
552 : : ASSERT_EXCEPTION( ex );
553 : 0 : }
554 : : }
555 : 0 : break;
556 : : }
557 : :
558 : 0 : return bChanged;
559 : : }
560 : :
561 : : uno::Reference< beans::XPropertySet >
562 : 0 : CharacterPropertyItemConverter::GetRefSizePropertySet() const
563 : : {
564 : 0 : return m_xRefSizePropSet;
565 : : }
566 : :
567 : : } // namespace wrapper
568 : : } // namespace chart
569 : :
570 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|