update dev300-m58
[ooovba.git] / chart2 / source / tools / CharacterProperties.cxx
blobaae579c296017d04c398fb84cbd1e3016baf9b9a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CharacterProperties.cxx,v $
10 * $Revision: 1.11.46.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "CharacterProperties.hxx"
34 #include "ContainerHelper.hxx"
35 #include "macros.hxx"
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #include <com/sun/star/style/XStyle.hpp>
39 #include <com/sun/star/awt/FontSlant.hpp>
40 #include <com/sun/star/lang/Locale.hpp>
42 #include <com/sun/star/awt/FontFamily.hpp>
43 #include <com/sun/star/awt/CharSet.hpp>
44 #include <com/sun/star/awt/FontPitch.hpp>
45 #include <com/sun/star/awt/FontUnderline.hpp>
46 #include <com/sun/star/awt/FontWeight.hpp>
47 #include <com/sun/star/awt/FontSlant.hpp>
48 #include <com/sun/star/style/CaseMap.hpp>
49 #include <com/sun/star/text/FontRelief.hpp>
50 #include <com/sun/star/text/FontEmphasis.hpp>
51 #include <com/sun/star/text/RubyAdjust.hpp>
52 #include <com/sun/star/awt/FontStrikeout.hpp>
53 #include <com/sun/star/text/WritingMode2.hpp>
55 #include <comphelper/InlineContainer.hxx>
57 // header for struct SvtLinguConfig
58 #ifndef _SVTOOLS_LINGUCFG_HXX_
59 #include <svtools/lingucfg.hxx>
60 #endif
61 #ifndef INCLUDED_I18NPOOL_MSLANGID_HXX
62 #include <i18npool/mslangid.hxx>
63 #endif
64 #ifndef _SV_OUTDEV_HXX
65 #include <vcl/outdev.hxx>
66 #endif
68 using namespace ::com::sun::star;
70 using ::com::sun::star::beans::Property;
72 using ::rtl::OUString;
74 namespace chart
77 void CharacterProperties::AddPropertiesToVector(
78 ::std::vector< Property > & rOutProperties )
80 // CharacterProperties
81 rOutProperties.push_back(
82 Property( C2U( "CharFontName" ),
83 PROP_CHAR_FONT_NAME,
84 ::getCppuType( reinterpret_cast< const OUString * >(0)),
85 beans::PropertyAttribute::BOUND
86 | beans::PropertyAttribute::MAYBEDEFAULT ));
87 rOutProperties.push_back(
88 Property( C2U( "CharFontStyleName" ),
89 PROP_CHAR_FONT_STYLE_NAME,
90 ::getCppuType( reinterpret_cast< const OUString * >(0)),
91 beans::PropertyAttribute::BOUND
92 | beans::PropertyAttribute::MAYBEDEFAULT
93 | beans::PropertyAttribute::MAYBEVOID ));
94 // CharFontFamily (see awt.FontFamily)
95 rOutProperties.push_back(
96 Property( C2U( "CharFontFamily" ),
97 PROP_CHAR_FONT_FAMILY,
98 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
99 beans::PropertyAttribute::BOUND
100 | beans::PropertyAttribute::MAYBEDEFAULT ));
101 // CharFontCharSet (see awt.CharSet)
102 rOutProperties.push_back(
103 Property( C2U( "CharFontCharSet" ),
104 PROP_CHAR_FONT_CHAR_SET,
105 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
106 beans::PropertyAttribute::BOUND
107 | beans::PropertyAttribute::MAYBEDEFAULT ));
108 // CharFontPitch (see awt.FontPitch)
109 rOutProperties.push_back(
110 Property( C2U( "CharFontPitch" ),
111 PROP_CHAR_FONT_PITCH,
112 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
113 beans::PropertyAttribute::BOUND
114 | beans::PropertyAttribute::MAYBEDEFAULT ));
115 // CharColor
116 rOutProperties.push_back(
117 Property( C2U( "CharColor" ),
118 PROP_CHAR_COLOR,
119 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::MAYBEDEFAULT ));
122 // CharBackColor
123 // rOutProperties.push_back(
124 // Property( C2U( "CharBackColor" ),
125 // PROP_CHAR_BACKGROUND_COLOR,
126 // ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
127 // beans::PropertyAttribute::BOUND
128 // | beans::PropertyAttribute::MAYBEDEFAULT));
129 // CharEscapement
130 rOutProperties.push_back(
131 Property( C2U( "CharEscapement" ),
132 PROP_CHAR_ESCAPEMENT,
133 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
134 beans::PropertyAttribute::BOUND
135 | beans::PropertyAttribute::MAYBEVOID ));
136 // CharHeight
137 rOutProperties.push_back(
138 Property( C2U( "CharHeight" ),
139 PROP_CHAR_CHAR_HEIGHT,
140 ::getCppuType( reinterpret_cast< const float * >(0)),
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::MAYBEDEFAULT ));
143 // CharUnderline (see awt.FontUnderline)
144 rOutProperties.push_back(
145 Property( C2U( "CharUnderline" ),
146 PROP_CHAR_UNDERLINE,
147 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
148 beans::PropertyAttribute::BOUND
149 | beans::PropertyAttribute::MAYBEDEFAULT ));
150 // CharUnderlineColor
151 rOutProperties.push_back(
152 Property( C2U( "CharUnderlineColor" ),
153 PROP_CHAR_UNDERLINE_COLOR,
154 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
155 beans::PropertyAttribute::BOUND
156 | beans::PropertyAttribute::MAYBEDEFAULT
157 | beans::PropertyAttribute::MAYBEVOID ));
158 // CharUnderlineHasColor
159 rOutProperties.push_back(
160 Property( C2U( "CharUnderlineHasColor" ),
161 PROP_CHAR_UNDERLINE_HAS_COLOR,
162 ::getBooleanCppuType(),
163 beans::PropertyAttribute::BOUND
164 | beans::PropertyAttribute::MAYBEDEFAULT ));
165 // CharWeight (see awt.FontWeight)
166 rOutProperties.push_back(
167 Property( C2U( "CharWeight" ),
168 PROP_CHAR_WEIGHT,
169 ::getCppuType( reinterpret_cast< const float * >(0)),
170 beans::PropertyAttribute::BOUND
171 | beans::PropertyAttribute::MAYBEDEFAULT ));
172 // CharPosture
173 rOutProperties.push_back(
174 Property( C2U( "CharPosture" ),
175 PROP_CHAR_POSTURE,
176 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
177 beans::PropertyAttribute::BOUND
178 | beans::PropertyAttribute::MAYBEDEFAULT ));
179 rOutProperties.push_back(
180 Property( C2U( "CharAutoKerning" ),
181 PROP_CHAR_AUTO_KERNING,
182 ::getBooleanCppuType(),
183 beans::PropertyAttribute::BOUND
184 | beans::PropertyAttribute::MAYBEDEFAULT
185 | beans::PropertyAttribute::MAYBEVOID ));
186 rOutProperties.push_back(
187 Property( C2U( "CharKerning" ),
188 PROP_CHAR_KERNING,
189 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
190 beans::PropertyAttribute::BOUND
191 | beans::PropertyAttribute::MAYBEDEFAULT
192 | beans::PropertyAttribute::MAYBEVOID ));
193 // CharCaseMap (see style.CaseMap)
194 // rOutProperties.push_back(
195 // Property( C2U( "CharCaseMap" ),
196 // PROP_CHAR_CASE_MAPPING,
197 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
198 // beans::PropertyAttribute::BOUND
199 // | beans::PropertyAttribute::MAYBEDEFAULT ));
202 // CharRotation
203 // rOutProperties.push_back(
204 // Property( C2U( "CharRotation" ),
205 // PROP_CHAR_ROTATION,
206 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
207 // beans::PropertyAttribute::BOUND
208 // | beans::PropertyAttribute::MAYBEDEFAULT ));
210 // // CharScaleWidth
211 // rOutProperties.push_back(
212 // Property( C2U( "CharScaleWidth" ),
213 // PROP_CHAR_SCALE_WIDTH,
214 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
215 // beans::PropertyAttribute::BOUND
216 // | beans::PropertyAttribute::MAYBEDEFAULT ));
217 // CharEscapementHeight
218 rOutProperties.push_back(
219 Property( C2U( "CharEscapementHeight" ),
220 PROP_CHAR_ESCAPEMENT_HEIGHT,
221 ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
222 beans::PropertyAttribute::BOUND
223 | beans::PropertyAttribute::MAYBEVOID ));
225 // CharCrossedOut
226 // rOutProperties.push_back(
227 // Property( C2U( "CharCrossedOut" ),
228 // PROP_CHAR_CROSSED_OUT,
229 // ::getBooleanCppuType(),
230 // beans::PropertyAttribute::BOUND
231 // | beans::PropertyAttribute::MAYBEDEFAULT ));
232 // CharStrikeout (see awt.FontStrikeout)
233 rOutProperties.push_back(
234 Property( C2U( "CharStrikeout" ),
235 PROP_CHAR_STRIKE_OUT,
236 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
237 beans::PropertyAttribute::BOUND
238 | beans::PropertyAttribute::MAYBEDEFAULT ));
239 // CharWordMode
240 rOutProperties.push_back(
241 Property( C2U( "CharWordMode" ),
242 PROP_CHAR_WORD_MODE,
243 ::getBooleanCppuType(),
244 beans::PropertyAttribute::BOUND
245 | beans::PropertyAttribute::MAYBEDEFAULT ));
246 // CharFlash
247 // rOutProperties.push_back(
248 // Property( C2U( "CharFlash" ),
249 // PROP_CHAR_FLASH,
250 // ::getBooleanCppuType(),
251 // beans::PropertyAttribute::BOUND
252 // | beans::PropertyAttribute::MAYBEDEFAULT ));
253 // CharLocale
254 rOutProperties.push_back(
255 Property( C2U( "CharLocale" ),
256 PROP_CHAR_LOCALE,
257 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
258 beans::PropertyAttribute::BOUND
259 | beans::PropertyAttribute::MAYBEDEFAULT ));
260 // CharShadowed
261 rOutProperties.push_back(
262 Property( C2U( "CharShadowed" ),
263 PROP_CHAR_SHADOWED,
264 ::getBooleanCppuType(),
265 beans::PropertyAttribute::BOUND
266 | beans::PropertyAttribute::MAYBEDEFAULT ));
267 // CharContoured
268 rOutProperties.push_back(
269 Property( C2U( "CharContoured" ),
270 PROP_CHAR_CONTOURED,
271 ::getBooleanCppuType(),
272 beans::PropertyAttribute::BOUND
273 | beans::PropertyAttribute::MAYBEDEFAULT ));
274 // CharRelief (see text.FontRelief)
275 rOutProperties.push_back(
276 Property( C2U( "CharRelief" ),
277 PROP_CHAR_RELIEF,
278 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
279 beans::PropertyAttribute::BOUND
280 | beans::PropertyAttribute::MAYBEDEFAULT ));
282 // CharEmphasize (see text.FontEmphasis)
283 rOutProperties.push_back(
284 Property( C2U( "CharEmphasis" ),
285 PROP_CHAR_EMPHASIS,
286 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
287 beans::PropertyAttribute::BOUND
288 | beans::PropertyAttribute::MAYBEDEFAULT ));
289 // // RubyText
290 // rOutProperties.push_back(
291 // Property( C2U( "RubyText" ),
292 // PROP_CHAR_RUBY_TEXT,
293 // ::getCppuType( reinterpret_cast< const OUString * >(0)),
294 // beans::PropertyAttribute::BOUND
295 // | beans::PropertyAttribute::MAYBEDEFAULT ));
296 // // RubyAdjust (see text.RubyAdjust)
297 // rOutProperties.push_back(
298 // Property( C2U( "RubyAdjust" ),
299 // PROP_CHAR_RUBY_ADJUST,
300 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
301 // beans::PropertyAttribute::BOUND
302 // | beans::PropertyAttribute::MAYBEDEFAULT ));
303 // // RubyCharStyleName
304 // rOutProperties.push_back(
305 // Property( C2U( "RubyStyleName" ),
306 // PROP_CHAR_RUBY_STYLE_NAME,
307 // ::getCppuType( reinterpret_cast< const OUString * >(0)),
308 // beans::PropertyAttribute::BOUND
309 // | beans::PropertyAttribute::MAYBEDEFAULT ));
310 // // RubyIsAbove
311 // rOutProperties.push_back(
312 // Property( C2U( "RubyIsAbove" ),
313 // PROP_CHAR_RUBY_IS_ABOVE,
314 // ::getBooleanCppuType(),
315 // beans::PropertyAttribute::BOUND
316 // | beans::PropertyAttribute::MAYBEDEFAULT ));
317 // // CharNoHyphenation
318 // rOutProperties.push_back(
319 // Property( C2U( "InhibitHyphenation" ),
320 // PROP_CHAR_INHIBIT_HYPHENATION,
321 // ::getBooleanCppuType(),
322 // beans::PropertyAttribute::BOUND
323 // | beans::PropertyAttribute::MAYBEDEFAULT ));
325 // CharacterPropertiesAsian
326 // =====
327 // CharFontNameAsian
328 rOutProperties.push_back(
329 Property( C2U( "CharFontNameAsian" ),
330 PROP_CHAR_ASIAN_FONT_NAME,
331 ::getCppuType( reinterpret_cast< const OUString * >(0)),
332 beans::PropertyAttribute::BOUND
333 | beans::PropertyAttribute::MAYBEDEFAULT ));
334 // CharFontStyleNameAsian
335 rOutProperties.push_back(
336 Property( C2U( "CharFontStyleNameAsian" ),
337 PROP_CHAR_ASIAN_FONT_STYLE_NAME,
338 ::getCppuType( reinterpret_cast< const OUString * >(0)),
339 beans::PropertyAttribute::BOUND
340 | beans::PropertyAttribute::MAYBEDEFAULT
341 | beans::PropertyAttribute::MAYBEVOID ));
342 // CharFontFamilyAsian (see awt.FontFamily)
343 rOutProperties.push_back(
344 Property( C2U( "CharFontFamilyAsian" ),
345 PROP_CHAR_ASIAN_FONT_FAMILY,
346 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
347 beans::PropertyAttribute::BOUND
348 | beans::PropertyAttribute::MAYBEDEFAULT ));
349 // CharFontCharSetAsian (see awt.CharSet)
350 rOutProperties.push_back(
351 Property( C2U( "CharFontCharSetAsian" ),
352 PROP_CHAR_ASIAN_CHAR_SET,
353 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
354 beans::PropertyAttribute::BOUND
355 | beans::PropertyAttribute::MAYBEDEFAULT ));
356 // CharFontPitchAsian (see awt.FontPitch)
357 rOutProperties.push_back(
358 Property( C2U( "CharFontPitchAsian" ),
359 PROP_CHAR_ASIAN_FONT_PITCH,
360 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
361 beans::PropertyAttribute::BOUND
362 | beans::PropertyAttribute::MAYBEDEFAULT ));
363 // CharHeightAsian
364 rOutProperties.push_back(
365 Property( C2U( "CharHeightAsian" ),
366 PROP_CHAR_ASIAN_CHAR_HEIGHT,
367 ::getCppuType( reinterpret_cast< const float * >(0)),
368 beans::PropertyAttribute::BOUND
369 | beans::PropertyAttribute::MAYBEDEFAULT ));
370 // CharWeightAsian
371 rOutProperties.push_back(
372 Property( C2U( "CharWeightAsian" ),
373 PROP_CHAR_ASIAN_WEIGHT,
374 ::getCppuType( reinterpret_cast< const float * >(0)),
375 beans::PropertyAttribute::BOUND
376 | beans::PropertyAttribute::MAYBEDEFAULT ));
377 // CharPostureAsian
378 rOutProperties.push_back(
379 Property( C2U( "CharPostureAsian" ),
380 PROP_CHAR_ASIAN_POSTURE,
381 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
382 beans::PropertyAttribute::BOUND
383 | beans::PropertyAttribute::MAYBEDEFAULT ));
384 // CharLocaleAsian
385 rOutProperties.push_back(
386 Property( C2U( "CharLocaleAsian" ),
387 PROP_CHAR_ASIAN_LOCALE,
388 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
389 beans::PropertyAttribute::BOUND
390 | beans::PropertyAttribute::MAYBEDEFAULT ));
392 // CharacterPropertiesComplex
393 // ===
394 // CharFontNameComplex
395 rOutProperties.push_back(
396 Property( C2U( "CharFontNameComplex" ),
397 PROP_CHAR_COMPLEX_FONT_NAME,
398 ::getCppuType( reinterpret_cast< const OUString * >(0)),
399 beans::PropertyAttribute::BOUND
400 | beans::PropertyAttribute::MAYBEDEFAULT ));
401 // CharFontStyleNameComplex
402 rOutProperties.push_back(
403 Property( C2U( "CharFontStyleNameComplex" ),
404 PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
405 ::getCppuType( reinterpret_cast< const OUString * >(0)),
406 beans::PropertyAttribute::BOUND
407 | beans::PropertyAttribute::MAYBEDEFAULT
408 | beans::PropertyAttribute::MAYBEVOID ));
409 // CharFontFamilyComplex (see awt.FontFamily)
410 rOutProperties.push_back(
411 Property( C2U( "CharFontFamilyComplex" ),
412 PROP_CHAR_COMPLEX_FONT_FAMILY,
413 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
414 beans::PropertyAttribute::BOUND
415 | beans::PropertyAttribute::MAYBEDEFAULT ));
416 // CharFontCharSetComplex (see awt.CharSet)
417 rOutProperties.push_back(
418 Property( C2U( "CharFontCharSetComplex" ),
419 PROP_CHAR_COMPLEX_CHAR_SET,
420 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
421 beans::PropertyAttribute::BOUND
422 | beans::PropertyAttribute::MAYBEDEFAULT ));
423 // CharFontPitchComplex (see awt.FontPitch)
424 rOutProperties.push_back(
425 Property( C2U( "CharFontPitchComplex" ),
426 PROP_CHAR_COMPLEX_FONT_PITCH,
427 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
428 beans::PropertyAttribute::BOUND
429 | beans::PropertyAttribute::MAYBEDEFAULT ));
430 // CharHeightComplex
431 rOutProperties.push_back(
432 Property( C2U( "CharHeightComplex" ),
433 PROP_CHAR_COMPLEX_CHAR_HEIGHT,
434 ::getCppuType( reinterpret_cast< const float * >(0)),
435 beans::PropertyAttribute::BOUND
436 | beans::PropertyAttribute::MAYBEDEFAULT ));
437 // CharWeightComplex
438 rOutProperties.push_back(
439 Property( C2U( "CharWeightComplex" ),
440 PROP_CHAR_COMPLEX_WEIGHT,
441 ::getCppuType( reinterpret_cast< const float * >(0)),
442 beans::PropertyAttribute::BOUND
443 | beans::PropertyAttribute::MAYBEDEFAULT ));
444 // CharPostureComplex
445 rOutProperties.push_back(
446 Property( C2U( "CharPostureComplex" ),
447 PROP_CHAR_COMPLEX_POSTURE,
448 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
449 beans::PropertyAttribute::BOUND
450 | beans::PropertyAttribute::MAYBEDEFAULT ));
451 // CharLocaleComplex
452 rOutProperties.push_back(
453 Property( C2U( "CharLocaleComplex" ),
454 PROP_CHAR_COMPLEX_LOCALE,
455 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
456 beans::PropertyAttribute::BOUND
457 | beans::PropertyAttribute::MAYBEDEFAULT ));
459 // Writing Mode left to right vs right to left
460 rOutProperties.push_back(
461 Property( C2U( "WritingMode" ),
462 PROP_WRITING_MODE,
463 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
464 beans::PropertyAttribute::BOUND
465 | beans::PropertyAttribute::MAYBEDEFAULT ));
467 rOutProperties.push_back(
468 Property( C2U( "ParaIsCharacterDistance" ),
469 PROP_PARA_IS_CHARACTER_DISTANCE,
470 ::getBooleanCppuType(),
471 beans::PropertyAttribute::BOUND
472 | beans::PropertyAttribute::MAYBEDEFAULT ));
475 void CharacterProperties::AddDefaultsToMap(
476 ::chart::tPropertyValueMap & rOutMap )
478 const float fDefaultFontHeight = 13.0;
480 SvtLinguConfig aLinguConfig;
481 lang::Locale aDefaultLocale( C2U( "en" ), C2U( "US" ), OUString() );
482 aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
483 lang::Locale aDefaultLocale_CJK;
484 aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
485 lang::Locale aDefaultLocale_CTL;
486 aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
488 Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
489 Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
490 Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL ), DEFAULTFONT_FLAGS_ONLYONE, 0 );
492 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
493 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
494 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//awt::FontFamily::SWISS
495 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_CHAR_SET, sal_Int16(aFont.GetCharSet()) );//use awt::CharSet::DONTKNOW instead of SYSTEM to avoid assertion issue 50249
496 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
497 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
498 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
499 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
500 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
501 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
502 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
503 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
504 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
505 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
507 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CASE_MAPPING, style::CaseMap::NONE );
508 // ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_ROTATION, 0 );
509 // ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_SCALE_WIDTH, 71 );
511 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CROSSED_OUT, false );
512 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
513 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
514 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FLASH, false );
516 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
517 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
518 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
519 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
521 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
523 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_ADJUST, text::RubyAdjust_INDENT_BLOCK );
524 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_STYLE_NAME, ?? );
525 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_IS_ABOVE, true );
526 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_INHIBIT_HYPHENATION, false );
528 // Asian (com.sun.star.style.CharacterPropertiesAsian)
529 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
530 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
531 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
532 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
533 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
534 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
535 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
536 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
537 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
539 // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
540 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
541 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
542 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
543 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
544 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
545 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
546 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
547 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
548 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
550 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
551 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
554 bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
556 return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
557 nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
560 // static
561 awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
562 const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
564 awt::FontDescriptor aResult;
565 // Note: keep this sorted!
566 ::comphelper::MakeVector< OUString > aPropNames
567 ( C2U("CharFontCharSet")); // CharSet
568 aPropNames
569 ( C2U("CharFontFamily")) // Family
570 ( C2U("CharFontName")) // Name
571 ( C2U("CharFontPitch")) // Pitch
572 ( C2U("CharFontStyleName")) // StyleName
573 ( C2U("CharHeight")) // Height
574 ( C2U("CharPosture")) // Slant
575 ( C2U("CharStrikeout")) // Strikeout
576 ( C2U("CharUnderline")) // Underline
577 ( C2U("CharWeight")) // Weight
578 ( C2U("CharWordMode")) // WordLineMode
581 uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
582 uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
584 sal_Int32 i=0;
585 // Note keep this sorted according to the list above (comments are the fieldnames)
586 aValues[ i++ ] >>= aResult.CharSet;
587 aValues[ i++ ] >>= aResult.Family;
588 aValues[ i++ ] >>= aResult.Name;
589 aValues[ i++ ] >>= aResult.Pitch;
590 aValues[ i++ ] >>= aResult.StyleName;
591 float fCharHeight = 0;
592 aValues[ i++ ] >>= fCharHeight;
593 aResult.Height = static_cast< sal_Int16 >( fCharHeight );
594 aValues[ i++ ] >>= aResult.Slant;
595 aValues[ i++ ] >>= aResult.Strikeout;
596 aValues[ i++ ] >>= aResult.Underline;
597 aValues[ i++ ] >>= aResult.Weight;
598 aValues[ i++ ] >>= aResult.WordLineMode;
599 OSL_ASSERT( i == aValues.getLength());
601 return aResult;
604 } // namespace chart