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