1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef CHART2_THREEDHELPER_HXX
29 #define CHART2_THREEDHELPER_HXX
31 #include <com/sun/star/chart2/XDiagram.hpp>
32 #include <com/sun/star/drawing/CameraGeometry.hpp>
33 #include <com/sun/star/drawing/ShadeMode.hpp>
34 #include "charttoolsdllapi.hxx"
36 //.............................................................................
39 //.............................................................................
41 //-----------------------------------------------------------------------------
47 ThreeDLookScheme_Simple
,
48 ThreeDLookScheme_Realistic
,
49 ThreeDLookScheme_Unknown
52 enum CuboidPlanePosition
54 CuboidPlanePosition_Left
,
55 CuboidPlanePosition_Right
,
56 CuboidPlanePosition_Top
,
57 CuboidPlanePosition_Bottom
,
58 CuboidPlanePosition_Front
,
59 CuboidPlanePosition_Back
62 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
66 /** Returns the default camera geometry that is set in the Diagram CTOR.
67 This is not the property default!
69 @todo deprecate the hard set camera geometry and use the property
72 static ::com::sun::star::drawing::CameraGeometry
getDefaultCameraGeometry( bool bPie
=false );
74 static void getRotationAngleFromDiagram(
75 const ::com::sun::star::uno::Reference
<
76 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
77 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
78 static void setRotationAngleToDiagram(
79 const ::com::sun::star::uno::Reference
<
80 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
81 , double fXAngleRad
, double fYAngleRad
, double fZAngleRad
);
83 static void getRotationFromDiagram(
84 const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
86 , sal_Int32
& rnHorizontalAngleDegree
, sal_Int32
& rnVerticalAngleDegree
);
87 static void setRotationToDiagram(
88 const ::com::sun::star::uno::Reference
<
89 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
90 , sal_Int32 nHorizontalAngleDegree
, sal_Int32 nVerticalYAngleDegree
);
92 static void switchRightAngledAxes( const ::com::sun::star::uno::Reference
<
93 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
94 , sal_Bool bRightAngledAxes
, bool bRotateLights
=true );
96 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad
, double& rfYAngleRad
);
97 static double getXDegreeAngleLimitForRightAngledAxes();
98 static double getYDegreeAngleLimitForRightAngledAxes();
99 static double getValueClippedToRange( double fValue
, const double& fPositivLimit
);
101 static void convertElevationRotationDegToXYZAngleRad(
102 sal_Int32 nElevationDeg
, sal_Int32 nRotationDeg
103 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
105 SAL_DLLPRIVATE
static void convertXYZAngleRadToElevationRotationDeg(
106 sal_Int32
& rnElevationDeg
, sal_Int32
& rnRotationDeg
107 , double fXRad
, double fYRad
, double fZRad
);
109 static double getCameraDistance(
110 const ::com::sun::star::uno::Reference
<
111 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
112 static void setCameraDistance(
113 const ::com::sun::star::uno::Reference
<
114 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
115 , double fCameraDistance
);
116 SAL_DLLPRIVATE
static void ensureCameraDistanceRange( double& rfCameraDistance
);
117 SAL_DLLPRIVATE
static void getCameraDistanceRange( double& rfMinimumDistance
, double& rfMaximumDistance
);
119 static double CameraDistanceToPerspective( double fCameraDistance
);
120 static double PerspectiveToCameraDistance( double fPerspective
);
122 static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference
<
123 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
124 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
126 static void setDefaultIllumination( const ::com::sun::star::uno::Reference
<
127 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
129 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
, bool bPieOrDonut
);
132 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference
<
133 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
134 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference
<
135 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
136 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference
<
137 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
139 static ThreeDLookScheme
detectScheme( const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::chart2::XDiagram
>& xDiagram
);
141 static void setScheme( const ::com::sun::star::uno::Reference
<
142 ::com::sun::star::chart2::XDiagram
>& xDiagram
143 , ThreeDLookScheme aScheme
);
145 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
146 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
148 static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
149 ::com::sun::star::chart2::XDiagram
>& xDiagram
150 , sal_Int32
& rnRoundedEdges
, sal_Int32
& rnObjectLines
);
151 static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
152 ::com::sun::star::chart2::XDiagram
>& xDiagram
153 , sal_Int32 nRoundedEdges
, sal_Int32 nObjectLines
);
156 //.............................................................................
158 //.............................................................................