1*de7b3f82SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*de7b3f82SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*de7b3f82SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*de7b3f82SAndrew Rist * distributed with this work for additional information 6*de7b3f82SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*de7b3f82SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*de7b3f82SAndrew Rist * "License"); you may not use this file except in compliance 9*de7b3f82SAndrew Rist * with the License. You may obtain a copy of the License at 10*de7b3f82SAndrew Rist * 11*de7b3f82SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*de7b3f82SAndrew Rist * 13*de7b3f82SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*de7b3f82SAndrew Rist * software distributed under the License is distributed on an 15*de7b3f82SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*de7b3f82SAndrew Rist * KIND, either express or implied. See the License for the 17*de7b3f82SAndrew Rist * specific language governing permissions and limitations 18*de7b3f82SAndrew Rist * under the License. 19*de7b3f82SAndrew Rist * 20*de7b3f82SAndrew Rist *************************************************************/ 21*de7b3f82SAndrew Rist 22*de7b3f82SAndrew Rist 23cdf0e10cSrcweir #ifndef _CHART2_VAXIS_PROPERTIES_HXX 24cdf0e10cSrcweir #define _CHART2_VAXIS_PROPERTIES_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "TickmarkProperties.hxx" 27cdf0e10cSrcweir #include "PlottingPositionHelper.hxx" 28cdf0e10cSrcweir #include "LabelAlignment.hxx" 29cdf0e10cSrcweir #include "ExplicitCategoriesProvider.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> 32cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> 33cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisPosition.hpp> 34cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp> 35cdf0e10cSrcweir #include <com/sun/star/chart2/AxisType.hpp> 36cdf0e10cSrcweir #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> 37cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 38cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 39cdf0e10cSrcweir #include <com/sun/star/drawing/TextVerticalAdjust.hpp> 40cdf0e10cSrcweir #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> 41cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <vector> 44cdf0e10cSrcweir 45cdf0e10cSrcweir //............................................................................. 46cdf0e10cSrcweir namespace chart 47cdf0e10cSrcweir { 48cdf0e10cSrcweir //............................................................................. 49cdf0e10cSrcweir 50cdf0e10cSrcweir //----------------------------------------------------------------------------- 51cdf0e10cSrcweir /** 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir 54cdf0e10cSrcweir //These properties describe how a couple of labels are arranged one to another. 55cdf0e10cSrcweir //The couple can contain all labels for all tickmark depth or just the labels for one single depth or 56cdf0e10cSrcweir //the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together). 57cdf0e10cSrcweir //... only allow side by side for different tick depth 58cdf0e10cSrcweir enum AxisLabelStaggering 59cdf0e10cSrcweir { 60cdf0e10cSrcweir SIDE_BY_SIDE 61cdf0e10cSrcweir , STAGGER_EVEN 62cdf0e10cSrcweir , STAGGER_ODD 63cdf0e10cSrcweir , STAGGER_AUTO 64cdf0e10cSrcweir }; 65cdf0e10cSrcweir 66cdf0e10cSrcweir struct AxisLabelProperties 67cdf0e10cSrcweir { 68cdf0e10cSrcweir AxisLabelProperties(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir ::com::sun::star::awt::Size m_aFontReferenceSize;//reference size to calculate the font height 71cdf0e10cSrcweir ::com::sun::star::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle 72cdf0e10cSrcweir 73cdf0e10cSrcweir sal_Int32 nNumberFormatKey; 74cdf0e10cSrcweir 75cdf0e10cSrcweir AxisLabelStaggering eStaggering; 76cdf0e10cSrcweir 77cdf0e10cSrcweir sal_Bool bLineBreakAllowed; 78cdf0e10cSrcweir sal_Bool bOverlapAllowed; 79cdf0e10cSrcweir 80cdf0e10cSrcweir sal_Bool bStackCharacters; 81cdf0e10cSrcweir double fRotationAngleDegree; 82cdf0e10cSrcweir 83cdf0e10cSrcweir sal_Int32 nRhythm; //show only each nth label with n==nRhythm 84cdf0e10cSrcweir bool bRhythmIsFix; //states wether the given rhythm is fix or may be changed 85cdf0e10cSrcweir 86cdf0e10cSrcweir //methods: 87cdf0e10cSrcweir void init( const ::com::sun::star::uno::Reference< 88cdf0e10cSrcweir ::com::sun::star::chart2::XAxis >& xAxisModel ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir sal_Bool getIsStaggered() const; 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir struct AxisProperties 94cdf0e10cSrcweir { 95cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > m_xAxisModel; 96cdf0e10cSrcweir 97cdf0e10cSrcweir sal_Int32 m_nDimensionIndex; 98cdf0e10cSrcweir bool m_bIsMainAxis;//not secondary axis 99cdf0e10cSrcweir bool m_bSwapXAndY; 100cdf0e10cSrcweir 101cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisPosition m_eCrossoverType; 102cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisLabelPosition m_eLabelPos; 103cdf0e10cSrcweir ::com::sun::star::chart::ChartAxisMarkPosition m_eTickmarkPos; 104cdf0e10cSrcweir 105cdf0e10cSrcweir double* m_pfMainLinePositionAtOtherAxis; 106cdf0e10cSrcweir double* m_pfExrtaLinePositionAtOtherAxis; 107cdf0e10cSrcweir 108cdf0e10cSrcweir bool m_bCrossingAxisHasReverseDirection; 109cdf0e10cSrcweir bool m_bCrossingAxisIsCategoryAxes; 110cdf0e10cSrcweir 111cdf0e10cSrcweir //this direction is used to indicate in which direction the labels are to be drawn 112cdf0e10cSrcweir double m_fLabelDirectionSign; 113cdf0e10cSrcweir //this direction is used to indicate in which direction inner tickmarks are to be drawn 114cdf0e10cSrcweir double m_fInnerDirectionSign; 115cdf0e10cSrcweir LabelAlignment m_aLabelAlignment; 116cdf0e10cSrcweir sal_Bool m_bDisplayLabels; 117cdf0e10cSrcweir 118cdf0e10cSrcweir sal_Int32 m_nNumberFormatKey; 119cdf0e10cSrcweir 120cdf0e10cSrcweir /* 121cdf0e10cSrcweir 0: no tickmarks 1: inner tickmarks 122cdf0e10cSrcweir 2: outer tickmarks 3: inner and outer tickmarks 123cdf0e10cSrcweir */ 124cdf0e10cSrcweir sal_Int32 m_nMajorTickmarks; 125cdf0e10cSrcweir sal_Int32 m_nMinorTickmarks; 126cdf0e10cSrcweir ::std::vector<TickmarkProperties> m_aTickmarkPropertiesList; 127cdf0e10cSrcweir 128cdf0e10cSrcweir VLineProperties m_aLineProperties; 129cdf0e10cSrcweir 130cdf0e10cSrcweir //for category axes -> 131cdf0e10cSrcweir sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType 132cdf0e10cSrcweir bool m_bComplexCategories; 133cdf0e10cSrcweir ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;/*no ownership here*/ 134cdf0e10cSrcweir ::com::sun::star::uno::Reference< 135cdf0e10cSrcweir ::com::sun::star::chart2::data::XTextualDataSequence > 136cdf0e10cSrcweir m_xAxisTextProvider; //for categries or series names 137cdf0e10cSrcweir //<- category axes 138cdf0e10cSrcweir 139cdf0e10cSrcweir //methods: 140cdf0e10cSrcweir 141cdf0e10cSrcweir AxisProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxisModel 142cdf0e10cSrcweir , ExplicitCategoriesProvider* pExplicitCategoriesProvider ); 143cdf0e10cSrcweir AxisProperties( const AxisProperties& rAxisProperties ); 144cdf0e10cSrcweir virtual ~AxisProperties(); 145cdf0e10cSrcweir virtual void init(bool bCartesian=false);//init from model data (m_xAxisModel) 146cdf0e10cSrcweir 147cdf0e10cSrcweir void initAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir static TickmarkProperties getBiggestTickmarkProperties(); 150cdf0e10cSrcweir TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis, sal_Int32 nTextLevel ) const; 151cdf0e10cSrcweir 152cdf0e10cSrcweir private: 153cdf0e10cSrcweir AxisProperties(); 154cdf0e10cSrcweir 155cdf0e10cSrcweir protected: 156cdf0e10cSrcweir virtual TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const; 157cdf0e10cSrcweir VLineProperties makeLinePropertiesForDepth( sal_Int32 nDepth ) const; 158cdf0e10cSrcweir }; 159cdf0e10cSrcweir 160cdf0e10cSrcweir //............................................................................. 161cdf0e10cSrcweir } //namespace chart 162cdf0e10cSrcweir //............................................................................. 163cdf0e10cSrcweir #endif 164