1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef _CHART2_VAXIS_PROPERTIES_HXX 28*cdf0e10cSrcweir #define _CHART2_VAXIS_PROPERTIES_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include "TickmarkProperties.hxx" 31*cdf0e10cSrcweir #include "PlottingPositionHelper.hxx" 32*cdf0e10cSrcweir #include "LabelAlignment.hxx" 33*cdf0e10cSrcweir #include "ExplicitCategoriesProvider.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisPosition.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/chart2/AxisType.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/drawing/TextVerticalAdjust.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include <vector> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir //............................................................................. 50*cdf0e10cSrcweir namespace chart 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir //............................................................................. 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir //----------------------------------------------------------------------------- 55*cdf0e10cSrcweir /** 56*cdf0e10cSrcweir */ 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir //These properties describe how a couple of labels are arranged one to another. 59*cdf0e10cSrcweir //The couple can contain all labels for all tickmark depth or just the labels for one single depth or 60*cdf0e10cSrcweir //the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together). 61*cdf0e10cSrcweir //... only allow side by side for different tick depth 62*cdf0e10cSrcweir enum AxisLabelStaggering 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir SIDE_BY_SIDE 65*cdf0e10cSrcweir , STAGGER_EVEN 66*cdf0e10cSrcweir , STAGGER_ODD 67*cdf0e10cSrcweir , STAGGER_AUTO 68*cdf0e10cSrcweir }; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir struct AxisLabelProperties 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir AxisLabelProperties(); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir ::com::sun::star::awt::Size m_aFontReferenceSize;//reference size to calculate the font height 75*cdf0e10cSrcweir ::com::sun::star::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir sal_Int32 nNumberFormatKey; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir AxisLabelStaggering eStaggering; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir sal_Bool bLineBreakAllowed; 82*cdf0e10cSrcweir sal_Bool bOverlapAllowed; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir sal_Bool bStackCharacters; 85*cdf0e10cSrcweir double fRotationAngleDegree; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir sal_Int32 nRhythm; //show only each nth label with n==nRhythm 88*cdf0e10cSrcweir bool bRhythmIsFix; //states wether the given rhythm is fix or may be changed 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir //methods: 91*cdf0e10cSrcweir void init( const ::com::sun::star::uno::Reference< 92*cdf0e10cSrcweir ::com::sun::star::chart2::XAxis >& xAxisModel ); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir sal_Bool getIsStaggered() const; 95*cdf0e10cSrcweir }; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir struct AxisProperties 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > m_xAxisModel; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir sal_Int32 m_nDimensionIndex; 102*cdf0e10cSrcweir bool m_bIsMainAxis;//not secondary axis 103*cdf0e10cSrcweir bool m_bSwapXAndY; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisPosition m_eCrossoverType; 106*cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisLabelPosition m_eLabelPos; 107*cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisMarkPosition m_eTickmarkPos; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir double* m_pfMainLinePositionAtOtherAxis; 110*cdf0e10cSrcweir double* m_pfExrtaLinePositionAtOtherAxis; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir bool m_bCrossingAxisHasReverseDirection; 113*cdf0e10cSrcweir bool m_bCrossingAxisIsCategoryAxes; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir //this direction is used to indicate in which direction the labels are to be drawn 116*cdf0e10cSrcweir double m_fLabelDirectionSign; 117*cdf0e10cSrcweir //this direction is used to indicate in which direction inner tickmarks are to be drawn 118*cdf0e10cSrcweir double m_fInnerDirectionSign; 119*cdf0e10cSrcweir LabelAlignment m_aLabelAlignment; 120*cdf0e10cSrcweir sal_Bool m_bDisplayLabels; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir sal_Int32 m_nNumberFormatKey; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir /* 125*cdf0e10cSrcweir 0: no tickmarks 1: inner tickmarks 126*cdf0e10cSrcweir 2: outer tickmarks 3: inner and outer tickmarks 127*cdf0e10cSrcweir */ 128*cdf0e10cSrcweir sal_Int32 m_nMajorTickmarks; 129*cdf0e10cSrcweir sal_Int32 m_nMinorTickmarks; 130*cdf0e10cSrcweir ::std::vector<TickmarkProperties> m_aTickmarkPropertiesList; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir VLineProperties m_aLineProperties; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir //for category axes -> 135*cdf0e10cSrcweir sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType 136*cdf0e10cSrcweir bool m_bComplexCategories; 137*cdf0e10cSrcweir ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;/*no ownership here*/ 138*cdf0e10cSrcweir ::com::sun::star::uno::Reference< 139*cdf0e10cSrcweir ::com::sun::star::chart2::data::XTextualDataSequence > 140*cdf0e10cSrcweir m_xAxisTextProvider; //for categries or series names 141*cdf0e10cSrcweir //<- category axes 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir //methods: 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir AxisProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxisModel 146*cdf0e10cSrcweir , ExplicitCategoriesProvider* pExplicitCategoriesProvider ); 147*cdf0e10cSrcweir AxisProperties( const AxisProperties& rAxisProperties ); 148*cdf0e10cSrcweir virtual ~AxisProperties(); 149*cdf0e10cSrcweir virtual void init(bool bCartesian=false);//init from model data (m_xAxisModel) 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp ); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir static TickmarkProperties getBiggestTickmarkProperties(); 154*cdf0e10cSrcweir TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 nTextLevel ) const; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir private: 157*cdf0e10cSrcweir AxisProperties(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir protected: 160*cdf0e10cSrcweir virtual TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const; 161*cdf0e10cSrcweir VLineProperties makeLinePropertiesForDepth( sal_Int32 nDepth ) const; 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir //............................................................................. 165*cdf0e10cSrcweir } //namespace chart 166*cdf0e10cSrcweir //............................................................................. 167*cdf0e10cSrcweir #endif 168