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