Branch data Line data Source code
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 : : #ifndef _CHART2_VCARTESIANAXIS_HXX
20 : : #define _CHART2_VCARTESIANAXIS_HXX
21 : :
22 : : #include "VAxisBase.hxx"
23 : : #include <basegfx/vector/b2dvector.hxx>
24 : :
25 : : #include <memory>
26 : :
27 : : //.............................................................................
28 : : namespace chart
29 : : {
30 : : //.............................................................................
31 : :
32 : : //-----------------------------------------------------------------------------
33 : : /**
34 : : */
35 : :
36 : : class VCartesianAxis : public VAxisBase
37 : : {
38 : : //-------------------------------------------------------------------------
39 : : // public methods
40 : : //-------------------------------------------------------------------------
41 : : public:
42 : : VCartesianAxis( const AxisProperties& rAxisProperties
43 : : , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
44 : : , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount
45 : : , PlottingPositionHelper* pPosHelper = NULL //takes ownership
46 : : );
47 : :
48 : : virtual ~VCartesianAxis();
49 : :
50 : : virtual void createMaximumLabels();
51 : : virtual void createLabels();
52 : : virtual void updatePositions();
53 : :
54 : : virtual void createShapes();
55 : :
56 : : virtual sal_Int32 estimateMaximumAutoMainIncrementCount();
57 : : virtual void createAllTickInfos( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
58 : : void createAllTickInfosFromComplexCategories( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos, bool bShiftedPosition );
59 : :
60 : : TickIter* createLabelTickIterator( sal_Int32 nTextLevel );
61 : : TickIter* createMaximumLabelTickIterator( sal_Int32 nTextLevel );
62 : : sal_Int32 getTextLevelCount() const;
63 : :
64 : : //-------------------------------------------------------------------------
65 : : virtual TickFactory* createTickFactory();
66 : :
67 : : //-------------------------------------------------------------------------
68 : : double getLogicValueWhereMainLineCrossesOtherAxis() const;
69 : : double getLogicValueWhereLabelLineCrossesOtherAxis() const;
70 : : bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis) const;
71 : : void get2DAxisMainLine( ::basegfx::B2DVector& rStart, ::basegfx::B2DVector& rEnd, double fCrossesOtherAxis );
72 : :
73 : : //-------------------------------------------------------------------------
74 : : //Layout interface for cartesian axes:
75 : :
76 : : //the returned value describes the minimum size that is necessary
77 : : //for the text labels in the direction orthogonal to the axis
78 : : //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
79 : : //the return value is measured in screen dimension
80 : : //As an example the MinimumOrthogonalSize of an x-axis equals the
81 : : //Font Height if the label properties allow for labels parallel to the axis.
82 : : // sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
83 : : //Minimum->Preferred
84 : :
85 : : //returns true if the MinimumOrthogonalSize can be calculated
86 : : //with the creation of at most one text shape
87 : : //(this is e.g. true if the parameters allow for labels parallel to the axis.)
88 : : // sal_bool canQuicklyCalculateMinimumOrthogonalSize();
89 : :
90 : :
91 : : //-------------------------------------------------------------------------
92 : : //-------------------------------------------------------------------------
93 : :
94 : 0 : struct ScreenPosAndLogicPos
95 : : {
96 : : double fLogicX;
97 : : double fLogicY;
98 : : double fLogicZ;
99 : :
100 : : B2DVector aScreenPos;
101 : : };
102 : :
103 : : protected: //methods
104 : : bool createTextShapes( const ::com::sun::star::uno::Reference<
105 : : ::com::sun::star::drawing::XShapes >& xTarget
106 : : , TickIter& rTickIter
107 : : , AxisLabelProperties& rAxisLabelProperties
108 : : , TickFactory_2D* pTickFactory
109 : : , sal_Int32 nScreenDistanceBetweenTicks );
110 : :
111 : : void createTickMarkLineShapes( ::std::vector< TickInfo >& rTickInfos, const TickmarkProperties& rTickmarkProperties, TickFactory_2D& rTickFactory2D, bool bOnlyAtLabels );
112 : :
113 : : TickFactory_2D* createTickFactory2D();
114 : : void hideIdenticalScreenValues( ::std::vector< ::std::vector< TickInfo > >& rTickInfos ) const;
115 : :
116 : : void doStaggeringOfLabels( const AxisLabelProperties& rAxisLabelProperties
117 : : , TickFactory_2D* pTickFactory2D );
118 : : bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties
119 : : , bool bIsHorizontalAxis, bool bIsVerticalAxis );
120 : : bool isBreakOfLabelsAllowed( const AxisLabelProperties& rAxisLabelProperties, bool bIsHorizontalAxis );
121 : :
122 : : ::basegfx::B2DVector getScreenPosition( double fLogicX, double fLogicY, double fLogicZ ) const;
123 : : ScreenPosAndLogicPos getScreenPosAndLogicPos( double fLogicX, double fLogicY, double fLogicZ ) const;
124 : : };
125 : :
126 : : //.............................................................................
127 : : } //namespace chart
128 : : //.............................................................................
129 : : #endif
130 : :
131 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|