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_INC_REGRESSIONCURVEHELPER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX
22 #include <svx/chrtitem.hxx>
23 #include "charttoolsdllapi.hxx"
27 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertySet
; } } } }
28 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XDataSeries
; } } } }
29 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XDiagram
; } } } }
30 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XRegressionCurve
; } } } }
31 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XRegressionCurveCalculator
; } } } }
32 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XRegressionCurveContainer
; } } } }
33 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XDataSource
; } } } } }
34 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{ class XModel
; } } } }
39 namespace RegressionCurveHelper
41 /// returns a model mean-value line
42 css::uno::Reference
<css::chart2::XRegressionCurve
> createMeanValueLine();
44 /// returns a model regression curve
45 css::uno::Reference
<css::chart2::XRegressionCurve
>
46 createRegressionCurveByServiceName( const OUString
& aServiceName
);
48 OOO_DLLPUBLIC_CHARTTOOLS
bool hasMeanValueLine(
49 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
> & xRegCnt
);
51 OOO_DLLPUBLIC_CHARTTOOLS
bool isMeanValueLine(
52 const css::uno::Reference
<css::chart2::XRegressionCurve
> & xRegCurve
);
54 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurve
>
56 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
> & xRegCnt
);
58 /** creates a mean-value line and adds it to the container.
61 If set, this property-set will be used to apply a line color
63 OOO_DLLPUBLIC_CHARTTOOLS
void addMeanValueLine(
64 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xRegCnt
,
65 const css::uno::Reference
<css::beans::XPropertySet
>& xSeriesProp
);
67 OOO_DLLPUBLIC_CHARTTOOLS
void removeMeanValueLine(
68 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xRegCnt
);
70 /** Returns the first regression curve found that is not of type
73 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurve
>
74 getFirstCurveNotMeanValueLine(
75 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
>& xCurveContainer
);
77 /** Returns the regression curve found at the index provided.
79 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurve
>
80 getRegressionCurveAtIndex(
81 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
>& xCurveContainer
,
84 /** Returns the type of the first regression curve found that is not of type
87 OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress
getFirstRegressTypeNotMeanValueLine(
88 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
>& xCurveContainer
);
90 OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress
getRegressionType(
91 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
93 /** @param xPropertySource is taken as source to copy all properties from if
95 @param xEquationProperties is set at the new regression curve as
96 equation properties if not null
98 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurve
>
100 SvxChartRegress eType
,
101 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xCurveContainer
,
102 const css::uno::Reference
<css::beans::XPropertySet
>& xPropertySource
=
103 css::uno::Reference
<css::beans::XPropertySet
>(),
104 const css::uno::Reference
<css::beans::XPropertySet
>& xEquationProperties
=
105 css::uno::Reference
<css::beans::XPropertySet
>() );
107 OOO_DLLPUBLIC_CHARTTOOLS
bool removeAllExceptMeanValueLine(
108 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xCurveContainer
);
110 OOO_DLLPUBLIC_CHARTTOOLS
void removeEquations(
111 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xCurveContainer
);
113 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurve
>
114 changeRegressionCurveType(
115 SvxChartRegress eType
,
116 css::uno::Reference
<css::chart2::XRegressionCurveContainer
> const & xRegressionCurveContainer
,
117 css::uno::Reference
<css::chart2::XRegressionCurve
> const & xRegressionCurve
);
119 /// returns a calculator object for regression curves (used by the view)
120 OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference
<css::chart2::XRegressionCurveCalculator
>
121 createRegressionCurveCalculatorByServiceName( const OUString
& aServiceName
);
123 /** recalculates the regression parameters according to the data given in
126 A sequence having the role "values-x" will be used as x-values for the
127 calculation if found. Otherwise a sequence (1, 2, 3, ...) of category
128 indexes will be used for the recalculateRegression() method of the
131 The first sequence having the role "values-y" will be used as y-values
132 for the recalculateRegression() method of the regression curve.
134 @param bUseXValuesIfAvailable
135 If false, the sequence (1, 2, 3, ...) will always be used, even if
136 there is a data-sequence with role "values-x"
138 void initializeCurveCalculator(
139 const css::uno::Reference
<css::chart2::XRegressionCurveCalculator
>& xOutCurveCalculator
,
140 const css::uno::Reference
<css::chart2::data::XDataSource
>& xSource
,
141 bool bUseXValuesIfAvailable
);
143 /** Same method as above, but uses the given XModel to determine the
144 parameter bUseXValuesIfAvailable in the above function. It is also
145 necessary that the data::XDataSource is an XDataSeries, thus this parameter
148 OOO_DLLPUBLIC_CHARTTOOLS
void initializeCurveCalculator(
149 const css::uno::Reference
<css::chart2::XRegressionCurveCalculator
>& xOutCurveCalculator
,
150 const css::uno::Reference
<css::chart2::XDataSeries
>& xSeries
,
151 const css::uno::Reference
<css::frame::XModel
>& xModel
);
153 OOO_DLLPUBLIC_CHARTTOOLS OUString
getUINameForRegressionCurve(
154 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
156 OOO_DLLPUBLIC_CHARTTOOLS OUString
getRegressionCurveName(
157 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
159 OOO_DLLPUBLIC_CHARTTOOLS OUString
getRegressionCurveGenericName(
160 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
162 OOO_DLLPUBLIC_CHARTTOOLS OUString
getRegressionCurveSpecificName(
163 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
165 OOO_DLLPUBLIC_CHARTTOOLS
std::vector
<css::uno::Reference
<css::chart2::XRegressionCurve
> >
166 getAllRegressionCurvesNotMeanValueLine(
167 const css::uno::Reference
<css::chart2::XDiagram
>& xDiagram
);
169 OOO_DLLPUBLIC_CHARTTOOLS
void resetEquationPosition(
170 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
172 /// @return the index of the given curve in the given container. -1 if not contained
173 OOO_DLLPUBLIC_CHARTTOOLS sal_Int32
getRegressionCurveIndex(
174 const css::uno::Reference
<css::chart2::XRegressionCurveContainer
>& xContainer
,
175 const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
177 OOO_DLLPUBLIC_CHARTTOOLS
bool hasEquation(const css::uno::Reference
<css::chart2::XRegressionCurve
>& xCurve
);
182 #endif // INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */