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 #ifndef _CHART2_AREACHART_HXX
25 #define _CHART2_AREACHART_HXX
26 
27 #include "VSeriesPlotter.hxx"
28 #include <com/sun/star/chart2/CurveStyle.hpp>
29 
30 //.............................................................................
31 namespace chart
32 {
33 //.............................................................................
34 class AreaPositionHelper;
35 
36 class AreaChart : public VSeriesPlotter
37 {
38 	//-------------------------------------------------------------------------
39 	// public methods
40 	//-------------------------------------------------------------------------
41 public:
42 	AreaChart( const ::com::sun::star::uno::Reference<
43              ::com::sun::star::chart2::XChartType >& xChartTypeModel
44              , sal_Int32 nDimensionCount
45              , bool bCategoryXAxis, bool bNoArea=false
46              , PlottingPositionHelper* pPlottingPositionHelper=NULL //takes owner ship
47              , bool bConnectLastToFirstPoint=false
48              , bool bExpandIfValuesCloseToBorder=true
49              , sal_Int32 nKeepAspectRatio=-1 //0->no 1->yes other value->automatic
50              , const ::com::sun::star::drawing::Direction3D& rAspectRatio=::com::sun::star::drawing::Direction3D(1,1,1)//only taken into account if nKeepAspectRatio==1
51              );
52 	virtual ~AreaChart();
53 
54 	virtual void createShapes();
55     virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
56 
57     //-------------------
58     virtual ::com::sun::star::drawing::Direction3D  getPreferredDiagramAspectRatio() const;
59     virtual bool keepAspectRatio() const;
60 
61     //-------------------------------------------------------------------------
62 	// MinimumAndMaximumSupplier
63 	//-------------------------------------------------------------------------
64     virtual double getMaximumX();
65     virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
66     virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
67 
68     //-------------------------------------------------------------------------
69 
70     virtual LegendSymbolStyle getLegendSymbolStyle();
71     virtual ::com::sun::star::uno::Any getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex=-1/*-1 for series symbol*/ );
72 
73     //-------------------------------------------------------------------------
74     //-------------------------------------------------------------------------
75     //-------------------------------------------------------------------------
76 private: //methods
77 	//no default constructor
78 	AreaChart();
79 
80     void impl_createSeriesShapes();
81     bool impl_createArea( VDataSeries* pSeries
82                 , ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
83                 , ::com::sun::star::drawing::PolyPolygonShape3D* pPreviousSeriesPoly
84                 , PlottingPositionHelper* pPosHelper );
85     bool impl_createLine( VDataSeries* pSeries
86                 , ::com::sun::star::drawing::PolyPolygonShape3D* pSeriesPoly
87                 , PlottingPositionHelper* pPosHelper );
88 
89 private: //member
90     PlottingPositionHelper*             m_pMainPosHelper;
91 
92 	bool								m_bArea;//false -> line or symbol only
93 	bool								m_bLine;
94 	bool								m_bSymbol;
95     bool                                m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different)
96     bool								m_bConnectLastToFirstPoint;//used e.g. for net chart
97     bool                                m_bExpandIfValuesCloseToBorder; // e.g. false for net charts
98 
99     sal_Int32                           m_nKeepAspectRatio; //0->no 1->yes other value->automatic
100     ::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1
101 
102     //Properties for splines:
103     ::com::sun::star::chart2::CurveStyle    m_eCurveStyle;
104     sal_Int32                                       m_nCurveResolution;
105     sal_Int32                                       m_nSplineOrder;
106 
107     ::com::sun::star::uno::Reference<
108                     ::com::sun::star::drawing::XShapes > m_xSeriesTarget;
109     ::com::sun::star::uno::Reference<
110                     ::com::sun::star::drawing::XShapes > m_xErrorBarTarget;
111     ::com::sun::star::uno::Reference<
112                     ::com::sun::star::drawing::XShapes > m_xTextTarget;
113     ::com::sun::star::uno::Reference<
114                     ::com::sun::star::drawing::XShapes > m_xRegressionCurveEquationTarget;
115 };
116 //.............................................................................
117 } //namespace chart
118 //.............................................................................
119 #endif
120