Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VDIAGRAM_HXX
20 : #define INCLUDED_CHART2_SOURCE_VIEW_INC_VDIAGRAM_HXX
21 :
22 : #include <com/sun/star/drawing/HomogenMatrix.hpp>
23 : #include <com/sun/star/drawing/XShapes.hpp>
24 : #include <com/sun/star/chart2/XDiagram.hpp>
25 : #include "AbstractShapeFactory.hxx"
26 : #include <basegfx/range/b2irectangle.hxx>
27 :
28 : namespace chart
29 : {
30 :
31 : class AbstractShapeFactory;
32 :
33 : /** The VDiagram is responsible to generate the visible parts of the Diagram
34 : that is wall, floor, axes and data series.
35 : The axes and data series are subobjects which are created and managed by the
36 : diagram.
37 : */
38 :
39 : class VDiagram
40 : {
41 : public: //methods
42 : VDiagram( const com::sun::star::uno::Reference<com::sun::star::chart2::XDiagram>& xDiagram,
43 : const com::sun::star::drawing::Direction3D& rPreferredAspectRatio,
44 : sal_Int32 nDimension = 3 );
45 : virtual ~VDiagram();
46 :
47 : void init(
48 : const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>& xTarget,
49 : const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xFactory );
50 :
51 : void createShapes( const ::com::sun::star::awt::Point& rPos
52 : , const ::com::sun::star::awt::Size& rSize );
53 :
54 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
55 544 : getCoordinateRegion() { return css::uno::Reference<css::drawing::XShapes>( m_xCoordinateRegionShape, css::uno::UNO_QUERY );}
56 :
57 : /**
58 : * Get current bounding rectangle for the diagram without axes.
59 : */
60 : basegfx::B2IRectangle getCurrentRectangle() const;
61 :
62 : void reduceToMimimumSize();
63 :
64 : ::basegfx::B2IRectangle adjustPosAndSize( const ::com::sun::star::awt::Point& rPos
65 : , const ::com::sun::star::awt::Size& rAvailableSize );
66 :
67 : ::basegfx::B2IRectangle adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect );
68 :
69 : private: //methods
70 : void createShapes_2d();
71 : void createShapes_3d();
72 :
73 : ::basegfx::B2IRectangle adjustPosAndSize_2d( const ::com::sun::star::awt::Point& rPos
74 : , const ::com::sun::star::awt::Size& rAvailableSize );
75 : ::basegfx::B2IRectangle adjustPosAndSize_3d( const ::com::sun::star::awt::Point& rPos
76 : , const ::com::sun::star::awt::Size& rAvailableSize );
77 :
78 : void adjustAspectRatio3d( const ::com::sun::star::awt::Size& rAvailableSize );
79 :
80 : private: //members
81 : VDiagram(const VDiagram& rD);
82 :
83 : ::com::sun::star::uno::Reference<
84 : ::com::sun::star::drawing::XShapes > m_xTarget;
85 : ::com::sun::star::uno::Reference<
86 : ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
87 : AbstractShapeFactory* m_pShapeFactory;
88 :
89 : // this is the surrounding shape which contains floor, wall and coordinate
90 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xOuterGroupShape;
91 : // this is an additional inner shape that represents the coordinate region - that is - where to place data points
92 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xCoordinateRegionShape;
93 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xWall2D;
94 :
95 : sal_Int32 m_nDimensionCount;
96 : ::com::sun::star::uno::Reference<
97 : ::com::sun::star::chart2::XDiagram > m_xDiagram;
98 :
99 : ::com::sun::star::drawing::Direction3D m_aPreferredAspectRatio;
100 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAspectRatio3D;
101 :
102 : double m_fXAnglePi;
103 : double m_fYAnglePi;
104 : double m_fZAnglePi;
105 :
106 : ::com::sun::star::awt::Point m_aAvailablePosIncludingAxes;
107 : ::com::sun::star::awt::Size m_aAvailableSizeIncludingAxes;
108 :
109 : ::com::sun::star::awt::Point m_aCurrentPosWithoutAxes;
110 : ::com::sun::star::awt::Size m_aCurrentSizeWithoutAxes;
111 :
112 : bool m_bRightAngledAxes;
113 : };
114 :
115 : } //namespace chart
116 : #endif
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|