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