1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FillProperties.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "FillProperties.hxx"
35 #include <com/sun/star/beans/PropertyAttribute.hpp>
36 #include <com/sun/star/drawing/BitmapMode.hpp>
37 #include <com/sun/star/drawing/FillStyle.hpp>
38 #include <com/sun/star/drawing/RectanglePoint.hpp>
40 using namespace ::com::sun::star
;
42 using ::com::sun::star::beans::Property
;
50 void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector
< ::com::sun::star::beans::Property
> & rOutProperties
)
52 rOutProperties
.push_back(
53 Property( C2U( "FillStyle" ),
54 FillProperties::PROP_FILL_STYLE
,
55 ::getCppuType( reinterpret_cast< const drawing::FillStyle
* >(0)),
56 beans::PropertyAttribute::BOUND
57 | beans::PropertyAttribute::MAYBEDEFAULT
));
59 rOutProperties
.push_back(
60 Property( C2U( "FillColor" ),
61 FillProperties::PROP_FILL_COLOR
,
62 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
63 beans::PropertyAttribute::BOUND
64 | beans::PropertyAttribute::MAYBEVOID
// "maybe auto"
65 | beans::PropertyAttribute::MAYBEDEFAULT
));
67 rOutProperties
.push_back(
68 Property( C2U( "FillTransparence" ),
69 FillProperties::PROP_FILL_TRANSPARENCE
,
70 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
71 beans::PropertyAttribute::BOUND
72 | beans::PropertyAttribute::MAYBEDEFAULT
));
74 rOutProperties
.push_back(
75 Property( C2U( "FillTransparenceGradientName" ),
76 FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME
,
77 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
78 beans::PropertyAttribute::BOUND
79 | beans::PropertyAttribute::MAYBEVOID
80 | beans::PropertyAttribute::MAYBEDEFAULT
));
83 // rOutProperties.push_back(
84 // Property( C2U( "FillTransparenceGradient" ),
85 // FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT,
86 // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
87 // beans::PropertyAttribute::BOUND
88 // | beans::PropertyAttribute::MAYBEDEFAULT
89 // | beans::PropertyAttribute::MAYBEVOID ));
91 rOutProperties
.push_back(
92 Property( C2U( "FillGradientName" ),
93 FillProperties::PROP_FILL_GRADIENT_NAME
,
94 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
95 beans::PropertyAttribute::BOUND
96 | beans::PropertyAttribute::MAYBEVOID
97 | beans::PropertyAttribute::MAYBEDEFAULT
));
99 rOutProperties
.push_back(
100 beans::Property( C2U( "FillGradientStepCount" ),
101 FillProperties::PROP_FILL_GRADIENT_STEPCOUNT
,
102 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
103 beans::PropertyAttribute::BOUND
104 | beans::PropertyAttribute::MAYBEVOID
));
107 // rOutProperties.push_back(
108 // Property( C2U( "FillGradient" ),
109 // FillProperties::PROP_FILL_GRADIENT,
110 // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
111 // beans::PropertyAttribute::BOUND
112 // | beans::PropertyAttribute::MAYBEDEFAULT
113 // | beans::PropertyAttribute::MAYBEVOID ));
115 rOutProperties
.push_back(
116 Property( C2U( "FillHatchName" ),
117 FillProperties::PROP_FILL_HATCH_NAME
,
118 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
119 beans::PropertyAttribute::BOUND
120 | beans::PropertyAttribute::MAYBEVOID
121 | beans::PropertyAttribute::MAYBEDEFAULT
));
124 // rOutProperties.push_back(
125 // Property( C2U( "FillHatch" ),
126 // FillProperties::PROP_FILL_HATCH,
127 // ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
128 // beans::PropertyAttribute::BOUND
129 // | beans::PropertyAttribute::MAYBEDEFAULT
130 // | beans::PropertyAttribute::MAYBEVOID ));
132 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
134 rOutProperties
.push_back(
135 Property( C2U( "FillBackground" ),
136 FillProperties::PROP_FILL_BACKGROUND
,
137 ::getCppuType( reinterpret_cast< const sal_Bool
* >(0)),
138 beans::PropertyAttribute::BOUND
139 | beans::PropertyAttribute::MAYBEDEFAULT
));
143 void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector
< ::com::sun::star::beans::Property
> & rOutProperties
)
145 rOutProperties
.push_back(
146 Property( C2U( "FillBitmapName" ),
147 FillProperties::PROP_FILL_BITMAP_NAME
,
148 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
149 beans::PropertyAttribute::BOUND
150 | beans::PropertyAttribute::MAYBEVOID
151 | beans::PropertyAttribute::MAYBEDEFAULT
));
154 // rOutProperties.push_back(
155 // Property( C2U( "FillBitmap" ),
156 // FillProperties::PROP_FILL_BITMAP,
157 // ::getCppuType( reinterpret_cast< const uno::Reference< awt::XBitmap > * >(0)),
158 // beans::PropertyAttribute::BOUND
159 // | beans::PropertyAttribute::MAYBEDEFAULT ));
162 // rOutProperties.push_back(
163 // Property( C2U( "FillBitmapURL" ),
164 // FillProperties::PROP_FILL_BITMAP_URL,
165 // ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
166 // beans::PropertyAttribute::BOUND
167 // | beans::PropertyAttribute::MAYBEDEFAULT ));
169 rOutProperties
.push_back(
170 Property( C2U( "FillBitmapOffsetX" ),
171 FillProperties::PROP_FILL_BITMAP_OFFSETX
,
172 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
173 beans::PropertyAttribute::BOUND
174 | beans::PropertyAttribute::MAYBEDEFAULT
));
176 rOutProperties
.push_back(
177 Property( C2U( "FillBitmapOffsetY" ),
178 FillProperties::PROP_FILL_BITMAP_OFFSETY
,
179 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
180 beans::PropertyAttribute::BOUND
181 | beans::PropertyAttribute::MAYBEDEFAULT
));
183 rOutProperties
.push_back(
184 Property( C2U( "FillBitmapPositionOffsetX" ),
185 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
,
186 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
187 beans::PropertyAttribute::BOUND
188 | beans::PropertyAttribute::MAYBEDEFAULT
));
190 rOutProperties
.push_back(
191 Property( C2U( "FillBitmapPositionOffsetY" ),
192 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
,
193 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
194 beans::PropertyAttribute::BOUND
195 | beans::PropertyAttribute::MAYBEDEFAULT
));
198 rOutProperties
.push_back(
199 Property( C2U( "FillBitmapRectanglePoint" ),
200 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
,
201 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint
* >(0)),
202 beans::PropertyAttribute::BOUND
203 | beans::PropertyAttribute::MAYBEDEFAULT
));
205 rOutProperties
.push_back(
206 Property( C2U( "FillBitmapLogicalSize" ),
207 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
,
208 ::getCppuType( reinterpret_cast< const sal_Bool
* >(0)),
209 beans::PropertyAttribute::BOUND
210 | beans::PropertyAttribute::MAYBEDEFAULT
));
212 rOutProperties
.push_back(
213 Property( C2U( "FillBitmapSizeX" ),
214 FillProperties::PROP_FILL_BITMAP_SIZEX
,
215 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
216 beans::PropertyAttribute::BOUND
217 | beans::PropertyAttribute::MAYBEDEFAULT
));
219 rOutProperties
.push_back(
220 Property( C2U( "FillBitmapSizeY" ),
221 FillProperties::PROP_FILL_BITMAP_SIZEY
,
222 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
223 beans::PropertyAttribute::BOUND
224 | beans::PropertyAttribute::MAYBEDEFAULT
));
226 rOutProperties
.push_back(
227 Property( C2U( "FillBitmapMode" ),
228 FillProperties::PROP_FILL_BITMAP_MODE
,
229 ::getCppuType( reinterpret_cast< const drawing::BitmapMode
* >(0)),
230 beans::PropertyAttribute::BOUND
231 | beans::PropertyAttribute::MAYBEDEFAULT
));
235 void lcl_AddDefaultsToMap_without_BitmapProperties(
236 ::chart::tPropertyValueMap
& rOutMap
)
238 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_STYLE
, drawing::FillStyle_SOLID
);
239 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_COLOR
, 0xd9d9d9 ); // gray85
240 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_TRANSPARENCE
, 0 );
241 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BACKGROUND
, false );
244 void lcl_AddDefaultsToMap_only_BitmapProperties(
245 ::chart::tPropertyValueMap
& rOutMap
)
247 uno::Any aSalInt16Zero
= uno::makeAny( sal_Int16( 0 ));
248 uno::Any aSalInt32SizeDefault
= uno::makeAny( sal_Int32( 0 ));
250 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETX
, 0 );
251 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETY
, 0 );
252 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
, 0 );
253 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
, 0 );
255 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
, drawing::RectanglePoint_MIDDLE_MIDDLE
);
256 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
, true );
257 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEX
, 0 );
258 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEY
, 0 );
259 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_MODE
, drawing::BitmapMode_REPEAT
);
262 }//end anonymous namespace
264 void FillProperties::AddPropertiesToVector(
265 ::std::vector
< Property
> & rOutProperties
)
267 // Fill Properties see service drawing::FillProperties
269 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties
);
270 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties
);
273 void FillProperties::AddDefaultsToMap(
274 ::chart::tPropertyValueMap
& rOutMap
)
276 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap
);
277 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap
);