1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*cde9e8dcSAndrew Rist * distributed with this work for additional information
6*cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the
17*cde9e8dcSAndrew Rist * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*cde9e8dcSAndrew Rist *************************************************************/
21*cde9e8dcSAndrew Rist
22*cde9e8dcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "FillProperties.hxx"
27cdf0e10cSrcweir #include "macros.hxx"
28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/BitmapMode.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/RectanglePoint.hpp>
32cdf0e10cSrcweir
33cdf0e10cSrcweir using namespace ::com::sun::star;
34cdf0e10cSrcweir
35cdf0e10cSrcweir using ::com::sun::star::beans::Property;
36cdf0e10cSrcweir
37cdf0e10cSrcweir namespace chart
38cdf0e10cSrcweir {
39cdf0e10cSrcweir
40cdf0e10cSrcweir namespace
41cdf0e10cSrcweir {
42cdf0e10cSrcweir
lcl_AddPropertiesToVector_without_BitmapProperties(::std::vector<::com::sun::star::beans::Property> & rOutProperties)43cdf0e10cSrcweir void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
44cdf0e10cSrcweir {
45cdf0e10cSrcweir rOutProperties.push_back(
46cdf0e10cSrcweir Property( C2U( "FillStyle" ),
47cdf0e10cSrcweir FillProperties::PROP_FILL_STYLE,
48cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const drawing::FillStyle * >(0)),
49cdf0e10cSrcweir beans::PropertyAttribute::BOUND
50cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
51cdf0e10cSrcweir
52cdf0e10cSrcweir rOutProperties.push_back(
53cdf0e10cSrcweir Property( C2U( "FillColor" ),
54cdf0e10cSrcweir FillProperties::PROP_FILL_COLOR,
55cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
56cdf0e10cSrcweir beans::PropertyAttribute::BOUND
57cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID // "maybe auto"
58cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
59cdf0e10cSrcweir
60cdf0e10cSrcweir rOutProperties.push_back(
61cdf0e10cSrcweir Property( C2U( "FillTransparence" ),
62cdf0e10cSrcweir FillProperties::PROP_FILL_TRANSPARENCE,
63cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
64cdf0e10cSrcweir beans::PropertyAttribute::BOUND
65cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
66cdf0e10cSrcweir
67cdf0e10cSrcweir rOutProperties.push_back(
68cdf0e10cSrcweir Property( C2U( "FillTransparenceGradientName" ),
69cdf0e10cSrcweir FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME,
70cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
71cdf0e10cSrcweir beans::PropertyAttribute::BOUND
72cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID
73cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
74cdf0e10cSrcweir
75cdf0e10cSrcweir //optional
76cdf0e10cSrcweir // rOutProperties.push_back(
77cdf0e10cSrcweir // Property( C2U( "FillTransparenceGradient" ),
78cdf0e10cSrcweir // FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT,
79cdf0e10cSrcweir // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
80cdf0e10cSrcweir // beans::PropertyAttribute::BOUND
81cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEDEFAULT
82cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEVOID ));
83cdf0e10cSrcweir
84cdf0e10cSrcweir rOutProperties.push_back(
85cdf0e10cSrcweir Property( C2U( "FillGradientName" ),
86cdf0e10cSrcweir FillProperties::PROP_FILL_GRADIENT_NAME,
87cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
88cdf0e10cSrcweir beans::PropertyAttribute::BOUND
89cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID
90cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
91cdf0e10cSrcweir
92cdf0e10cSrcweir rOutProperties.push_back(
93cdf0e10cSrcweir beans::Property( C2U( "FillGradientStepCount" ),
94cdf0e10cSrcweir FillProperties::PROP_FILL_GRADIENT_STEPCOUNT,
95cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
96cdf0e10cSrcweir beans::PropertyAttribute::BOUND
97cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID ));
98cdf0e10cSrcweir
99cdf0e10cSrcweir //optional
100cdf0e10cSrcweir // rOutProperties.push_back(
101cdf0e10cSrcweir // Property( C2U( "FillGradient" ),
102cdf0e10cSrcweir // FillProperties::PROP_FILL_GRADIENT,
103cdf0e10cSrcweir // ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
104cdf0e10cSrcweir // beans::PropertyAttribute::BOUND
105cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEDEFAULT
106cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEVOID ));
107cdf0e10cSrcweir
108cdf0e10cSrcweir rOutProperties.push_back(
109cdf0e10cSrcweir Property( C2U( "FillHatchName" ),
110cdf0e10cSrcweir FillProperties::PROP_FILL_HATCH_NAME,
111cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
112cdf0e10cSrcweir beans::PropertyAttribute::BOUND
113cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID
114cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
115cdf0e10cSrcweir
116cdf0e10cSrcweir //optional
117cdf0e10cSrcweir // rOutProperties.push_back(
118cdf0e10cSrcweir // Property( C2U( "FillHatch" ),
119cdf0e10cSrcweir // FillProperties::PROP_FILL_HATCH,
120cdf0e10cSrcweir // ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
121cdf0e10cSrcweir // beans::PropertyAttribute::BOUND
122cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEDEFAULT
123cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEVOID ));
124cdf0e10cSrcweir
125cdf0e10cSrcweir //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
126cdf0e10cSrcweir
127cdf0e10cSrcweir rOutProperties.push_back(
128cdf0e10cSrcweir Property( C2U( "FillBackground" ),
129cdf0e10cSrcweir FillProperties::PROP_FILL_BACKGROUND,
130cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
131cdf0e10cSrcweir beans::PropertyAttribute::BOUND
132cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
lcl_AddPropertiesToVector_only_BitmapProperties(::std::vector<::com::sun::star::beans::Property> & rOutProperties)135cdf0e10cSrcweir void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties )
136cdf0e10cSrcweir {
137cdf0e10cSrcweir rOutProperties.push_back(
138cdf0e10cSrcweir Property( C2U( "FillBitmapName" ),
139cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_NAME,
140cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
141cdf0e10cSrcweir beans::PropertyAttribute::BOUND
142cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID
143cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
144cdf0e10cSrcweir
145cdf0e10cSrcweir //optional
146cdf0e10cSrcweir // rOutProperties.push_back(
147cdf0e10cSrcweir // Property( C2U( "FillBitmap" ),
148cdf0e10cSrcweir // FillProperties::PROP_FILL_BITMAP,
149cdf0e10cSrcweir // ::getCppuType( reinterpret_cast< const uno::Reference< awt::XBitmap > * >(0)),
150cdf0e10cSrcweir // beans::PropertyAttribute::BOUND
151cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEDEFAULT ));
152cdf0e10cSrcweir
153cdf0e10cSrcweir //optional
154cdf0e10cSrcweir // rOutProperties.push_back(
155cdf0e10cSrcweir // Property( C2U( "FillBitmapURL" ),
156cdf0e10cSrcweir // FillProperties::PROP_FILL_BITMAP_URL,
157cdf0e10cSrcweir // ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
158cdf0e10cSrcweir // beans::PropertyAttribute::BOUND
159cdf0e10cSrcweir // | beans::PropertyAttribute::MAYBEDEFAULT ));
160cdf0e10cSrcweir
161cdf0e10cSrcweir rOutProperties.push_back(
162cdf0e10cSrcweir Property( C2U( "FillBitmapOffsetX" ),
163cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_OFFSETX,
164cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
165cdf0e10cSrcweir beans::PropertyAttribute::BOUND
166cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
167cdf0e10cSrcweir
168cdf0e10cSrcweir rOutProperties.push_back(
169cdf0e10cSrcweir Property( C2U( "FillBitmapOffsetY" ),
170cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_OFFSETY,
171cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
172cdf0e10cSrcweir beans::PropertyAttribute::BOUND
173cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
174cdf0e10cSrcweir
175cdf0e10cSrcweir rOutProperties.push_back(
176cdf0e10cSrcweir Property( C2U( "FillBitmapPositionOffsetX" ),
177cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX,
178cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
179cdf0e10cSrcweir beans::PropertyAttribute::BOUND
180cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
181cdf0e10cSrcweir
182cdf0e10cSrcweir rOutProperties.push_back(
183cdf0e10cSrcweir Property( C2U( "FillBitmapPositionOffsetY" ),
184cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY,
185cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)),
186cdf0e10cSrcweir beans::PropertyAttribute::BOUND
187cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
188cdf0e10cSrcweir
189cdf0e10cSrcweir
190cdf0e10cSrcweir rOutProperties.push_back(
191cdf0e10cSrcweir Property( C2U( "FillBitmapRectanglePoint" ),
192cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT,
193cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)),
194cdf0e10cSrcweir beans::PropertyAttribute::BOUND
195cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
196cdf0e10cSrcweir
197cdf0e10cSrcweir rOutProperties.push_back(
198cdf0e10cSrcweir Property( C2U( "FillBitmapLogicalSize" ),
199cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_LOGICALSIZE,
200cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Bool * >(0)),
201cdf0e10cSrcweir beans::PropertyAttribute::BOUND
202cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
203cdf0e10cSrcweir
204cdf0e10cSrcweir rOutProperties.push_back(
205cdf0e10cSrcweir Property( C2U( "FillBitmapSizeX" ),
206cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_SIZEX,
207cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
208cdf0e10cSrcweir beans::PropertyAttribute::BOUND
209cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
210cdf0e10cSrcweir
211cdf0e10cSrcweir rOutProperties.push_back(
212cdf0e10cSrcweir Property( C2U( "FillBitmapSizeY" ),
213cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_SIZEY,
214cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
215cdf0e10cSrcweir beans::PropertyAttribute::BOUND
216cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
217cdf0e10cSrcweir
218cdf0e10cSrcweir rOutProperties.push_back(
219cdf0e10cSrcweir Property( C2U( "FillBitmapMode" ),
220cdf0e10cSrcweir FillProperties::PROP_FILL_BITMAP_MODE,
221cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)),
222cdf0e10cSrcweir beans::PropertyAttribute::BOUND
223cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT ));
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir
lcl_AddDefaultsToMap_without_BitmapProperties(::chart::tPropertyValueMap & rOutMap)227cdf0e10cSrcweir void lcl_AddDefaultsToMap_without_BitmapProperties(
228cdf0e10cSrcweir ::chart::tPropertyValueMap & rOutMap )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID );
231cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85
232cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 );
233cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false );
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
lcl_AddDefaultsToMap_only_BitmapProperties(::chart::tPropertyValueMap & rOutMap)236cdf0e10cSrcweir void lcl_AddDefaultsToMap_only_BitmapProperties(
237cdf0e10cSrcweir ::chart::tPropertyValueMap & rOutMap )
238cdf0e10cSrcweir {
239cdf0e10cSrcweir uno::Any aSalInt16Zero = uno::makeAny( sal_Int16( 0 ));
240cdf0e10cSrcweir uno::Any aSalInt32SizeDefault = uno::makeAny( sal_Int32( 0 ));
241cdf0e10cSrcweir
242cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 );
243cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 );
244cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 );
245cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 );
246cdf0e10cSrcweir
247cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE );
248cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true );
249cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 );
250cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 );
251cdf0e10cSrcweir ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir }//end anonymous namespace
255cdf0e10cSrcweir
AddPropertiesToVector(::std::vector<Property> & rOutProperties)256cdf0e10cSrcweir void FillProperties::AddPropertiesToVector(
257cdf0e10cSrcweir ::std::vector< Property > & rOutProperties )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir // Fill Properties see service drawing::FillProperties
260cdf0e10cSrcweir // ---------------
261cdf0e10cSrcweir lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties );
262cdf0e10cSrcweir lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties );
263cdf0e10cSrcweir }
264cdf0e10cSrcweir
AddDefaultsToMap(::chart::tPropertyValueMap & rOutMap)265cdf0e10cSrcweir void FillProperties::AddDefaultsToMap(
266cdf0e10cSrcweir ::chart::tPropertyValueMap & rOutMap )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap );
269cdf0e10cSrcweir lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir } // namespace chart
273