1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
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"
33 
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>
38 
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>
52 
53 #include <comphelper/InlineContainer.hxx>
54 
55 
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
66 
67 using namespace ::com::sun::star;
68 
69 using ::com::sun::star::beans::Property;
70 
71 using ::rtl::OUString;
72 
73 namespace chart
74 {
75 
76 void CharacterProperties::AddPropertiesToVector(
77     ::std::vector< Property > & rOutProperties )
78 {
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     // CharOverline (see awt.FontUnderline)
165     rOutProperties.push_back(
166         Property( C2U( "CharOverline" ),
167                   PROP_CHAR_OVERLINE,
168                   ::getCppuType( reinterpret_cast< const sal_Int16* >( 0 ) ),
169                   beans::PropertyAttribute::BOUND
170                   | beans::PropertyAttribute::MAYBEDEFAULT ) );
171     // CharOverlineColor
172     rOutProperties.push_back(
173         Property( C2U( "CharOverlineColor" ),
174                   PROP_CHAR_OVERLINE_COLOR,
175                   ::getCppuType( reinterpret_cast< const sal_Int32* >( 0 ) ),
176                   beans::PropertyAttribute::BOUND
177                   | beans::PropertyAttribute::MAYBEDEFAULT
178                   | beans::PropertyAttribute::MAYBEVOID ) );
179     // CharOverlineHasColor
180     rOutProperties.push_back(
181         Property( C2U( "CharOverlineHasColor" ),
182                   PROP_CHAR_OVERLINE_HAS_COLOR,
183                   ::getBooleanCppuType(),
184                   beans::PropertyAttribute::BOUND
185                   | beans::PropertyAttribute::MAYBEDEFAULT ) );
186     // CharWeight (see awt.FontWeight)
187     rOutProperties.push_back(
188         Property( C2U( "CharWeight" ),
189                   PROP_CHAR_WEIGHT,
190                   ::getCppuType( reinterpret_cast< const float * >(0)),
191                   beans::PropertyAttribute::BOUND
192                   | beans::PropertyAttribute::MAYBEDEFAULT ));
193     // CharPosture
194     rOutProperties.push_back(
195         Property( C2U( "CharPosture" ),
196                   PROP_CHAR_POSTURE,
197                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
198                   beans::PropertyAttribute::BOUND
199                   | beans::PropertyAttribute::MAYBEDEFAULT ));
200     rOutProperties.push_back(
201         Property( C2U( "CharAutoKerning" ),
202                   PROP_CHAR_AUTO_KERNING,
203                   ::getBooleanCppuType(),
204                   beans::PropertyAttribute::BOUND
205                   | beans::PropertyAttribute::MAYBEDEFAULT
206                   | beans::PropertyAttribute::MAYBEVOID ));
207     rOutProperties.push_back(
208         Property( C2U( "CharKerning" ),
209                   PROP_CHAR_KERNING,
210                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
211                   beans::PropertyAttribute::BOUND
212                   | beans::PropertyAttribute::MAYBEDEFAULT
213                   | beans::PropertyAttribute::MAYBEVOID ));
214     // CharCaseMap (see style.CaseMap)
215 //     rOutProperties.push_back(
216 //         Property( C2U( "CharCaseMap" ),
217 //                   PROP_CHAR_CASE_MAPPING,
218 //                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
219 //                   beans::PropertyAttribute::BOUND
220 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
221 
222 
223     // CharRotation
224 //     rOutProperties.push_back(
225 //         Property( C2U( "CharRotation" ),
226 //                   PROP_CHAR_ROTATION,
227 //                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
228 //                   beans::PropertyAttribute::BOUND
229 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
230 
231 //     // CharScaleWidth
232 //     rOutProperties.push_back(
233 //         Property( C2U( "CharScaleWidth" ),
234 //                   PROP_CHAR_SCALE_WIDTH,
235 //                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
236 //                   beans::PropertyAttribute::BOUND
237 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
238     // CharEscapementHeight
239     rOutProperties.push_back(
240         Property( C2U( "CharEscapementHeight" ),
241                   PROP_CHAR_ESCAPEMENT_HEIGHT,
242                   ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
243                   beans::PropertyAttribute::BOUND
244                   | beans::PropertyAttribute::MAYBEVOID ));
245 
246     // CharCrossedOut
247 //     rOutProperties.push_back(
248 //         Property( C2U( "CharCrossedOut" ),
249 //                   PROP_CHAR_CROSSED_OUT,
250 //                   ::getBooleanCppuType(),
251 //                   beans::PropertyAttribute::BOUND
252 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
253     // CharStrikeout (see awt.FontStrikeout)
254     rOutProperties.push_back(
255         Property( C2U( "CharStrikeout" ),
256                   PROP_CHAR_STRIKE_OUT,
257                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
258                   beans::PropertyAttribute::BOUND
259                   | beans::PropertyAttribute::MAYBEDEFAULT ));
260     // CharWordMode
261     rOutProperties.push_back(
262         Property( C2U( "CharWordMode" ),
263                   PROP_CHAR_WORD_MODE,
264                   ::getBooleanCppuType(),
265                   beans::PropertyAttribute::BOUND
266                   | beans::PropertyAttribute::MAYBEDEFAULT ));
267     // CharFlash
268 //     rOutProperties.push_back(
269 //         Property( C2U( "CharFlash" ),
270 //                   PROP_CHAR_FLASH,
271 //                   ::getBooleanCppuType(),
272 //                   beans::PropertyAttribute::BOUND
273 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
274     // CharLocale
275     rOutProperties.push_back(
276         Property( C2U( "CharLocale" ),
277                   PROP_CHAR_LOCALE,
278                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
279                   //#i111967# no PropertyChangeEvent is fired on change so far
280                   beans::PropertyAttribute::MAYBEDEFAULT ));
281     // CharShadowed
282     rOutProperties.push_back(
283         Property( C2U( "CharShadowed" ),
284                   PROP_CHAR_SHADOWED,
285                   ::getBooleanCppuType(),
286                   beans::PropertyAttribute::BOUND
287                   | beans::PropertyAttribute::MAYBEDEFAULT ));
288     // CharContoured
289     rOutProperties.push_back(
290         Property( C2U( "CharContoured" ),
291                   PROP_CHAR_CONTOURED,
292                   ::getBooleanCppuType(),
293                   beans::PropertyAttribute::BOUND
294                   | beans::PropertyAttribute::MAYBEDEFAULT ));
295     // CharRelief (see text.FontRelief)
296     rOutProperties.push_back(
297         Property( C2U( "CharRelief" ),
298                   PROP_CHAR_RELIEF,
299                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
300                   beans::PropertyAttribute::BOUND
301                   | beans::PropertyAttribute::MAYBEDEFAULT ));
302 
303     // CharEmphasize (see text.FontEmphasis)
304     rOutProperties.push_back(
305         Property( C2U( "CharEmphasis" ),
306                   PROP_CHAR_EMPHASIS,
307                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
308                   beans::PropertyAttribute::BOUND
309                   | beans::PropertyAttribute::MAYBEDEFAULT ));
310 //     // RubyText
311 //     rOutProperties.push_back(
312 //         Property( C2U( "RubyText" ),
313 //                   PROP_CHAR_RUBY_TEXT,
314 //                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
315 //                   beans::PropertyAttribute::BOUND
316 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
317 //     // RubyAdjust (see text.RubyAdjust)
318 //     rOutProperties.push_back(
319 //         Property( C2U( "RubyAdjust" ),
320 //                   PROP_CHAR_RUBY_ADJUST,
321 //                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
322 //                   beans::PropertyAttribute::BOUND
323 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
324 //     // RubyCharStyleName
325 //     rOutProperties.push_back(
326 //         Property( C2U( "RubyStyleName" ),
327 //                   PROP_CHAR_RUBY_STYLE_NAME,
328 //                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
329 //                   beans::PropertyAttribute::BOUND
330 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
331 //     // RubyIsAbove
332 //     rOutProperties.push_back(
333 //         Property( C2U( "RubyIsAbove" ),
334 //                   PROP_CHAR_RUBY_IS_ABOVE,
335 //                   ::getBooleanCppuType(),
336 //                   beans::PropertyAttribute::BOUND
337 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
338 //     // CharNoHyphenation
339 //     rOutProperties.push_back(
340 //         Property( C2U( "InhibitHyphenation" ),
341 //                   PROP_CHAR_INHIBIT_HYPHENATION,
342 //                   ::getBooleanCppuType(),
343 //                   beans::PropertyAttribute::BOUND
344 //                   | beans::PropertyAttribute::MAYBEDEFAULT ));
345 
346     // CharacterPropertiesAsian
347     // =====
348     // CharFontNameAsian
349     rOutProperties.push_back(
350         Property( C2U( "CharFontNameAsian" ),
351                   PROP_CHAR_ASIAN_FONT_NAME,
352                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
353                   beans::PropertyAttribute::BOUND
354                   | beans::PropertyAttribute::MAYBEDEFAULT ));
355     // CharFontStyleNameAsian
356     rOutProperties.push_back(
357         Property( C2U( "CharFontStyleNameAsian" ),
358                   PROP_CHAR_ASIAN_FONT_STYLE_NAME,
359                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
360                   beans::PropertyAttribute::BOUND
361                   | beans::PropertyAttribute::MAYBEDEFAULT
362                   | beans::PropertyAttribute::MAYBEVOID ));
363     // CharFontFamilyAsian (see awt.FontFamily)
364     rOutProperties.push_back(
365         Property( C2U( "CharFontFamilyAsian" ),
366                   PROP_CHAR_ASIAN_FONT_FAMILY,
367                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
368                   beans::PropertyAttribute::BOUND
369                   | beans::PropertyAttribute::MAYBEDEFAULT ));
370     // CharFontCharSetAsian (see awt.CharSet)
371     rOutProperties.push_back(
372         Property( C2U( "CharFontCharSetAsian" ),
373                   PROP_CHAR_ASIAN_CHAR_SET,
374                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
375                   beans::PropertyAttribute::BOUND
376                   | beans::PropertyAttribute::MAYBEDEFAULT ));
377     // CharFontPitchAsian (see awt.FontPitch)
378     rOutProperties.push_back(
379         Property( C2U( "CharFontPitchAsian" ),
380                   PROP_CHAR_ASIAN_FONT_PITCH,
381                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
382                   beans::PropertyAttribute::BOUND
383                   | beans::PropertyAttribute::MAYBEDEFAULT ));
384     // CharHeightAsian
385     rOutProperties.push_back(
386         Property( C2U( "CharHeightAsian" ),
387                   PROP_CHAR_ASIAN_CHAR_HEIGHT,
388                   ::getCppuType( reinterpret_cast< const float * >(0)),
389                   beans::PropertyAttribute::BOUND
390                   | beans::PropertyAttribute::MAYBEDEFAULT ));
391     // CharWeightAsian
392     rOutProperties.push_back(
393         Property( C2U( "CharWeightAsian" ),
394                   PROP_CHAR_ASIAN_WEIGHT,
395                   ::getCppuType( reinterpret_cast< const float * >(0)),
396                   beans::PropertyAttribute::BOUND
397                   | beans::PropertyAttribute::MAYBEDEFAULT ));
398     // CharPostureAsian
399     rOutProperties.push_back(
400         Property( C2U( "CharPostureAsian" ),
401                   PROP_CHAR_ASIAN_POSTURE,
402                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
403                   beans::PropertyAttribute::BOUND
404                   | beans::PropertyAttribute::MAYBEDEFAULT ));
405     // CharLocaleAsian
406     rOutProperties.push_back(
407         Property( C2U( "CharLocaleAsian" ),
408                   PROP_CHAR_ASIAN_LOCALE,
409                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
410                   //#i111967# no PropertyChangeEvent is fired on change so far
411                   beans::PropertyAttribute::MAYBEDEFAULT ));
412 
413     // CharacterPropertiesComplex
414     // ===
415     // CharFontNameComplex
416     rOutProperties.push_back(
417         Property( C2U( "CharFontNameComplex" ),
418                   PROP_CHAR_COMPLEX_FONT_NAME,
419                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
420                   beans::PropertyAttribute::BOUND
421                   | beans::PropertyAttribute::MAYBEDEFAULT ));
422     // CharFontStyleNameComplex
423     rOutProperties.push_back(
424         Property( C2U( "CharFontStyleNameComplex" ),
425                   PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
426                   ::getCppuType( reinterpret_cast< const OUString * >(0)),
427                   beans::PropertyAttribute::BOUND
428                   | beans::PropertyAttribute::MAYBEDEFAULT
429                   | beans::PropertyAttribute::MAYBEVOID ));
430     // CharFontFamilyComplex (see awt.FontFamily)
431     rOutProperties.push_back(
432         Property( C2U( "CharFontFamilyComplex" ),
433                   PROP_CHAR_COMPLEX_FONT_FAMILY,
434                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
435                   beans::PropertyAttribute::BOUND
436                   | beans::PropertyAttribute::MAYBEDEFAULT ));
437     // CharFontCharSetComplex (see awt.CharSet)
438     rOutProperties.push_back(
439         Property( C2U( "CharFontCharSetComplex" ),
440                   PROP_CHAR_COMPLEX_CHAR_SET,
441                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
442                   beans::PropertyAttribute::BOUND
443                   | beans::PropertyAttribute::MAYBEDEFAULT ));
444     // CharFontPitchComplex (see awt.FontPitch)
445     rOutProperties.push_back(
446         Property( C2U( "CharFontPitchComplex" ),
447                   PROP_CHAR_COMPLEX_FONT_PITCH,
448                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
449                   beans::PropertyAttribute::BOUND
450                   | beans::PropertyAttribute::MAYBEDEFAULT ));
451     // CharHeightComplex
452     rOutProperties.push_back(
453         Property( C2U( "CharHeightComplex" ),
454                   PROP_CHAR_COMPLEX_CHAR_HEIGHT,
455                   ::getCppuType( reinterpret_cast< const float * >(0)),
456                   beans::PropertyAttribute::BOUND
457                   | beans::PropertyAttribute::MAYBEDEFAULT ));
458     // CharWeightComplex
459     rOutProperties.push_back(
460         Property( C2U( "CharWeightComplex" ),
461                   PROP_CHAR_COMPLEX_WEIGHT,
462                   ::getCppuType( reinterpret_cast< const float * >(0)),
463                   beans::PropertyAttribute::BOUND
464                   | beans::PropertyAttribute::MAYBEDEFAULT ));
465     // CharPostureComplex
466     rOutProperties.push_back(
467         Property( C2U( "CharPostureComplex" ),
468                   PROP_CHAR_COMPLEX_POSTURE,
469                   ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
470                   beans::PropertyAttribute::BOUND
471                   | beans::PropertyAttribute::MAYBEDEFAULT ));
472     // CharLocaleComplex
473     rOutProperties.push_back(
474         Property( C2U( "CharLocaleComplex" ),
475                   PROP_CHAR_COMPLEX_LOCALE,
476                   ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
477                   //#i111967# no PropertyChangeEvent is fired on change so far
478                   beans::PropertyAttribute::MAYBEDEFAULT ));
479 
480     // Writing Mode left to right vs right to left
481     rOutProperties.push_back(
482         Property( C2U( "WritingMode" ),
483                   PROP_WRITING_MODE,
484                   ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
485                   beans::PropertyAttribute::BOUND
486                   | beans::PropertyAttribute::MAYBEDEFAULT ));
487 
488     rOutProperties.push_back(
489         Property( C2U( "ParaIsCharacterDistance" ),
490                   PROP_PARA_IS_CHARACTER_DISTANCE,
491                   ::getBooleanCppuType(),
492                   beans::PropertyAttribute::BOUND
493                   | beans::PropertyAttribute::MAYBEDEFAULT ));
494 }
495 
496 void CharacterProperties::AddDefaultsToMap(
497     ::chart::tPropertyValueMap & rOutMap )
498 {
499     const float fDefaultFontHeight = 13.0;
500 
501     SvtLinguConfig aLinguConfig;
502     lang::Locale aDefaultLocale;
503     aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale;
504     lang::Locale aDefaultLocale_CJK;
505     aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK;
506     lang::Locale aDefaultLocale_CTL;
507     aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL;
508 
509     using namespace ::com::sun::star::i18n::ScriptType;
510     LanguageType nLang;
511     nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aDefaultLocale), LATIN);
512     Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
513     nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK), ASIAN);
514     Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
515     nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL), COMPLEX);
516     Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
517 
518     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
519     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
520     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//awt::FontFamily::SWISS
521     ::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
522     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
523     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
524     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
525     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
526     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
527     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
528     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE, awt::FontUnderline::NONE );
529     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_OVERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
530     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_HAS_COLOR, false );
531     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
532     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
533     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
534     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
535 
536 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CASE_MAPPING, style::CaseMap::NONE );
537 //     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_ROTATION, 0 );
538 //     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_SCALE_WIDTH, 71 );
539 
540 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CROSSED_OUT, false );
541     ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
542     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
543 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FLASH, false );
544 
545     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
546     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
547     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
548     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
549 
550     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
551 
552 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_ADJUST, text::RubyAdjust_INDENT_BLOCK );
553 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_STYLE_NAME, ?? );
554 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RUBY_IS_ABOVE, true );
555 //     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_INHIBIT_HYPHENATION, false );
556 
557     // Asian (com.sun.star.style.CharacterPropertiesAsian)
558     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
559     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
560     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
561     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
562     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
563     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
564     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
565     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
566     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
567 
568     // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
569     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
570     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
571     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
572     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
573     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
574     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
575     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
576     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
577     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
578 
579     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
580     ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
581 }
582 
583 bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
584 {
585     return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
586              nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
587 }
588 
589 awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
590     const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
591 {
592     awt::FontDescriptor aResult;
593     // Note: keep this sorted!
594     ::comphelper::MakeVector< OUString > aPropNames
595         ( C2U("CharFontCharSet"));                // CharSet
596     aPropNames
597         ( C2U("CharFontFamily"))                  // Family
598         ( C2U("CharFontName"))                    // Name
599         ( C2U("CharFontPitch"))                   // Pitch
600         ( C2U("CharFontStyleName"))               // StyleName
601         ( C2U("CharHeight"))                      // Height
602         ( C2U("CharPosture"))                     // Slant
603         ( C2U("CharStrikeout"))                   // Strikeout
604         ( C2U("CharUnderline"))                   // Underline
605         ( C2U("CharWeight"))                      // Weight
606         ( C2U("CharWordMode"))                    // WordLineMode
607         ;
608 
609     uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
610     uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
611 
612     sal_Int32 i=0;
613     // Note keep this sorted according to the list above (comments are the fieldnames)
614     aValues[ i++ ]  >>= aResult.CharSet;
615     aValues[ i++ ]  >>= aResult.Family;
616     aValues[ i++ ]  >>= aResult.Name;
617     aValues[ i++ ]  >>= aResult.Pitch;
618     aValues[ i++ ]  >>= aResult.StyleName;
619     float fCharHeight = 0;
620     aValues[ i++ ]  >>= fCharHeight;
621     aResult.Height = static_cast< sal_Int16 >( fCharHeight );
622     aValues[ i++ ]  >>= aResult.Slant;
623     aValues[ i++ ]  >>= aResult.Strikeout;
624     aValues[ i++ ]  >>= aResult.Underline;
625     aValues[ i++ ]  >>= aResult.Weight;
626     aValues[ i++ ]  >>= aResult.WordLineMode;
627     OSL_ASSERT( i == aValues.getLength());
628 
629     return aResult;
630 }
631 
632 } //  namespace chart
633