nss: upgrade to release 3.73
[LibreOffice.git] / chart2 / source / view / axes / VCartesianAxis.hxx
blob7474c38b6c49faa9582e6971752cf1c9798a60d2
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 #pragma once
21 #include "VAxisBase.hxx"
22 #include <basegfx/vector/b2dvector.hxx>
24 namespace chart
27 class VCartesianAxis : public VAxisBase
29 // public methods
30 public:
31 VCartesianAxis( const AxisProperties& rAxisProperties
32 , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
33 , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
34 , PlottingPositionHelper* pPosHelper = nullptr //takes ownership
37 virtual ~VCartesianAxis() override;
39 virtual void createMaximumLabels() override;
40 virtual void createLabels() override;
41 virtual void updatePositions() override;
43 virtual void createShapes() override;
45 virtual sal_Int32 estimateMaximumAutoMainIncrementCount() override;
46 virtual void createAllTickInfos( TickInfoArraysType& rAllTickInfos ) override;
47 void createAllTickInfosFromComplexCategories( TickInfoArraysType& rAllTickInfos, bool bShiftedPosition );
49 TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
50 TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
51 sal_Int32 getTextLevelCount() const;
53 virtual TickFactory* createTickFactory() override;
55 /**
56 * Get the value at which the other axis crosses.
58 double getAxisIntersectionValue() const;
60 /**
61 * Get the value at which label line crosses the other axis.
63 double getLabelLineIntersectionValue() const;
65 /**
66 * Get the value at which extra line crosses the other axis.
68 * @return a NaN if the line doesn't cross the other axis, a non-NaN value
69 * otherwise.
71 double getExtraLineIntersectionValue() const;
73 void get2DAxisMainLine(
74 basegfx::B2DVector& rStart, basegfx::B2DVector& rEnd, AxisLabelAlignment& rLabelAlignment,
75 double fCrossesOtherAxis ) const;
77 //Layout interface for cartesian axes:
79 //the returned value describes the minimum size that is necessary
80 //for the text labels in the direction orthogonal to the axis
81 //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
82 //the return value is measured in screen dimension
83 //As an example the MinimumOrthogonalSize of an x-axis equals the
84 //Font Height if the label properties allow for labels parallel to the axis.
85 // sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
86 //Minimum->Preferred
88 //returns true if the MinimumOrthogonalSize can be calculated
89 //with the creation of at most one text shape
90 //(this is e.g. true if the parameters allow for labels parallel to the axis.)
91 // sal_bool canQuicklyCalculateMinimumOrthogonalSize();
93 struct ScreenPosAndLogicPos
95 double fLogicX;
96 double fLogicY;
97 double fLogicZ;
99 ::basegfx::B2DVector aScreenPos;
102 private: //methods
104 * Go through all tick label positions and decide which labels to display
105 * based on the text shape geometry, overlap setting, tick interval,
106 * auto-stagger setting etc.
108 * When the auto-stagger setting is on, try to avoid overlaps by
109 * staggering labels or set the labels at an angle. This method may
110 * change the axis label properties especially when the auto staggering is
111 * performed. But the screen label positions will not be shifted in this
112 * method; it will be done in the doStaggeringOfLabels method.
114 * @return true if the text shapes have been successfully created,
115 * otherwise false. Returning false means the AxisLabelProperties
116 * have changed during the call, and the caller needs to call this
117 * method once again to get the text shapes created.
119 bool createTextShapes(
120 const css::uno::Reference<css::drawing::XShapes >& xTarget,
121 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
122 TickFactory2D const * pTickFactory, sal_Int32 nScreenDistanceBetweenTicks );
125 * Variant of createTextShapes where none of auto-staggering and
126 * link-breaking are allowed in case of overlaps. Overlaps of text shapes
127 * are to be resolved only by adjusting the label tick interval.
129 bool createTextShapesSimple(
130 const css::uno::Reference<css::drawing::XShapes >& xTarget,
131 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
132 TickFactory2D const * pTickFactory );
134 void createTickMarkLineShapes( TickInfoArrayType& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory2D const & rTickFactory2D, bool bOnlyAtLabels );
136 TickFactory2D* createTickFactory2D();
137 void hideIdenticalScreenValues( TickInfoArraysType& rTickInfos ) const;
140 * Shift the screen positions of the tick labels according to the stagger
141 * settings. Final stagger setting is decided during the createTextShapes
142 * call, but this method does the physical shifting of the label
143 * positions based on the final stagger setting.
145 void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
146 , TickFactory2D const * pTickFactory2D );
149 * @return true if we can break a single line label text into multiple
150 * lines for better fitting, otherwise false.
152 bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis ) const;
154 ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
155 ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
158 } //namespace chart
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */