1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 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> 36 37 using namespace ::com::sun::star; 38 39 using ::com::sun::star::beans::Property; 40 41 namespace chart 42 { 43 44 namespace 45 { 46 47 void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ) 48 { 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 )); 55 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 )); 63 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 )); 70 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 )); 78 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 )); 87 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 )); 95 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 )); 102 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 )); 111 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 )); 119 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 )); 128 129 //bitmap properties see lcl_AddPropertiesToVector_only_BitmapProperties() 130 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 )); 137 } 138 139 void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ) 140 { 141 rOutProperties.push_back( 142 Property( C2U( "FillBitmapName" ), 143 FillProperties::PROP_FILL_BITMAP_NAME, 144 ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)), 145 beans::PropertyAttribute::BOUND 146 | beans::PropertyAttribute::MAYBEVOID 147 | beans::PropertyAttribute::MAYBEDEFAULT )); 148 149 //optional 150 // rOutProperties.push_back( 151 // Property( C2U( "FillBitmap" ), 152 // FillProperties::PROP_FILL_BITMAP, 153 // ::getCppuType( reinterpret_cast< const uno::Reference< awt::XBitmap > * >(0)), 154 // beans::PropertyAttribute::BOUND 155 // | beans::PropertyAttribute::MAYBEDEFAULT )); 156 157 //optional 158 // rOutProperties.push_back( 159 // Property( C2U( "FillBitmapURL" ), 160 // FillProperties::PROP_FILL_BITMAP_URL, 161 // ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)), 162 // beans::PropertyAttribute::BOUND 163 // | beans::PropertyAttribute::MAYBEDEFAULT )); 164 165 rOutProperties.push_back( 166 Property( C2U( "FillBitmapOffsetX" ), 167 FillProperties::PROP_FILL_BITMAP_OFFSETX, 168 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), 169 beans::PropertyAttribute::BOUND 170 | beans::PropertyAttribute::MAYBEDEFAULT )); 171 172 rOutProperties.push_back( 173 Property( C2U( "FillBitmapOffsetY" ), 174 FillProperties::PROP_FILL_BITMAP_OFFSETY, 175 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), 176 beans::PropertyAttribute::BOUND 177 | beans::PropertyAttribute::MAYBEDEFAULT )); 178 179 rOutProperties.push_back( 180 Property( C2U( "FillBitmapPositionOffsetX" ), 181 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 182 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), 183 beans::PropertyAttribute::BOUND 184 | beans::PropertyAttribute::MAYBEDEFAULT )); 185 186 rOutProperties.push_back( 187 Property( C2U( "FillBitmapPositionOffsetY" ), 188 FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 189 ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), 190 beans::PropertyAttribute::BOUND 191 | beans::PropertyAttribute::MAYBEDEFAULT )); 192 193 194 rOutProperties.push_back( 195 Property( C2U( "FillBitmapRectanglePoint" ), 196 FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, 197 ::getCppuType( reinterpret_cast< const drawing::RectanglePoint * >(0)), 198 beans::PropertyAttribute::BOUND 199 | beans::PropertyAttribute::MAYBEDEFAULT )); 200 201 rOutProperties.push_back( 202 Property( C2U( "FillBitmapLogicalSize" ), 203 FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, 204 ::getCppuType( reinterpret_cast< const sal_Bool * >(0)), 205 beans::PropertyAttribute::BOUND 206 | beans::PropertyAttribute::MAYBEDEFAULT )); 207 208 rOutProperties.push_back( 209 Property( C2U( "FillBitmapSizeX" ), 210 FillProperties::PROP_FILL_BITMAP_SIZEX, 211 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 212 beans::PropertyAttribute::BOUND 213 | beans::PropertyAttribute::MAYBEDEFAULT )); 214 215 rOutProperties.push_back( 216 Property( C2U( "FillBitmapSizeY" ), 217 FillProperties::PROP_FILL_BITMAP_SIZEY, 218 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 219 beans::PropertyAttribute::BOUND 220 | beans::PropertyAttribute::MAYBEDEFAULT )); 221 222 rOutProperties.push_back( 223 Property( C2U( "FillBitmapMode" ), 224 FillProperties::PROP_FILL_BITMAP_MODE, 225 ::getCppuType( reinterpret_cast< const drawing::BitmapMode * >(0)), 226 beans::PropertyAttribute::BOUND 227 | beans::PropertyAttribute::MAYBEDEFAULT )); 228 } 229 230 231 void lcl_AddDefaultsToMap_without_BitmapProperties( 232 ::chart::tPropertyValueMap & rOutMap ) 233 { 234 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_STYLE, drawing::FillStyle_SOLID ); 235 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_COLOR, 0xd9d9d9 ); // gray85 236 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_TRANSPARENCE, 0 ); 237 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BACKGROUND, false ); 238 } 239 240 void lcl_AddDefaultsToMap_only_BitmapProperties( 241 ::chart::tPropertyValueMap & rOutMap ) 242 { 243 uno::Any aSalInt16Zero = uno::makeAny( sal_Int16( 0 )); 244 uno::Any aSalInt32SizeDefault = uno::makeAny( sal_Int32( 0 )); 245 246 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 ); 247 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETY, 0 ); 248 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETX, 0 ); 249 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_POSITION_OFFSETY, 0 ); 250 251 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_RECTANGLEPOINT, drawing::RectanglePoint_MIDDLE_MIDDLE ); 252 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_LOGICALSIZE, true ); 253 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEX, 0 ); 254 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, FillProperties::PROP_FILL_BITMAP_SIZEY, 0 ); 255 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, FillProperties::PROP_FILL_BITMAP_MODE, drawing::BitmapMode_REPEAT ); 256 } 257 258 }//end anonymous namespace 259 260 void FillProperties::AddPropertiesToVector( 261 ::std::vector< Property > & rOutProperties ) 262 { 263 // Fill Properties see service drawing::FillProperties 264 // --------------- 265 lcl_AddPropertiesToVector_without_BitmapProperties( rOutProperties ); 266 lcl_AddPropertiesToVector_only_BitmapProperties( rOutProperties ); 267 } 268 269 void FillProperties::AddDefaultsToMap( 270 ::chart::tPropertyValueMap & rOutMap ) 271 { 272 lcl_AddDefaultsToMap_without_BitmapProperties( rOutMap ); 273 lcl_AddDefaultsToMap_only_BitmapProperties( rOutMap ); 274 } 275 276 } // namespace chart 277