1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "FillProperties.hxx"
31 #include <com/sun/star/beans/PropertyAttribute.hpp>
32 #include <com/sun/star/drawing/BitmapMode.hpp>
33 #include <com/sun/star/drawing/FillStyle.hpp>
34 #include <com/sun/star/drawing/RectanglePoint.hpp>
36 using namespace ::com::sun::star
;
38 using ::com::sun::star::beans::Property
;
46 void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector
< ::com::sun::star::beans::Property
> & rOutProperties
)
48 rOutProperties
.push_back(
49 Property( C2U( "FillStyle" ),
50 FillProperties::PROP_FILL_STYLE
,
51 ::getCppuType( reinterpret_cast< const drawing::FillStyle
* >(0)),
52 beans::PropertyAttribute::BOUND
53 | beans::PropertyAttribute::MAYBEDEFAULT
));
55 rOutProperties
.push_back(
56 Property( C2U( "FillColor" ),
57 FillProperties::PROP_FILL_COLOR
,
58 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
59 beans::PropertyAttribute::BOUND
60 | beans::PropertyAttribute::MAYBEVOID
// "maybe auto"
61 | beans::PropertyAttribute::MAYBEDEFAULT
));
63 rOutProperties
.push_back(
64 Property( C2U( "FillTransparence" ),
65 FillProperties::PROP_FILL_TRANSPARENCE
,
66 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
67 beans::PropertyAttribute::BOUND
68 | beans::PropertyAttribute::MAYBEDEFAULT
));
70 rOutProperties
.push_back(
71 Property( C2U( "FillTransparenceGradientName" ),
72 FillProperties::PROP_FILL_TRANSPARENCE_GRADIENT_NAME
,
73 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
74 beans::PropertyAttribute::BOUND
75 | beans::PropertyAttribute::MAYBEVOID
76 | beans::PropertyAttribute::MAYBEDEFAULT
));
78 rOutProperties
.push_back(
79 Property( C2U( "FillGradientName" ),
80 FillProperties::PROP_FILL_GRADIENT_NAME
,
81 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
82 beans::PropertyAttribute::BOUND
83 | beans::PropertyAttribute::MAYBEVOID
84 | beans::PropertyAttribute::MAYBEDEFAULT
));
86 rOutProperties
.push_back(
87 beans::Property( C2U( "FillGradientStepCount" ),
88 FillProperties::PROP_FILL_GRADIENT_STEPCOUNT
,
89 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
90 beans::PropertyAttribute::BOUND
91 | beans::PropertyAttribute::MAYBEVOID
));
93 rOutProperties
.push_back(
94 Property( C2U( "FillHatchName" ),
95 FillProperties::PROP_FILL_HATCH_NAME
,
96 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
97 beans::PropertyAttribute::BOUND
98 | beans::PropertyAttribute::MAYBEVOID
99 | beans::PropertyAttribute::MAYBEDEFAULT
));
101 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties()
103 rOutProperties
.push_back(
104 Property( C2U( "FillBackground" ),
105 FillProperties::PROP_FILL_BACKGROUND
,
106 ::getCppuType( reinterpret_cast< const sal_Bool
* >(0)),
107 beans::PropertyAttribute::BOUND
108 | beans::PropertyAttribute::MAYBEDEFAULT
));
111 void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector
< ::com::sun::star::beans::Property
> & rOutProperties
)
113 rOutProperties
.push_back(
114 Property( C2U( "FillBitmapName" ),
115 FillProperties::PROP_FILL_BITMAP_NAME
,
116 ::getCppuType( reinterpret_cast< const ::rtl::OUString
* >(0)),
117 beans::PropertyAttribute::BOUND
118 | beans::PropertyAttribute::MAYBEVOID
119 | beans::PropertyAttribute::MAYBEDEFAULT
));
121 rOutProperties
.push_back(
122 Property( C2U( "FillBitmapOffsetX" ),
123 FillProperties::PROP_FILL_BITMAP_OFFSETX
,
124 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
125 beans::PropertyAttribute::BOUND
126 | beans::PropertyAttribute::MAYBEDEFAULT
));
128 rOutProperties
.push_back(
129 Property( C2U( "FillBitmapOffsetY" ),
130 FillProperties::PROP_FILL_BITMAP_OFFSETY
,
131 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
132 beans::PropertyAttribute::BOUND
133 | beans::PropertyAttribute::MAYBEDEFAULT
));
135 rOutProperties
.push_back(
136 Property( C2U( "FillBitmapPositionOffsetX" ),
137 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
,
138 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
139 beans::PropertyAttribute::BOUND
140 | beans::PropertyAttribute::MAYBEDEFAULT
));
142 rOutProperties
.push_back(
143 Property( C2U( "FillBitmapPositionOffsetY" ),
144 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
,
145 ::getCppuType( reinterpret_cast< const sal_Int16
* >(0)),
146 beans::PropertyAttribute::BOUND
147 | beans::PropertyAttribute::MAYBEDEFAULT
));
150 rOutProperties
.push_back(
151 Property( C2U( "FillBitmapRectanglePoint" ),
152 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
,
153 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint
* >(0)),
154 beans::PropertyAttribute::BOUND
155 | beans::PropertyAttribute::MAYBEDEFAULT
));
157 rOutProperties
.push_back(
158 Property( C2U( "FillBitmapLogicalSize" ),
159 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
,
160 ::getCppuType( reinterpret_cast< const sal_Bool
* >(0)),
161 beans::PropertyAttribute::BOUND
162 | beans::PropertyAttribute::MAYBEDEFAULT
));
164 rOutProperties
.push_back(
165 Property( C2U( "FillBitmapSizeX" ),
166 FillProperties::PROP_FILL_BITMAP_SIZEX
,
167 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
168 beans::PropertyAttribute::BOUND
169 | beans::PropertyAttribute::MAYBEDEFAULT
));
171 rOutProperties
.push_back(
172 Property( C2U( "FillBitmapSizeY" ),
173 FillProperties::PROP_FILL_BITMAP_SIZEY
,
174 ::getCppuType( reinterpret_cast< const sal_Int32
* >(0)),
175 beans::PropertyAttribute::BOUND
176 | beans::PropertyAttribute::MAYBEDEFAULT
));
178 rOutProperties
.push_back(
179 Property( C2U( "FillBitmapMode" ),
180 FillProperties::PROP_FILL_BITMAP_MODE
,
181 ::getCppuType( reinterpret_cast< const drawing::BitmapMode
* >(0)),
182 beans::PropertyAttribute::BOUND
183 | beans::PropertyAttribute::MAYBEDEFAULT
));
187 void lcl_AddDefaultsToMap_without_BitmapProperties(
188 ::chart::tPropertyValueMap
& rOutMap
)
190 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_STYLE
, drawing::FillStyle_SOLID
);
191 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_COLOR
, 0xd9d9d9 ); // gray85
192 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_TRANSPARENCE
, 0 );
193 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BACKGROUND
, false );
196 void lcl_AddDefaultsToMap_only_BitmapProperties(
197 ::chart::tPropertyValueMap
& rOutMap
)
199 uno::Any aSalInt16Zero
= uno::makeAny( sal_Int16( 0 ));
200 uno::Any aSalInt32SizeDefault
= uno::makeAny( sal_Int32( 0 ));
202 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETX
, 0 );
203 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_OFFSETY
, 0 );
204 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX
, 0 );
205 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int16
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY
, 0 );
207 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT
, drawing::RectanglePoint_MIDDLE_MIDDLE
);
208 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE
, true );
209 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEX
, 0 );
210 ::chart::PropertyHelper::setPropertyValueDefault
< sal_Int32
>( rOutMap
, FillProperties::PROP_FILL_BITMAP_SIZEY
, 0 );
211 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap
, FillProperties::PROP_FILL_BITMAP_MODE
, drawing::BitmapMode_REPEAT
);
214 }//end anonymous namespace
216 void FillProperties::AddPropertiesToVector(
217 ::std::vector
< Property
> & rOutProperties
)
219 // Fill Properties see service drawing::FillProperties
221 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties
);
222 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties
);
225 void FillProperties::AddDefaultsToMap(
226 ::chart::tPropertyValueMap
& rOutMap
)
228 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap
);
229 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap
);
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */