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_VCARTESIANAXIS_HXX 24cdf0e10cSrcweir #define _CHART2_VCARTESIANAXIS_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "VAxisBase.hxx" 27cdf0e10cSrcweir #include <basegfx/vector/b2dvector.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <memory> 30cdf0e10cSrcweir 31cdf0e10cSrcweir //............................................................................. 32cdf0e10cSrcweir namespace chart 33cdf0e10cSrcweir { 34cdf0e10cSrcweir //............................................................................. 35cdf0e10cSrcweir 36cdf0e10cSrcweir //----------------------------------------------------------------------------- 37cdf0e10cSrcweir /** 38cdf0e10cSrcweir */ 39cdf0e10cSrcweir 40cdf0e10cSrcweir class VCartesianAxis : public VAxisBase 41cdf0e10cSrcweir { 42cdf0e10cSrcweir //------------------------------------------------------------------------- 43cdf0e10cSrcweir // public methods 44cdf0e10cSrcweir //------------------------------------------------------------------------- 45cdf0e10cSrcweir public: 46cdf0e10cSrcweir VCartesianAxis( const AxisProperties& rAxisProperties 47cdf0e10cSrcweir , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier 48cdf0e10cSrcweir , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount 49cdf0e10cSrcweir , PlottingPositionHelper* pPosHelper = NULL //takes ownership 50cdf0e10cSrcweir ); 51cdf0e10cSrcweir 52cdf0e10cSrcweir virtual ~VCartesianAxis(); 53cdf0e10cSrcweir 54cdf0e10cSrcweir virtual void createMaximumLabels(); 55cdf0e10cSrcweir virtual void createLabels(); 56cdf0e10cSrcweir virtual void updatePositions(); 57cdf0e10cSrcweir 58cdf0e10cSrcweir virtual void createShapes(); 59cdf0e10cSrcweir 60cdf0e10cSrcweir virtual sal_Int32 estimateMaximumAutoMainIncrementCount(); 61cdf0e10cSrcweir virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ); 62cdf0e10cSrcweir void createAllTickInfosFromComplexCategories( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShiftedPosition ); 63cdf0e10cSrcweir 64cdf0e10cSrcweir ::std::auto_ptr< TickIter > createLabelTickIterator( sal_Int32 nTextLevel ); 65cdf0e10cSrcweir ::std::auto_ptr< TickIter > createMaximumLabelTickIterator( sal_Int32 nTextLevel ); 66cdf0e10cSrcweir sal_Int32 getTextLevelCount() const; 67cdf0e10cSrcweir 68cdf0e10cSrcweir //------------------------------------------------------------------------- 69cdf0e10cSrcweir virtual TickFactory* createTickFactory(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir //------------------------------------------------------------------------- 72cdf0e10cSrcweir double getLogicValueWhereMainLineCrossesOtherAxis() const; 73cdf0e10cSrcweir double getLogicValueWhereLabelLineCrossesOtherAxis() const; 74cdf0e10cSrcweir bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis) const; 75cdf0e10cSrcweir void get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir //------------------------------------------------------------------------- 78cdf0e10cSrcweir //Layout interface for cartesian axes: 79cdf0e10cSrcweir 80cdf0e10cSrcweir //the returned value describes the minimum size that is necessary 81cdf0e10cSrcweir //for the text labels in the direction orthogonal to the axis 82cdf0e10cSrcweir //(for an y-axis a width is returned; in case of an x-axis the value describes a height) 83cdf0e10cSrcweir //the return value is measured in screen dimension 84cdf0e10cSrcweir //As an example the MinimumOrthogonalSize of an x-axis equals the 85cdf0e10cSrcweir //Font Height if the label properties allow for labels parallel to the axis. 86cdf0e10cSrcweir // sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ ); 87cdf0e10cSrcweir //Minimum->Preferred 88cdf0e10cSrcweir 89cdf0e10cSrcweir //returns true if the MinimumOrthogonalSize can be calculated 90cdf0e10cSrcweir //with the creation of at most one text shape 91cdf0e10cSrcweir //(this is e.g. true if the parameters allow for labels parallel to the axis.) 92cdf0e10cSrcweir // sal_bool canQuicklyCalculateMinimumOrthogonalSize(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir 95cdf0e10cSrcweir //------------------------------------------------------------------------- 96cdf0e10cSrcweir //------------------------------------------------------------------------- 97cdf0e10cSrcweir 98cdf0e10cSrcweir struct ScreenPosAndLogicPos 99cdf0e10cSrcweir { 100cdf0e10cSrcweir double fLogicX; 101cdf0e10cSrcweir double fLogicY; 102cdf0e10cSrcweir double fLogicZ; 103cdf0e10cSrcweir 104cdf0e10cSrcweir B2DVector aScreenPos; 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir protected: //methods 108cdf0e10cSrcweir bool createTextShapes( const ::com::sun::star::uno::Reference< 109cdf0e10cSrcweir ::com::sun::star::drawing::XShapes >& xTarget 110cdf0e10cSrcweir , TickIter& rTickIter 111cdf0e10cSrcweir , AxisLabelProperties& rAxisLabelProperties 112cdf0e10cSrcweir , TickFactory_2D* pTickFactory 113cdf0e10cSrcweir , sal_Int32 nScreenDistanceBetweenTicks ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory_2D& rTickFactory2D, bool bOnlyAtLabels ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir TickFactory_2D* createTickFactory2D(); 118cdf0e10cSrcweir void hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const; 119cdf0e10cSrcweir 120cdf0e10cSrcweir void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties 121cdf0e10cSrcweir , TickFactory_2D* pTickFactory2D ); 122cdf0e10cSrcweir bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties 123cdf0e10cSrcweir , bool bIsHorizontalAxis, bool bIsVerticalAxis ); 124cdf0e10cSrcweir bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const; 127cdf0e10cSrcweir ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const; 128cdf0e10cSrcweir }; 129cdf0e10cSrcweir 130cdf0e10cSrcweir //............................................................................. 131cdf0e10cSrcweir } //namespace chart 132cdf0e10cSrcweir //............................................................................. 133cdf0e10cSrcweir #endif 134