Coverage Report

Created: 2026-02-14 09:37

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