tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / chart2 / source / inc / RegressionCurveHelper.hxx
blobfc0c2abcd5b71c2cbe2656dfa6f6019e72ee10fe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <config_options.h>
22 #include <svx/chrtitem.hxx>
23 #include "charttoolsdllapi.hxx"
24 #include <rtl/ref.hxx>
26 #include <vector>
28 namespace com::sun::star::beans { class XPropertySet; }
29 namespace com::sun::star::chart2 { class XDataSeries; }
30 namespace com::sun::star::chart2 { class XDiagram; }
31 namespace com::sun::star::chart2 { class XRegressionCurve; }
32 namespace com::sun::star::chart2 { class XRegressionCurveCalculator; }
33 namespace com::sun::star::chart2 { class XRegressionCurveContainer; }
34 namespace com::sun::star::chart2::data { class XDataSource; }
35 namespace com::sun::star::frame { class XModel; }
36 namespace chart { class ChartModel; }
37 namespace chart { class DataSeries; }
38 namespace chart { class RegressionCurveModel; }
39 namespace chart { class RegressionCurveCalculator; }
41 namespace chart::RegressionCurveHelper
43 /// returns a model mean-value line
44 rtl::Reference<::chart::RegressionCurveModel> createMeanValueLine();
46 /// returns a model regression curve
47 rtl::Reference<::chart::RegressionCurveModel>
48 createRegressionCurveByServiceName( std::u16string_view aServiceName );
50 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasMeanValueLine(
51 const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt );
52 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasMeanValueLine(
53 const rtl::Reference<::chart::DataSeries> & xRegCnt );
55 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool isMeanValueLine(
56 const css::uno::Reference<css::chart2::XRegressionCurve> & xRegCurve );
57 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool isMeanValueLine(
58 const rtl::Reference<::chart::RegressionCurveModel> & xRegCurve );
60 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
61 getMeanValueLine(
62 const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt );
63 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
64 getMeanValueLine(
65 const rtl::Reference<::chart::DataSeries> & xRegCnt );
67 /** creates a mean-value line and adds it to the container.
69 @param xSeriesProp
70 If set, this property-set will be used to apply a line color
72 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void addMeanValueLine(
73 css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt,
74 const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp );
75 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void addMeanValueLine(
76 rtl::Reference<::chart::DataSeries> const & xRegCnt,
77 const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp );
79 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeMeanValueLine(
80 css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt );
81 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeMeanValueLine(
82 rtl::Reference<::chart::DataSeries> const & xRegCnt );
84 /** Returns the first regression curve found that is not of type
85 mean-value line
87 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
88 getFirstCurveNotMeanValueLine(
89 const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer );
90 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
91 getFirstCurveNotMeanValueLine(
92 const rtl::Reference<::chart::DataSeries>& xCurveContainer );
94 /** Returns the regression curve found at the index provided.
96 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
97 getRegressionCurveAtIndex(
98 const rtl::Reference<::chart::DataSeries>& xCurveContainer,
99 sal_Int32 aIndex);
101 /** Returns the type of the first regression curve found that is not of type
102 mean-value line
104 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) SvxChartRegress getFirstRegressTypeNotMeanValueLine(
105 const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer );
107 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) SvxChartRegress getRegressionType(
108 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
110 /** @param xPropertySource is taken as source to copy all properties from if
111 not null
112 @param xEquationProperties is set at the new regression curve as
113 equation properties if not null
115 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
116 addRegressionCurve(
117 SvxChartRegress eType,
118 css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer,
119 const css::uno::Reference<css::beans::XPropertySet >& xPropertySource =
120 css::uno::Reference<css::beans::XPropertySet>(),
121 const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties =
122 css::uno::Reference<css::beans::XPropertySet>() );
123 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
124 addRegressionCurve(
125 SvxChartRegress eType,
126 rtl::Reference<::chart::DataSeries> const & xCurveContainer,
127 const css::uno::Reference<css::beans::XPropertySet >& xPropertySource =
128 css::uno::Reference<css::beans::XPropertySet>(),
129 const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties =
130 css::uno::Reference<css::beans::XPropertySet>() );
132 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool removeAllExceptMeanValueLine(
133 rtl::Reference<::chart::DataSeries> const & xCurveContainer );
135 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void removeEquations(
136 rtl::Reference<::chart::DataSeries> const & xCurveContainer );
138 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveModel>
139 changeRegressionCurveType(
140 SvxChartRegress eType,
141 css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegressionCurveContainer,
142 css::uno::Reference<css::chart2::XRegressionCurve> const & xRegressionCurve );
144 /// returns a calculator object for regression curves (used by the view)
145 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) rtl::Reference<::chart::RegressionCurveCalculator>
146 createRegressionCurveCalculatorByServiceName( std::u16string_view aServiceName );
148 /** recalculates the regression parameters according to the data given in
149 the data source.
151 A sequence having the role "values-x" will be used as x-values for the
152 calculation if found. Otherwise a sequence (1, 2, 3, ...) of category
153 indexes will be used for the recalculateRegression() method of the
154 regression curve.
156 The first sequence having the role "values-y" will be used as y-values
157 for the recalculateRegression() method of the regression curve.
159 @param bUseXValuesIfAvailable
160 If false, the sequence (1, 2, 3, ...) will always be used, even if
161 there is a data-sequence with role "values-x"
163 void initializeCurveCalculator(
164 const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator,
165 const css::uno::Reference<css::chart2::data::XDataSource>& xSource,
166 bool bUseXValuesIfAvailable );
168 /** Same method as above, but uses the given XModel to determine the
169 parameter bUseXValuesIfAvailable in the above function. It is also
170 necessary that the data::XDataSource is an XDataSeries, thus this parameter
171 also changed.
173 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void initializeCurveCalculator(
174 const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator,
175 const rtl::Reference<::chart::DataSeries>& xSeries,
176 const rtl::Reference<::chart::ChartModel>& xModel );
178 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getUINameForRegressionCurve(
179 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
181 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveName(
182 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
184 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveGenericName(
185 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
187 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) OUString getRegressionCurveSpecificName(
188 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
190 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) void resetEquationPosition(
191 const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
193 /// @return the index of the given curve in the given container. -1 if not contained
194 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) sal_Int32 getRegressionCurveIndex(
195 const rtl::Reference<::chart::DataSeries>& xContainer,
196 const rtl::Reference<::chart::RegressionCurveModel>& xCurve );
198 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool hasEquation(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
199 UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) bool MayHaveCorrelationCoefficient(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve );
201 } // namespace chart
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */