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 
31 #include "NamedFillProperties.hxx"
32 #include "macros.hxx"
33 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <com/sun/star/awt/Gradient.hpp>
35 #include <com/sun/star/drawing/Hatch.hpp>
36 #include <com/sun/star/chart2/FillBitmap.hpp>
37 
38 using namespace ::com::sun::star;
39 
40 using ::com::sun::star::beans::Property;
41 using ::rtl::OUString;
42 
43 namespace chart
44 {
45 
46 void NamedFillProperties::AddPropertiesToVector(
47     ::std::vector< Property > & rOutProperties )
48 {
49     const uno::Type tCppuTypeString = ::getCppuType( reinterpret_cast< const OUString * >(0));
50 
51     // Fill Properties
52     // ---------------
53 
54     //optional property:
55     rOutProperties.push_back(
56         Property( C2U( "FillTransparenceGradient" ),
57                   PROP_FILL_TRANSPARENCE_GRADIENT,
58                   ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
59                   beans::PropertyAttribute::BOUND
60                   | beans::PropertyAttribute::MAYBEDEFAULT
61                   | beans::PropertyAttribute::MAYBEVOID ));
62 
63     //optional property:
64     rOutProperties.push_back(
65         Property( C2U( "FillGradient" ),
66                   PROP_FILL_GRADIENT,
67                   ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
68                   beans::PropertyAttribute::BOUND
69                   | beans::PropertyAttribute::MAYBEDEFAULT
70                   | beans::PropertyAttribute::MAYBEVOID ));
71 
72     //optional property:
73     rOutProperties.push_back(
74         Property( C2U( "FillHatch" ),
75                   PROP_FILL_HATCH,
76                   ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
77                   beans::PropertyAttribute::BOUND
78                   | beans::PropertyAttribute::MAYBEDEFAULT
79                   | beans::PropertyAttribute::MAYBEVOID ));
80 
81     //optional property:
82     rOutProperties.push_back(
83         Property( C2U( "FillBitmapURL" ),
84                   PROP_FILL_BITMAP,
85                   ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
86                   beans::PropertyAttribute::BOUND
87                   | beans::PropertyAttribute::MAYBEDEFAULT
88                   | beans::PropertyAttribute::MAYBEVOID ));
89 }
90 
91 void NamedFillProperties::AddDefaultsToMap(
92     ::chart::tPropertyValueMap & rOutMap )
93 {
94 }
95 
96 OUString NamedFillProperties::GetPropertyNameForHandle( sal_Int32 nHandle )
97 {
98     //will return e.g. "FillGradientName" for PROP_FILL_GRADIENT_NAME
99     switch( nHandle )
100     {
101         case PROP_FILL_GRADIENT_NAME:
102             return C2U( "FillGradientName" );
103         case PROP_FILL_HATCH_NAME:
104             return C2U( "FillHatchName" );
105         case PROP_FILL_BITMAP_NAME:
106             return C2U( "FillBitmapName" );
107         case PROP_FILL_TRANSPARENCY_GRADIENT_NAME:
108             return C2U( "FillTransparenceGradientName" );
109     }
110     return OUString();
111 }
112 
113 } //  namespace chart
114