1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CHART2_VAXISBASE_HXX
28 #define _CHART2_VAXISBASE_HXX
29 
30 #include "VAxisOrGridBase.hxx"
31 #include "VAxisProperties.hxx"
32 #include "Tickmarks.hxx"
33 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
34 
35 //.............................................................................
36 namespace chart
37 {
38 //.............................................................................
39 
40 //-----------------------------------------------------------------------------
41 /**
42 */
43 
44 class VAxisBase : public VAxisOrGridBase
45 {
46 public:
47     VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
48            , const AxisProperties& rAxisProperties
49            , const ::com::sun::star::uno::Reference<
50                     ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
51     virtual ~VAxisBase();
52 
53     sal_Int32 getDimensionCount();
54 
55     virtual void createMaximumLabels()=0;
56     virtual void createLabels()=0;
57     virtual void updatePositions()=0;
58 
59     virtual sal_Bool isAnythingToDraw();
60     virtual void initAxisLabelProperties(
61                     const ::com::sun::star::awt::Size& rFontReferenceSize
62                   , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
63 
64     virtual void setExplicitScaleAndIncrement(
65             const ExplicitScaleData& rScale
66           , const ExplicitIncrementData& rIncrement )
67                 throw (::com::sun::star::uno::RuntimeException);
68 
69     virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
70     virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
71 
72     void setExrtaLinePositionAtOtherAxis( const double& fCrossingAt );
73 
74     //-------------------------------------------------------------------------
75     //-------------------------------------------------------------------------
76 protected: //methods
77     sal_Int32 getIndexOfLongestLabel( const ::com::sun::star::uno::Sequence< rtl::OUString >& rLabels );
78     void removeTextShapesFromTicks();
79     void updateUnscaledValuesAtTicks( TickIter& rIter );
80 
81     virtual bool prepareShapeCreation();
82     void recordMaximumTextSize( const ::com::sun::star::uno::Reference<
83                     ::com::sun::star::drawing::XShape >& xShape
84                     , double fRotationAngleDegree );
85 
86     bool isDateAxis() const;
87     bool isComplexCategoryAxis() const;
88 
89 protected: //member
90     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  m_xNumberFormatsSupplier;
91     AxisProperties                                                                      m_aAxisProperties;
92     AxisLabelProperties                                                                 m_aAxisLabelProperties;
93     ::com::sun::star::uno::Sequence< rtl::OUString >                                    m_aTextLabels;
94     bool                                                                                m_bUseTextLabels;
95 
96     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xGroupShape_Shapes;
97     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xTextTarget;
98 
99     ::std::vector< ::std::vector< TickInfo > >                                          m_aAllTickInfos;
100     bool m_bReCreateAllTickInfos;
101 
102     bool m_bRecordMaximumTextSize;
103     sal_Int32 m_nMaximumTextWidthSoFar;
104     sal_Int32 m_nMaximumTextHeightSoFar;
105 };
106 
107 //.............................................................................
108 } //namespace chart
109 //.............................................................................
110 #endif
111