merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / tools / CharacterProperties.cxx
blob66a1e1880e3d3c2ca72fb345964b415bf6655077
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>
54 #include <com/sun/star/i18n/ScriptType.hpp>
56 #include <comphelper/InlineContainer.hxx>
59 // header for struct SvtLinguConfig
60 #ifndef _SVTOOLS_LINGUCFG_HXX_
61 #include <svtools/lingucfg.hxx>
62 #endif
63 #ifndef INCLUDED_I18NPOOL_MSLANGID_HXX
64 #include <i18npool/mslangid.hxx>
65 #endif
66 #ifndef _SV_OUTDEV_HXX
67 #include <vcl/outdev.hxx>
68 #endif
70 using namespace ::com::sun::star;
72 using ::com::sun::star::beans::Property;
74 using ::rtl::OUString;
76 namespace chart
79 void CharacterProperties::AddPropertiesToVector(
80 ::std::vector< Property > & rOutProperties )
82 // CharacterProperties
83 rOutProperties.push_back(
84 Property( C2U( "CharFontName" ),
85 PROP_CHAR_FONT_NAME,
86 ::getCppuType( reinterpret_cast< const OUString * >(0)),
87 beans::PropertyAttribute::BOUND
88 | beans::PropertyAttribute::MAYBEDEFAULT ));
89 rOutProperties.push_back(
90 Property( C2U( "CharFontStyleName" ),
91 PROP_CHAR_FONT_STYLE_NAME,
92 ::getCppuType( reinterpret_cast< const OUString * >(0)),
93 beans::PropertyAttribute::BOUND
94 | beans::PropertyAttribute::MAYBEDEFAULT
95 | beans::PropertyAttribute::MAYBEVOID ));
96 // CharFontFamily (see awt.FontFamily)
97 rOutProperties.push_back(
98 Property( C2U( "CharFontFamily" ),
99 PROP_CHAR_FONT_FAMILY,
100 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
101 beans::PropertyAttribute::BOUND
102 | beans::PropertyAttribute::MAYBEDEFAULT ));
103 // CharFontCharSet (see awt.CharSet)
104 rOutProperties.push_back(
105 Property( C2U( "CharFontCharSet" ),
106 PROP_CHAR_FONT_CHAR_SET,
107 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
108 beans::PropertyAttribute::BOUND
109 | beans::PropertyAttribute::MAYBEDEFAULT ));
110 // CharFontPitch (see awt.FontPitch)
111 rOutProperties.push_back(
112 Property( C2U( "CharFontPitch" ),
113 PROP_CHAR_FONT_PITCH,
114 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
115 beans::PropertyAttribute::BOUND
116 | beans::PropertyAttribute::MAYBEDEFAULT ));
117 // CharColor
118 rOutProperties.push_back(
119 Property( C2U( "CharColor" ),
120 PROP_CHAR_COLOR,
121 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
122 beans::PropertyAttribute::BOUND
123 | beans::PropertyAttribute::MAYBEDEFAULT ));
124 // CharBackColor
125 // rOutProperties.push_back(
126 // Property( C2U( "CharBackColor" ),
127 // PROP_CHAR_BACKGROUND_COLOR,
128 // ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
129 // beans::PropertyAttribute::BOUND
130 // | beans::PropertyAttribute::MAYBEDEFAULT));
131 // CharEscapement
132 rOutProperties.push_back(
133 Property( C2U( "CharEscapement" ),
134 PROP_CHAR_ESCAPEMENT,
135 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
136 beans::PropertyAttribute::BOUND
137 | beans::PropertyAttribute::MAYBEVOID ));
138 // CharHeight
139 rOutProperties.push_back(
140 Property( C2U( "CharHeight" ),
141 PROP_CHAR_CHAR_HEIGHT,
142 ::getCppuType( reinterpret_cast< const float * >(0)),
143 beans::PropertyAttribute::BOUND
144 | beans::PropertyAttribute::MAYBEDEFAULT ));
145 // CharUnderline (see awt.FontUnderline)
146 rOutProperties.push_back(
147 Property( C2U( "CharUnderline" ),
148 PROP_CHAR_UNDERLINE,
149 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
150 beans::PropertyAttribute::BOUND
151 | beans::PropertyAttribute::MAYBEDEFAULT ));
152 // CharUnderlineColor
153 rOutProperties.push_back(
154 Property( C2U( "CharUnderlineColor" ),
155 PROP_CHAR_UNDERLINE_COLOR,
156 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
157 beans::PropertyAttribute::BOUND
158 | beans::PropertyAttribute::MAYBEDEFAULT
159 | beans::PropertyAttribute::MAYBEVOID ));
160 // CharUnderlineHasColor
161 rOutProperties.push_back(
162 Property( C2U( "CharUnderlineHasColor" ),
163 PROP_CHAR_UNDERLINE_HAS_COLOR,
164 ::getBooleanCppuType(),
165 beans::PropertyAttribute::BOUND
166 | beans::PropertyAttribute::MAYBEDEFAULT ));
167 // CharWeight (see awt.FontWeight)
168 rOutProperties.push_back(
169 Property( C2U( "CharWeight" ),
170 PROP_CHAR_WEIGHT,
171 ::getCppuType( reinterpret_cast< const float * >(0)),
172 beans::PropertyAttribute::BOUND
173 | beans::PropertyAttribute::MAYBEDEFAULT ));
174 // CharPosture
175 rOutProperties.push_back(
176 Property( C2U( "CharPosture" ),
177 PROP_CHAR_POSTURE,
178 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
179 beans::PropertyAttribute::BOUND
180 | beans::PropertyAttribute::MAYBEDEFAULT ));
181 rOutProperties.push_back(
182 Property( C2U( "CharAutoKerning" ),
183 PROP_CHAR_AUTO_KERNING,
184 ::getBooleanCppuType(),
185 beans::PropertyAttribute::BOUND
186 | beans::PropertyAttribute::MAYBEDEFAULT
187 | beans::PropertyAttribute::MAYBEVOID ));
188 rOutProperties.push_back(
189 Property( C2U( "CharKerning" ),
190 PROP_CHAR_KERNING,
191 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
192 beans::PropertyAttribute::BOUND
193 | beans::PropertyAttribute::MAYBEDEFAULT
194 | beans::PropertyAttribute::MAYBEVOID ));
195 // CharCaseMap (see style.CaseMap)
196 // rOutProperties.push_back(
197 // Property( C2U( "CharCaseMap" ),
198 // PROP_CHAR_CASE_MAPPING,
199 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
200 // beans::PropertyAttribute::BOUND
201 // | beans::PropertyAttribute::MAYBEDEFAULT ));
204 // CharRotation
205 // rOutProperties.push_back(
206 // Property( C2U( "CharRotation" ),
207 // PROP_CHAR_ROTATION,
208 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
209 // beans::PropertyAttribute::BOUND
210 // | beans::PropertyAttribute::MAYBEDEFAULT ));
212 // // CharScaleWidth
213 // rOutProperties.push_back(
214 // Property( C2U( "CharScaleWidth" ),
215 // PROP_CHAR_SCALE_WIDTH,
216 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
217 // beans::PropertyAttribute::BOUND
218 // | beans::PropertyAttribute::MAYBEDEFAULT ));
219 // CharEscapementHeight
220 rOutProperties.push_back(
221 Property( C2U( "CharEscapementHeight" ),
222 PROP_CHAR_ESCAPEMENT_HEIGHT,
223 ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
224 beans::PropertyAttribute::BOUND
225 | beans::PropertyAttribute::MAYBEVOID ));
227 // CharCrossedOut
228 // rOutProperties.push_back(
229 // Property( C2U( "CharCrossedOut" ),
230 // PROP_CHAR_CROSSED_OUT,
231 // ::getBooleanCppuType(),
232 // beans::PropertyAttribute::BOUND
233 // | beans::PropertyAttribute::MAYBEDEFAULT ));
234 // CharStrikeout (see awt.FontStrikeout)
235 rOutProperties.push_back(
236 Property( C2U( "CharStrikeout" ),
237 PROP_CHAR_STRIKE_OUT,
238 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
239 beans::PropertyAttribute::BOUND
240 | beans::PropertyAttribute::MAYBEDEFAULT ));
241 // CharWordMode
242 rOutProperties.push_back(
243 Property( C2U( "CharWordMode" ),
244 PROP_CHAR_WORD_MODE,
245 ::getBooleanCppuType(),
246 beans::PropertyAttribute::BOUND
247 | beans::PropertyAttribute::MAYBEDEFAULT ));
248 // CharFlash
249 // rOutProperties.push_back(
250 // Property( C2U( "CharFlash" ),
251 // PROP_CHAR_FLASH,
252 // ::getBooleanCppuType(),
253 // beans::PropertyAttribute::BOUND
254 // | beans::PropertyAttribute::MAYBEDEFAULT ));
255 // CharLocale
256 rOutProperties.push_back(
257 Property( C2U( "CharLocale" ),
258 PROP_CHAR_LOCALE,
259 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
260 beans::PropertyAttribute::BOUND
261 | beans::PropertyAttribute::MAYBEDEFAULT ));
262 // CharShadowed
263 rOutProperties.push_back(
264 Property( C2U( "CharShadowed" ),
265 PROP_CHAR_SHADOWED,
266 ::getBooleanCppuType(),
267 beans::PropertyAttribute::BOUND
268 | beans::PropertyAttribute::MAYBEDEFAULT ));
269 // CharContoured
270 rOutProperties.push_back(
271 Property( C2U( "CharContoured" ),
272 PROP_CHAR_CONTOURED,
273 ::getBooleanCppuType(),
274 beans::PropertyAttribute::BOUND
275 | beans::PropertyAttribute::MAYBEDEFAULT ));
276 // CharRelief (see text.FontRelief)
277 rOutProperties.push_back(
278 Property( C2U( "CharRelief" ),
279 PROP_CHAR_RELIEF,
280 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
281 beans::PropertyAttribute::BOUND
282 | beans::PropertyAttribute::MAYBEDEFAULT ));
284 // CharEmphasize (see text.FontEmphasis)
285 rOutProperties.push_back(
286 Property( C2U( "CharEmphasis" ),
287 PROP_CHAR_EMPHASIS,
288 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
289 beans::PropertyAttribute::BOUND
290 | beans::PropertyAttribute::MAYBEDEFAULT ));
291 // // RubyText
292 // rOutProperties.push_back(
293 // Property( C2U( "RubyText" ),
294 // PROP_CHAR_RUBY_TEXT,
295 // ::getCppuType( reinterpret_cast< const OUString * >(0)),
296 // beans::PropertyAttribute::BOUND
297 // | beans::PropertyAttribute::MAYBEDEFAULT ));
298 // // RubyAdjust (see text.RubyAdjust)
299 // rOutProperties.push_back(
300 // Property( C2U( "RubyAdjust" ),
301 // PROP_CHAR_RUBY_ADJUST,
302 // ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
303 // beans::PropertyAttribute::BOUND
304 // | beans::PropertyAttribute::MAYBEDEFAULT ));
305 // // RubyCharStyleName
306 // rOutProperties.push_back(
307 // Property( C2U( "RubyStyleName" ),
308 // PROP_CHAR_RUBY_STYLE_NAME,
309 // ::getCppuType( reinterpret_cast< const OUString * >(0)),
310 // beans::PropertyAttribute::BOUND
311 // | beans::PropertyAttribute::MAYBEDEFAULT ));
312 // // RubyIsAbove
313 // rOutProperties.push_back(
314 // Property( C2U( "RubyIsAbove" ),
315 // PROP_CHAR_RUBY_IS_ABOVE,
316 // ::getBooleanCppuType(),
317 // beans::PropertyAttribute::BOUND
318 // | beans::PropertyAttribute::MAYBEDEFAULT ));
319 // // CharNoHyphenation
320 // rOutProperties.push_back(
321 // Property( C2U( "InhibitHyphenation" ),
322 // PROP_CHAR_INHIBIT_HYPHENATION,
323 // ::getBooleanCppuType(),
324 // beans::PropertyAttribute::BOUND
325 // | beans::PropertyAttribute::MAYBEDEFAULT ));
327 // CharacterPropertiesAsian
328 // =====
329 // CharFontNameAsian
330 rOutProperties.push_back(
331 Property( C2U( "CharFontNameAsian" ),
332 PROP_CHAR_ASIAN_FONT_NAME,
333 ::getCppuType( reinterpret_cast< const OUString * >(0)),
334 beans::PropertyAttribute::BOUND
335 | beans::PropertyAttribute::MAYBEDEFAULT ));
336 // CharFontStyleNameAsian
337 rOutProperties.push_back(
338 Property( C2U( "CharFontStyleNameAsian" ),
339 PROP_CHAR_ASIAN_FONT_STYLE_NAME,
340 ::getCppuType( reinterpret_cast< const OUString * >(0)),
341 beans::PropertyAttribute::BOUND
342 | beans::PropertyAttribute::MAYBEDEFAULT
343 | beans::PropertyAttribute::MAYBEVOID ));
344 // CharFontFamilyAsian (see awt.FontFamily)
345 rOutProperties.push_back(
346 Property( C2U( "CharFontFamilyAsian" ),
347 PROP_CHAR_ASIAN_FONT_FAMILY,
348 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
349 beans::PropertyAttribute::BOUND
350 | beans::PropertyAttribute::MAYBEDEFAULT ));
351 // CharFontCharSetAsian (see awt.CharSet)
352 rOutProperties.push_back(
353 Property( C2U( "CharFontCharSetAsian" ),
354 PROP_CHAR_ASIAN_CHAR_SET,
355 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
356 beans::PropertyAttribute::BOUND
357 | beans::PropertyAttribute::MAYBEDEFAULT ));
358 // CharFontPitchAsian (see awt.FontPitch)
359 rOutProperties.push_back(
360 Property( C2U( "CharFontPitchAsian" ),
361 PROP_CHAR_ASIAN_FONT_PITCH,
362 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
363 beans::PropertyAttribute::BOUND
364 | beans::PropertyAttribute::MAYBEDEFAULT ));
365 // CharHeightAsian
366 rOutProperties.push_back(
367 Property( C2U( "CharHeightAsian" ),
368 PROP_CHAR_ASIAN_CHAR_HEIGHT,
369 ::getCppuType( reinterpret_cast< const float * >(0)),
370 beans::PropertyAttribute::BOUND
371 | beans::PropertyAttribute::MAYBEDEFAULT ));
372 // CharWeightAsian
373 rOutProperties.push_back(
374 Property( C2U( "CharWeightAsian" ),
375 PROP_CHAR_ASIAN_WEIGHT,
376 ::getCppuType( reinterpret_cast< const float * >(0)),
377 beans::PropertyAttribute::BOUND
378 | beans::PropertyAttribute::MAYBEDEFAULT ));
379 // CharPostureAsian
380 rOutProperties.push_back(
381 Property( C2U( "CharPostureAsian" ),
382 PROP_CHAR_ASIAN_POSTURE,
383 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
384 beans::PropertyAttribute::BOUND
385 | beans::PropertyAttribute::MAYBEDEFAULT ));
386 // CharLocaleAsian
387 rOutProperties.push_back(
388 Property( C2U( "CharLocaleAsian" ),
389 PROP_CHAR_ASIAN_LOCALE,
390 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
391 beans::PropertyAttribute::BOUND
392 | beans::PropertyAttribute::MAYBEDEFAULT ));
394 // CharacterPropertiesComplex
395 // ===
396 // CharFontNameComplex
397 rOutProperties.push_back(
398 Property( C2U( "CharFontNameComplex" ),
399 PROP_CHAR_COMPLEX_FONT_NAME,
400 ::getCppuType( reinterpret_cast< const OUString * >(0)),
401 beans::PropertyAttribute::BOUND
402 | beans::PropertyAttribute::MAYBEDEFAULT ));
403 // CharFontStyleNameComplex
404 rOutProperties.push_back(
405 Property( C2U( "CharFontStyleNameComplex" ),
406 PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
407 ::getCppuType( reinterpret_cast< const OUString * >(0)),
408 beans::PropertyAttribute::BOUND
409 | beans::PropertyAttribute::MAYBEDEFAULT
410 | beans::PropertyAttribute::MAYBEVOID ));
411 // CharFontFamilyComplex (see awt.FontFamily)
412 rOutProperties.push_back(
413 Property( C2U( "CharFontFamilyComplex" ),
414 PROP_CHAR_COMPLEX_FONT_FAMILY,
415 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
416 beans::PropertyAttribute::BOUND
417 | beans::PropertyAttribute::MAYBEDEFAULT ));
418 // CharFontCharSetComplex (see awt.CharSet)
419 rOutProperties.push_back(
420 Property( C2U( "CharFontCharSetComplex" ),
421 PROP_CHAR_COMPLEX_CHAR_SET,
422 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
423 beans::PropertyAttribute::BOUND
424 | beans::PropertyAttribute::MAYBEDEFAULT ));
425 // CharFontPitchComplex (see awt.FontPitch)
426 rOutProperties.push_back(
427 Property( C2U( "CharFontPitchComplex" ),
428 PROP_CHAR_COMPLEX_FONT_PITCH,
429 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
430 beans::PropertyAttribute::BOUND
431 | beans::PropertyAttribute::MAYBEDEFAULT ));
432 // CharHeightComplex
433 rOutProperties.push_back(
434 Property( C2U( "CharHeightComplex" ),
435 PROP_CHAR_COMPLEX_CHAR_HEIGHT,
436 ::getCppuType( reinterpret_cast< const float * >(0)),
437 beans::PropertyAttribute::BOUND
438 | beans::PropertyAttribute::MAYBEDEFAULT ));
439 // CharWeightComplex
440 rOutProperties.push_back(
441 Property( C2U( "CharWeightComplex" ),
442 PROP_CHAR_COMPLEX_WEIGHT,
443 ::getCppuType( reinterpret_cast< const float * >(0)),
444 beans::PropertyAttribute::BOUND
445 | beans::PropertyAttribute::MAYBEDEFAULT ));
446 // CharPostureComplex
447 rOutProperties.push_back(
448 Property( C2U( "CharPostureComplex" ),
449 PROP_CHAR_COMPLEX_POSTURE,
450 ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
451 beans::PropertyAttribute::BOUND
452 | beans::PropertyAttribute::MAYBEDEFAULT ));
453 // CharLocaleComplex
454 rOutProperties.push_back(
455 Property( C2U( "CharLocaleComplex" ),
456 PROP_CHAR_COMPLEX_LOCALE,
457 ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
458 beans::PropertyAttribute::BOUND
459 | beans::PropertyAttribute::MAYBEDEFAULT ));
461 // Writing Mode left to right vs right to left
462 rOutProperties.push_back(
463 Property( C2U( "WritingMode" ),
464 PROP_WRITING_MODE,
465 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
466 beans::PropertyAttribute::BOUND
467 | beans::PropertyAttribute::MAYBEDEFAULT ));
469 rOutProperties.push_back(
470 Property( C2U( "ParaIsCharacterDistance" ),
471 PROP_PARA_IS_CHARACTER_DISTANCE,
472 ::getBooleanCppuType(),
473 beans::PropertyAttribute::BOUND
474 | beans::PropertyAttribute::MAYBEDEFAULT ));
477 void CharacterProperties::AddDefaultsToMap(
478 ::chart::tPropertyValueMap & rOutMap )
480 const float fDefaultFontHeight = 13.0;
482 SvtLinguConfig aLinguConfig;
483 lang::Locale aDefaultLocale;
484 aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
485 lang::Locale aDefaultLocale_CJK;
486 aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
487 lang::Locale aDefaultLocale_CTL;
488 aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
490 using namespace ::com::sun::star::i18n::ScriptType;
491 LanguageType nLang;
492 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aDefaultLocale), LATIN);
493 Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
494 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK), ASIAN);
495 Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
496 nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL), COMPLEX);
497 Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
499 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
500 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
501 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//awt::FontFamily::SWISS
502 ::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
503 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
504 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
505 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
506 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
507 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
508 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
509 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
510 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
511 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
512 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
514 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CASE_MAPPING, style::CaseMap::NONE );
515 // ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_ROTATION, 0 );
516 // ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_SCALE_WIDTH, 71 );
518 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CROSSED_OUT, false );
519 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
520 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
521 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FLASH, false );
523 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
524 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
525 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
526 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
528 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
530 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_ADJUST, text::RubyAdjust_INDENT_BLOCK );
531 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_STYLE_NAME, ?? );
532 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_IS_ABOVE, true );
533 // ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_INHIBIT_HYPHENATION, false );
535 // Asian (com.sun.star.style.CharacterPropertiesAsian)
536 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
537 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
538 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
539 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
540 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
541 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
542 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
543 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
544 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
546 // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
547 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
548 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
549 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
550 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
551 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
552 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
553 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
554 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
555 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
557 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
558 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
561 bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
563 return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
564 nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
567 // static
568 awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
569 const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
571 awt::FontDescriptor aResult;
572 // Note: keep this sorted!
573 ::comphelper::MakeVector< OUString > aPropNames
574 ( C2U("CharFontCharSet")); // CharSet
575 aPropNames
576 ( C2U("CharFontFamily")) // Family
577 ( C2U("CharFontName")) // Name
578 ( C2U("CharFontPitch")) // Pitch
579 ( C2U("CharFontStyleName")) // StyleName
580 ( C2U("CharHeight")) // Height
581 ( C2U("CharPosture")) // Slant
582 ( C2U("CharStrikeout")) // Strikeout
583 ( C2U("CharUnderline")) // Underline
584 ( C2U("CharWeight")) // Weight
585 ( C2U("CharWordMode")) // WordLineMode
588 uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
589 uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
591 sal_Int32 i=0;
592 // Note keep this sorted according to the list above (comments are the fieldnames)
593 aValues[ i++ ] >>= aResult.CharSet;
594 aValues[ i++ ] >>= aResult.Family;
595 aValues[ i++ ] >>= aResult.Name;
596 aValues[ i++ ] >>= aResult.Pitch;
597 aValues[ i++ ] >>= aResult.StyleName;
598 float fCharHeight = 0;
599 aValues[ i++ ] >>= fCharHeight;
600 aResult.Height = static_cast< sal_Int16 >( fCharHeight );
601 aValues[ i++ ] >>= aResult.Slant;
602 aValues[ i++ ] >>= aResult.Strikeout;
603 aValues[ i++ ] >>= aResult.Underline;
604 aValues[ i++ ] >>= aResult.Weight;
605 aValues[ i++ ] >>= aResult.WordLineMode;
606 OSL_ASSERT( i == aValues.getLength());
608 return aResult;
611 } // namespace chart