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 #ifndef CHART_STOCKCHARTTYPETEMPLATE_HXX
24 #define CHART_STOCKCHARTTYPETEMPLATE_HXX
25 
26 #include "ChartTypeTemplate.hxx"
27 #include "OPropertySet.hxx"
28 #include "MutexContainer.hxx"
29 #include <comphelper/uno3.hxx>
30 
31 namespace chart
32 {
33 
34 class StockChartTypeTemplate :
35         public MutexContainer,
36         public ChartTypeTemplate,
37         public ::property::OPropertySet
38 {
39 public:
40     enum StockVariant
41     {
42         LOW_HI_CLOSE,
43         OPEN_LOW_HI_CLOSE,
44         VOL_LOW_HI_CLOSE,
45         VOL_OPEN_LOW_HI_CLOSE
46     };
47 
48     /** CTOR
49 
50         @param bJapaneseStyle
51             If true, the candlesticks are drawn as solid white or black boxes
52             depending on rising or falling stock-values.  Otherwise the
53             open-value will be drawn as a small line at the left side of a
54             straight vertical line, and the close-value on the right hand side.
55      */
56     explicit StockChartTypeTemplate(
57         ::com::sun::star::uno::Reference<
58             ::com::sun::star::uno::XComponentContext > const & xContext,
59         const ::rtl::OUString & rServiceName,
60         StockVariant eVariant,
61         bool bJapaneseStyle );
62     virtual ~StockChartTypeTemplate();
63 
64     /// XServiceInfo declarations
65     APPHELPER_XSERVICEINFO_DECL()
66 
67     /// merge XInterface implementations
68  	DECLARE_XINTERFACE()
69     /// merge XTypeProvider implementations
70  	DECLARE_XTYPEPROVIDER()
71 
72 protected:
73     // ____ OPropertySet ____
74     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
75         throw(::com::sun::star::beans::UnknownPropertyException);
76     virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
77 
78     // ____ XPropertySet ____
79     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
80         getPropertySetInfo()
81         throw (::com::sun::star::uno::RuntimeException);
82 
83     // ____ XChartTypeTemplate ____
84     virtual sal_Bool SAL_CALL matchesTemplate(
85         const ::com::sun::star::uno::Reference<
86             ::com::sun::star::chart2::XDiagram >& xDiagram,
87         sal_Bool bAdaptProperties )
88         throw (::com::sun::star::uno::RuntimeException);
89     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > SAL_CALL
90         getChartTypeForNewSeries( const ::com::sun::star::uno::Sequence<
91             ::com::sun::star::uno::Reference<
92                 ::com::sun::star::chart2::XChartType > >& aFormerlyUsedChartTypes )
93         throw (::com::sun::star::uno::RuntimeException);
94     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataInterpreter > SAL_CALL getDataInterpreter()
95         throw (::com::sun::star::uno::RuntimeException);
96     virtual void SAL_CALL applyStyle(
97         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries,
98         ::sal_Int32 nChartTypeIndex,
99         ::sal_Int32 nSeriesIndex,
100         ::sal_Int32 nSeriesCount )
101         throw (::com::sun::star::uno::RuntimeException);
102     virtual void SAL_CALL resetStyles(
103         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram )
104         throw (::com::sun::star::uno::RuntimeException);
105 
106     // ChartTypeTemplate
107     virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension );
108 
109     // ____ ChartTypeTemplate ____
110     virtual void createChartTypes(
111             const ::com::sun::star::uno::Sequence<
112                  ::com::sun::star::uno::Sequence<
113                     ::com::sun::star::uno::Reference<
114                         ::com::sun::star::chart2::XDataSeries > > >& aSeriesSeq,
115             const ::com::sun::star::uno::Sequence<
116                 ::com::sun::star::uno::Reference<
117                     ::com::sun::star::chart2::XCoordinateSystem > > & rCoordSys,
118             const ::com::sun::star::uno::Sequence<
119                   ::com::sun::star::uno::Reference<
120                       ::com::sun::star::chart2::XChartType > > & aOldChartTypesSeq
121             );
122 
123     virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >
124                 getChartTypeForIndex( sal_Int32 nChartTypeIndex );
125 
126 private:
127     // todo: deprecate this variable
128     StockVariant  m_eStockVariant;
129 };
130 
131 } //  namespace chart
132 
133 // CHART_STOCKCHARTTYPETEMPLATE_HXX
134 #endif
135