Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/inc/PropertyHelper.hxx
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
#pragma once
20
21
#include <com/sun/star/beans/Property.hpp>
22
#include <com/sun/star/uno/Any.hxx>
23
24
#include <unordered_map>
25
26
namespace com::sun::star::lang { class XMultiServiceFactory; }
27
28
namespace chart
29
{
30
31
typedef int tPropertyValueMapKey;
32
33
typedef std::unordered_map<tPropertyValueMapKey, css::uno::Any> tPropertyValueMap;
34
35
namespace PropertyHelper
36
{
37
38
/** adds a line dash with a unique name to the gradient obtained by the given
39
    factory.
40
41
    @return The name used for storing this element in the table
42
*/
43
OUString addLineDashUniqueNameToTable(
44
    const css::uno::Any & rValue,
45
    const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
46
    const OUString & rPreferredName );
47
48
/** adds a gradient with a unique name to the gradient obtained by the given
49
    factory.
50
51
    @return The name used for storing this element in the table
52
*/
53
OUString addGradientUniqueNameToTable(
54
    const css::uno::Any & rValue,
55
    const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
56
    const OUString & rPreferredName );
57
58
/** adds a transparency gradient with a unique name to the gradient obtained
59
    by the given factory.
60
61
    @return The name used for storing this element in the table
62
*/
63
OUString addTransparencyGradientUniqueNameToTable(
64
    const css::uno::Any & rValue,
65
    const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
66
    const OUString & rPreferredName );
67
68
/** adds a hatch with a unique name to the gradient obtained by the given
69
    factory.
70
71
    @return The name used for storing this element in the table
72
*/
73
OUString addHatchUniqueNameToTable(
74
    const css::uno::Any & rValue,
75
    const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
76
    const OUString & rPreferredName );
77
78
/** adds a bitmap with a unique name to the gradient obtained by the given
79
    factory.
80
81
    @return The name used for storing this element in the table
82
*/
83
OUString addBitmapUniqueNameToTable(
84
    const css::uno::Any & rValue,
85
    const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact,
86
    const OUString & rPreferredName );
87
88
/** Set a property to a certain value in the given map.  This works for
89
    properties that are already set, and those which are not yet in the map.
90
91
    @param any is the value encapsulated in the variant type Any
92
 */
93
void setPropertyValueAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key,
94
                          const css::uno::Any & rAny );
95
96
/** Set a property to a certain value in the given map.  This works for
97
    properties that are already set, and those which are not yet in the map.
98
99
    @param value is the value of type Value that will be put into a variant type
100
        Any before set in the property map.
101
 */
102
template< typename Value >
103
    void setPropertyValue( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value )
104
0
{
105
0
    setPropertyValueAny( rOutMap, key, css::uno::Any( value ));
106
0
}
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValue<float>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, float const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValue<int>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, int const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValue<Color>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, Color const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValue<com::sun::star::drawing::LineStyle>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::LineStyle const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValue<com::sun::star::drawing::FillStyle>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::FillStyle const&)
107
108
template<>
109
    void setPropertyValue< css::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
110
111
void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
112
113
/** Calls setPropertyValue() but asserts that the given property hasn't been set
114
    before.
115
 */
116
template< typename Value >
117
    void setPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value )
118
0
{
119
0
    setPropertyValueDefaultAny( rOutMap, key, css::uno::Any( value ));
120
0
}
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<bool>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, bool const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart::ChartAxisPosition>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart::ChartAxisPosition const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart::ChartAxisLabelPosition>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart::ChartAxisLabelPosition const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<double>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, double const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart::ChartAxisArrangeOrderType>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart::ChartAxisArrangeOrderType const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<int>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, int const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart::ChartAxisMarkPosition>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart::ChartAxisMarkPosition const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::StackingDirection>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::StackingDirection const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::PieChartSubType>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::PieChartSubType const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::LegendPosition>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::LegendPosition const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart::ChartLegendExpansion>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart::ChartLegendExpansion const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::style::ParagraphAdjust>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::style::ParagraphAdjust const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::uno::Sequence<int> >(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::uno::Sequence<int> const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::CurveStyle>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::CurveStyle const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::PieChartOffsetMode>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::PieChartOffsetMode const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<rtl::OUString>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, rtl::OUString const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<short>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, short const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<Color>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, Color const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<float>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, float const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::awt::FontSlant>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::awt::FontSlant const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::lang::Locale>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::lang::Locale const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::FillStyle>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::FillStyle const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::RectanglePoint>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::RectanglePoint const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::BitmapMode>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::BitmapMode const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::LineStyle>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::LineStyle const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::LineJoint>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::LineJoint const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::LineCap>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::LineCap const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::HomogenMatrix>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::HomogenMatrix const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::ShadeMode>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::ShadeMode const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::CameraGeometry>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::CameraGeometry const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::ProjectionMode>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::ProjectionMode const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::Direction3D>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::Direction3D const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::drawing::LineDash>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::drawing::LineDash const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::Symbol>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::Symbol const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> >(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::chart2::DataPointLabel>(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::chart2::DataPointLabel const&)
Unexecuted instantiation: void chart::PropertyHelper::setPropertyValueDefault<com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::chart2::XDataPointCustomLabelField> > >(std::__1::unordered_map<int, com::sun::star::uno::Any, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<int const, com::sun::star::uno::Any> > >&, int, com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::chart2::XDataPointCustomLabelField> > const&)
121
122
/** Calls setPropertyValue() but asserts that the given property hasn't been set
123
    before.
124
 */
125
template<>
126
    void setPropertyValueDefault< css::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny );
127
128
/** Calls setPropertyValueDefault() with an empty Any as value
129
 */
130
void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key );
131
132
} // namespace PropertyHelper
133
134
struct PropertyNameLess
135
{
136
    bool operator() ( const css::beans::Property & first,
137
                             const css::beans::Property & second )
138
0
    {
139
0
        return ( first.Name.compareTo( second.Name ) < 0 );
140
0
    }
141
};
142
143
} //  namespace chart
144
145
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */