xref: /aoo4110/main/chart2/source/view/inc/VDiagram.hxx (revision b1cdbd2c)
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 _CHART2_VDIAGRAM_HXX
24 #define _CHART2_VDIAGRAM_HXX
25 
26 #include <com/sun/star/drawing/HomogenMatrix.hpp>
27 #include <com/sun/star/drawing/XShapes.hpp>
28 #include <com/sun/star/chart2/XDiagram.hpp>
29 #include "ShapeFactory.hxx"
30 #include <basegfx/range/b2irectangle.hxx>
31 
32 //.............................................................................
33 namespace chart
34 {
35 //.............................................................................
36 
37 class ShapeFactory;
38 
39 //-----------------------------------------------------------------------------
40 /** The VDiagram is responsible to generate the visible parts of the Diagram
41 that is wall, floor, axes and data series.
42 The axes and data series are subobjects which are created and managed by the
43 diagram.
44 */
45 
46 class VDiagram
47 {
48 public: //methods
49     VDiagram( const ::com::sun::star::uno::Reference<
50                   ::com::sun::star::chart2::XDiagram > & xDiagram
51                 , const ::com::sun::star::drawing::Direction3D& rPreferredAspectRatio
52                 , sal_Int32 nDimension=3, sal_Bool bPolar=sal_False );
53     virtual ~VDiagram();
54 
55     void init( const ::com::sun::star::uno::Reference<
56                      ::com::sun::star::drawing::XShapes >& xLogicTarget
57 			 , const ::com::sun::star::uno::Reference<
58                      ::com::sun::star::drawing::XShapes >& xFinalTarget
59              , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory);
60 
61     void    createShapes( const ::com::sun::star::awt::Point& rPos
62                         , const ::com::sun::star::awt::Size& rSize );
63 
64     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
65             getCoordinateRegion();
66 
67     ::basegfx::B2IRectangle    getCurrentRectangle();
68 
69     void    reduceToMimimumSize();
70 
71     ::basegfx::B2IRectangle    adjustPosAndSize( const ::com::sun::star::awt::Point& rPos
72                                     , const ::com::sun::star::awt::Size& rAvailableSize );
73 
74     ::basegfx::B2IRectangle    adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect );
75 
76     //    updateShapes(..);
77     // const awt::Point& rPos, const awt::Size& rSize );
78 
79 private: //methods
80     void    createShapes_2d();
81     void    createShapes_3d();
82 
83     ::basegfx::B2IRectangle    adjustPosAndSize_2d( const ::com::sun::star::awt::Point& rPos
84                         , const ::com::sun::star::awt::Size& rAvailableSize );
85     ::basegfx::B2IRectangle    adjustPosAndSize_3d( const ::com::sun::star::awt::Point& rPos
86                         , const ::com::sun::star::awt::Size& rAvailableSize );
87 
88     void    adjustAspectRatio3d( const ::com::sun::star::awt::Size& rAvailableSize );
89 
90 private: //members
91     VDiagram(const VDiagram& rD);
92 
93     ::com::sun::star::uno::Reference<
94                     ::com::sun::star::drawing::XShapes >                    m_xLogicTarget;
95     ::com::sun::star::uno::Reference<
96                     ::com::sun::star::drawing::XShapes >                    m_xFinalTarget;
97     ::com::sun::star::uno::Reference<
98                     ::com::sun::star::lang::XMultiServiceFactory>	        m_xShapeFactory;
99     ShapeFactory*                                                           m_pShapeFactory;
100 
101     // this is the surrounding shape which contains floor, wall and coordinate
102     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xOuterGroupShape;
103     // this is an additional inner shape that represents the coordinate region -  that is - where to place data points
104     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xCoordinateRegionShape;
105     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xWall2D;
106 
107     sal_Int32                                                               m_nDimensionCount;
108     sal_Bool                                                                m_bPolar;
109     ::com::sun::star::uno::Reference<
110         ::com::sun::star::chart2::XDiagram >                                m_xDiagram;
111 
112     ::com::sun::star::drawing::Direction3D                                  m_aPreferredAspectRatio;
113     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAspectRatio3D;
114 
115     double m_fXAnglePi;
116     double m_fYAnglePi;
117     double m_fZAnglePi;
118     sal_Bool m_bRightAngledAxes;
119 
120     ::com::sun::star::awt::Point    m_aAvailablePosIncludingAxes;
121     ::com::sun::star::awt::Size     m_aAvailableSizeIncludingAxes;
122 
123     ::com::sun::star::awt::Point    m_aCurrentPosWithoutAxes;
124     ::com::sun::star::awt::Size     m_aCurrentSizeWithoutAxes;
125 };
126 
127 //.............................................................................
128 } //namespace chart
129 //.............................................................................
130 #endif
131 
132 
133