1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef CHART2_THREEDHELPER_HXX
21 #define CHART2_THREEDHELPER_HXX
23 #include <com/sun/star/chart2/XDiagram.hpp>
24 #include <com/sun/star/drawing/CameraGeometry.hpp>
25 #include <com/sun/star/drawing/ShadeMode.hpp>
26 #include "charttoolsdllapi.hxx"
28 //.............................................................................
31 //.............................................................................
33 //-----------------------------------------------------------------------------
39 ThreeDLookScheme_Simple
,
40 ThreeDLookScheme_Realistic
,
41 ThreeDLookScheme_Unknown
44 enum CuboidPlanePosition
46 CuboidPlanePosition_Left
,
47 CuboidPlanePosition_Right
,
48 CuboidPlanePosition_Top
,
49 CuboidPlanePosition_Bottom
,
50 CuboidPlanePosition_Front
,
51 CuboidPlanePosition_Back
54 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
58 /** Returns the default camera geometry that is set in the Diagram CTOR.
59 This is not the property default!
61 @todo deprecate the hard set camera geometry and use the property
64 static ::com::sun::star::drawing::CameraGeometry
getDefaultCameraGeometry( bool bPie
=false );
66 static void getRotationAngleFromDiagram(
67 const ::com::sun::star::uno::Reference
<
68 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
69 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
70 static void setRotationAngleToDiagram(
71 const ::com::sun::star::uno::Reference
<
72 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
73 , double fXAngleRad
, double fYAngleRad
, double fZAngleRad
);
75 static void getRotationFromDiagram(
76 const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
78 , sal_Int32
& rnHorizontalAngleDegree
, sal_Int32
& rnVerticalAngleDegree
);
79 static void setRotationToDiagram(
80 const ::com::sun::star::uno::Reference
<
81 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
82 , sal_Int32 nHorizontalAngleDegree
, sal_Int32 nVerticalYAngleDegree
);
84 static void switchRightAngledAxes( const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
86 , sal_Bool bRightAngledAxes
, bool bRotateLights
=true );
88 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad
, double& rfYAngleRad
);
89 static double getXDegreeAngleLimitForRightAngledAxes();
90 static double getYDegreeAngleLimitForRightAngledAxes();
91 static double getValueClippedToRange( double fValue
, const double& fPositivLimit
);
93 static void convertElevationRotationDegToXYZAngleRad(
94 sal_Int32 nElevationDeg
, sal_Int32 nRotationDeg
95 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
97 SAL_DLLPRIVATE
static void convertXYZAngleRadToElevationRotationDeg(
98 sal_Int32
& rnElevationDeg
, sal_Int32
& rnRotationDeg
99 , double fXRad
, double fYRad
, double fZRad
);
101 static double getCameraDistance(
102 const ::com::sun::star::uno::Reference
<
103 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
104 static void setCameraDistance(
105 const ::com::sun::star::uno::Reference
<
106 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
107 , double fCameraDistance
);
108 SAL_DLLPRIVATE
static void ensureCameraDistanceRange( double& rfCameraDistance
);
109 SAL_DLLPRIVATE
static void getCameraDistanceRange( double& rfMinimumDistance
, double& rfMaximumDistance
);
111 static double CameraDistanceToPerspective( double fCameraDistance
);
112 static double PerspectiveToCameraDistance( double fPerspective
);
114 static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
116 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
117 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
118 static void setDefaultIllumination( const ::com::sun::star::uno::Reference
<
119 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
121 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
122 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
, bool bPieOrDonut
);
124 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
126 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference
<
127 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
128 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference
<
129 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
131 static ThreeDLookScheme
detectScheme( const ::com::sun::star::uno::Reference
<
132 ::com::sun::star::chart2::XDiagram
>& xDiagram
);
133 static void setScheme( const ::com::sun::star::uno::Reference
<
134 ::com::sun::star::chart2::XDiagram
>& xDiagram
135 , ThreeDLookScheme aScheme
);
137 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
138 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
140 static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
141 ::com::sun::star::chart2::XDiagram
>& xDiagram
142 , sal_Int32
& rnRoundedEdges
, sal_Int32
& rnObjectLines
);
143 static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
144 ::com::sun::star::chart2::XDiagram
>& xDiagram
145 , sal_Int32 nRoundedEdges
, sal_Int32 nObjectLines
);
148 //.............................................................................
150 //.............................................................................
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */