1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19*cde9e8dcSAndrew Rist  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "DataSeriesProperties.hxx"
27cdf0e10cSrcweir #include "DataPointProperties.hxx"
28cdf0e10cSrcweir #include "DataPoint.hxx"
29cdf0e10cSrcweir #include "macros.hxx"
30cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
31cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
32cdf0e10cSrcweir #include <com/sun/star/chart2/StackingDirection.hpp>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <algorithm>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace ::com::sun::star;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir using ::rtl::OUString;
39cdf0e10cSrcweir using ::com::sun::star::beans::Property;
40cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace chart
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 
AddPropertiesToVector(::std::vector<Property> & rOutProperties)45cdf0e10cSrcweir void DataSeriesProperties::AddPropertiesToVector(
46cdf0e10cSrcweir     ::std::vector< Property > & rOutProperties )
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     rOutProperties.push_back(
49cdf0e10cSrcweir         Property( C2U( "AttributedDataPoints" ),
50cdf0e10cSrcweir                   PROP_DATASERIES_ATTRIBUTED_DATA_POINTS,
51cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const uno::Sequence< sal_Int32 > * >(0)),
52cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
53cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     rOutProperties.push_back(
56cdf0e10cSrcweir         Property( C2U( "StackingDirection" ),
57cdf0e10cSrcweir                   PROP_DATASERIES_STACKING_DIRECTION,
58cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const chart2::StackingDirection * >(0)),
59cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
60cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     rOutProperties.push_back(
63cdf0e10cSrcweir         Property( C2U( "VaryColorsByPoint" ),
64cdf0e10cSrcweir                   PROP_DATASERIES_VARY_COLORS_BY_POINT,
65cdf0e10cSrcweir                   ::getBooleanCppuType(),
66cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
67cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     rOutProperties.push_back(
70cdf0e10cSrcweir         Property( C2U( "AttachedAxisIndex" ),
71cdf0e10cSrcweir                   PROP_DATASERIES_ATTACHED_AXIS_INDEX,
72cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
73cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
74cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID
75cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     // add properties of service DataPointProperties
78cdf0e10cSrcweir     DataPointProperties::AddPropertiesToVector( rOutProperties );
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
AddDefaultsToMap(tPropertyValueMap & rOutMap)81cdf0e10cSrcweir void DataSeriesProperties::AddDefaultsToMap(
82cdf0e10cSrcweir     tPropertyValueMap & rOutMap )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_STACKING_DIRECTION, chart2::StackingDirection_NO_STACKING );
85cdf0e10cSrcweir     PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATASERIES_VARY_COLORS_BY_POINT, false );
86cdf0e10cSrcweir     PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DATASERIES_ATTACHED_AXIS_INDEX, 0 );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     // PROP_DATASERIES_ATTRIBUTED_DATA_POINTS has no default
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     // add properties of service DataPointProperties
91cdf0e10cSrcweir      DataPointProperties::AddDefaultsToMap( rOutMap );
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir }  // namespace chart
95