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