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_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
20 : #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
21 :
22 : #include <chartview/ExplicitScaleValues.hxx>
23 : #include <com/sun/star/chart2/XAxis.hpp>
24 : #include <com/sun/star/chart2/XChartDocument.hpp>
25 : #include <com/sun/star/chart2/XDataSeries.hpp>
26 : #include <com/sun/star/chart2/XDiagram.hpp>
27 : #include <com/sun/star/chart2/XTitle.hpp>
28 : #include <cppuhelper/weakref.hxx>
29 : #include <com/sun/star/awt/Size.hpp>
30 : #include <com/sun/star/container/XNameContainer.hpp>
31 : #include <com/sun/star/drawing/XDrawPage.hpp>
32 : #include <com/sun/star/frame/XModel.hpp>
33 : #include <com/sun/star/lang/XUnoTunnel.hpp>
34 : #include <com/sun/star/uno/XComponentContext.hpp>
35 :
36 : #include <map>
37 :
38 : namespace chart
39 : {
40 : class ExplicitValueProvider;
41 : class ChartModel;
42 :
43 : namespace wrapper
44 : {
45 :
46 : class Chart2ModelContact
47 : {
48 : public:
49 : explicit Chart2ModelContact( const ::com::sun::star::uno::Reference<
50 : ::com::sun::star::uno::XComponentContext >& xContext );
51 : virtual ~Chart2ModelContact();
52 :
53 : public:
54 : void setModel( const ::com::sun::star::uno::Reference<
55 : ::com::sun::star::frame::XModel >& xChartModel );
56 : void clear();
57 :
58 : ::com::sun::star::uno::Reference<
59 : ::com::sun::star::frame::XModel > getChartModel() const;
60 :
61 2023 : ChartModel* getModel() const { return mpModel;}
62 :
63 : ::com::sun::star::uno::Reference<
64 : ::com::sun::star::chart2::XChartDocument > getChart2Document() const;
65 : ::com::sun::star::uno::Reference<
66 : ::com::sun::star::chart2::XDiagram > getChart2Diagram() const;
67 :
68 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getDrawPage();
69 :
70 : /** get the current values calculated for an axis in the current view in
71 : case properties are 'auto'.
72 : */
73 : bool getExplicitValuesForAxis(
74 : const ::com::sun::star::uno::Reference<
75 : ::com::sun::star::chart2::XAxis > & xAxis,
76 : ExplicitScaleData & rOutExplicitScale,
77 : ExplicitIncrementData & rOutExplicitIncrement );
78 :
79 : sal_Int32 getExplicitNumberFormatKeyForAxis(
80 : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
81 :
82 : sal_Int32 getExplicitNumberFormatKeyForSeries(
83 : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
84 :
85 : /** Returns the size of the page in logic coordinates. This value is used
86 : for setting an appropriate "ReferencePageSize" for FontHeights.
87 : */
88 : ::com::sun::star::awt::Size GetPageSize() const;
89 :
90 : /** calculates the current axes title sizes and subtract that space them from the given recangle
91 : */
92 : ::com::sun::star::awt::Rectangle SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle& rPositionRect );
93 :
94 : /** Returns the position and size of the diagram in logic coordinates (100th mm) including
95 : the space used for axes including axes titles.
96 : */
97 : ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingTitle() const;
98 :
99 : /** Returns the position and size of the diagram in logic coordinates (100th mm) including
100 : the space used for axes excluding axes titles.
101 : */
102 : ::com::sun::star::awt::Rectangle GetDiagramRectangleIncludingAxes() const;
103 :
104 : /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
105 : the space used for axes (inner plot area).
106 : */
107 : ::com::sun::star::awt::Rectangle GetDiagramRectangleExcludingAxes() const;
108 :
109 : /** Returns the size of the object in logic coordinates.
110 : */
111 : ::com::sun::star::awt::Size GetLegendSize() const;
112 :
113 : /** Returns the position of the object in logic coordinates.
114 : */
115 : ::com::sun::star::awt::Point GetLegendPosition() const;
116 :
117 : /** Returns the size of the object in logic coordinates.
118 : */
119 : ::com::sun::star::awt::Size GetTitleSize( const ::com::sun::star::uno::Reference<
120 : ::com::sun::star::chart2::XTitle > & xTitle ) const;
121 :
122 : /** Returns the position of the object in logic coordinates.
123 : */
124 : ::com::sun::star::awt::Point GetTitlePosition( const ::com::sun::star::uno::Reference<
125 : ::com::sun::star::chart2::XTitle > & xTitle ) const;
126 :
127 : /** Returns the size of the object in logic coordinates.
128 : */
129 : ::com::sun::star::awt::Size GetAxisSize( const ::com::sun::star::uno::Reference<
130 : ::com::sun::star::chart2::XAxis > & xAxis ) const;
131 :
132 : /** Returns the position of the object in logic coordinates.
133 : */
134 : ::com::sun::star::awt::Point GetAxisPosition( const ::com::sun::star::uno::Reference<
135 : ::com::sun::star::chart2::XAxis > & xAxis ) const;
136 :
137 : private: //methods
138 : ExplicitValueProvider* getExplicitValueProvider() const;
139 : ::com::sun::star::uno::Reference<
140 : ::com::sun::star::lang::XUnoTunnel > getChartView() const;
141 :
142 : public: //member
143 : ::com::sun::star::uno::Reference<
144 : ::com::sun::star::uno::XComponentContext >
145 : m_xContext;
146 :
147 : private: //member
148 : ::com::sun::star::uno::WeakReference<
149 : ::com::sun::star::frame::XModel > m_xChartModel;
150 :
151 : ChartModel* mpModel;
152 :
153 : mutable ::com::sun::star::uno::Reference<
154 : ::com::sun::star::lang::XUnoTunnel > m_xChartView;
155 :
156 : typedef std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > > tTableMap;//GradientTable, HatchTable etc.
157 : tTableMap m_aTableMap;
158 : };
159 :
160 : } // namespace wrapper
161 : } // namespace chart
162 :
163 : // INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
164 : #endif
165 :
166 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|