fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / axes / Tickmarks.hxx
blobb9ecc35bd6458cb4a4dca5b1b2ddf9dffe2ec7e9
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_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_AXES_TICKMARKS_HXX
22 #include "TickmarkProperties.hxx"
23 #include "VAxisProperties.hxx"
24 #include "chartview/ExplicitScaleValues.hxx"
25 #include <basegfx/vector/b2dvector.hxx>
26 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/uno/Sequence.h>
30 #include <vector>
32 namespace chart {
34 struct TickInfo
36 double fScaledTickValue;
37 css::uno::Reference<css::chart2::XScaling> xInverseScaling;
39 ::basegfx::B2DVector aTickScreenPosition;
40 bool bPaintIt;
42 css::uno::Reference<css::drawing::XShape> xTextShape;
44 OUString aText;//used only for complex categories so far
45 sal_Int32 nFactorForLimitedTextWidth;//categories in higher levels of complex categories can have more place than a single simple category
47 //methods:
48 TickInfo( const css::uno::Reference<css::chart2::XScaling>& xInverse );
50 /**
51 * Return a value associated with the tick mark. It's normally an original
52 * value from the data source, or 1-based integer index in case the axis
53 * is a category axis.
55 double getUnscaledTickValue() const;
56 sal_Int32 getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const;
57 private:
58 TickInfo();
61 typedef std::vector<TickInfo> TickInfoArrayType;
62 typedef std::vector<TickInfoArrayType> TickInfoArraysType;
64 class TickIter
66 public:
67 virtual ~TickIter() {}
68 virtual TickInfo* firstInfo() = 0;
69 virtual TickInfo* nextInfo() = 0;
72 class PureTickIter : public TickIter
74 public:
75 PureTickIter( TickInfoArrayType& rTickInfoVector );
76 virtual ~PureTickIter();
77 virtual TickInfo* firstInfo() SAL_OVERRIDE;
78 virtual TickInfo* nextInfo() SAL_OVERRIDE;
80 private:
81 TickInfoArrayType& m_rTickVector;
82 TickInfoArrayType::iterator m_aTickIter;
85 class TickFactory
87 public:
88 TickFactory(
89 const ExplicitScaleData& rScale
90 , const ExplicitIncrementData& rIncrement );
91 virtual ~TickFactory();
93 void getAllTicks( TickInfoArraysType& rAllTickInfos ) const;
94 void getAllTicksShifted( TickInfoArraysType& rAllTickInfos ) const;
96 /**
97 * Determine the screen positions of all ticks based on their numeric values.
99 virtual void updateScreenValues( TickInfoArraysType& rAllTickInfos ) const;
101 private: //methods
102 bool isDateAxis() const;
104 protected: //member
105 ExplicitScaleData m_rScale;
106 ExplicitIncrementData m_rIncrement;
107 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >
108 m_xInverseScaling;
110 //minimum and maximum of the visible range after scaling
111 double m_fScaledVisibleMin;
112 double m_fScaledVisibleMax;
115 class TickFactory2D : public TickFactory
117 public:
118 TickFactory2D(
119 const ExplicitScaleData& rScale
120 , const ExplicitIncrementData& rIncrement
121 , const ::basegfx::B2DVector& rStartScreenPos, const ::basegfx::B2DVector& rEndScreenPos
122 , const ::basegfx::B2DVector& rAxisLineToLabelLineShift );
124 virtual ~TickFactory2D();
126 static sal_Int32 getTickScreenDistance( TickIter& rIter );
128 void createPointSequenceForAxisMainLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints ) const;
129 void addPointSequenceForTickLine( ::com::sun::star::drawing::PointSequenceSequence& rPoints
130 , sal_Int32 nSequenceIndex
131 , double fScaledLogicTickValue, double fInnerDirectionSign
132 , const TickmarkProperties& rTickmarkProperties, bool bPlaceAtLabels ) const;
133 ::basegfx::B2DVector getDistanceAxisTickToText( const AxisProperties& rAxisProperties
134 , bool bIncludeFarAwayDistanceIfSo = false
135 , bool bIncludeSpaceBetweenTickAndText = true ) const;
137 virtual void updateScreenValues( TickInfoArraysType& rAllTickInfos ) const SAL_OVERRIDE;
139 bool isHorizontalAxis() const;
140 bool isVerticalAxis() const;
142 protected: //methods
143 ::basegfx::B2DVector getTickScreenPosition2D( double fScaledLogicTickValue ) const;
145 private: //member
146 ::basegfx::B2DVector m_aAxisStartScreenPosition2D;
147 ::basegfx::B2DVector m_aAxisEndScreenPosition2D;
149 //labels might be posioned high or low on the border of the diagram far away from the axis
150 //add this vector to go from the axis line to the label line (border of the diagram)
151 ::basegfx::B2DVector m_aAxisLineToLabelLineShift;
153 double m_fStretch_LogicToScreen;
154 double m_fOffset_LogicToScreen;
157 } //namespace chart
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */