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 INCLUDED_CHART2_SOURCE_INC_THREEDHELPER_HXX
21 #define INCLUDED_CHART2_SOURCE_INC_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"
36 ThreeDLookScheme_Simple
,
37 ThreeDLookScheme_Realistic
,
38 ThreeDLookScheme_Unknown
41 enum CuboidPlanePosition
43 CuboidPlanePosition_Left
,
44 CuboidPlanePosition_Right
,
45 CuboidPlanePosition_Top
,
46 CuboidPlanePosition_Bottom
,
47 CuboidPlanePosition_Front
,
48 CuboidPlanePosition_Back
51 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
55 /** Returns the default camera geometry that is set in the Diagram CTOR.
56 This is not the property default!
58 @todo deprecate the hard set camera geometry and use the property
61 static ::com::sun::star::drawing::CameraGeometry
getDefaultCameraGeometry( bool bPie
=false );
63 static void getRotationAngleFromDiagram(
64 const ::com::sun::star::uno::Reference
<
65 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
66 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
67 static void setRotationAngleToDiagram(
68 const ::com::sun::star::uno::Reference
<
69 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
70 , double fXAngleRad
, double fYAngleRad
, double fZAngleRad
);
72 static void getRotationFromDiagram(
73 const ::com::sun::star::uno::Reference
<
74 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
75 , sal_Int32
& rnHorizontalAngleDegree
, sal_Int32
& rnVerticalAngleDegree
);
76 static void setRotationToDiagram(
77 const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
79 , sal_Int32 nHorizontalAngleDegree
, sal_Int32 nVerticalYAngleDegree
);
81 static void switchRightAngledAxes( const ::com::sun::star::uno::Reference
<
82 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
83 , bool bRightAngledAxes
, bool bRotateLights
=true );
85 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad
, double& rfYAngleRad
);
86 static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; }
87 static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; }
89 static double getValueClippedToRange( double fValue
, const double& fPositivLimit
);
91 static void convertElevationRotationDegToXYZAngleRad(
92 sal_Int32 nElevationDeg
, sal_Int32 nRotationDeg
93 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
95 SAL_DLLPRIVATE
static void convertXYZAngleRadToElevationRotationDeg(
96 sal_Int32
& rnElevationDeg
, sal_Int32
& rnRotationDeg
97 , double fXRad
, double fYRad
, double fZRad
);
99 static double getCameraDistance(
100 const ::com::sun::star::uno::Reference
<
101 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
102 static void setCameraDistance(
103 const ::com::sun::star::uno::Reference
<
104 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
105 , double fCameraDistance
);
106 SAL_DLLPRIVATE
static void ensureCameraDistanceRange( double& rfCameraDistance
);
107 SAL_DLLPRIVATE
static void getCameraDistanceRange( double& rfMinimumDistance
, double& rfMaximumDistance
);
109 static double CameraDistanceToPerspective( double fCameraDistance
);
110 static double PerspectiveToCameraDistance( double fPerspective
);
112 static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference
<
113 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
114 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
116 static void setDefaultIllumination( const ::com::sun::star::uno::Reference
<
117 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
119 static void setDefaultRotation( const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
, bool bPieOrDonut
);
122 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference
<
123 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
124 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
126 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference
<
127 ::com::sun::star::beans::XPropertySet
>& xSceneProperties
);
129 static ThreeDLookScheme
detectScheme( const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::chart2::XDiagram
>& xDiagram
);
131 static void setScheme( const ::com::sun::star::uno::Reference
<
132 ::com::sun::star::chart2::XDiagram
>& xDiagram
133 , ThreeDLookScheme aScheme
);
135 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
136 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
138 static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
139 ::com::sun::star::chart2::XDiagram
>& xDiagram
140 , sal_Int32
& rnRoundedEdges
, sal_Int32
& rnObjectLines
);
141 static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference
<
142 ::com::sun::star::chart2::XDiagram
>& xDiagram
143 , sal_Int32 nRoundedEdges
, sal_Int32 nObjectLines
);
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */