xref: /trunk/main/chart2/source/inc/ThreeDHelper.hxx (revision de7b3f82)
1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*de7b3f82SAndrew Rist  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*de7b3f82SAndrew Rist  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19*de7b3f82SAndrew Rist  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef CHART2_THREEDHELPER_HXX
25cdf0e10cSrcweir #define CHART2_THREEDHELPER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
28cdf0e10cSrcweir #include <com/sun/star/drawing/CameraGeometry.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/ShadeMode.hpp>
30cdf0e10cSrcweir #include "charttoolsdllapi.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //.............................................................................
33cdf0e10cSrcweir namespace chart
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //.............................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //-----------------------------------------------------------------------------
38cdf0e10cSrcweir /**
39cdf0e10cSrcweir */
40cdf0e10cSrcweir 
41cdf0e10cSrcweir enum ThreeDLookScheme
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     ThreeDLookScheme_Simple,
44cdf0e10cSrcweir     ThreeDLookScheme_Realistic,
45cdf0e10cSrcweir     ThreeDLookScheme_Unknown
46cdf0e10cSrcweir };
47cdf0e10cSrcweir 
48cdf0e10cSrcweir enum CuboidPlanePosition
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     CuboidPlanePosition_Left,
51cdf0e10cSrcweir     CuboidPlanePosition_Right,
52cdf0e10cSrcweir     CuboidPlanePosition_Top,
53cdf0e10cSrcweir     CuboidPlanePosition_Bottom,
54cdf0e10cSrcweir     CuboidPlanePosition_Front,
55cdf0e10cSrcweir     CuboidPlanePosition_Back
56cdf0e10cSrcweir };
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
59cdf0e10cSrcweir {
60cdf0e10cSrcweir public:
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     /** Returns the default camera geometry that is set in the Diagram CTOR.
63cdf0e10cSrcweir         This is not the property default!
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         @todo deprecate the hard set camera geometry and use the property
66cdf0e10cSrcweir               default
67cdf0e10cSrcweir      */
68cdf0e10cSrcweir     static ::com::sun::star::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     static void getRotationAngleFromDiagram(
71cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
72cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
73cdf0e10cSrcweir             , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
74cdf0e10cSrcweir     static void setRotationAngleToDiagram(
75cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
76cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
77cdf0e10cSrcweir             , double fXAngleRad, double fYAngleRad, double fZAngleRad );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     static void getRotationFromDiagram(
80cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
81cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
82cdf0e10cSrcweir             , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
83cdf0e10cSrcweir     static void setRotationToDiagram(
84cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
85cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
86cdf0e10cSrcweir             , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     static void switchRightAngledAxes( const ::com::sun::star::uno::Reference<
89cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
90cdf0e10cSrcweir             , sal_Bool bRightAngledAxes, bool bRotateLights=true );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
93cdf0e10cSrcweir     static double getXDegreeAngleLimitForRightAngledAxes();
94cdf0e10cSrcweir     static double getYDegreeAngleLimitForRightAngledAxes();
95cdf0e10cSrcweir     static double getValueClippedToRange( double fValue, const double& fPositivLimit );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     static void convertElevationRotationDegToXYZAngleRad(
98cdf0e10cSrcweir         sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
99cdf0e10cSrcweir         , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
102cdf0e10cSrcweir         sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
103cdf0e10cSrcweir         , double fXRad, double fYRad, double fZRad );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     static double getCameraDistance(
106cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
107cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
108cdf0e10cSrcweir     static void setCameraDistance(
109cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
110cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties
111cdf0e10cSrcweir             , double fCameraDistance );
112cdf0e10cSrcweir     SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
113cdf0e10cSrcweir     SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     static double CameraDistanceToPerspective( double fCameraDistance );
116cdf0e10cSrcweir     static double PerspectiveToCameraDistance( double fPerspective );
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference<
119cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
120cdf0e10cSrcweir     static void setDefaultRotation( const ::com::sun::star::uno::Reference<
121cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
122cdf0e10cSrcweir     static void setDefaultIllumination( const ::com::sun::star::uno::Reference<
123cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     static void setDefaultRotation( const ::com::sun::star::uno::Reference<
126cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference<
129cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
130cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference<
131cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
132cdf0e10cSrcweir     static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference<
133cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >& xSceneProperties );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     static ThreeDLookScheme detectScheme( const ::com::sun::star::uno::Reference<
136cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram );
137cdf0e10cSrcweir     static void setScheme( const ::com::sun::star::uno::Reference<
138cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
139cdf0e10cSrcweir             , ThreeDLookScheme aScheme );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     //sal_Int32 nRoundedEdges:  <0 or >100 -> mixed state
142cdf0e10cSrcweir     //sal_Int32 nObjectLines:  0->no lines; 1->all lines on; other->mixed state
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference<
145cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
146cdf0e10cSrcweir             , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
147cdf0e10cSrcweir     static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference<
148cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
149cdf0e10cSrcweir             , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
150cdf0e10cSrcweir };
151cdf0e10cSrcweir 
152cdf0e10cSrcweir //.............................................................................
153cdf0e10cSrcweir } //namespace chart
154cdf0e10cSrcweir //.............................................................................
155cdf0e10cSrcweir #endif
156