xref: /aoo41x/main/chart2/source/inc/ThreeDHelper.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef CHART2_THREEDHELPER_HXX
29*cdf0e10cSrcweir #define CHART2_THREEDHELPER_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/drawing/CameraGeometry.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/drawing/ShadeMode.hpp>
34*cdf0e10cSrcweir #include "charttoolsdllapi.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir //.............................................................................
37*cdf0e10cSrcweir namespace chart
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir //.............................................................................
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //-----------------------------------------------------------------------------
42*cdf0e10cSrcweir /**
43*cdf0e10cSrcweir */
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir enum ThreeDLookScheme
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir     ThreeDLookScheme_Simple,
48*cdf0e10cSrcweir     ThreeDLookScheme_Realistic,
49*cdf0e10cSrcweir     ThreeDLookScheme_Unknown
50*cdf0e10cSrcweir };
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir enum CuboidPlanePosition
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir     CuboidPlanePosition_Left,
55*cdf0e10cSrcweir     CuboidPlanePosition_Right,
56*cdf0e10cSrcweir     CuboidPlanePosition_Top,
57*cdf0e10cSrcweir     CuboidPlanePosition_Bottom,
58*cdf0e10cSrcweir     CuboidPlanePosition_Front,
59*cdf0e10cSrcweir     CuboidPlanePosition_Back
60*cdf0e10cSrcweir };
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir public:
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     /** Returns the default camera geometry that is set in the Diagram CTOR.
67*cdf0e10cSrcweir         This is not the property default!
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir         @todo deprecate the hard set camera geometry and use the property
70*cdf0e10cSrcweir               default
71*cdf0e10cSrcweir      */
72*cdf0e10cSrcweir     static ::com::sun::star::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir     static void getRotationAngleFromDiagram(
75*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
76*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
77*cdf0e10cSrcweir             , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
78*cdf0e10cSrcweir     static void setRotationAngleToDiagram(
79*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
80*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
81*cdf0e10cSrcweir             , double fXAngleRad, double fYAngleRad, double fZAngleRad );
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     static void getRotationFromDiagram(
84*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
85*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
86*cdf0e10cSrcweir             , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
87*cdf0e10cSrcweir     static void setRotationToDiagram(
88*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
89*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
90*cdf0e10cSrcweir             , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     static void switchRightAngledAxes( const ::com::sun::star::uno::Reference<
93*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
94*cdf0e10cSrcweir             , sal_Bool bRightAngledAxes, bool bRotateLights=true );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
97*cdf0e10cSrcweir     static double getXDegreeAngleLimitForRightAngledAxes();
98*cdf0e10cSrcweir     static double getYDegreeAngleLimitForRightAngledAxes();
99*cdf0e10cSrcweir     static double getValueClippedToRange( double fValue, const double& fPositivLimit );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir     static void convertElevationRotationDegToXYZAngleRad(
102*cdf0e10cSrcweir         sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
103*cdf0e10cSrcweir         , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
106*cdf0e10cSrcweir         sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
107*cdf0e10cSrcweir         , double fXRad, double fYRad, double fZRad );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     static double getCameraDistance(
110*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
111*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
112*cdf0e10cSrcweir     static void setCameraDistance(
113*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
114*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
115*cdf0e10cSrcweir             , double fCameraDistance );
116*cdf0e10cSrcweir     SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
117*cdf0e10cSrcweir     SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     static double CameraDistanceToPerspective( double fCameraDistance );
120*cdf0e10cSrcweir     static double PerspectiveToCameraDistance( double fPerspective );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference<
123*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
124*cdf0e10cSrcweir     static void setDefaultRotation( const ::com::sun::star::uno::Reference<
125*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
126*cdf0e10cSrcweir     static void setDefaultIllumination( const ::com::sun::star::uno::Reference<
127*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     static void setDefaultRotation( const ::com::sun::star::uno::Reference<
130*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut );
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference<
133*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
134*cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference<
135*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
136*cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference<
137*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir     static ThreeDLookScheme detectScheme( const ::com::sun::star::uno::Reference<
140*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram );
141*cdf0e10cSrcweir     static void setScheme( const ::com::sun::star::uno::Reference<
142*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
143*cdf0e10cSrcweir             , ThreeDLookScheme aScheme );
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     //sal_Int32 nRoundedEdges:  <0 or >100 -> mixed state
146*cdf0e10cSrcweir     //sal_Int32 nObjectLines:  0->no lines; 1->all lines on; other->mixed state
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference<
149*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
150*cdf0e10cSrcweir             , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
151*cdf0e10cSrcweir     static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference<
152*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
153*cdf0e10cSrcweir             , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
154*cdf0e10cSrcweir };
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir //.............................................................................
157*cdf0e10cSrcweir } //namespace chart
158*cdf0e10cSrcweir //.............................................................................
159*cdf0e10cSrcweir #endif
160