1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _CHART2_EXPLICITVALUEPROVIDER_HXX
28 #define _CHART2_EXPLICITVALUEPROVIDER_HXX
29 
30 #include "ExplicitScaleValues.hxx"
31 
32 #include <boost/shared_ptr.hpp>
33 #include <com/sun/star/chart2/XAxis.hpp>
34 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
35 #include <com/sun/star/chart2/XDataSeries.hpp>
36 #include <com/sun/star/chart2/XDiagram.hpp>
37 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <com/sun/star/frame/XModel.hpp>
39 #include <com/sun/star/drawing/XShape.hpp>
40 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
41 #include "chartviewdllapi.hxx"
42 
43 //.............................................................................
44 namespace chart
45 {
46 //.............................................................................
47 
48 //-----------------------------------------------------------------------------
49 /**
50 */
51 
52 class DrawModelWrapper;
53 class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider
54 {
55 public:
56     /** Gives calculated scale and increment values for a given xAxis in the current view.
57         In contrast to the model data these explicit values are always complete as misssing auto properties are calculated.
58         If the given Axis could not be found or for another reason no correct output can be given false is returned.
59      */
60     virtual sal_Bool getExplicitValuesForAxis(
61         ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
62         , ExplicitScaleData&  rExplicitScale
63         , ExplicitIncrementData& rExplicitIncrement )=0;
64 
65     /** for rotated objects the shape size and position differs from the visible rectangle
66         if bSnapRect is set to true you get the resulting visible position (left-top) and size
67     */
68     virtual ::com::sun::star::awt::Rectangle
69         getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false )=0;
70 
71     virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes()=0;
72 
73     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
74         getShapeForCID( const rtl::OUString& rObjectCID )=0;
75 
76     virtual ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0;
77 
78     static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
79     static ExplicitValueProvider* getExplicitValueProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView );
80 
81     static ::com::sun::star::awt::Rectangle
82         addAxisTitleSizes(
83             const ::com::sun::star::uno::Reference<
84                 ::com::sun::star::frame::XModel >& xChartModel
85             , const ::com::sun::star::uno::Reference<
86                 ::com::sun::star::uno::XInterface >& xChartView
87             , const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize );
88 
89     static ::com::sun::star::awt::Rectangle
90         substractAxisTitleSizes(
91             const ::com::sun::star::uno::Reference<
92                 ::com::sun::star::frame::XModel >& xChartModel
93             , const ::com::sun::star::uno::Reference<
94                 ::com::sun::star::uno::XInterface >& xChartView
95             , const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles );
96 
97     static sal_Int32 getExplicitNumberFormatKeyForAxis(
98               const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
99             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
100             , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
101 
102     static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
103             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
104             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
105             , sal_Int32 nPointIndex /*-1 for whole series*/
106             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
107 
108     static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
109             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
110             , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
111 };
112 
113 //.............................................................................
114 } //namespace chart
115 //.............................................................................
116 #endif
117