xref: /trunk/main/chart2/source/view/axes/VAxisBase.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _CHART2_VAXISBASE_HXX
24 #define _CHART2_VAXISBASE_HXX
25 
26 #include "VAxisOrGridBase.hxx"
27 #include "VAxisProperties.hxx"
28 #include "Tickmarks.hxx"
29 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
30 
31 //.............................................................................
32 namespace chart
33 {
34 //.............................................................................
35 
36 //-----------------------------------------------------------------------------
37 /**
38 */
39 
40 class VAxisBase : public VAxisOrGridBase
41 {
42 public:
43     VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
44            , const AxisProperties& rAxisProperties
45            , const ::com::sun::star::uno::Reference<
46                     ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
47     virtual ~VAxisBase();
48 
49     sal_Int32 getDimensionCount();
50 
51     virtual void createMaximumLabels()=0;
52     virtual void createLabels()=0;
53     virtual void updatePositions()=0;
54 
55     virtual sal_Bool isAnythingToDraw();
56     virtual void initAxisLabelProperties(
57                     const ::com::sun::star::awt::Size& rFontReferenceSize
58                   , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
59 
60     virtual void setExplicitScaleAndIncrement(
61             const ExplicitScaleData& rScale
62           , const ExplicitIncrementData& rIncrement );
63 
64     virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
65     virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
66 
67     void setExrtaLinePositionAtOtherAxis( const double& fCrossingAt );
68 
69     //-------------------------------------------------------------------------
70     //-------------------------------------------------------------------------
71 protected: //methods
72     sal_Int32 getIndexOfLongestLabel( const ::com::sun::star::uno::Sequence< rtl::OUString >& rLabels );
73     void removeTextShapesFromTicks();
74     void updateUnscaledValuesAtTicks( TickIter& rIter );
75 
76     virtual bool prepareShapeCreation();
77     void recordMaximumTextSize( const ::com::sun::star::uno::Reference<
78                     ::com::sun::star::drawing::XShape >& xShape
79                     , double fRotationAngleDegree );
80 
81     bool isDateAxis() const;
82     bool isComplexCategoryAxis() const;
83 
84 protected: //member
85     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  m_xNumberFormatsSupplier;
86     AxisProperties                                                                      m_aAxisProperties;
87     AxisLabelProperties                                                                 m_aAxisLabelProperties;
88     ::com::sun::star::uno::Sequence< rtl::OUString >                                    m_aTextLabels;
89     bool                                                                                m_bUseTextLabels;
90 
91     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape_Shapes;
92     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xTextTarget;
93 
94     ::std::vector< ::std::vector< TickInfo > >                                          m_aAllTickInfos;
95     bool m_bReCreateAllTickInfos;
96 
97     bool m_bRecordMaximumTextSize;
98     sal_Int32 m_nMaximumTextWidthSoFar;
99     sal_Int32 m_nMaximumTextHeightSoFar;
100 };
101 
102 //.............................................................................
103 } //namespace chart
104 //.............................................................................
105 #endif
106