fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / view / axes / VCartesianAxis.hxx
blobc1937a48ef6db55e418952b97885eeefff5ad20f
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_VCARTESIANAXIS_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_AXES_VCARTESIANAXIS_HXX
22 #include "VAxisBase.hxx"
23 #include <basegfx/vector/b2dvector.hxx>
25 namespace chart
28 class VCartesianAxis : public VAxisBase
30 // public methods
31 public:
32 VCartesianAxis( const AxisProperties& rAxisProperties
33 , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
34 , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
35 , PlottingPositionHelper* pPosHelper = NULL //takes ownership
38 virtual ~VCartesianAxis();
40 virtual void createMaximumLabels() SAL_OVERRIDE;
41 virtual void createLabels() SAL_OVERRIDE;
42 virtual void updatePositions() SAL_OVERRIDE;
44 virtual void createShapes() SAL_OVERRIDE;
46 virtual sal_Int32 estimateMaximumAutoMainIncrementCount() SAL_OVERRIDE;
47 virtual void createAllTickInfos( TickInfoArraysType& rAllTickInfos ) SAL_OVERRIDE;
48 void createAllTickInfosFromComplexCategories( TickInfoArraysType& rAllTickInfos, bool bShiftedPosition );
50 TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
51 TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
52 sal_Int32 getTextLevelCount() const;
54 virtual TickFactory* createTickFactory() SAL_OVERRIDE;
56 /**
57 * Get the value at which the other axis crosses.
59 double getAxisIntersectionValue() const;
61 /**
62 * Get the value at which label line crosses the other axis.
64 double getLabelLineIntersectionValue() const;
66 /**
67 * Get the value at which extra line crosses the other axis.
69 * @return a NaN if the line doesn't cross the other axis, a non-NaN value
70 * otherwise.
72 double getExtraLineIntersectionValue() const;
74 void get2DAxisMainLine(
75 basegfx::B2DVector& rStart, basegfx::B2DVector& rEnd, AxisLabelAlignment& rLabelAlignment,
76 double fCrossesOtherAxis ) const;
78 //Layout interface for cartesian axes:
80 //the returned value describes the minimum size that is necessary
81 //for the text labels in the direction orthogonal to the axis
82 //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
83 //the return value is measured in screen dimension
84 //As an example the MinimumOrthogonalSize of an x-axis equals the
85 //Font Height if the label properties allow for labels parallel to the axis.
86 // sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
87 //Minimum->Preferred
89 //returns true if the MinimumOrthogonalSize can be calculated
90 //with the creation of at most one text shape
91 //(this is e.g. true if the parameters allow for labels parallel to the axis.)
92 // sal_bool canQuicklyCalculateMinimumOrthogonalSize();
94 struct ScreenPosAndLogicPos
96 double fLogicX;
97 double fLogicY;
98 double fLogicZ;
100 ::basegfx::B2DVector aScreenPos;
103 private: //methods
105 * Go through all tick label positions and decide which labels to display
106 * based on the text shape geometry, overlap setting, tick interval,
107 * auto-stagger setting etc.
109 * When the auto-stagger setting is on, try to avoid overlaps by
110 * staggering labels or set the labels at an angle. This method may
111 * change the axis label properties especially when the auto staggering is
112 * performed. But the screen label positions will not be shifted in this
113 * method; it will be done in the doStaggeringOfLabels method.
115 * @return true if the text shapes have been successfully created,
116 * otherwise false. Returning false means the AxisLabelProperties
117 * have changed during the call, and the caller needs to call this
118 * method once again to get the text shapes created.
120 bool createTextShapes(
121 const css::uno::Reference<css::drawing::XShapes >& xTarget,
122 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
123 TickFactory2D* pTickFactory, sal_Int32 nScreenDistanceBetweenTicks );
126 * Variant of createTextShapes where none of auto-staggering and
127 * link-breaking are allowed in case of overlaps. Overlaps of text shapes
128 * are to be resolved only by adjusting the label tick interval.
130 bool createTextShapesSimple(
131 const css::uno::Reference<css::drawing::XShapes >& xTarget,
132 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
133 TickFactory2D* pTickFactory );
135 void createTickMarkLineShapes( TickInfoArrayType& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory2D& rTickFactory2D, bool bOnlyAtLabels );
137 TickFactory2D* createTickFactory2D();
138 void hideIdenticalScreenValues( TickInfoArraysType& rTickInfos ) const;
141 * Shift the screen positions of the tick labels according to the stagger
142 * settings. Final stagger setting is decided during the createTextShapes
143 * call, but this method does the physical shifting of the label
144 * positions based on the final stagger setting.
146 void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
147 , TickFactory2D* pTickFactory2D );
150 * @return true if we can try to stagger labels in order to avoid
151 * overlaps, otherwise false.
153 static bool isAutoStaggeringOfLabelsAllowed(
154 const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis );
157 * @return true if we can break a single line label text into multiple
158 * lines for better fitting, otherwise false.
160 bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis ) const;
162 ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
163 ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
166 } //namespace chart
167 #endif
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */