fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / axes / Tickmarks_Equidistant.hxx
blob259708ffc606d37c02a88b9e5bc20a162a22c810
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_EQUIDISTANT_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_EQUIDISTANT_HXX
22 #include "Tickmarks.hxx"
24 namespace chart
27 class EquidistantTickIter : public TickIter
29 public:
30 EquidistantTickIter( const ::com::sun::star::uno::Sequence<
31 ::com::sun::star::uno::Sequence< double > >& rTicks
32 , const ExplicitIncrementData& rIncrement
33 , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
34 EquidistantTickIter( TickInfoArraysType& rTickInfos
35 , const ExplicitIncrementData& rIncrement
36 , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
37 virtual ~EquidistantTickIter();
39 double* firstValue();
40 double* nextValue();
42 virtual TickInfo* firstInfo() SAL_OVERRIDE;
43 virtual TickInfo* nextInfo() SAL_OVERRIDE;
45 sal_Int32 getCurrentDepth() const { return m_nCurrentDepth; }
47 private: //methods
48 sal_Int32 getIntervalCount( sal_Int32 nDepth );
49 bool isAtLastPartTick();
51 void initIter( sal_Int32 nMinDepth, sal_Int32 nMaxDepth );
52 sal_Int32 getStartDepth() const;
54 bool gotoFirst();
55 bool gotoNext();
57 double getTickValue(sal_Int32 nDepth, sal_Int32 nIndex) const
59 if(m_pSimpleTicks)
60 return (*m_pSimpleTicks)[nDepth][nIndex];
61 else
62 return (((*m_pInfoTicks)[nDepth])[nIndex]).fScaledTickValue;
64 sal_Int32 getTickCount( sal_Int32 nDepth ) const
66 if(m_pSimpleTicks)
67 return (*m_pSimpleTicks)[nDepth].getLength();
68 else
69 return (*m_pInfoTicks)[nDepth].size();
71 sal_Int32 getMaxDepth() const
73 if(m_pSimpleTicks)
74 return (*m_pSimpleTicks).getLength()-1;
75 else
76 return (*m_pInfoTicks).size()-1;
79 private: //member
80 const ::com::sun::star::uno::Sequence<
81 ::com::sun::star::uno::Sequence< double > >* m_pSimpleTicks;
82 TickInfoArraysType* m_pInfoTicks;
83 const ExplicitIncrementData& m_rIncrement;
84 sal_Int32 m_nMaxDepth;
85 sal_Int32 m_nTickCount;
86 sal_Int32* m_pnPositions; //current positions in the different sequences
87 sal_Int32* m_pnPreParentCount; //the tickmarks do not start with a major tick always,
88 //the PreParentCount states for each depth how many subtickmarks are available in front of the first parent tickmark
89 bool* m_pbIntervalFinished;
90 sal_Int32 m_nCurrentDepth;
91 sal_Int32 m_nCurrentPos;
92 double m_fCurrentValue;
95 class EquidistantTickFactory
97 public:
98 EquidistantTickFactory(
99 const ExplicitScaleData& rScale
100 , const ExplicitIncrementData& rIncrement );
101 ~EquidistantTickFactory();
103 void getAllTicks( TickInfoArraysType& rAllTickInfos ) const;
104 void getAllTicksShifted( TickInfoArraysType& rAllTickInfos ) const;
106 static double getMinimumAtIncrement( double fMin, const ExplicitIncrementData& rIncrement );
107 static double getMaximumAtIncrement( double fMax, const ExplicitIncrementData& rIncrement );
109 private: //methods
110 void addSubTicks( sal_Int32 nDepth,
111 ::com::sun::star::uno::Sequence<
112 ::com::sun::star::uno::Sequence< double > >& rParentTicks ) const;
113 double* getMajorTick( sal_Int32 nTick ) const;
114 double* getMinorTick( sal_Int32 nTick, sal_Int32 nDepth
115 , double fStartParentTick, double fNextParentTick ) const;
116 sal_Int32 getMaxTickCount( sal_Int32 nDepth = 0 ) const;
117 sal_Int32 getTickDepth() const;
119 bool isVisible( double fValue ) const;
120 bool isWithinOuterBorder( double fScaledValue ) const; //all within the outer major tick marks
122 private: //member
123 ExplicitScaleData m_rScale;
124 ExplicitIncrementData m_rIncrement;
125 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
126 m_xInverseScaling;
128 //minimum and maximum of the visible range after scaling
129 double m_fScaledVisibleMin;
130 double m_fScaledVisibleMax;
132 double* m_pfCurrentValues;
133 //major-tick positions that may lay outside the visible range but complete partly visible intervals at the borders
134 double m_fOuterMajorTickBorderMin;
135 double m_fOuterMajorTickBorderMax;
136 double m_fOuterMajorTickBorderMin_Scaled;
137 double m_fOuterMajorTickBorderMax_Scaled;
140 } //namespace chart
141 #endif
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */