Debian Codegraph @

chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx

raw
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 #pragma once
20
21 #include <com/sun/star/awt/Size.hpp>
22 #include <com/sun/star/awt/Point.hpp>
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <rtl/ref.hxx>
25 #include <svx/unopage.hxx>
26 #include <unotools/weakref.hxx>
27 #include <ChartModel.hxx>
28 #include <Diagram.hxx>
29 #include <map>
30
31 namespace chart { struct ExplicitIncrementData; }
32 namespace chart { struct ExplicitScaleData; }
33 namespace com::sun::star::chart2 { class XAxis; }
34 namespace com::sun::star::chart2 { class XTitle; }
35 namespace com::sun::star::container { class XNameContainer; }
36 namespace com::sun::star::uno { class XComponentContext; }
37
38
39 namespace chart
40 {
41 class ChartModel;
42
43 namespace wrapper
44 {
45
46 class Chart2ModelContact final
47 {
48 public:
49 explicit Chart2ModelContact( const css::uno::Reference< css::uno::XComponentContext >& xContext );
50 ~Chart2ModelContact();
51
52 public:
53 void setDocumentModel( ChartModel* pChartModel );
54 void clear();
55
56 rtl::Reference<ChartModel> getDocumentModel() const;
57
58 rtl::Reference< ::chart::Diagram > getDiagram() const;
59
60 rtl::Reference<SvxDrawPage> getDrawPage() const;
61
62 /** get the current values calculated for an axis in the current view in
63 case properties are 'auto'.
64 */
65 void getExplicitValuesForAxis(
66 const rtl::Reference< ::chart::Axis > & xAxis,
67 ExplicitScaleData & rOutExplicitScale,
68 ExplicitIncrementData & rOutExplicitIncrement );
69
70 sal_Int32 getExplicitNumberFormatKeyForAxis(
71 const rtl::Reference< ::chart::Axis >& xAxis );
72
73 /** Returns the size of the page in logic coordinates. This value is used
74 for setting an appropriate "ReferencePageSize" for FontHeights.
75 */
76 css::awt::Size GetPageSize() const;
77
78 /** calculates the current axes title sizes and subtract that space them from the given rectangle
79 */
80 css::awt::Rectangle SubstractAxisTitleSizes( const css::awt::Rectangle& rPositionRect );
81
82 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
83 the space used for axes including axes titles.
84 */
85 css::awt::Rectangle GetDiagramRectangleIncludingTitle() const;
86
87 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
88 the space used for axes excluding axes titles.
89 */
90 css::awt::Rectangle GetDiagramRectangleIncludingAxes() const;
91
92 /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
93 the space used for axes (inner plot area).
94 */
95 css::awt::Rectangle GetDiagramRectangleExcludingAxes() const;
96
97 /** Returns the size of the object in logic coordinates.
98 */
99 css::awt::Size GetLegendSize() const;
100
101 /** Returns the position of the object in logic coordinates.
102 */
103 css::awt::Point GetLegendPosition() const;
104
105 /** Returns the size of the object in logic coordinates.
106 */
107 css::awt::Size GetTitleSize( const css::uno::Reference< css::chart2::XTitle > & xTitle ) const;
108
109 /** Returns the position of the object in logic coordinates.
110 */
111 css::awt::Point GetTitlePosition( const css::uno::Reference< css::chart2::XTitle > & xTitle ) const;
112
113 /** Returns the size of the object in logic coordinates.
114 */
115 css::awt::Size GetAxisSize( const css::uno::Reference< css::chart2::XAxis > & xAxis ) const;
116
117 /** Returns the position of the object in logic coordinates.
118 */
119 css::awt::Point GetAxisPosition( const css::uno::Reference< css::chart2::XAxis > & xAxis ) const;
120
121 private: //methods
122 rtl::Reference< ChartView > const & getChartView() const;
123
124 public: //member
125 css::uno::Reference< css::uno::XComponentContext > m_xContext;
126
127 private: //member
128 unotools::WeakReference< ChartModel > m_xChartModel;
129
130 mutable rtl::Reference< ChartView > m_xChartView;
131
132 std::map< OUString, css::uno::Reference< css::container::XNameContainer > > m_aTableMap;
133 };
134
135 } // namespace wrapper
136 } // namespace chart
137
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */