1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: VCartesianAxis.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART2_VCARTESIANAXIS_HXX
31 #define _CHART2_VCARTESIANAXIS_HXX
33 #include "VAxisBase.hxx"
34 #include <basegfx/vector/b2dvector.hxx>
36 //.............................................................................
39 //.............................................................................
41 //-----------------------------------------------------------------------------
45 class VCartesianAxis
: public VAxisBase
47 //-------------------------------------------------------------------------
49 //-------------------------------------------------------------------------
51 VCartesianAxis( const AxisProperties
& rAxisProperties
52 , const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>& xNumberFormatsSupplier
53 , sal_Int32 nDimensionIndex
, sal_Int32 nDimensionCount
54 , PlottingPositionHelper
* pPosHelper
= NULL
//takes ownership
57 virtual ~VCartesianAxis();
59 //-------------------------------------------------------------------------
60 // partly chart2::XPlotter
61 //-------------------------------------------------------------------------
64 virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
65 virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
68 virtual void SAL_CALL
createMaximumLabels();
69 virtual void SAL_CALL
createLabels();
70 virtual void SAL_CALL
updatePositions();
72 virtual void SAL_CALL
createShapes();
74 virtual sal_Int32
estimateMaximumAutoMainIncrementCount();
76 //-------------------------------------------------------------------------
77 virtual TickmarkHelper
* createTickmarkHelper();
79 //-------------------------------------------------------------------------
80 double getLogicValueWhereMainLineCrossesOtherAxis() const;
81 double getLogicValueWhereLabelLineCrossesOtherAxis() const;
82 bool getLogicValueWhereExtraLineCrossesOtherAxis( double& fCrossesOtherAxis
) const;
83 void get2DAxisMainLine( ::basegfx::B2DVector
& rStart
, ::basegfx::B2DVector
& rEnd
, double fCrossesOtherAxis
);
85 //-------------------------------------------------------------------------
86 //Layout interface for cartesian axes:
88 //the returned value describes the minimum size that is necessary
89 //for the text labels in the direction orthogonal to the axis
90 //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
91 //the return value is measured in screen dimension
92 //As an example the MinimumOrthogonalSize of an x-axis equals the
93 //Font Height if the label properties allow for labels parallel to the axis.
94 // sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
97 //returns true if the MinimumOrthogonalSize can be calculated
98 //with the creation of at most one text shape
99 //(this is e.g. true if the parameters allow for labels parallel to the axis.)
100 // sal_bool canQuicklyCalculateMinimumOrthogonalSize();
103 //-------------------------------------------------------------------------
104 //-------------------------------------------------------------------------
106 struct ScreenPosAndLogicPos
112 B2DVector aScreenPos
;
116 bool createTextShapes( const ::com::sun::star::uno::Reference
<
117 ::com::sun::star::drawing::XShapes
>& xTarget
118 , TickIter
& rTickIter
119 , AxisLabelProperties
& rAxisLabelProperties
120 , TickmarkHelper_2D
* pTickmarkHelper
);
122 TickmarkHelper_2D
* createTickmarkHelper2D();
124 void doStaggeringOfLabels( const AxisLabelProperties
& rAxisLabelProperties
125 , TickmarkHelper_2D
* pTickmarkHelper2D
);
126 bool isAutoStaggeringOfLabelsAllowed( const AxisLabelProperties
& rAxisLabelProperties
127 , TickmarkHelper_2D
* pTickmarkHelper
);
128 bool isBreakOfLabelsAllowed( const AxisLabelProperties
& rAxisLabelProperties
129 , TickmarkHelper_2D
* pTickmarkHelper
);
131 ::basegfx::B2DVector
getScreenPosition( double fLogicX
, double fLogicY
, double fLogicZ
) const;
132 ScreenPosAndLogicPos
getScreenPosAndLogicPos( double fLogicX
, double fLogicY
, double fLogicZ
) const;
135 //.............................................................................
137 //.............................................................................