Update ooo320-m1
[ooovba.git] / chart2 / source / view / axes / VAxisProperties.hxx
blobd9038556ff32669f48f50b1e1f4306f924183f6e
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: VAxisProperties.hxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
30 #ifndef _CHART2_VAXIS_PROPERTIES_HXX
31 #define _CHART2_VAXIS_PROPERTIES_HXX
33 #include "TickmarkProperties.hxx"
34 #include "PlottingPositionHelper.hxx"
35 #include "LabelAlignment.hxx"
37 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
38 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
39 #include <com/sun/star/chart/ChartAxisPosition.hpp>
40 #include <com/sun/star/chart2/XAxis.hpp>
41 #include <com/sun/star/chart2/AxisType.hpp>
42 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
43 #include <com/sun/star/awt/Rectangle.hpp>
44 #include <com/sun/star/awt/Size.hpp>
45 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
46 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
47 #include <com/sun/star/lang/Locale.hpp>
49 #include <vector>
51 //.............................................................................
52 namespace chart
54 //.............................................................................
56 //-----------------------------------------------------------------------------
57 /**
60 //These properties describe how a couple of labels are arranged one to another.
61 //The couple can contain all labels for all tickmark depth or just the labels for one single depth or
62 //the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
63 //... only allow side by side for different tick depth
64 enum AxisLabelStaggering
66 SIDE_BY_SIDE
67 , STAGGER_EVEN
68 , STAGGER_ODD
69 , STAGGER_AUTO
72 struct AxisLabelProperties
74 AxisLabelProperties();
76 ::com::sun::star::awt::Size m_aFontReferenceSize;//reference size to calculate the font height
77 ::com::sun::star::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
79 sal_Int32 nNumberFormatKey;
81 AxisLabelStaggering eStaggering;
83 sal_Bool bLineBreakAllowed;
84 sal_Bool bOverlapAllowed;
86 sal_Bool bStackCharacters;
87 double fRotationAngleDegree;
89 sal_Int32 nRhythm; //show only each nth label with n==nRhythm
90 bool bRhythmIsFix; //states wether the given rythm is fix or may be changed
92 //methods:
93 void init( const ::com::sun::star::uno::Reference<
94 ::com::sun::star::chart2::XAxis >& xAxisModel );
96 sal_Bool getIsStaggered() const;
99 struct AxisProperties
101 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > m_xAxisModel;
103 sal_Int32 m_nDimensionIndex;
104 bool m_bIsMainAxis;//not secondary axis
105 bool m_bSwapXAndY;
107 ::com::sun::star::chart::ChartAxisPosition m_eCrossoverType;
108 ::com::sun::star::chart::ChartAxisLabelPosition m_eLabelPos;
109 ::com::sun::star::chart::ChartAxisMarkPosition m_eTickmarkPos;
111 double* m_pfMainLinePositionAtOtherAxis;
112 double* m_pfExrtaLinePositionAtOtherAxis;
114 bool m_bCrossingAxisHasReverseDirection;
115 bool m_bCrossingAxisIsCategoryAxes;
116 bool m_bAxisBetweenCategories;
118 //this direction is used to indicate in which direction the labels are to be drawn
119 double m_fLabelDirectionSign;
120 //this direction is used to indicate in which direction inner tickmarks are to be drawn
121 double m_fInnerDirectionSign;
122 bool m_bLabelsOutside;
123 LabelAlignment m_aLabelAlignment;
124 sal_Bool m_bDisplayLabels;
126 sal_Int32 m_nNumberFormatKey;
129 0: no tickmarks 1: inner tickmarks
130 2: outer tickmarks 3: inner and outer tickmarks
132 sal_Int32 m_nMajorTickmarks;
133 sal_Int32 m_nMinorTickmarks;
134 ::std::vector<TickmarkProperties> m_aTickmarkPropertiesList;
136 VLineProperties m_aLineProperties;
138 //for category axes ->
139 sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType
140 ::com::sun::star::uno::Reference<
141 ::com::sun::star::chart2::data::XTextualDataSequence >
142 m_xAxisTextProvider; //for categries or series names
143 //position of main tickmarks in respect to the indicated value: at value or between neighboured indicated values
144 bool m_bTickmarksAtIndicatedValue;
145 //<- category axes
147 //methods:
149 AxisProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxisModel
150 , const ::com::sun::star::uno::Reference<
151 ::com::sun::star::chart2::data::XTextualDataSequence >& xAxisTextProvider );
152 AxisProperties( const AxisProperties& rAxisProperties );
153 virtual ~AxisProperties();
154 virtual void init(bool bCartesian=false);//init from model data (m_xAxisModel)
156 void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp );
158 static TickmarkProperties getBiggestTickmarkProperties();
160 private:
161 AxisProperties();
163 protected:
164 virtual TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const;
165 VLineProperties makeLinePropertiesForDepth( sal_Int32 nDepth ) const;
168 //.............................................................................
169 } //namespace chart
170 //.............................................................................
171 #endif