Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/view/main/PropertyMapper.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 <PropertyMapper.hxx>
21
#include <unonames.hxx>
22
23
#include <com/sun/star/beans/XMultiPropertySet.hpp>
24
#include <com/sun/star/beans/XPropertySet.hpp>
25
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
26
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
27
#include <com/sun/star/drawing/LineJoint.hpp>
28
#include <com/sun/star/style/ParagraphAdjust.hpp>
29
#include <comphelper/diagnose_ex.hxx>
30
#include <comphelper/sequence.hxx>
31
#include <svx/unoshape.hxx>
32
33
namespace chart
34
{
35
using namespace ::com::sun::star;
36
37
void PropertyMapper::setMappedProperties(
38
          SvxShape& xTarget
39
        , const uno::Reference< beans::XPropertySet >& xSource
40
        , const tPropertyNameMap& rMap )
41
0
{
42
0
    if( !xSource.is() )
43
0
        return;
44
45
0
    sal_Int32 nPropertyCount = rMap.size();
46
0
    tNameSequence aNames(nPropertyCount);
47
0
    tAnySequence  aValues(nPropertyCount);
48
0
    auto pNames = aNames.getArray();
49
0
    auto pValues = aValues.getArray();
50
0
    sal_Int32 nN=0;
51
0
    uno::Reference< css::beans::XPropertySetInfo > xInfo = xSource->getPropertySetInfo();
52
53
0
    for (auto const& elem : rMap)
54
0
    {
55
0
        const OUString & rTarget = elem.first;
56
0
        const OUString & rSource = elem.second;
57
0
        if (xInfo->hasPropertyByName(rSource))
58
0
        {
59
0
            uno::Any aAny( xSource->getPropertyValue(rSource) );
60
0
            if( aAny.hasValue() )
61
0
            {
62
                //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
63
0
                pNames[nN]  = rTarget;
64
0
                pValues[nN] = std::move(aAny);
65
0
                ++nN;
66
0
            }
67
0
        }
68
0
    }
69
0
    if (nN == 0)
70
0
        return;
71
    //reduce to real property count
72
0
    aNames.realloc(nN);
73
0
    aValues.realloc(nN);
74
75
0
    uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY_THROW );
76
0
    try
77
0
    {
78
0
        xShapeMultiProp->setPropertyValues( aNames, aValues );
79
0
    }
80
0
    catch( const uno::Exception& )
81
0
    {
82
0
        TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
83
0
    }
84
0
}
85
86
void PropertyMapper::setMappedProperties(
87
          const uno::Reference< beans::XPropertySet >& xTarget
88
        , const uno::Reference< beans::XPropertySet >& xSource
89
        , const tPropertyNameMap& rMap )
90
0
{
91
0
    if( !xTarget.is() || !xSource.is() )
92
0
        return;
93
94
0
    tNameSequence aNames;
95
0
    tAnySequence  aValues;
96
0
    sal_Int32 nN=0;
97
0
    sal_Int32 nPropertyCount = rMap.size();
98
0
    aNames.realloc(nPropertyCount);
99
0
    auto pNames = aNames.getArray();
100
0
    aValues.realloc(nPropertyCount);
101
0
    auto pValues = aValues.getArray();
102
0
    uno::Reference< css::beans::XPropertySetInfo > xInfo = xSource->getPropertySetInfo();
103
104
0
    for (auto const& elem : rMap)
105
0
    {
106
0
        const OUString & rTarget = elem.first;
107
0
        const OUString & rSource = elem.second;
108
0
        if (xInfo->hasPropertyByName(rSource))
109
0
        {
110
0
            uno::Any aAny( xSource->getPropertyValue(rSource) );
111
0
            if( aAny.hasValue() )
112
0
            {
113
                //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
114
0
                pNames[nN]  = rTarget;
115
0
                pValues[nN] = std::move(aAny);
116
0
                ++nN;
117
0
            }
118
0
        }
119
0
    }
120
0
    if (nN == 0)
121
0
        return;
122
123
0
    uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
124
0
    if (xShapeMultiProp)
125
0
        try
126
0
        {
127
            //reduce to real property count
128
0
            aNames.realloc(nN);
129
0
            aValues.realloc(nN);
130
0
            xShapeMultiProp->setPropertyValues( aNames, aValues );
131
0
            return; // successful
132
0
        }
133
0
        catch( const uno::Exception& )
134
0
        {
135
0
            TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
136
0
        }
137
138
    // fall back to one at a time
139
0
    try
140
0
    {
141
0
        for( sal_Int32 i = 0; i < nN; i++ )
142
0
        {
143
0
            try
144
0
            {
145
0
                xTarget->setPropertyValue( aNames[i], aValues[i] );
146
0
            }
147
0
            catch( const uno::Exception& )
148
0
            {
149
0
                TOOLS_WARN_EXCEPTION("chart2", "" );
150
0
            }
151
0
        }
152
0
    }
153
0
    catch( const uno::Exception& )
154
0
    {
155
0
        TOOLS_WARN_EXCEPTION("chart2", "" );
156
0
    }
157
0
}
158
159
css::uno::Sequence<css::beans::PropertyValue> PropertyMapper::getPropVals(
160
         const uno::Reference< beans::XPropertySet >& xSource
161
        , const tPropertyNameMap& rMap )
162
0
{
163
0
    std::vector<css::beans::PropertyValue> aRet;
164
0
    aRet.reserve(rMap.size());
165
0
    uno::Reference< css::beans::XPropertySetInfo > xInfo = xSource->getPropertySetInfo();
166
167
0
    for (auto const& elem : rMap)
168
0
    {
169
0
        const OUString & rTarget = elem.first;
170
0
        const OUString & rSource = elem.second;
171
0
        if (xInfo->hasPropertyByName(rSource))
172
0
        {
173
0
            uno::Any aAny( xSource->getPropertyValue(rSource) );
174
0
            if( aAny.hasValue() )
175
0
            {
176
                //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
177
0
                css::beans::PropertyValue aPropVal;
178
0
                aPropVal.Name = rTarget;
179
0
                aPropVal.Value = std::move(aAny);
180
0
                aRet.push_back(std::move(aPropVal));
181
0
            }
182
0
        }
183
0
    }
184
0
    return comphelper::containerToSequence(aRet);
185
0
}
186
187
void PropertyMapper::getValueMap(
188
                  tPropertyNameValueMap& rValueMap
189
                , const tPropertyNameMap& rNameMap
190
                , const uno::Reference< beans::XPropertySet >& xSourceProp
191
                )
192
0
{
193
0
    uno::Reference< beans::XMultiPropertySet > xMultiPropSet(xSourceProp, uno::UNO_QUERY);
194
0
    if((false) && xMultiPropSet.is())
195
0
    {
196
0
        uno::Sequence< OUString > aPropSourceNames(rNameMap.size());
197
0
        auto aPropSourceNamesRange = asNonConstRange(aPropSourceNames);
198
0
        uno::Sequence< OUString > aPropTargetNames(rNameMap.size());
199
0
        auto aPropTargetNamesRange = asNonConstRange(aPropTargetNames);
200
0
        sal_Int32 i = 0;
201
0
        for (auto const& elem : rNameMap)
202
0
        {
203
0
            aPropTargetNamesRange[i] = elem.first;
204
0
            aPropSourceNamesRange[i] = elem.second;
205
0
            ++i;
206
0
        }
207
208
0
        uno::Sequence< uno::Any > xValues = xMultiPropSet->getPropertyValues(aPropSourceNames);
209
0
        sal_Int32 n = rNameMap.size();
210
0
        for(i = 0;i < n; ++i)
211
0
        {
212
0
            if( xValues[i].hasValue() )
213
0
                rValueMap.emplace(  aPropTargetNames[i], xValues[i] );
214
0
        }
215
0
    }
216
0
    else
217
0
    {
218
0
        for (auto const& elem : rNameMap)
219
0
        {
220
0
            const OUString & rTarget = elem.first;
221
0
            const OUString & rSource = elem.second;
222
0
            try
223
0
            {
224
0
                uno::Any aAny( xSourceProp->getPropertyValue(rSource) );
225
0
                if( aAny.hasValue() )
226
0
                    rValueMap.emplace(  rTarget, aAny );
227
0
            }
228
0
            catch( const uno::Exception& )
229
0
            {
230
0
                TOOLS_WARN_EXCEPTION("chart2", "" );
231
0
            }
232
0
        }
233
0
    }
234
0
}
235
236
void PropertyMapper::getMultiPropertyListsFromValueMap(
237
                  tNameSequence& rNames
238
                , tAnySequence&  rValues
239
                , const tPropertyNameValueMap& rValueMap
240
                )
241
0
{
242
0
    sal_Int32 nPropertyCount = rValueMap.size();
243
0
    rNames.realloc(nPropertyCount);
244
0
    auto pNames = rNames.getArray();
245
0
    rValues.realloc(nPropertyCount);
246
0
    auto pValues = rValues.getArray();
247
248
    //fill sequences
249
0
    sal_Int32 nN=0;
250
0
    for (auto const& elem : rValueMap)
251
0
    {
252
0
        const uno::Any& rAny = elem.second;
253
0
        if( rAny.hasValue() )
254
0
        {
255
            //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
256
0
            pNames[nN]  = elem.first;
257
0
            pValues[nN] = rAny;
258
0
            ++nN;
259
0
        }
260
0
    }
261
    //reduce to real property count
262
0
    rNames.realloc(nN);
263
0
    rValues.realloc(nN);
264
0
}
265
266
uno::Any* PropertyMapper::getValuePointer( tAnySequence& rPropValues
267
                         , const tNameSequence& rPropNames
268
                         , std::u16string_view rPropName )
269
0
{
270
0
    sal_Int32 nCount = rPropNames.getLength();
271
0
    for( sal_Int32 nN = 0; nN < nCount; nN++ )
272
0
    {
273
0
        if(rPropNames[nN] == rPropName)
274
0
            return &rPropValues.getArray()[nN];
275
0
    }
276
0
    return nullptr;
277
0
}
278
279
uno::Any* PropertyMapper::getValuePointerForLimitedSpace( tAnySequence& rPropValues
280
                         , const tNameSequence& rPropNames
281
                         , bool bLimitedHeight)
282
0
{
283
0
    return PropertyMapper::getValuePointer( rPropValues, rPropNames
284
0
        , bLimitedHeight ? u"TextMaximumFrameHeight"_ustr : u"TextMaximumFrameWidth"_ustr );
285
0
}
286
287
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProperties()
288
0
{
289
    //shape property -- chart model object property
290
0
    static tPropertyNameMap s_aShapePropertyMapForCharacterProperties{
291
0
        {"CharColor",                "CharColor"},
292
0
        {"CharComplexColor",         "CharComplexColor"},
293
0
        {"CharContoured",            "CharContoured"},
294
0
        {"CharEmphasis",             "CharEmphasis"},//the service style::CharacterProperties  describes a property called 'CharEmphasize' which is nowhere implemented
295
0
        {"CharEscapement",           "CharEscapement"},
296
0
        {"CharEscapementHeight",     "CharEscapementHeight"},
297
0
        {"CharFontFamily",           "CharFontFamily"},
298
0
        {"CharFontFamilyAsian",      "CharFontFamilyAsian"},
299
0
        {"CharFontFamilyComplex",    "CharFontFamilyComplex"},
300
0
        {"CharFontCharSet",          "CharFontCharSet"},
301
0
        {"CharFontCharSetAsian",     "CharFontCharSetAsian"},
302
0
        {"CharFontCharSetComplex",   "CharFontCharSetComplex"},
303
0
        {"CharFontName",             "CharFontName"},
304
0
        {"CharFontNameAsian",        "CharFontNameAsian"},
305
0
        {"CharFontNameComplex",      "CharFontNameComplex"},
306
0
        {"CharFontPitch",            "CharFontPitch"},
307
0
        {"CharFontPitchAsian",       "CharFontPitchAsian"},
308
0
        {"CharFontPitchComplex",     "CharFontPitchComplex"},
309
0
        {"CharFontStyleName",        "CharFontStyleName"},
310
0
        {"CharFontStyleNameAsian",   "CharFontStyleNameAsian"},
311
0
        {"CharFontStyleNameComplex", "CharFontStyleNameComplex"},
312
313
0
        {"CharHeight",               "CharHeight"},
314
0
        {"CharHeightAsian",          "CharHeightAsian"},
315
0
        {"CharHeightComplex",        "CharHeightComplex"},
316
0
        {"CharKerning",              "CharKerning"},
317
0
        {"CharLocale",               "CharLocale"},
318
0
        {"CharLocaleAsian",          "CharLocaleAsian"},
319
0
        {"CharLocaleComplex",        "CharLocaleComplex"},
320
0
        {"CharPosture",              "CharPosture"},
321
0
        {"CharPostureAsian",         "CharPostureAsian"},
322
0
        {"CharPostureComplex",       "CharPostureComplex"},
323
0
        {"CharRelief",               "CharRelief"},
324
0
        {"CharShadowed",             "CharShadowed"},
325
0
        {"CharStrikeout",            "CharStrikeout"},
326
0
        {"CharUnderline",            "CharUnderline"},
327
0
        {"CharUnderlineColor",       "CharUnderlineColor"},
328
0
        {"CharUnderlineComplexColor", "CharUnderlineComplexColor"},
329
0
        {"CharUnderlineHasColor",    "CharUnderlineHasColor"},
330
0
        {"CharOverline",             "CharOverline"},
331
0
        {"CharOverlineColor",        "CharOverlineColor"},
332
0
        {"CharOverlineComplexColor", "CharOverlineComplexColor"},
333
0
        {"CharOverlineHasColor",     "CharOverlineHasColor"},
334
0
        {"CharWeight",               "CharWeight"},
335
0
        {"CharWeightAsian",          "CharWeightAsian"},
336
0
        {"CharWeightComplex",        "CharWeightComplex"},
337
0
        {"CharWordMode",             "CharWordMode"},
338
339
0
        {"WritingMode",              "WritingMode"},
340
341
0
        {"ParaIsCharacterDistance",  "ParaIsCharacterDistance"}};
342
343
0
    return s_aShapePropertyMapForCharacterProperties;
344
0
}
345
346
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForParagraphProperties()
347
0
{
348
    //shape property -- chart model object property
349
0
    static tPropertyNameMap s_aShapePropertyMapForParagraphProperties{
350
0
        {"ParaAdjust",          "ParaAdjust"},
351
0
        {"ParaBottomMargin",    "ParaBottomMargin"},
352
0
        {"ParaIsHyphenation",   "ParaIsHyphenation"},
353
0
        {"ParaLastLineAdjust",  "ParaLastLineAdjust"},
354
0
        {"ParaLeftMargin",      "ParaLeftMargin"},
355
0
        {"ParaRightMargin",     "ParaRightMargin"},
356
0
        {"ParaTopMargin",       "ParaTopMargin"}};
357
0
    return s_aShapePropertyMapForParagraphProperties;
358
0
}
359
360
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForFillProperties()
361
0
{
362
    //shape property -- chart model object property
363
0
    static tPropertyNameMap s_aShapePropertyMapForFillProperties{
364
0
        {"FillBackground",               "FillBackground"},
365
0
        {"FillBitmapName",               "FillBitmapName"},
366
0
        {"FillColor",                    "FillColor"},
367
0
        {"FillComplexColor",             "FillComplexColor"},
368
0
        {"FillGradientName",             "FillGradientName"},
369
0
        {"FillGradientStepCount",        "FillGradientStepCount"},
370
0
        {"FillHatchName",                "FillHatchName"},
371
0
        {"FillStyle",                    "FillStyle"},
372
0
        {"FillTransparence",             "FillTransparence"},
373
0
        {"FillTransparenceGradientName", "FillTransparenceGradientName"},
374
        //bitmap properties
375
0
        {"FillBitmapMode",               "FillBitmapMode"},
376
0
        {"FillBitmapSizeX",              "FillBitmapSizeX"},
377
0
        {"FillBitmapSizeY",              "FillBitmapSizeY"},
378
0
        {"FillBitmapLogicalSize",        "FillBitmapLogicalSize"},
379
0
        {"FillBitmapOffsetX",            "FillBitmapOffsetX"},
380
0
        {"FillBitmapOffsetY",            "FillBitmapOffsetY"},
381
0
        {"FillBitmapRectanglePoint",     "FillBitmapRectanglePoint"},
382
0
        {"FillBitmapPositionOffsetX",    "FillBitmapPositionOffsetX"},
383
0
        {"FillBitmapPositionOffsetY",    "FillBitmapPositionOffsetY"}};
384
0
    return s_aShapePropertyMapForFillProperties;
385
0
}
386
387
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties()
388
0
{
389
    //shape property -- chart model object property
390
0
    static tPropertyNameMap s_aShapePropertyMapForLineProperties{
391
0
        {"LineColor",              "LineColor"},
392
0
        {"LineComplexColor",       "LineComplexColor"},
393
0
        {"LineDashName",           "LineDashName"},
394
0
        {"LineJoint",              "LineJoint"},
395
0
        {"LineStyle",              "LineStyle"},
396
0
        {"LineTransparence",       "LineTransparence"},
397
0
        {"LineWidth",              "LineWidth"},
398
0
        {"LineCap",                "LineCap"}};
399
0
    return s_aShapePropertyMapForLineProperties;
400
0
}
401
402
namespace {
403
0
    tPropertyNameMap getPropertyNameMapForFillAndLineProperties_() {
404
0
        auto map = PropertyMapper::getPropertyNameMapForFillProperties();
405
0
        auto const & add
406
0
            = PropertyMapper::getPropertyNameMapForLineProperties();
407
0
        map.insert(add.begin(), add.end());
408
0
        return map;
409
0
    }
410
}
411
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForFillAndLineProperties()
412
0
{
413
0
    static tPropertyNameMap s_aShapePropertyMapForFillAndLineProperties
414
0
        = getPropertyNameMapForFillAndLineProperties_();
415
0
    return s_aShapePropertyMapForFillAndLineProperties;
416
0
}
417
418
namespace {
419
0
    tPropertyNameMap getPropertyNameMapForTextShapeProperties_() {
420
0
        auto map = PropertyMapper::getPropertyNameMapForCharacterProperties();
421
0
        auto const & add1
422
0
            = PropertyMapper::getPropertyNameMapForFillProperties();
423
0
        map.insert(add1.begin(), add1.end());
424
0
        auto const & add2
425
0
            = PropertyMapper::getPropertyNameMapForLineProperties();
426
0
        map.insert(add2.begin(), add2.end());
427
0
        return map;
428
0
    }
429
}
430
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForTextShapeProperties()
431
0
{
432
0
    static tPropertyNameMap s_aShapePropertyMapForTextShapeProperties
433
0
        = getPropertyNameMapForTextShapeProperties_();
434
0
    return s_aShapePropertyMapForTextShapeProperties;
435
0
}
436
437
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesProperties()
438
0
{
439
    //shape property -- chart model object property
440
0
    static tPropertyNameMap s_aShapePropertyMapForLineSeriesProperties{
441
0
        {"LineColor",           "Color"},
442
0
        {"LineComplexColor",    "ComplexColor"},
443
0
        {"LineDashName",        "LineDashName"},
444
0
        {"LineStyle",           "LineStyle"},
445
0
        {"LineTransparence",    "Transparency"},
446
0
        {"LineWidth",           "LineWidth"},
447
0
        {"LineCap",             "LineCap"}};
448
0
    return s_aShapePropertyMapForLineSeriesProperties;
449
0
}
450
451
namespace {
452
0
    tPropertyNameMap getPropertyNameMapForTextLabelProperties_() {
453
0
        auto map = PropertyMapper::getPropertyNameMapForCharacterProperties();
454
0
        map.insert({
455
0
            {"LineStyle", CHART_UNONAME_LABEL_BORDER_STYLE},
456
0
            {"LineWidth", CHART_UNONAME_LABEL_BORDER_WIDTH},
457
0
            {"LineColor", CHART_UNONAME_LABEL_BORDER_COLOR},
458
0
            {"LineComplexColor", CHART_UNONAME_LABEL_BORDER_COMPLEX_COLOR},
459
0
            {"LineTransparence", CHART_UNONAME_LABEL_BORDER_TRANS},
460
0
            {"FillStyle", CHART_UNONAME_LABEL_FILL_STYLE},
461
0
            {"FillColor", CHART_UNONAME_LABEL_FILL_COLOR},
462
0
            {"FillComplexColor", CHART_UNONAME_LABEL_FILL_COMPLEX_COLOR},
463
0
            {"FillBackground", CHART_UNONAME_LABEL_FILL_BACKGROUND},
464
0
            {"FillHatchName", CHART_UNONAME_LABEL_FILL_HATCH_NAME}
465
0
            });
466
                // fix the spelling!
467
0
        return map;
468
0
    }
469
}
470
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForTextLabelProperties()
471
0
{
472
    // target name (drawing layer) : source name (chart model)
473
0
    static tPropertyNameMap aMap = getPropertyNameMapForTextLabelProperties_();
474
0
    return aMap;
475
0
}
476
477
const tPropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesProperties()
478
0
{
479
    //shape property -- chart model object property
480
0
    static tPropertyNameMap s_aShapePropertyMapForFilledSeriesProperties{
481
0
        {"FillBackground",               "FillBackground"},
482
0
        {"FillBitmapName",               "FillBitmapName"},
483
0
        {"FillColor",                    "Color"},
484
0
        {"FillComplexColor",             "ComplexColor"},
485
0
        {"FillGradientName",             "GradientName"},
486
0
        {"FillGradientStepCount",        "GradientStepCount"},
487
0
        {"FillHatchName",                "HatchName"},
488
0
        {"FillStyle",                    "FillStyle"},
489
0
        {"FillTransparence",             "Transparency"},
490
0
        {"FillTransparenceGradientName", "TransparencyGradientName"},
491
        //bitmap properties
492
0
        {"FillBitmapMode",               "FillBitmapMode"},
493
0
        {"FillBitmapSizeX",              "FillBitmapSizeX"},
494
0
        {"FillBitmapSizeY",              "FillBitmapSizeY"},
495
0
        {"FillBitmapLogicalSize",        "FillBitmapLogicalSize"},
496
0
        {"FillBitmapOffsetX",            "FillBitmapOffsetX"},
497
0
        {"FillBitmapOffsetY",            "FillBitmapOffsetY"},
498
0
        {"FillBitmapRectanglePoint",     "FillBitmapRectanglePoint"},
499
0
        {"FillBitmapPositionOffsetX",    "FillBitmapPositionOffsetX"},
500
0
        {"FillBitmapPositionOffsetY",    "FillBitmapPositionOffsetY"},
501
        //line properties
502
0
        {"LineColor",                    "BorderColor"},
503
0
        {"LineComplexColor",             "BorderComplexColor"},
504
0
        {"LineDashName",                 "BorderDashName"},
505
0
        {"LineStyle",                    "BorderStyle"},
506
0
        {"LineTransparence",             "BorderTransparency"},
507
0
        {"LineWidth",                    "BorderWidth"},
508
0
        {"LineCap",                      "LineCap"}};
509
0
    return s_aShapePropertyMapForFilledSeriesProperties;
510
0
}
511
512
void PropertyMapper::setMultiProperties(
513
                  const tNameSequence& rNames
514
                , const tAnySequence&  rValues
515
                , SvxShape& xTarget )
516
0
{
517
0
    try
518
0
    {
519
0
        xTarget.setPropertyValues( rNames, rValues );
520
0
    }
521
0
    catch( const uno::Exception& )
522
0
    {
523
0
        TOOLS_WARN_EXCEPTION("chart2", "" ); //if this occurs more often think of removing the XMultiPropertySet completely for better performance
524
0
    }
525
0
}
526
527
void PropertyMapper::getTextLabelMultiPropertyLists(
528
    const uno::Reference< beans::XPropertySet >& xSourceProp
529
    , tNameSequence& rPropNames, tAnySequence& rPropValues
530
    , bool bName
531
    , sal_Int32 nLimitedSpace
532
    , bool bLimitedHeight
533
    , bool bSupportsLabelBorder)
534
0
{
535
    //fill character properties into the ValueMap
536
0
    tPropertyNameValueMap aValueMap;
537
0
    tPropertyNameMap const & aNameMap = bSupportsLabelBorder ? PropertyMapper::getPropertyNameMapForTextLabelProperties() : getPropertyNameMapForCharacterProperties();
538
539
0
    PropertyMapper::getValueMap(aValueMap, aNameMap, xSourceProp);
540
541
    //some more shape properties apart from character properties, position-matrix and label string
542
0
    aValueMap.emplace( "TextHorizontalAdjust", uno::Any(drawing::TextHorizontalAdjust_CENTER) ); // drawing::TextHorizontalAdjust - needs to be overwritten
543
0
    aValueMap.emplace( "TextVerticalAdjust", uno::Any(drawing::TextVerticalAdjust_CENTER) ); //drawing::TextVerticalAdjust - needs to be overwritten
544
0
    aValueMap.emplace( "TextAutoGrowHeight", uno::Any(true) ); // sal_Bool
545
0
    aValueMap.emplace( "TextAutoGrowWidth", uno::Any(true) ); // sal_Bool
546
0
    aValueMap.emplace( "ParaAdjust", uno::Any(style::ParagraphAdjust_CENTER) ); // style::ParagraphAdjust_CENTER - needs to be overwritten
547
0
    if( bName )
548
0
        aValueMap.emplace( "Name", uno::Any( OUString() ) ); //CID OUString - needs to be overwritten for each point
549
550
0
    if( nLimitedSpace > 0 )
551
0
    {
552
0
        if(bLimitedHeight)
553
0
            aValueMap.emplace( "TextMaximumFrameHeight", uno::Any(nLimitedSpace) ); //sal_Int32
554
0
        else
555
0
            aValueMap.emplace( "TextMaximumFrameWidth", uno::Any(nLimitedSpace) ); //sal_Int32
556
0
        aValueMap.emplace( "ParaIsHyphenation", uno::Any(true) );
557
0
    }
558
559
0
    PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
560
0
}
561
562
void PropertyMapper::getPreparedTextShapePropertyLists(
563
    const uno::Reference< beans::XPropertySet >& xSourceProp
564
    , tNameSequence& rPropNames, tAnySequence& rPropValues )
565
0
{
566
    //fill character, line and fill properties into the ValueMap
567
0
    tPropertyNameValueMap aValueMap;
568
0
    PropertyMapper::getValueMap( aValueMap
569
0
            , PropertyMapper::getPropertyNameMapForTextShapeProperties()
570
0
            , xSourceProp );
571
572
    // auto-grow makes sure the shape has the correct size after setting text
573
0
    aValueMap.emplace( "TextHorizontalAdjust", uno::Any( drawing::TextHorizontalAdjust_CENTER ));
574
0
    aValueMap.emplace( "TextVerticalAdjust", uno::Any( drawing::TextVerticalAdjust_CENTER ));
575
0
    aValueMap.emplace( "TextAutoGrowHeight", uno::Any( true ));
576
0
    aValueMap.emplace( "TextAutoGrowWidth", uno::Any( true ));
577
578
    // set some distance to the border, in case it is shown
579
0
    const sal_Int32 nWidthDist  = 250;
580
0
    const sal_Int32 nHeightDist = 125;
581
0
    aValueMap.emplace( "TextLeftDistance",  uno::Any( nWidthDist ));
582
0
    aValueMap.emplace( "TextRightDistance", uno::Any( nWidthDist ));
583
0
    aValueMap.emplace( "TextUpperDistance", uno::Any( nHeightDist ));
584
0
    aValueMap.emplace( "TextLowerDistance", uno::Any( nHeightDist ));
585
586
    // use a line-joint showing the border of thick lines like two rectangles
587
    // filled in between.
588
0
    aValueMap[u"LineJoint"_ustr] <<= drawing::LineJoint_ROUND;
589
590
0
    PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
591
0
}
592
593
} //namespace chart
594
595
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */