LibreOffice Module chart2 (master) 1
VCartesianAxis.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include "VAxisBase.hxx"
23
24namespace chart
25{
27{
28 // public methods
29public:
30 VCartesianAxis( const AxisProperties& rAxisProperties
31 , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
32 , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
33 , PlottingPositionHelper* pPosHelper = nullptr //takes ownership
34 );
35
36 virtual ~VCartesianAxis() override;
37
38 virtual void createMaximumLabels() override;
39 virtual void createLabels() override;
40 virtual void updatePositions() override;
41
42 virtual void createShapes() override;
43
44 virtual sal_Int32 estimateMaximumAutoMainIncrementCount() override;
45 virtual void createAllTickInfos( TickInfoArraysType& rAllTickInfos ) override;
46 void createAllTickInfosFromComplexCategories( TickInfoArraysType& rAllTickInfos, bool bShiftedPosition );
47
48 TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
49 TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
50 sal_Int32 getTextLevelCount() const;
51
52 virtual TickFactory* createTickFactory() override;
53
57 double getAxisIntersectionValue() const;
58
62 double getLabelLineIntersectionValue() const;
63
70 double getExtraLineIntersectionValue() const;
71
73 basegfx::B2DVector& rStart, basegfx::B2DVector& rEnd, AxisLabelAlignment& rLabelAlignment,
74 double fCrossesOtherAxis ) const;
75
76 //Layout interface for cartesian axes:
77
78 //the returned value describes the minimum size that is necessary
79 //for the text labels in the direction orthogonal to the axis
80 //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
81 //the return value is measured in screen dimension
82 //As an example the MinimumOrthogonalSize of an x-axis equals the
83 //Font Height if the label properties allow for labels parallel to the axis.
84// sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
85 //Minimum->Preferred
86
87 //returns true if the MinimumOrthogonalSize can be calculated
88 //with the creation of at most one text shape
89 //(this is e.g. true if the parameters allow for labels parallel to the axis.)
90// sal_bool canQuicklyCalculateMinimumOrthogonalSize();
91
93 {
94 double fLogicX;
95 double fLogicY;
96 double fLogicZ;
97
99 };
100
101 void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
102 css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier,
104 css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) override;
105private: //methods
122 bool createTextShapes(
124 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
125 TickFactory2D const * pTickFactory, sal_Int32 nScreenDistanceBetweenTicks );
126
134 TickIter& rTickIter, AxisLabelProperties& rAxisLabelProperties,
135 TickFactory2D const * pTickFactory );
136
137 void createTickMarkLineShapes( TickInfoArrayType& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory2D const & rTickFactory2D, bool bOnlyAtLabels );
138
140 void hideIdenticalScreenValues( TickInfoArraysType& rTickInfos ) const;
141
148 void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
149 , TickFactory2D const * pTickFactory2D );
150
155 bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis ) const;
156
157 ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
158 ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
159
160 void createDataTableShape(std::unique_ptr<TickFactory2D> const& rTickFactory2D);
161};
162
163} //namespace chart
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void updatePositions() override
bool createTextShapesSimple(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, TickIter &rTickIter, AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory)
Variant of createTextShapes where none of auto-staggering and link-breaking are allowed in case of ov...
virtual void createLabels() override
virtual void createMaximumLabels() override
bool isBreakOfLabelsAllowed(const AxisLabelProperties &rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis) const
virtual void createShapes() override
void createTickMarkLineShapes(TickInfoArrayType &rTickInfos, const TickmarkProperties &rTickmarkProperties, TickFactory2D const &rTickFactory2D, bool bOnlyAtLabels)
VCartesianAxis(const AxisProperties &rAxisProperties, const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount, PlottingPositionHelper *pPosHelper=nullptr)
void createAllTickInfosFromComplexCategories(TickInfoArraysType &rAllTickInfos, bool bShiftedPosition)
void get2DAxisMainLine(basegfx::B2DVector &rStart, basegfx::B2DVector &rEnd, AxisLabelAlignment &rLabelAlignment, double fCrossesOtherAxis) const
ScreenPosAndLogicPos getScreenPosAndLogicPos(double fLogicX, double fLogicY, double fLogicZ) const
TickIter * createLabelTickIterator(sal_Int32 nTextLevel)
void hideIdenticalScreenValues(TickInfoArraysType &rTickInfos) const
bool createTextShapes(const rtl::Reference< SvxShapeGroupAnyD > &xTarget, TickIter &rTickIter, AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory, sal_Int32 nScreenDistanceBetweenTicks)
Go through all tick label positions and decide which labels to display based on the text shape geomet...
virtual ~VCartesianAxis() override
virtual TickFactory * createTickFactory() override
virtual void createAllTickInfos(TickInfoArraysType &rAllTickInfos) override
double getExtraLineIntersectionValue() const
Get the value at which extra line crosses the other axis.
void doStaggeringOfLabels(const AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory2D)
Shift the screen positions of the tick labels according to the stagger settings.
void createDataTableView(std::vector< std::unique_ptr< VSeriesPlotter > > &rSeriesPlotterList, css::uno::Reference< css::util::XNumberFormatsSupplier > const &xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel > const &xChartDoc, css::uno::Reference< css::uno::XComponentContext > const &rComponentContext) override
::basegfx::B2DVector getScreenPosition(double fLogicX, double fLogicY, double fLogicZ) const
double getLabelLineIntersectionValue() const
Get the value at which label line crosses the other axis.
void createDataTableShape(std::unique_ptr< TickFactory2D > const &rTickFactory2D)
TickFactory2D * createTickFactory2D()
double getAxisIntersectionValue() const
Get the value at which the other axis crosses.
virtual sal_Int32 estimateMaximumAutoMainIncrementCount() override
sal_Int32 getTextLevelCount() const
TickIter * createMaximumLabelTickIterator(sal_Int32 nTextLevel)
std::vector< TickInfoArrayType > TickInfoArraysType
Definition: Tickmarks.hxx:59
std::vector< TickInfo > TickInfoArrayType
Definition: Tickmarks.hxx:58