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/Rectangle.hpp>
22 #include <chartview/chartviewdllapi.hxx>
23 
24 #include <memory>
25 
26 namespace chart { class ChartModel; }
27 namespace chart { struct ExplicitIncrementData; }
28 namespace chart { struct ExplicitScaleData; }
29 namespace com::sun::star::beans { class XPropertySet; }
30 namespace com::sun::star::chart2 { class XAxis; }
31 namespace com::sun::star::chart2 { class XChartDocument; }
32 namespace com::sun::star::chart2 { class XCoordinateSystem; }
33 namespace com::sun::star::chart2 { class XDataSeries; }
34 namespace com::sun::star::chart2 { class XDiagram; }
35 namespace com::sun::star::drawing { class XShape; }
36 namespace com::sun::star::uno { class XInterface; }
37 namespace com::sun::star::uno { template <typename > class Reference; }
38 namespace com::sun::star::uno { template <typename > class Sequence; }
39 namespace com::sun::star::util { class XNumberFormatsSupplier; }
40 
41 namespace chart
42 {
43 
44 class DrawModelWrapper;
45 class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider
46 {
47 public:
48     /** Gives calculated scale and increment values for a given xAxis in the current view.
49         In contrast to the model data these explicit values are always complete as missing auto properties are calculated.
50         If the given Axis could not be found or for another reason no correct output can be given false is returned.
51      */
52     virtual bool getExplicitValuesForAxis(
53         css::uno::Reference< css::chart2::XAxis > xAxis
54         , ExplicitScaleData&  rExplicitScale
55         , ExplicitIncrementData& rExplicitIncrement )=0;
56 
57     /** for rotated objects the shape size and position differs from the visible rectangle
58         if bSnapRect is set to true you get the resulting visible position (left-top) and size
59     */
60     virtual css::awt::Rectangle
61         getRectangleOfObject( const OUString& rObjectCID, bool bSnapRect=false )=0;
62 
63     virtual css::awt::Rectangle getDiagramRectangleExcludingAxes()=0;
64 
65     virtual css::uno::Reference< css::drawing::XShape >
66         getShapeForCID( const OUString& rObjectCID )=0;
67 
68     virtual std::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0;
69 
70     static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
71 
72     static css::awt::Rectangle
73         AddSubtractAxisTitleSizes(
74                 ChartModel& rModel
75             , const css::uno::Reference< css::uno::XInterface >& xChartView
76             , const css::awt::Rectangle& rPositionAndSize, bool bSubtract );
77 
78     static sal_Int32 getExplicitNumberFormatKeyForAxis(
79               const css::uno::Reference< css::chart2::XAxis >& xAxis
80             , const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
81             , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc);
82 
83     static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
84             const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp );
85 
86     static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
87             const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp
88             , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
89 
90 protected:
~ExplicitValueProvider()91     ~ExplicitValueProvider() {}
92 };
93 
94 } //namespace chart
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
97