1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
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>
40 class ExplicitValueProvider
;
46 class Chart2ModelContact
49 Chart2ModelContact( const ::com::sun::star::uno::Reference
<
50 ::com::sun::star::uno::XComponentContext
>& xContext
);
51 virtual ~Chart2ModelContact();
54 void setModel( const ::com::sun::star::uno::Reference
<
55 ::com::sun::star::frame::XModel
>& xChartModel
);
58 ::com::sun::star::uno::Reference
<
59 ::com::sun::star::frame::XModel
> getChartModel() const;
61 ChartModel
* getModel() const { return mpModel
;}
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;
68 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> getDrawPage();
70 /** get the current values calculated for an axis in the current view in
71 case properties are 'auto'.
73 bool getExplicitValuesForAxis(
74 const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::chart2::XAxis
> & xAxis
,
76 ExplicitScaleData
& rOutExplicitScale
,
77 ExplicitIncrementData
& rOutExplicitIncrement
);
79 sal_Int32
getExplicitNumberFormatKeyForAxis(
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>& xAxis
);
82 sal_Int32
getExplicitNumberFormatKeyForSeries(
83 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
>& xSeries
);
85 /** Returns the size of the page in logic coordinates. This value is used
86 for setting an appropriate "ReferencePageSize" for FontHeights.
88 ::com::sun::star::awt::Size
GetPageSize() const;
90 /** calculates the current axes title sizes and subtract that space them from the given recangle
92 ::com::sun::star::awt::Rectangle
SubstractAxisTitleSizes( const ::com::sun::star::awt::Rectangle
& rPositionRect
);
94 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
95 the space used for axes including axes titles.
97 ::com::sun::star::awt::Rectangle
GetDiagramRectangleIncludingTitle() const;
99 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
100 the space used for axes excluding axes titles.
102 ::com::sun::star::awt::Rectangle
GetDiagramRectangleIncludingAxes() const;
104 /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
105 the space used for axes (inner plot area).
107 ::com::sun::star::awt::Rectangle
GetDiagramRectangleExcludingAxes() const;
109 /** Returns the size of the object in logic coordinates.
111 ::com::sun::star::awt::Size
GetLegendSize() const;
113 /** Returns the position of the object in logic coordinates.
115 ::com::sun::star::awt::Point
GetLegendPosition() const;
117 /** Returns the size of the object in logic coordinates.
119 ::com::sun::star::awt::Size
GetTitleSize( const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::chart2::XTitle
> & xTitle
) const;
122 /** Returns the position of the object in logic coordinates.
124 ::com::sun::star::awt::Point
GetTitlePosition( const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::chart2::XTitle
> & xTitle
) const;
127 /** Returns the size of the object in logic coordinates.
129 ::com::sun::star::awt::Size
GetAxisSize( const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::chart2::XAxis
> & xAxis
) const;
132 /** Returns the position of the object in logic coordinates.
134 ::com::sun::star::awt::Point
GetAxisPosition( const ::com::sun::star::uno::Reference
<
135 ::com::sun::star::chart2::XAxis
> & xAxis
) const;
138 ExplicitValueProvider
* getExplicitValueProvider() const;
139 ::com::sun::star::uno::Reference
<
140 ::com::sun::star::lang::XUnoTunnel
> getChartView() const;
143 ::com::sun::star::uno::Reference
<
144 ::com::sun::star::uno::XComponentContext
>
148 ::com::sun::star::uno::WeakReference
<
149 ::com::sun::star::frame::XModel
> m_xChartModel
;
153 mutable ::com::sun::star::uno::Reference
<
154 ::com::sun::star::lang::XUnoTunnel
> m_xChartView
;
156 typedef std::map
< OUString
, ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> > tTableMap
;//GradientTable, HatchTable etc.
157 tTableMap m_aTableMap
;
160 } // namespace wrapper
163 // INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_CHART2MODELCONTACT_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */