1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _CHART2_EXPLICITVALUEPROVIDER_HXX
24 #define _CHART2_EXPLICITVALUEPROVIDER_HXX
25 
26 #include "ExplicitScaleValues.hxx"
27 
28 #include <boost/shared_ptr.hpp>
29 #include <com/sun/star/chart2/XAxis.hpp>
30 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
31 #include <com/sun/star/chart2/XDataSeries.hpp>
32 #include <com/sun/star/chart2/XDiagram.hpp>
33 #include <com/sun/star/awt/Rectangle.hpp>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/drawing/XShape.hpp>
36 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
37 #include "chartviewdllapi.hxx"
38 
39 //.............................................................................
40 namespace chart
41 {
42 //.............................................................................
43 
44 //-----------------------------------------------------------------------------
45 /**
46 */
47 
48 class DrawModelWrapper;
49 class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider
50 {
51 public:
52     /** Gives calculated scale and increment values for a given xAxis in the current view.
53         In contrast to the model data these explicit values are always complete as misssing auto properties are calculated.
54         If the given Axis could not be found or for another reason no correct output can be given false is returned.
55      */
56     virtual sal_Bool getExplicitValuesForAxis(
57         ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis
58         , ExplicitScaleData&  rExplicitScale
59         , ExplicitIncrementData& rExplicitIncrement )=0;
60 
61     /** for rotated objects the shape size and position differs from the visible rectangle
62         if bSnapRect is set to true you get the resulting visible position (left-top) and size
63     */
64     virtual ::com::sun::star::awt::Rectangle
65         getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false )=0;
66 
67     virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes()=0;
68 
69     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
70         getShapeForCID( const rtl::OUString& rObjectCID )=0;
71 
72     virtual ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0;
73 
74     static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
75     static ExplicitValueProvider* getExplicitValueProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView );
76 
77     static ::com::sun::star::awt::Rectangle
78         addAxisTitleSizes(
79             const ::com::sun::star::uno::Reference<
80                 ::com::sun::star::frame::XModel >& xChartModel
81             , const ::com::sun::star::uno::Reference<
82                 ::com::sun::star::uno::XInterface >& xChartView
83             , const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize );
84 
85     static ::com::sun::star::awt::Rectangle
86         substractAxisTitleSizes(
87             const ::com::sun::star::uno::Reference<
88                 ::com::sun::star::frame::XModel >& xChartModel
89             , const ::com::sun::star::uno::Reference<
90                 ::com::sun::star::uno::XInterface >& xChartView
91             , const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles );
92 
93     static sal_Int32 getExplicitNumberFormatKeyForAxis(
94               const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
95             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
96             , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
97 
98     static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
99             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
100             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries
101             , sal_Int32 nPointIndex /*-1 for whole series*/
102             , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
103 
104     static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
105             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
106             , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
107 };
108 
109 //.............................................................................
110 } //namespace chart
111 //.............................................................................
112 #endif
113