Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / inc / ThreeDHelper.hxx
bloba8fc1d63fb40c4a3dbaeaae8104b7edcc6d262bd
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 #pragma once
22 #include <com/sun/star/drawing/CameraGeometry.hpp>
23 #include <rtl/ref.hxx>
24 #include "charttoolsdllapi.hxx"
26 namespace com::sun::star::beans { class XPropertySet; }
27 namespace com::sun::star::chart2 { class XDiagram; }
29 namespace chart
31 class Diagram;
33 enum class ThreeDLookScheme
35 ThreeDLookScheme_Simple,
36 ThreeDLookScheme_Realistic,
37 ThreeDLookScheme_Unknown
40 enum CuboidPlanePosition
42 CuboidPlanePosition_Left,
43 CuboidPlanePosition_Right,
44 CuboidPlanePosition_Top,
45 CuboidPlanePosition_Bottom,
46 CuboidPlanePosition_Front,
47 CuboidPlanePosition_Back
50 class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper
52 public:
54 /** Returns the default camera geometry that is set in the Diagram CTOR.
55 This is not the property default!
57 @todo deprecate the hard set camera geometry and use the property
58 default
60 static css::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false );
62 static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad );
63 static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; }
64 static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; }
66 static double getValueClippedToRange( double fValue, const double& fPositivLimit );
68 static void convertElevationRotationDegToXYZAngleRad(
69 sal_Int32 nElevationDeg, sal_Int32 nRotationDeg
70 , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad );
72 SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg(
73 sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg
74 , double fXRad, double fYRad, double fZRad );
76 SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance );
77 SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
79 static double CameraDistanceToPerspective( double fCameraDistance );
80 static double PerspectiveToCameraDistance( double fPerspective );
82 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference<
83 ::chart::Diagram >& xDiagram );
84 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const rtl::Reference<
85 ::chart::Diagram >& xDiagram );
86 static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const rtl::Reference<
87 ::chart::Diagram >& xDiagram );
89 //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state
90 //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state
92 static void getRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram
93 , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines );
94 static void setRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram
95 , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines );
98 } //namespace chart
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */