Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / ThreeDHelper.hxx
blobfedf0d0df99880f35a8aec4c4e4dbec7c66eac5b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/drawing/CameraGeometry.hpp>
24 #include "charttoolsdllapi.hxx"
26 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
27 namespace com { namespace sun { namespace star { namespace chart2 { class XDiagram; } } } }
29 namespace chart
32 enum ThreeDLookScheme
34 ThreeDLookScheme_Simple,
35 ThreeDLookScheme_Realistic,
36 ThreeDLookScheme_Unknown
39 enum CuboidPlanePosition
41 CuboidPlanePosition_Left,
42 CuboidPlanePosition_Right,
43 CuboidPlanePosition_Top,
44 CuboidPlanePosition_Bottom,
45 CuboidPlanePosition_Front,
46 CuboidPlanePosition_Back
49 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
51 public:
53 /** Returns the default camera geometry that is set in the Diagram CTOR.
54 This is not the property default!
56 @todo deprecate the hard set camera geometry and use the property
57 default
59 static css::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
61 static void getRotationAngleFromDiagram(
62 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
63 , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
64 static void setRotationAngleToDiagram(
65 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
66 , double fXAngleRad, double fYAngleRad, double fZAngleRad );
68 static void getRotationFromDiagram(
69 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
70 , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree );
71 static void setRotationToDiagram(
72 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
73 , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree );
75 static void switchRightAngledAxes( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
76 , bool bRightAngledAxes );
78 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
79 static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; }
80 static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; }
82 static double getValueClippedToRange( double fValue, const double& fPositivLimit );
84 static void convertElevationRotationDegToXYZAngleRad(
85 sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
86 , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
88 SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
89 sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
90 , double fXRad, double fYRad, double fZRad );
92 static double getCameraDistance(
93 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
94 static void setCameraDistance(
95 const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties
96 , double fCameraDistance );
97 SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
98 SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
100 static double CameraDistanceToPerspective( double fCameraDistance );
101 static double PerspectiveToCameraDistance( double fPerspective );
103 static void set3DSettingsToDefault( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
104 static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
105 static void setDefaultIllumination( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties );
107 static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut );
109 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const css::uno::Reference<
110 css::beans::XPropertySet >& xSceneProperties );
111 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const css::uno::Reference<
112 css::beans::XPropertySet >& xSceneProperties );
113 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const css::uno::Reference<
114 css::beans::XPropertySet >& xSceneProperties );
116 static ThreeDLookScheme detectScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
117 static void setScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
118 , ThreeDLookScheme aScheme );
120 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
121 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
123 static void getRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
124 , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
125 static void setRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
126 , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
129 } //namespace chart
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */