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 .
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>
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 XChartDocument
; }
35 namespace com::sun::star::chart2
{ class XDataSeries
; }
36 namespace com::sun::star::chart2
{ class XDiagram
; }
37 namespace com::sun::star::chart2
{ class XTitle
; }
38 namespace com::sun::star::container
{ class XNameContainer
; }
39 namespace com::sun::star::drawing
{ class XDrawPage
; }
40 namespace com::sun::star::frame
{ class XModel
; }
41 namespace com::sun::star::lang
{ class XUnoTunnel
; }
42 namespace com::sun::star::uno
{ class XComponentContext
; }
47 class ExplicitValueProvider
;
53 class Chart2ModelContact final
56 explicit Chart2ModelContact( const css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
57 ~Chart2ModelContact();
60 void setDocumentModel( ChartModel
* pChartModel
);
63 rtl::Reference
<ChartModel
> getDocumentModel() const;
65 rtl::Reference
< ::chart::Diagram
> getDiagram() const;
67 rtl::Reference
<SvxDrawPage
> getDrawPage() const;
69 /** get the current values calculated for an axis in the current view in
70 case properties are 'auto'.
72 void getExplicitValuesForAxis(
73 const rtl::Reference
< ::chart::Axis
> & xAxis
,
74 ExplicitScaleData
& rOutExplicitScale
,
75 ExplicitIncrementData
& rOutExplicitIncrement
);
77 sal_Int32
getExplicitNumberFormatKeyForAxis(
78 const rtl::Reference
< ::chart::Axis
>& xAxis
);
80 static sal_Int32
getExplicitNumberFormatKeyForSeries(
81 const css::uno::Reference
< css::chart2::XDataSeries
>& xSeries
);
83 /** Returns the size of the page in logic coordinates. This value is used
84 for setting an appropriate "ReferencePageSize" for FontHeights.
86 css::awt::Size
GetPageSize() const;
88 /** calculates the current axes title sizes and subtract that space them from the given rectangle
90 css::awt::Rectangle
SubstractAxisTitleSizes( const css::awt::Rectangle
& rPositionRect
);
92 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
93 the space used for axes including axes titles.
95 css::awt::Rectangle
GetDiagramRectangleIncludingTitle() const;
97 /** Returns the position and size of the diagram in logic coordinates (100th mm) including
98 the space used for axes excluding axes titles.
100 css::awt::Rectangle
GetDiagramRectangleIncludingAxes() const;
102 /** Returns the position and size of the diagram in logic coordinates (100th mm) excluding
103 the space used for axes (inner plot area).
105 css::awt::Rectangle
GetDiagramRectangleExcludingAxes() const;
107 /** Returns the size of the object in logic coordinates.
109 css::awt::Size
GetLegendSize() const;
111 /** Returns the position of the object in logic coordinates.
113 css::awt::Point
GetLegendPosition() const;
115 /** Returns the size of the object in logic coordinates.
117 css::awt::Size
GetTitleSize( const css::uno::Reference
< css::chart2::XTitle
> & xTitle
) const;
119 /** Returns the position of the object in logic coordinates.
121 css::awt::Point
GetTitlePosition( const css::uno::Reference
< css::chart2::XTitle
> & xTitle
) const;
123 /** Returns the size of the object in logic coordinates.
125 css::awt::Size
GetAxisSize( const css::uno::Reference
< css::chart2::XAxis
> & xAxis
) const;
127 /** Returns the position of the object in logic coordinates.
129 css::awt::Point
GetAxisPosition( const css::uno::Reference
< css::chart2::XAxis
> & xAxis
) const;
132 ExplicitValueProvider
* getExplicitValueProvider() const;
133 rtl::Reference
< ChartView
> const & getChartView() const;
136 css::uno::Reference
< css::uno::XComponentContext
> m_xContext
;
139 unotools::WeakReference
< ChartModel
> m_xChartModel
;
141 mutable rtl::Reference
< ChartView
> m_xChartView
;
143 std::map
< OUString
, css::uno::Reference
< css::container::XNameContainer
> > m_aTableMap
;
146 } // namespace wrapper
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */