1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26 
27 #include "NamedFillProperties.hxx"
28 #include "macros.hxx"
29 #include <com/sun/star/beans/PropertyAttribute.hpp>
30 #include <com/sun/star/awt/Gradient.hpp>
31 #include <com/sun/star/drawing/Hatch.hpp>
32 #include <com/sun/star/chart2/FillBitmap.hpp>
33 
34 using namespace ::com::sun::star;
35 
36 using ::com::sun::star::beans::Property;
37 using ::rtl::OUString;
38 
39 namespace chart
40 {
41 
AddPropertiesToVector(::std::vector<Property> & rOutProperties)42 void NamedFillProperties::AddPropertiesToVector(
43     ::std::vector< Property > & rOutProperties )
44 {
45     const uno::Type tCppuTypeString = ::getCppuType( reinterpret_cast< const OUString * >(0));
46 
47     // Fill Properties
48     // ---------------
49 
50     //optional property:
51     rOutProperties.push_back(
52         Property( C2U( "FillTransparenceGradient" ),
53                   PROP_FILL_TRANSPARENCE_GRADIENT,
54                   ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
55                   beans::PropertyAttribute::BOUND
56                   | beans::PropertyAttribute::MAYBEDEFAULT
57                   | beans::PropertyAttribute::MAYBEVOID ));
58 
59     //optional property:
60     rOutProperties.push_back(
61         Property( C2U( "FillGradient" ),
62                   PROP_FILL_GRADIENT,
63                   ::getCppuType( reinterpret_cast< const awt::Gradient * >(0)),
64                   beans::PropertyAttribute::BOUND
65                   | beans::PropertyAttribute::MAYBEDEFAULT
66                   | beans::PropertyAttribute::MAYBEVOID ));
67 
68     //optional property:
69     rOutProperties.push_back(
70         Property( C2U( "FillHatch" ),
71                   PROP_FILL_HATCH,
72                   ::getCppuType( reinterpret_cast< const drawing::Hatch * >(0)),
73                   beans::PropertyAttribute::BOUND
74                   | beans::PropertyAttribute::MAYBEDEFAULT
75                   | beans::PropertyAttribute::MAYBEVOID ));
76 
77     //optional property:
78     rOutProperties.push_back(
79         Property( C2U( "FillBitmapURL" ),
80                   PROP_FILL_BITMAP,
81                   ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
82                   beans::PropertyAttribute::BOUND
83                   | beans::PropertyAttribute::MAYBEDEFAULT
84                   | beans::PropertyAttribute::MAYBEVOID ));
85 }
86 
AddDefaultsToMap(::chart::tPropertyValueMap & rOutMap)87 void NamedFillProperties::AddDefaultsToMap(
88     ::chart::tPropertyValueMap & rOutMap )
89 {
90 }
91 
GetPropertyNameForHandle(sal_Int32 nHandle)92 OUString NamedFillProperties::GetPropertyNameForHandle( sal_Int32 nHandle )
93 {
94     //will return e.g. "FillGradientName" for PROP_FILL_GRADIENT_NAME
95     switch( nHandle )
96     {
97         case PROP_FILL_GRADIENT_NAME:
98             return C2U( "FillGradientName" );
99         case PROP_FILL_HATCH_NAME:
100             return C2U( "FillHatchName" );
101         case PROP_FILL_BITMAP_NAME:
102             return C2U( "FillBitmapName" );
103         case PROP_FILL_TRANSPARENCY_GRADIENT_NAME:
104             return C2U( "FillTransparenceGradientName" );
105     }
106     return OUString();
107 }
108 
109 } //  namespace chart
110