merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / tools / FillProperties.cxx
blobee23727c321bef9657b1996f51d83708a3080f83
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #include "FillProperties.hxx"
31 #include "macros.hxx"
32 #include <com/sun/star/beans/PropertyAttribute.hpp>
33 #include <com/sun/star/drawing/BitmapMode.hpp>
34 #include <com/sun/star/drawing/FillStyle.hpp>
35 #include <com/sun/star/drawing/RectanglePoint.hpp>
37 using namespace ::com::sun::star;
39 using ::com::sun::star::beans::Property;
41 namespace chart
44 namespace
47 void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
49 rOutProperties.push_back(
50 Property( C2U( "FillStyle" ),
51 FillProperties::PROP_FILL_STYLE,
52 ::getCppuType( reinterpret_cast< const drawing::FillStyle * >(0)),
53 beans::PropertyAttribute::BOUND
54 | beans::PropertyAttribute::MAYBEDEFAULT ));
56 rOutProperties.push_back(
57 Property( C2U( "FillColor" ),
58 FillProperties::PROP_FILL_COLOR,
59 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
60 beans::PropertyAttribute::BOUND
61 | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
62 | beans::PropertyAttribute::MAYBEDEFAULT ));
64 rOutProperties.push_back(
65 Property( C2U( "FillTransparence" ),
66 FillProperties::PROP_FILL_TRANSPARENCE,
67 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
68 beans::PropertyAttribute::BOUND
69 | beans::PropertyAttribute::MAYBEDEFAULT ));
71 rOutProperties.push_back(
72 Property( C2U( "FillTransparenceGradientName" ),
73 FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME,
74 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
75 beans::PropertyAttribute::BOUND
76 | beans::PropertyAttribute::MAYBEVOID
77 | beans::PropertyAttribute::MAYBEDEFAULT ));
79 //optional
80 // rOutProperties.push_back(
81 // Property( C2U( "FillTransparenceGradient" ),
82 // FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT,
83 // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
84 // beans::PropertyAttribute::BOUND
85 // | beans::PropertyAttribute::MAYBEDEFAULT
86 // | beans::PropertyAttribute::MAYBEVOID ));
88 rOutProperties.push_back(
89 Property( C2U( "FillGradientName" ),
90 FillProperties::PROP_FILL_GRADIENT_NAME,
91 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
92 beans::PropertyAttribute::BOUND
93 | beans::PropertyAttribute::MAYBEVOID
94 | beans::PropertyAttribute::MAYBEDEFAULT ));
96 rOutProperties.push_back(
97 beans::Property( C2U( "FillGradientStepCount" ),
98 FillProperties::PROP_FILL_GRADIENT_STEPCOUNT,
99 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
100 beans::PropertyAttribute::BOUND
101 | beans::PropertyAttribute::MAYBEVOID ));
103 //optional
104 // rOutProperties.push_back(
105 // Property( C2U( "FillGradient" ),
106 // FillProperties::PROP_FILL_GRADIENT,
107 // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
108 // beans::PropertyAttribute::BOUND
109 // | beans::PropertyAttribute::MAYBEDEFAULT
110 // | beans::PropertyAttribute::MAYBEVOID ));
112 rOutProperties.push_back(
113 Property( C2U( "FillHatchName" ),
114 FillProperties::PROP_FILL_HATCH_NAME,
115 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
116 beans::PropertyAttribute::BOUND
117 | beans::PropertyAttribute::MAYBEVOID
118 | beans::PropertyAttribute::MAYBEDEFAULT ));
120 //optional
121 // rOutProperties.push_back(
122 // Property( C2U( "FillHatch" ),
123 // FillProperties::PROP_FILL_HATCH,
124 // ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
125 // beans::PropertyAttribute::BOUND
126 // | beans::PropertyAttribute::MAYBEDEFAULT
127 // | beans::PropertyAttribute::MAYBEVOID ));
129 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
131 rOutProperties.push_back(
132 Property( C2U( "FillBackground" ),
133 FillProperties::PROP_FILL_BACKGROUND,
134 ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
135 beans::PropertyAttribute::BOUND
136 | beans::PropertyAttribute::MAYBEDEFAULT ));
139 //static
140 void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
142 rOutProperties.push_back(
143 Property( C2U( "FillBitmapName" ),
144 FillProperties::PROP_FILL_BITMAP_NAME,
145 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
146 beans::PropertyAttribute::BOUND
147 | beans::PropertyAttribute::MAYBEVOID
148 | beans::PropertyAttribute::MAYBEDEFAULT ));
150 //optional
151 // rOutProperties.push_back(
152 // Property( C2U( "FillBitmap" ),
153 // FillProperties::PROP_FILL_BITMAP,
154 // ::getCppuType( reinterpret_cast< const uno::Reference< awt::XBitmap > * >(0)),
155 // beans::PropertyAttribute::BOUND
156 // | beans::PropertyAttribute::MAYBEDEFAULT ));
158 //optional
159 // rOutProperties.push_back(
160 // Property( C2U( "FillBitmapURL" ),
161 // FillProperties::PROP_FILL_BITMAP_URL,
162 // ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
163 // beans::PropertyAttribute::BOUND
164 // | beans::PropertyAttribute::MAYBEDEFAULT ));
166 rOutProperties.push_back(
167 Property( C2U( "FillBitmapOffsetX" ),
168 FillProperties::PROP_FILL_BITMAP_OFFSETX,
169 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
170 beans::PropertyAttribute::BOUND
171 | beans::PropertyAttribute::MAYBEDEFAULT ));
173 rOutProperties.push_back(
174 Property( C2U( "FillBitmapOffsetY" ),
175 FillProperties::PROP_FILL_BITMAP_OFFSETY,
176 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
177 beans::PropertyAttribute::BOUND
178 | beans::PropertyAttribute::MAYBEDEFAULT ));
180 rOutProperties.push_back(
181 Property( C2U( "FillBitmapPositionOffsetX" ),
182 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
183 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
184 beans::PropertyAttribute::BOUND
185 | beans::PropertyAttribute::MAYBEDEFAULT ));
187 rOutProperties.push_back(
188 Property( C2U( "FillBitmapPositionOffsetY" ),
189 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
190 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
191 beans::PropertyAttribute::BOUND
192 | beans::PropertyAttribute::MAYBEDEFAULT ));
195 rOutProperties.push_back(
196 Property( C2U( "FillBitmapRectanglePoint" ),
197 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
198 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)),
199 beans::PropertyAttribute::BOUND
200 | beans::PropertyAttribute::MAYBEDEFAULT ));
202 rOutProperties.push_back(
203 Property( C2U( "FillBitmapLogicalSize" ),
204 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
205 ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
206 beans::PropertyAttribute::BOUND
207 | beans::PropertyAttribute::MAYBEDEFAULT ));
209 rOutProperties.push_back(
210 Property( C2U( "FillBitmapSizeX" ),
211 FillProperties::PROP_FILL_BITMAP_SIZEX,
212 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
213 beans::PropertyAttribute::BOUND
214 | beans::PropertyAttribute::MAYBEDEFAULT ));
216 rOutProperties.push_back(
217 Property( C2U( "FillBitmapSizeY" ),
218 FillProperties::PROP_FILL_BITMAP_SIZEY,
219 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
220 beans::PropertyAttribute::BOUND
221 | beans::PropertyAttribute::MAYBEDEFAULT ));
223 rOutProperties.push_back(
224 Property( C2U( "FillBitmapMode" ),
225 FillProperties::PROP_FILL_BITMAP_MODE,
226 ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)),
227 beans::PropertyAttribute::BOUND
228 | beans::PropertyAttribute::MAYBEDEFAULT ));
232 void lcl_AddDefaultsToMap_without_BitmapProperties(
233 ::chart::tPropertyValueMap & rOutMap )
235 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID );
236 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85
237 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 );
238 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false );
241 void lcl_AddDefaultsToMap_only_BitmapProperties(
242 ::chart::tPropertyValueMap & rOutMap )
244 uno::Any aSalInt16Zero = uno::makeAny( sal_Int16( 0 ));
245 uno::Any aSalInt32SizeDefault = uno::makeAny( sal_Int32( 0 ));
247 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
248 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
249 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
250 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
252 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
253 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
254 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
255 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
256 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
259 }//end anonymous namespace
261 void FillProperties::AddPropertiesToVector(
262 ::std::vector< Property > & rOutProperties )
264 // Fill Properties see service drawing::FillProperties
265 // ---------------
266 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties );
267 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties );
270 void FillProperties::AddDefaultsToMap(
271 ::chart::tPropertyValueMap & rOutMap )
273 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap );
274 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap );
277 } // namespace chart