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