xref: /aoo41x/main/chart2/source/view/inc/VDiagram.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CHART2_VDIAGRAM_HXX
28 #define _CHART2_VDIAGRAM_HXX
29 
30 #include <com/sun/star/drawing/HomogenMatrix.hpp>
31 #include <com/sun/star/drawing/XShapes.hpp>
32 #include <com/sun/star/chart2/XDiagram.hpp>
33 #include "ShapeFactory.hxx"
34 #include <basegfx/range/b2irectangle.hxx>
35 
36 //.............................................................................
37 namespace chart
38 {
39 //.............................................................................
40 
41 class ShapeFactory;
42 
43 //-----------------------------------------------------------------------------
44 /** The VDiagram is responsible to generate the visible parts of the Diagram
45 that is wall, floor, axes and data series.
46 The axes and data series are subobjects which are created and managed by the
47 diagram.
48 */
49 
50 class VDiagram
51 {
52 public: //methods
53     VDiagram( const ::com::sun::star::uno::Reference<
54                   ::com::sun::star::chart2::XDiagram > & xDiagram
55                 , const ::com::sun::star::drawing::Direction3D& rPreferredAspectRatio
56                 , sal_Int32 nDimension=3, sal_Bool bPolar=sal_False );
57     virtual ~VDiagram();
58 
59     void init( const ::com::sun::star::uno::Reference<
60                      ::com::sun::star::drawing::XShapes >& xLogicTarget
61 			 , const ::com::sun::star::uno::Reference<
62                      ::com::sun::star::drawing::XShapes >& xFinalTarget
63              , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory);
64 
65     void    createShapes( const ::com::sun::star::awt::Point& rPos
66                         , const ::com::sun::star::awt::Size& rSize );
67 
68     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
69             getCoordinateRegion();
70 
71     ::basegfx::B2IRectangle    getCurrentRectangle();
72 
73     void    reduceToMimimumSize();
74 
75     ::basegfx::B2IRectangle    adjustPosAndSize( const ::com::sun::star::awt::Point& rPos
76                                     , const ::com::sun::star::awt::Size& rAvailableSize );
77 
78     ::basegfx::B2IRectangle    adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect );
79 
80     //    updateShapes(..);
81     // const awt::Point& rPos, const awt::Size& rSize );
82 
83 private: //methods
84     void    createShapes_2d();
85     void    createShapes_3d();
86 
87     ::basegfx::B2IRectangle    adjustPosAndSize_2d( const ::com::sun::star::awt::Point& rPos
88                         , const ::com::sun::star::awt::Size& rAvailableSize );
89     ::basegfx::B2IRectangle    adjustPosAndSize_3d( const ::com::sun::star::awt::Point& rPos
90                         , const ::com::sun::star::awt::Size& rAvailableSize );
91 
92     void    adjustAspectRatio3d( const ::com::sun::star::awt::Size& rAvailableSize );
93 
94 private: //members
95     VDiagram(const VDiagram& rD);
96 
97     ::com::sun::star::uno::Reference<
98                     ::com::sun::star::drawing::XShapes >                    m_xLogicTarget;
99     ::com::sun::star::uno::Reference<
100                     ::com::sun::star::drawing::XShapes >                    m_xFinalTarget;
101     ::com::sun::star::uno::Reference<
102                     ::com::sun::star::lang::XMultiServiceFactory>	        m_xShapeFactory;
103     ShapeFactory*                                                           m_pShapeFactory;
104 
105     // this is the surrounding shape which contains floor, wall and coordinate
106     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xOuterGroupShape;
107     // this is an additional inner shape that represents the coordinate region -  that is - where to place data points
108     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xCoordinateRegionShape;
109     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xWall2D;
110 
111     sal_Int32                                                               m_nDimensionCount;
112     sal_Bool                                                                m_bPolar;
113     ::com::sun::star::uno::Reference<
114         ::com::sun::star::chart2::XDiagram >                                m_xDiagram;
115 
116     ::com::sun::star::drawing::Direction3D                                  m_aPreferredAspectRatio;
117     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAspectRatio3D;
118 
119     double m_fXAnglePi;
120     double m_fYAnglePi;
121     double m_fZAnglePi;
122     sal_Bool m_bRightAngledAxes;
123 
124     ::com::sun::star::awt::Point    m_aAvailablePosIncludingAxes;
125     ::com::sun::star::awt::Size     m_aAvailableSizeIncludingAxes;
126 
127     ::com::sun::star::awt::Point    m_aCurrentPosWithoutAxes;
128     ::com::sun::star::awt::Size     m_aCurrentSizeWithoutAxes;
129 };
130 
131 //.............................................................................
132 } //namespace chart
133 //.............................................................................
134 #endif
135 
136 
137