Avoid potential negative array index access to cached text.
[LibreOffice.git] / chart2 / source / inc / StatisticsHelper.hxx
blobe7008020022c830ada67a5436377eb556dd934cc
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 <com/sun/star/uno/Reference.h>
22 #include <rtl/ustring.hxx>
23 #include <rtl/ref.hxx>
24 #include "charttoolsdllapi.hxx"
26 namespace com::sun::star::beans { class XPropertySet; }
27 namespace com::sun::star::chart2 { class XDataSeries; }
28 namespace com::sun::star::chart2::data { class XDataProvider; }
29 namespace com::sun::star::chart2::data { class XDataSequence; }
30 namespace com::sun::star::chart2::data { class XDataSource; }
31 namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
32 namespace com::sun::star::uno { template <typename > class Sequence; }
33 namespace chart { class LabeledDataSequence; }
34 namespace chart { class DataSeries; }
36 namespace chart::StatisticsHelper
38 /** Calculates 1/n * sum (x_i - x_mean)^2.
40 @see http://mathworld.wolfram.com/Variance.html
42 OOO_DLLPUBLIC_CHARTTOOLS double getVariance( const css::uno::Sequence< double > & rData );
44 // square root of the variance
45 OOO_DLLPUBLIC_CHARTTOOLS double getStandardDeviation( const css::uno::Sequence< double > & rData );
47 // also called "Standard deviation of the mean (SDOM)"
48 OOO_DLLPUBLIC_CHARTTOOLS double getStandardError( const css::uno::Sequence< double > & rData );
50 OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence >
51 getErrorLabeledDataSequenceFromDataSource(
52 const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
53 bool bPositiveValue,
54 bool bYError = true );
56 OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSequence >
57 getErrorDataSequenceFromDataSource(
58 const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
59 bool bPositiveValue,
60 bool bYError = true );
62 OOO_DLLPUBLIC_CHARTTOOLS double getErrorFromDataSource(
63 const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
64 sal_Int32 nIndex,
65 bool bPositiveValue,
66 bool bYError = true );
68 OOO_DLLPUBLIC_CHARTTOOLS void setErrorDataSequence(
69 const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource,
70 const css::uno::Reference< css::chart2::data::XDataProvider > & xDataProvider,
71 const OUString & rNewRange,
72 bool bPositiveValue,
73 bool bYError = true,
74 OUString const * pXMLRange = nullptr );
76 /// @return the newly created or existing error bar object
77 OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
78 addErrorBars(
79 const rtl::Reference< ::chart::DataSeries > & xDataSeries,
80 sal_Int32 nStyle,
81 bool bYError = true );
83 OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
84 getErrorBars(
85 const rtl::Reference< ::chart::DataSeries > & xDataSeries,
86 bool bYError = true );
88 OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars(
89 const rtl::Reference< ::chart::DataSeries > & xDataSeries,
90 bool bYError = true );
92 OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars(
93 const rtl::Reference< ::chart::DataSeries > & xDataSeries,
94 bool bYError = true );
96 OOO_DLLPUBLIC_CHARTTOOLS bool usesErrorBarRanges(
97 const rtl::Reference< ::chart::DataSeries > & xDataSeries,
98 bool bYError = true );
100 } // namespace chart
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */