1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*de7b3f82SAndrew Rist  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*de7b3f82SAndrew Rist  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19*de7b3f82SAndrew Rist  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef CHART_CHART2MODELCONTACT_HXX
24cdf0e10cSrcweir #define CHART_CHART2MODELCONTACT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <chartview/ExplicitScaleValues.hxx>
27cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp>
28cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
29cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeries.hpp>
30cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
31cdf0e10cSrcweir #include <com/sun/star/chart2/XTitle.hpp>
32cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
33cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp>
34cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
35cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
36cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
37cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
38cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <map>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace chart
43cdf0e10cSrcweir {
44cdf0e10cSrcweir class ExplicitValueProvider;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace wrapper
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class Chart2ModelContact
50cdf0e10cSrcweir {
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir     Chart2ModelContact( const ::com::sun::star::uno::Reference<
53cdf0e10cSrcweir                       ::com::sun::star::uno::XComponentContext >& xContext );
54cdf0e10cSrcweir 	virtual ~Chart2ModelContact();
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir     void setModel( const ::com::sun::star::uno::Reference<
58cdf0e10cSrcweir                        ::com::sun::star::frame::XModel >& xChartModel );
59cdf0e10cSrcweir     void clear();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
62cdf0e10cSrcweir         ::com::sun::star::frame::XModel > getChartModel() const;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
65cdf0e10cSrcweir         ::com::sun::star::chart2::XChartDocument > getChart2Document() const;
66cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
67cdf0e10cSrcweir         ::com::sun::star::chart2::XDiagram > getChart2Diagram() const;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getDrawPage();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     /** get the current values calculated for an axis in the current view in
72cdf0e10cSrcweir         case properties are 'auto'.
73cdf0e10cSrcweir      */
74cdf0e10cSrcweir     sal_Bool getExplicitValuesForAxis(
75cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
76cdf0e10cSrcweir             ::com::sun::star::chart2::XAxis > & xAxis,
77cdf0e10cSrcweir         ExplicitScaleData &  rOutExplicitScale,
78cdf0e10cSrcweir         ExplicitIncrementData & rOutExplicitIncrement );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     sal_Int32 getExplicitNumberFormatKeyForAxis(
81cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     sal_Int32 getExplicitNumberFormatKeyForSeries(
84cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     /** Returns the size of the page in logic coordinates.  This value is used
87cdf0e10cSrcweir         for setting an appropriate "ReferencePageSize" for FontHeights.
88cdf0e10cSrcweir      */
89cdf0e10cSrcweir     ::com::sun::star::awt::Size GetPageSize() const;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     /** calculates the current axes title sizes and substract that space them from the given recangle
92cdf0e10cSrcweir      */
93cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle& rPositionRect );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     /** Returns the position and size of the diagram in logic coordinates (100th mm) including
96cdf0e10cSrcweir         the space used for axes including axes titles.
97cdf0e10cSrcweir      */
98cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingTitle() const;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     /** Returns the position and size of the diagram in logic coordinates (100th mm) including
101cdf0e10cSrcweir         the space used for axes excluding axes titles.
102cdf0e10cSrcweir      */
103cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingAxes() const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
106cdf0e10cSrcweir         the space used for axes (inner plot area).
107cdf0e10cSrcweir      */
108cdf0e10cSrcweir     ::com::sun::star::awt::Rectangle GetDiagramRectangleExcludingAxes() const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     /** Returns the size of the object in logic coordinates.
111cdf0e10cSrcweir      */
112cdf0e10cSrcweir     ::com::sun::star::awt::Size GetLegendSize() const;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     /** Returns the position of the object in logic coordinates.
115cdf0e10cSrcweir      */
116cdf0e10cSrcweir     ::com::sun::star::awt::Point GetLegendPosition() const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     /** Returns the size of the object in logic coordinates.
119cdf0e10cSrcweir      */
120cdf0e10cSrcweir     ::com::sun::star::awt::Size GetTitleSize( const ::com::sun::star::uno::Reference<
121cdf0e10cSrcweir                       ::com::sun::star::chart2::XTitle > & xTitle ) const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /** Returns the position of the object in logic coordinates.
124cdf0e10cSrcweir      */
125cdf0e10cSrcweir     ::com::sun::star::awt::Point GetTitlePosition( const ::com::sun::star::uno::Reference<
126cdf0e10cSrcweir                       ::com::sun::star::chart2::XTitle > & xTitle ) const;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     /** Returns the size of the object in logic coordinates.
130cdf0e10cSrcweir      */
131cdf0e10cSrcweir     ::com::sun::star::awt::Size GetAxisSize( const ::com::sun::star::uno::Reference<
132cdf0e10cSrcweir                       ::com::sun::star::chart2::XAxis > & xAxis ) const;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     /** Returns the position of the object in logic coordinates.
135cdf0e10cSrcweir      */
136cdf0e10cSrcweir     ::com::sun::star::awt::Point GetAxisPosition( const ::com::sun::star::uno::Reference<
137cdf0e10cSrcweir                       ::com::sun::star::chart2::XAxis > & xAxis ) const;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir private: //methods
140cdf0e10cSrcweir     ExplicitValueProvider* getExplicitValueProvider() const;
141cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
142cdf0e10cSrcweir         ::com::sun::star::lang::XUnoTunnel > getChartView() const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir public: //member
145cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
146cdf0e10cSrcweir         ::com::sun::star::uno::XComponentContext >
147cdf0e10cSrcweir                         m_xContext;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir private: //member
150cdf0e10cSrcweir 	::com::sun::star::uno::WeakReference<
151cdf0e10cSrcweir         ::com::sun::star::frame::XModel >   m_xChartModel;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     mutable ::com::sun::star::uno::Reference<
154cdf0e10cSrcweir         ::com::sun::star::lang::XUnoTunnel >        m_xChartView;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > > tTableMap;//GradientTable, HatchTable etc.
157cdf0e10cSrcweir     tTableMap   m_aTableMap;
158cdf0e10cSrcweir };
159cdf0e10cSrcweir 
160cdf0e10cSrcweir } //  namespace wrapper
161cdf0e10cSrcweir } //  namespace chart
162cdf0e10cSrcweir 
163cdf0e10cSrcweir // CHART_CHART2MODELCONTACT_HXX
164cdf0e10cSrcweir #endif
165