1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <FillProperties.hxx>
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <com/sun/star/drawing/BitmapMode.hpp>
23 #include <com/sun/star/drawing/FillStyle.hpp>
24 #include <com/sun/star/drawing/RectanglePoint.hpp>
26 #include <tools/color.hxx>
28 using namespace ::com::sun::star
;
30 using ::com::sun::star::beans::Property
;
38 void lcl_AddPropertiesToVector_without_BitmapProperties( std::vector
< css::beans::Property
> & rOutProperties
)
40 rOutProperties
.emplace_back( "FillStyle",
41 FillProperties::PROP_FILL_STYLE
,
42 cppu::UnoType
<drawing::FillStyle
>::get(),
43 beans::PropertyAttribute::BOUND
44 | beans::PropertyAttribute::MAYBEDEFAULT
);
46 rOutProperties
.emplace_back( "FillColor",
47 FillProperties::PROP_FILL_COLOR
,
48 cppu::UnoType
<sal_Int32
>::get(),
49 beans::PropertyAttribute::BOUND
50 | beans::PropertyAttribute::MAYBEVOID
// "maybe auto"
51 | beans::PropertyAttribute::MAYBEDEFAULT
);
53 rOutProperties
.emplace_back( "FillTransparence",
54 FillProperties::PROP_FILL_TRANSPARENCE
,
55 cppu::UnoType
<sal_Int16
>::get(),
56 beans::PropertyAttribute::BOUND
57 | beans::PropertyAttribute::MAYBEDEFAULT
);
59 rOutProperties
.emplace_back( "FillTransparenceGradientName",
60 FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME
,
61 cppu::UnoType
<OUString
>::get(),
62 beans::PropertyAttribute::BOUND
63 | beans::PropertyAttribute::MAYBEVOID
64 | beans::PropertyAttribute::MAYBEDEFAULT
);
66 rOutProperties
.emplace_back( "FillGradientName",
67 FillProperties::PROP_FILL_GRADIENT_NAME
,
68 cppu::UnoType
<OUString
>::get(),
69 beans::PropertyAttribute::BOUND
70 | beans::PropertyAttribute::MAYBEVOID
71 | beans::PropertyAttribute::MAYBEDEFAULT
);
73 rOutProperties
.emplace_back( "FillGradientStepCount",
74 FillProperties::PROP_FILL_GRADIENT_STEPCOUNT
,
75 cppu::UnoType
<sal_Int16
>::get(),
76 beans::PropertyAttribute::BOUND
77 | beans::PropertyAttribute::MAYBEVOID
);
79 rOutProperties
.emplace_back( "FillHatchName",
80 FillProperties::PROP_FILL_HATCH_NAME
,
81 cppu::UnoType
<OUString
>::get(),
82 beans::PropertyAttribute::BOUND
83 | beans::PropertyAttribute::MAYBEVOID
84 | beans::PropertyAttribute::MAYBEDEFAULT
);
86 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
88 rOutProperties
.emplace_back( "FillBackground",
89 FillProperties::PROP_FILL_BACKGROUND
,
90 cppu::UnoType
<sal_Bool
>::get(),
91 beans::PropertyAttribute::BOUND
92 | beans::PropertyAttribute::MAYBEDEFAULT
);
95 void lcl_AddPropertiesToVector_only_BitmapProperties( std::vector
< css::beans::Property
> & rOutProperties
)
97 rOutProperties
.emplace_back( "FillBitmapName",
98 FillProperties::PROP_FILL_BITMAP_NAME
,
99 cppu::UnoType
<OUString
>::get(),
100 beans::PropertyAttribute::BOUND
101 | beans::PropertyAttribute::MAYBEVOID
102 | beans::PropertyAttribute::MAYBEDEFAULT
);
104 rOutProperties
.emplace_back( "FillBitmapOffsetX",
105 FillProperties::PROP_FILL_BITMAP_OFFSETX
,
106 cppu::UnoType
<sal_Int16
>::get(),
107 beans::PropertyAttribute::BOUND
108 | beans::PropertyAttribute::MAYBEDEFAULT
);
110 rOutProperties
.emplace_back( "FillBitmapOffsetY",
111 FillProperties::PROP_FILL_BITMAP_OFFSETY
,
112 cppu::UnoType
<sal_Int16
>::get(),
113 beans::PropertyAttribute::BOUND
114 | beans::PropertyAttribute::MAYBEDEFAULT
);
116 rOutProperties
.emplace_back( "FillBitmapPositionOffsetX",
117 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
,
118 cppu::UnoType
<sal_Int16
>::get(),
119 beans::PropertyAttribute::BOUND
120 | beans::PropertyAttribute::MAYBEDEFAULT
);
122 rOutProperties
.emplace_back( "FillBitmapPositionOffsetY",
123 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
,
124 cppu::UnoType
<sal_Int16
>::get(),
125 beans::PropertyAttribute::BOUND
126 | beans::PropertyAttribute::MAYBEDEFAULT
);
128 rOutProperties
.emplace_back( "FillBitmapRectanglePoint",
129 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
,
130 cppu::UnoType
<drawing::RectanglePoint
>::get(),
131 beans::PropertyAttribute::BOUND
132 | beans::PropertyAttribute::MAYBEDEFAULT
);
134 rOutProperties
.emplace_back( "FillBitmapLogicalSize",
135 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
,
136 cppu::UnoType
<sal_Bool
>::get(),
137 beans::PropertyAttribute::BOUND
138 | beans::PropertyAttribute::MAYBEDEFAULT
);
140 rOutProperties
.emplace_back( "FillBitmapSizeX",
141 FillProperties::PROP_FILL_BITMAP_SIZEX
,
142 cppu::UnoType
<sal_Int32
>::get(),
143 beans::PropertyAttribute::BOUND
144 | beans::PropertyAttribute::MAYBEDEFAULT
);
146 rOutProperties
.emplace_back( "FillBitmapSizeY",
147 FillProperties::PROP_FILL_BITMAP_SIZEY
,
148 cppu::UnoType
<sal_Int32
>::get(),
149 beans::PropertyAttribute::BOUND
150 | beans::PropertyAttribute::MAYBEDEFAULT
);
152 rOutProperties
.emplace_back( "FillBitmapMode",
153 FillProperties::PROP_FILL_BITMAP_MODE
,
154 cppu::UnoType
<drawing::BitmapMode
>::get(),
155 beans::PropertyAttribute::BOUND
156 | beans::PropertyAttribute::MAYBEDEFAULT
);
159 void lcl_AddDefaultsToMap_without_BitmapProperties(
160 ::chart::tPropertyValueMap
& rOutMap
)
162 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_STYLE
, drawing::FillStyle_SOLID
);
163 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_COLOR
, Color(0xd9, 0xd9, 0xd9) ); // gray85
164 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_TRANSPARENCE
, sal_Int16(0) );
165 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BACKGROUND
, false );
168 void lcl_AddDefaultsToMap_only_BitmapProperties(
169 ::chart::tPropertyValueMap
& rOutMap
)
171 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETX
, sal_Int16(0) );
172 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETY
, sal_Int16(0) );
173 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
, sal_Int16(0) );
174 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
, sal_Int16(0) );
176 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
, drawing::RectanglePoint_MIDDLE_MIDDLE
);
177 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
, true );
178 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEX
, sal_Int32(0) );
179 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEY
, sal_Int32(0) );
180 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_MODE
, drawing::BitmapMode_REPEAT
);
183 }//end anonymous namespace
185 void FillProperties::AddPropertiesToVector(
186 std::vector
< Property
> & rOutProperties
)
188 // Fill Properties see service drawing::FillProperties
189 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties
);
190 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties
);
193 void FillProperties::AddDefaultsToMap(
194 ::chart::tPropertyValueMap
& rOutMap
)
196 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap
);
197 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap
);
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */