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 .
22 #include <com/sun/star/drawing/CameraGeometry.hpp>
23 #include "charttoolsdllapi.hxx"
25 namespace com::sun::star::beans
{ class XPropertySet
; }
26 namespace com::sun::star::chart2
{ class XDiagram
; }
33 ThreeDLookScheme_Simple
,
34 ThreeDLookScheme_Realistic
,
35 ThreeDLookScheme_Unknown
38 enum CuboidPlanePosition
40 CuboidPlanePosition_Left
,
41 CuboidPlanePosition_Right
,
42 CuboidPlanePosition_Top
,
43 CuboidPlanePosition_Bottom
,
44 CuboidPlanePosition_Front
,
45 CuboidPlanePosition_Back
48 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
52 /** Returns the default camera geometry that is set in the Diagram CTOR.
53 This is not the property default!
55 @todo deprecate the hard set camera geometry and use the property
58 static css::drawing::CameraGeometry
getDefaultCameraGeometry( bool bPie
=false );
60 static void getRotationAngleFromDiagram(
61 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
62 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
63 static void setRotationAngleToDiagram(
64 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
65 , double fXAngleRad
, double fYAngleRad
, double fZAngleRad
);
67 static void getRotationFromDiagram(
68 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
69 , sal_Int32
& rnHorizontalAngleDegree
, sal_Int32
& rnVerticalAngleDegree
);
70 static void setRotationToDiagram(
71 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
72 , sal_Int32 nHorizontalAngleDegree
, sal_Int32 nVerticalYAngleDegree
);
74 static void switchRightAngledAxes( const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
75 , bool bRightAngledAxes
);
77 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad
, double& rfYAngleRad
);
78 static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; }
79 static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; }
81 static double getValueClippedToRange( double fValue
, const double& fPositivLimit
);
83 static void convertElevationRotationDegToXYZAngleRad(
84 sal_Int32 nElevationDeg
, sal_Int32 nRotationDeg
85 , double& rfXAngleRad
, double& rfYAngleRad
, double& rfZAngleRad
);
87 SAL_DLLPRIVATE
static void convertXYZAngleRadToElevationRotationDeg(
88 sal_Int32
& rnElevationDeg
, sal_Int32
& rnRotationDeg
89 , double fXRad
, double fYRad
, double fZRad
);
91 static double getCameraDistance(
92 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
);
93 static void setCameraDistance(
94 const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
95 , double fCameraDistance
);
96 SAL_DLLPRIVATE
static void ensureCameraDistanceRange( double& rfCameraDistance
);
97 SAL_DLLPRIVATE
static void getCameraDistanceRange( double& rfMinimumDistance
, double& rfMaximumDistance
);
99 static double CameraDistanceToPerspective( double fCameraDistance
);
100 static double PerspectiveToCameraDistance( double fPerspective
);
102 static void set3DSettingsToDefault( const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
);
103 static void setDefaultRotation( const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
);
104 static void setDefaultIllumination( const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
);
106 static void setDefaultRotation( const css::uno::Reference
< css::beans::XPropertySet
>& xSceneProperties
, bool bPieOrDonut
);
108 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardLeftWall( const css::uno::Reference
<
109 css::beans::XPropertySet
>& xSceneProperties
);
110 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBackWall(const css::uno::Reference
<
111 css::beans::XPropertySet
>& xSceneProperties
);
112 static CuboidPlanePosition
getAutomaticCuboidPlanePositionForStandardBottom(const css::uno::Reference
<
113 css::beans::XPropertySet
>& xSceneProperties
);
115 static ThreeDLookScheme
detectScheme( const css::uno::Reference
< css::chart2::XDiagram
>& xDiagram
);
116 static void setScheme( const css::uno::Reference
< css::chart2::XDiagram
>& xDiagram
117 , ThreeDLookScheme aScheme
);
119 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
120 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
122 static void getRoundedEdgesAndObjectLines( const css::uno::Reference
< css::chart2::XDiagram
>& xDiagram
123 , sal_Int32
& rnRoundedEdges
, sal_Int32
& rnObjectLines
);
124 static void setRoundedEdgesAndObjectLines( const css::uno::Reference
< css::chart2::XDiagram
>& xDiagram
125 , sal_Int32 nRoundedEdges
, sal_Int32 nObjectLines
);
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */