merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / view / charttypes / PieChart.hxx
blob6447515114aaae870f0e835bc01a2f800043d451
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PieChart.hxx,v $
10 * $Revision: 1.9.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CHART2_PIECHART_HXX
32 #define _CHART2_PIECHART_HXX
34 #include "VSeriesPlotter.hxx"
35 #include <basegfx/vector/b2dvector.hxx>
36 #include <basegfx/range/b2irectangle.hxx>
38 //.............................................................................
39 namespace chart
41 //.............................................................................
42 class PiePositionHelper;
44 class PieChart : public VSeriesPlotter
46 //-------------------------------------------------------------------------
47 // public methods
48 //-------------------------------------------------------------------------
49 public:
50 PieChart( const ::com::sun::star::uno::Reference<
51 ::com::sun::star::chart2::XChartType >& xChartTypeModel
52 , sal_Int32 nDimensionCount );
53 virtual ~PieChart();
55 //-------------------------------------------------------------------------
56 // chart2::XPlotter
57 //-------------------------------------------------------------------------
59 virtual void SAL_CALL createShapes();
60 virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize );
62 virtual void SAL_CALL setScales(
63 const ::com::sun::star::uno::Sequence<
64 ::com::sun::star::chart2::ExplicitScaleData >& rScales
65 , sal_Bool bSwapXAndYAxis )
66 throw (::com::sun::star::uno::RuntimeException);
68 virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
69 virtual void SAL_CALL setScales( const ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::ExplicitScaleData >& rScales ) throw (::com::sun::star::uno::RuntimeException);
70 virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
73 virtual void addSeries( VDataSeries* pSeries, sal_Int32 zSlot = -1, sal_Int32 xSlot = -1,sal_Int32 ySlot = -1 );
75 //-------------------
76 virtual ::com::sun::star::drawing::Direction3D getPreferredDiagramAspectRatio() const;
77 virtual bool keepAspectRatio() const;
79 //MinimumAndMaximumSupplier
80 virtual double getMinimumX();
81 virtual double getMaximumX();
82 virtual double getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
83 virtual double getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex );
85 virtual bool isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex );
86 virtual bool isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex );
87 virtual bool isExpandWideValuesToZero( sal_Int32 nDimensionIndex );
88 virtual bool isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex );
89 virtual bool isSeperateStackingForDifferentSigns( sal_Int32 nDimensionIndex );
91 //-------------------------------------------------------------------------
92 //-------------------------------------------------------------------------
93 //-------------------------------------------------------------------------
94 private: //methods
95 //no default constructor
96 PieChart();
98 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
99 createDataPoint( const ::com::sun::star::uno::Reference<
100 ::com::sun::star::drawing::XShapes >& xTarget
101 , const ::com::sun::star::uno::Reference<
102 ::com::sun::star::beans::XPropertySet >& xObjectProperties
103 , double fUnitCircleStartAngleDegree, double fWidthAngleDegree
104 , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
105 , double fLogicZ, double fDepth, double fExplodePercentage
106 , tPropertyNameValueMap* pOverWritePropertiesMap );
108 double getMaxOffset();
109 bool detectLabelOverlapsAndMove(const ::com::sun::star::awt::Size& rPageSize);//returns true when there might be more to do
110 void resetLabelPositionsToPreviousState();
111 struct PieLabelInfo;
112 bool tryMoveLabels( PieLabelInfo* pFirstBorder, PieLabelInfo* pSecondBorder
113 , PieLabelInfo* pCenter, bool bSingleCenter, bool& rbAlternativeMoveDirection
114 , const ::com::sun::star::awt::Size& rPageSize );
116 private: //member
117 PiePositionHelper* m_pPosHelper;
118 bool m_bUseRings;
120 struct PieLabelInfo
122 PieLabelInfo();
123 bool moveAwayFrom( const PieLabelInfo* pFix, const ::com::sun::star::awt::Size& rPageSize
124 , bool bMoveHalfWay, bool bMoveClockwise, bool bAlternativeMoveDirection );
126 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xTextShape;
127 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xLabelGroupShape;
128 ::basegfx::B2IVector aFirstPosition;
129 ::basegfx::B2IVector aOrigin;
130 double fValue;
131 bool bMovementAllowed;
132 bool bMoved;
133 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > xTextTarget;
134 PieLabelInfo* pPrevious;
135 PieLabelInfo* pNext;
136 ::com::sun::star::awt::Point aPreviousPosition;
139 ::std::vector< PieLabelInfo > m_aLabelInfoList;
141 double m_fMaxOffset; /// cached max offset value (init'ed to NaN)
143 //.............................................................................
144 } //namespace chart
145 //.............................................................................
146 #endif