Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "CharacterProperties.hxx"
21 : #include "ContainerHelper.hxx"
22 : #include "macros.hxx"
23 :
24 : #include <com/sun/star/beans/PropertyAttribute.hpp>
25 : #include <com/sun/star/style/XStyle.hpp>
26 : #include <com/sun/star/awt/FontSlant.hpp>
27 : #include <com/sun/star/lang/Locale.hpp>
28 :
29 : #include <com/sun/star/awt/FontFamily.hpp>
30 : #include <com/sun/star/awt/CharSet.hpp>
31 : #include <com/sun/star/awt/FontPitch.hpp>
32 : #include <com/sun/star/awt/FontUnderline.hpp>
33 : #include <com/sun/star/awt/FontWeight.hpp>
34 : #include <com/sun/star/style/CaseMap.hpp>
35 : #include <com/sun/star/text/FontRelief.hpp>
36 : #include <com/sun/star/text/FontEmphasis.hpp>
37 : #include <com/sun/star/text/RubyAdjust.hpp>
38 : #include <com/sun/star/awt/FontStrikeout.hpp>
39 : #include <com/sun/star/text/WritingMode2.hpp>
40 : #include <com/sun/star/i18n/ScriptType.hpp>
41 :
42 : #include <comphelper/InlineContainer.hxx>
43 :
44 :
45 : // header for struct SvtLinguConfig
46 : #include <unotools/lingucfg.hxx>
47 : #include <i18nlangtag/mslangid.hxx>
48 : #include <i18nlangtag/languagetag.hxx>
49 : #include <vcl/outdev.hxx>
50 :
51 : using namespace ::com::sun::star;
52 :
53 : using ::com::sun::star::beans::Property;
54 :
55 :
56 : namespace chart
57 : {
58 :
59 66 : void CharacterProperties::AddPropertiesToVector(
60 : ::std::vector< Property > & rOutProperties )
61 : {
62 : // CharacterProperties
63 : rOutProperties.push_back(
64 : Property( "CharFontName",
65 : PROP_CHAR_FONT_NAME,
66 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
67 : beans::PropertyAttribute::BOUND
68 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
69 : rOutProperties.push_back(
70 : Property( "CharFontStyleName",
71 : PROP_CHAR_FONT_STYLE_NAME,
72 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
73 : beans::PropertyAttribute::BOUND
74 : | beans::PropertyAttribute::MAYBEDEFAULT
75 132 : | beans::PropertyAttribute::MAYBEVOID ));
76 : // CharFontFamily (see awt.FontFamily)
77 : rOutProperties.push_back(
78 : Property( "CharFontFamily",
79 : PROP_CHAR_FONT_FAMILY,
80 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
81 : beans::PropertyAttribute::BOUND
82 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
83 : // CharFontCharSet (see awt.CharSet)
84 : rOutProperties.push_back(
85 : Property( "CharFontCharSet",
86 : PROP_CHAR_FONT_CHAR_SET,
87 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
88 : beans::PropertyAttribute::BOUND
89 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
90 : // CharFontPitch (see awt.FontPitch)
91 : rOutProperties.push_back(
92 : Property( "CharFontPitch",
93 : PROP_CHAR_FONT_PITCH,
94 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
95 : beans::PropertyAttribute::BOUND
96 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
97 : // CharColor
98 : rOutProperties.push_back(
99 : Property( "CharColor",
100 : PROP_CHAR_COLOR,
101 66 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
102 : beans::PropertyAttribute::BOUND
103 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
104 : // CharEscapement
105 : rOutProperties.push_back(
106 : Property( "CharEscapement",
107 : PROP_CHAR_ESCAPEMENT,
108 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
109 : beans::PropertyAttribute::BOUND
110 132 : | beans::PropertyAttribute::MAYBEVOID ));
111 : // CharHeight
112 : rOutProperties.push_back(
113 : Property( "CharHeight",
114 : PROP_CHAR_CHAR_HEIGHT,
115 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
116 : beans::PropertyAttribute::BOUND
117 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
118 : // CharUnderline (see awt.FontUnderline)
119 : rOutProperties.push_back(
120 : Property( "CharUnderline",
121 : PROP_CHAR_UNDERLINE,
122 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
123 : beans::PropertyAttribute::BOUND
124 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
125 : // CharUnderlineColor
126 : rOutProperties.push_back(
127 : Property( "CharUnderlineColor",
128 : PROP_CHAR_UNDERLINE_COLOR,
129 66 : ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
130 : beans::PropertyAttribute::BOUND
131 : | beans::PropertyAttribute::MAYBEDEFAULT
132 132 : | beans::PropertyAttribute::MAYBEVOID ));
133 : // CharUnderlineHasColor
134 : rOutProperties.push_back(
135 : Property( "CharUnderlineHasColor",
136 : PROP_CHAR_UNDERLINE_HAS_COLOR,
137 66 : ::getBooleanCppuType(),
138 : beans::PropertyAttribute::BOUND
139 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
140 : // CharOverline (see awt.FontUnderline)
141 : rOutProperties.push_back(
142 : Property( "CharOverline",
143 : PROP_CHAR_OVERLINE,
144 66 : ::getCppuType( reinterpret_cast< const sal_Int16* >( 0 ) ),
145 : beans::PropertyAttribute::BOUND
146 132 : | beans::PropertyAttribute::MAYBEDEFAULT ) );
147 : // CharOverlineColor
148 : rOutProperties.push_back(
149 : Property( "CharOverlineColor",
150 : PROP_CHAR_OVERLINE_COLOR,
151 66 : ::getCppuType( reinterpret_cast< const sal_Int32* >( 0 ) ),
152 : beans::PropertyAttribute::BOUND
153 : | beans::PropertyAttribute::MAYBEDEFAULT
154 132 : | beans::PropertyAttribute::MAYBEVOID ) );
155 : // CharOverlineHasColor
156 : rOutProperties.push_back(
157 : Property( "CharOverlineHasColor",
158 : PROP_CHAR_OVERLINE_HAS_COLOR,
159 66 : ::getBooleanCppuType(),
160 : beans::PropertyAttribute::BOUND
161 132 : | beans::PropertyAttribute::MAYBEDEFAULT ) );
162 : // CharWeight (see awt.FontWeight)
163 : rOutProperties.push_back(
164 : Property( "CharWeight",
165 : PROP_CHAR_WEIGHT,
166 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
167 : beans::PropertyAttribute::BOUND
168 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
169 : // CharPosture
170 : rOutProperties.push_back(
171 : Property( "CharPosture",
172 : PROP_CHAR_POSTURE,
173 66 : ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
174 : beans::PropertyAttribute::BOUND
175 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
176 : rOutProperties.push_back(
177 : Property( "CharAutoKerning",
178 : PROP_CHAR_AUTO_KERNING,
179 66 : ::getBooleanCppuType(),
180 : beans::PropertyAttribute::BOUND
181 : | beans::PropertyAttribute::MAYBEDEFAULT
182 132 : | beans::PropertyAttribute::MAYBEVOID ));
183 : rOutProperties.push_back(
184 : Property( "CharKerning",
185 : PROP_CHAR_KERNING,
186 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
187 : beans::PropertyAttribute::BOUND
188 : | beans::PropertyAttribute::MAYBEDEFAULT
189 132 : | beans::PropertyAttribute::MAYBEVOID ));
190 : // CharEscapementHeight
191 : rOutProperties.push_back(
192 : Property( "CharEscapementHeight",
193 : PROP_CHAR_ESCAPEMENT_HEIGHT,
194 66 : ::getCppuType( reinterpret_cast< const sal_Int8 * >(0)),
195 : beans::PropertyAttribute::BOUND
196 132 : | beans::PropertyAttribute::MAYBEVOID ));
197 : // CharStrikeout (see awt.FontStrikeout)
198 : rOutProperties.push_back(
199 : Property( "CharStrikeout",
200 : PROP_CHAR_STRIKE_OUT,
201 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
202 : beans::PropertyAttribute::BOUND
203 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
204 : // CharWordMode
205 : rOutProperties.push_back(
206 : Property( "CharWordMode",
207 : PROP_CHAR_WORD_MODE,
208 66 : ::getBooleanCppuType(),
209 : beans::PropertyAttribute::BOUND
210 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
211 : // CharLocale
212 : rOutProperties.push_back(
213 : Property( "CharLocale",
214 : PROP_CHAR_LOCALE,
215 66 : ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
216 : //#i111967# no PropertyChangeEvent is fired on change so far
217 66 : beans::PropertyAttribute::MAYBEDEFAULT ));
218 : // CharShadowed
219 : rOutProperties.push_back(
220 : Property( "CharShadowed",
221 : PROP_CHAR_SHADOWED,
222 66 : ::getBooleanCppuType(),
223 : beans::PropertyAttribute::BOUND
224 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
225 : // CharContoured
226 : rOutProperties.push_back(
227 : Property( "CharContoured",
228 : PROP_CHAR_CONTOURED,
229 66 : ::getBooleanCppuType(),
230 : beans::PropertyAttribute::BOUND
231 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
232 : // CharRelief (see text.FontRelief)
233 : rOutProperties.push_back(
234 : Property( "CharRelief",
235 : PROP_CHAR_RELIEF,
236 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
237 : beans::PropertyAttribute::BOUND
238 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
239 :
240 : // CharEmphasize (see text.FontEmphasis)
241 : rOutProperties.push_back(
242 : Property( "CharEmphasis",
243 : PROP_CHAR_EMPHASIS,
244 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
245 : beans::PropertyAttribute::BOUND
246 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
247 : // CharacterPropertiesAsian
248 : // =====
249 : // CharFontNameAsian
250 : rOutProperties.push_back(
251 : Property( "CharFontNameAsian",
252 : PROP_CHAR_ASIAN_FONT_NAME,
253 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
254 : beans::PropertyAttribute::BOUND
255 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
256 : // CharFontStyleNameAsian
257 : rOutProperties.push_back(
258 : Property( "CharFontStyleNameAsian",
259 : PROP_CHAR_ASIAN_FONT_STYLE_NAME,
260 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
261 : beans::PropertyAttribute::BOUND
262 : | beans::PropertyAttribute::MAYBEDEFAULT
263 132 : | beans::PropertyAttribute::MAYBEVOID ));
264 : // CharFontFamilyAsian (see awt.FontFamily)
265 : rOutProperties.push_back(
266 : Property( "CharFontFamilyAsian",
267 : PROP_CHAR_ASIAN_FONT_FAMILY,
268 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
269 : beans::PropertyAttribute::BOUND
270 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
271 : // CharFontCharSetAsian (see awt.CharSet)
272 : rOutProperties.push_back(
273 : Property( "CharFontCharSetAsian",
274 : PROP_CHAR_ASIAN_CHAR_SET,
275 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
276 : beans::PropertyAttribute::BOUND
277 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
278 : // CharFontPitchAsian (see awt.FontPitch)
279 : rOutProperties.push_back(
280 : Property( "CharFontPitchAsian",
281 : PROP_CHAR_ASIAN_FONT_PITCH,
282 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
283 : beans::PropertyAttribute::BOUND
284 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
285 : // CharHeightAsian
286 : rOutProperties.push_back(
287 : Property( "CharHeightAsian",
288 : PROP_CHAR_ASIAN_CHAR_HEIGHT,
289 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
290 : beans::PropertyAttribute::BOUND
291 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
292 : // CharWeightAsian
293 : rOutProperties.push_back(
294 : Property( "CharWeightAsian",
295 : PROP_CHAR_ASIAN_WEIGHT,
296 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
297 : beans::PropertyAttribute::BOUND
298 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
299 : // CharPostureAsian
300 : rOutProperties.push_back(
301 : Property( "CharPostureAsian",
302 : PROP_CHAR_ASIAN_POSTURE,
303 66 : ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
304 : beans::PropertyAttribute::BOUND
305 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
306 : // CharLocaleAsian
307 : rOutProperties.push_back(
308 : Property( "CharLocaleAsian",
309 : PROP_CHAR_ASIAN_LOCALE,
310 66 : ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
311 : //#i111967# no PropertyChangeEvent is fired on change so far
312 66 : beans::PropertyAttribute::MAYBEDEFAULT ));
313 :
314 : // CharacterPropertiesComplex
315 : // ===
316 : // CharFontNameComplex
317 : rOutProperties.push_back(
318 : Property( "CharFontNameComplex",
319 : PROP_CHAR_COMPLEX_FONT_NAME,
320 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
321 : beans::PropertyAttribute::BOUND
322 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
323 : // CharFontStyleNameComplex
324 : rOutProperties.push_back(
325 : Property( "CharFontStyleNameComplex",
326 : PROP_CHAR_COMPLEX_FONT_STYLE_NAME,
327 66 : ::getCppuType( reinterpret_cast< const OUString * >(0)),
328 : beans::PropertyAttribute::BOUND
329 : | beans::PropertyAttribute::MAYBEDEFAULT
330 132 : | beans::PropertyAttribute::MAYBEVOID ));
331 : // CharFontFamilyComplex (see awt.FontFamily)
332 : rOutProperties.push_back(
333 : Property( "CharFontFamilyComplex",
334 : PROP_CHAR_COMPLEX_FONT_FAMILY,
335 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
336 : beans::PropertyAttribute::BOUND
337 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
338 : // CharFontCharSetComplex (see awt.CharSet)
339 : rOutProperties.push_back(
340 : Property( "CharFontCharSetComplex",
341 : PROP_CHAR_COMPLEX_CHAR_SET,
342 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
343 : beans::PropertyAttribute::BOUND
344 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
345 : // CharFontPitchComplex (see awt.FontPitch)
346 : rOutProperties.push_back(
347 : Property( "CharFontPitchComplex",
348 : PROP_CHAR_COMPLEX_FONT_PITCH,
349 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
350 : beans::PropertyAttribute::BOUND
351 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
352 : // CharHeightComplex
353 : rOutProperties.push_back(
354 : Property( "CharHeightComplex",
355 : PROP_CHAR_COMPLEX_CHAR_HEIGHT,
356 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
357 : beans::PropertyAttribute::BOUND
358 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
359 : // CharWeightComplex
360 : rOutProperties.push_back(
361 : Property( "CharWeightComplex",
362 : PROP_CHAR_COMPLEX_WEIGHT,
363 66 : ::getCppuType( reinterpret_cast< const float * >(0)),
364 : beans::PropertyAttribute::BOUND
365 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
366 : // CharPostureComplex
367 : rOutProperties.push_back(
368 : Property( "CharPostureComplex",
369 : PROP_CHAR_COMPLEX_POSTURE,
370 66 : ::getCppuType( reinterpret_cast< const awt::FontSlant * >(0)),
371 : beans::PropertyAttribute::BOUND
372 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
373 : // CharLocaleComplex
374 : rOutProperties.push_back(
375 : Property( "CharLocaleComplex",
376 : PROP_CHAR_COMPLEX_LOCALE,
377 66 : ::getCppuType( reinterpret_cast< const lang::Locale * >(0)),
378 : //#i111967# no PropertyChangeEvent is fired on change so far
379 66 : beans::PropertyAttribute::MAYBEDEFAULT ));
380 :
381 : // Writing Mode left to right vs right to left
382 : rOutProperties.push_back(
383 : Property( "WritingMode",
384 : PROP_WRITING_MODE,
385 66 : ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), /*com::sun::star::text::WritingMode2*/
386 : beans::PropertyAttribute::BOUND
387 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
388 :
389 : rOutProperties.push_back(
390 : Property( "ParaIsCharacterDistance",
391 : PROP_PARA_IS_CHARACTER_DISTANCE,
392 66 : ::getBooleanCppuType(),
393 : beans::PropertyAttribute::BOUND
394 132 : | beans::PropertyAttribute::MAYBEDEFAULT ));
395 66 : }
396 :
397 39 : void CharacterProperties::AddDefaultsToMap(
398 : ::chart::tPropertyValueMap & rOutMap )
399 : {
400 39 : const float fDefaultFontHeight = 13.0;
401 :
402 39 : SvtLinguConfig aLinguConfig;
403 78 : lang::Locale aDefaultLocale;
404 39 : aLinguConfig.GetProperty("DefaultLocale") >>= aDefaultLocale;
405 78 : lang::Locale aDefaultLocale_CJK;
406 39 : aLinguConfig.GetProperty("DefaultLocale_CJK") >>= aDefaultLocale_CJK;
407 78 : lang::Locale aDefaultLocale_CTL;
408 39 : aLinguConfig.GetProperty("DefaultLocale_CTL") >>= aDefaultLocale_CTL;
409 :
410 : using namespace ::com::sun::star::i18n::ScriptType;
411 : LanguageType nLang;
412 39 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aDefaultLocale).getLanguageType( false), LATIN);
413 78 : Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
414 39 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag( aDefaultLocale_CJK).getLanguageType( false), ASIAN);
415 78 : Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
416 39 : nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag( aDefaultLocale_CTL).getLanguageType( false), COMPLEX);
417 78 : Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 );
418 :
419 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) );
420 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) );
421 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_FAMILY, sal_Int16(aFont.GetFamily()) );//awt::FontFamily::SWISS
422 39 : ::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
423 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_PITCH, sal_Int16(aFont.GetPitch()) );//awt::FontPitch::VARIABLE
424 39 : ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_COLOR, -1 ); //automatic color (COL_AUTO)
425 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CHAR_HEIGHT, fDefaultFontHeight );
426 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE, awt::FontUnderline::NONE );
427 39 : ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_UNDERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
428 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_UNDERLINE_HAS_COLOR, false );
429 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE, awt::FontUnderline::NONE );
430 39 : ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_CHAR_OVERLINE_COLOR, -1 ); //automatic color (COL_AUTO)
431 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_OVERLINE_HAS_COLOR, false );
432 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WEIGHT, awt::FontWeight::NORMAL );
433 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_POSTURE, awt::FontSlant_NONE );
434 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_AUTO_KERNING, true );
435 39 : ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_KERNING, 0 );
436 39 : ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_CHAR_STRIKE_OUT, awt::FontStrikeout::NONE );
437 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_WORD_MODE, false );
438 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_LOCALE, aDefaultLocale );
439 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_SHADOWED, false );
440 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_CONTOURED, false );
441 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_RELIEF, text::FontRelief::NONE );
442 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_EMPHASIS, text::FontEmphasis::NONE );
443 :
444 : // Asian (com.sun.star.style.CharacterPropertiesAsian)
445 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultFontHeight );
446 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_WEIGHT, awt::FontWeight::NORMAL );
447 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_POSTURE, awt::FontSlant_NONE );
448 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_LOCALE, aDefaultLocale_CJK );
449 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_NAME, OUString( aFontCJK.GetName() ) );
450 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_STYLE_NAME, OUString(aFontCJK.GetStyleName()) );
451 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_FAMILY, sal_Int16(aFontCJK.GetFamily()) );
452 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_CHAR_SET, sal_Int16(aFontCJK.GetCharSet()) );
453 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_ASIAN_FONT_PITCH, sal_Int16(aFontCJK.GetPitch()) );
454 :
455 : // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex)
456 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultFontHeight );
457 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_WEIGHT, awt::FontWeight::NORMAL );
458 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_POSTURE, awt::FontSlant_NONE );
459 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_LOCALE, aDefaultLocale_CTL );
460 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_NAME, OUString( aFontCTL.GetName() ) );
461 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_STYLE_NAME, OUString(aFontCTL.GetStyleName()) );
462 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_FAMILY, sal_Int16(aFontCTL.GetFamily()) );
463 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_CHAR_SET, sal_Int16(aFontCTL.GetCharSet()) );
464 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_COMPLEX_FONT_PITCH, sal_Int16(aFontCTL.GetPitch()) );
465 :
466 39 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_WRITING_MODE, sal_Int16( com::sun::star::text::WritingMode2::PAGE ) );
467 78 : ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PARA_IS_CHARACTER_DISTANCE, sal_True );
468 39 : }
469 :
470 814 : bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle )
471 : {
472 814 : return ( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
473 814 : nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
474 : }
475 :
476 0 : awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
477 : const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
478 : {
479 0 : awt::FontDescriptor aResult;
480 : // Note: keep this sorted!
481 : ::comphelper::MakeVector< OUString > aPropNames
482 0 : ( "CharFontCharSet"); // CharSet
483 : aPropNames
484 0 : ( "CharFontFamily") // Family
485 0 : ( "CharFontName") // Name
486 0 : ( "CharFontPitch") // Pitch
487 0 : ( "CharFontStyleName") // StyleName
488 0 : ( "CharHeight") // Height
489 0 : ( "CharPosture") // Slant
490 0 : ( "CharStrikeout") // Strikeout
491 0 : ( "CharUnderline") // Underline
492 0 : ( "CharWeight") // Weight
493 0 : ( "CharWordMode") // WordLineMode
494 0 : ;
495 :
496 0 : uno::Sequence< OUString > aPropNameSeq( ContainerHelper::ContainerToSequence( aPropNames ));
497 0 : uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( aPropNameSeq ));
498 :
499 0 : sal_Int32 i=0;
500 : // Note keep this sorted according to the list above (comments are the fieldnames)
501 0 : aValues[ i++ ] >>= aResult.CharSet;
502 0 : aValues[ i++ ] >>= aResult.Family;
503 0 : aValues[ i++ ] >>= aResult.Name;
504 0 : aValues[ i++ ] >>= aResult.Pitch;
505 0 : aValues[ i++ ] >>= aResult.StyleName;
506 0 : float fCharHeight = 0;
507 0 : aValues[ i++ ] >>= fCharHeight;
508 0 : aResult.Height = static_cast< sal_Int16 >( fCharHeight );
509 0 : aValues[ i++ ] >>= aResult.Slant;
510 0 : aValues[ i++ ] >>= aResult.Strikeout;
511 0 : aValues[ i++ ] >>= aResult.Underline;
512 0 : aValues[ i++ ] >>= aResult.Weight;
513 0 : aValues[ i++ ] >>= aResult.WordLineMode;
514 : OSL_ASSERT( i == aValues.getLength());
515 :
516 0 : return aResult;
517 : }
518 :
519 33 : } // namespace chart
520 :
521 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|