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