LibreOffice Module sc (master) 1
RegressionDialog.hxx
Go to the documentation of this file.
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 */
10
11#pragma once
12
15
17{
23
24 std::unique_ptr<weld::CheckButton> mxWithLabelsCheckBox;
25 std::unique_ptr<weld::RadioButton> mxLinearRadioButton;
26 std::unique_ptr<weld::RadioButton> mxLogarithmicRadioButton;
27 std::unique_ptr<weld::Label> mxErrorMessage;
28 std::unique_ptr<weld::SpinButton> mxConfidenceLevelField;
29 std::unique_ptr<weld::CheckButton> mxCalcResidualsCheckBox;
30 std::unique_ptr<weld::CheckButton> mxNoInterceptCheckBox;
31
32public:
35 weld::Window* pParent, ScViewData& rViewData );
36
37 virtual ~ScRegressionDialog() override;
38
39 virtual void Close() override;
40
41protected:
42 virtual TranslateId GetUndoNameId() override;
43 virtual ScRange ApplyOutput(ScDocShell* pDocShell) override;
44 virtual bool InputRangesValid() override;
45
46private:
47
48 using CellValueGetter = const OUString&(size_t, size_t);
49 using CellWriter = void(const OUString&, size_t, size_t);
50
51 size_t GetRegressionTypeIndex() const;
52 ScRange GetDataRange(const ScRange& rRange);
53 OUString GetVariableNameFormula(bool bXVar, size_t nIndex, bool bWithLog);
54 OUString GetXVariableNameFormula(size_t nIndex, bool bWithLog);
55 OUString GetYVariableNameFormula(bool bWithLog);
56
57 // Helper methods for writing different parts of regression results.
59 FormulaTemplate& rTemplate,
60 size_t nRegressionIndex);
62 FormulaTemplate& rTemplate);
64 FormulaTemplate& rTemplate);
66 FormulaTemplate& rTemplate,
67 bool bTakeLogX);
69 FormulaTemplate& rTemplate,
70 size_t nRegressionIndex);
71 // Generic table writer
72 static void WriteTable(const std::function<CellValueGetter>& rCellGetter, size_t nRowsInTable,
73 size_t nColsInTable, AddressWalkerWriter& rOutput,
74 const std::function<CellWriter>& rFunc);
75
76 DECL_LINK( CheckBoxHdl, weld::Toggleable&, void );
77 DECL_LINK( NumericFieldHdl, weld::SpinButton&, void );
78};
79
80
81/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Close() override
DECL_LINK(CheckBoxHdl, weld::Toggleable &, void)
virtual TranslateId GetUndoNameId() override
std::unique_ptr< weld::RadioButton > mxLinearRadioButton
void WritePredictionsWithResiduals(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, size_t nRegressionIndex)
ScRegressionDialog(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData)
std::unique_ptr< weld::RadioButton > mxLogarithmicRadioButton
void WriteRegressionEstimatesWithCI(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, bool bTakeLogX)
std::unique_ptr< weld::SpinButton > mxConfidenceLevelField
size_t GetRegressionTypeIndex() const
virtual ~ScRegressionDialog() override
void WriteRegressionStatistics(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate)
const OUString &(size_t, size_t) CellValueGetter
OUString GetXVariableNameFormula(size_t nIndex, bool bWithLog)
void WriteRegressionANOVAResults(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate)
static void WriteTable(const std::function< CellValueGetter > &rCellGetter, size_t nRowsInTable, size_t nColsInTable, AddressWalkerWriter &rOutput, const std::function< CellWriter > &rFunc)
DECL_LINK(NumericFieldHdl, weld::SpinButton &, void)
virtual bool InputRangesValid() override
void(const OUString &, size_t, size_t) CellWriter
std::unique_ptr< weld::CheckButton > mxCalcResidualsCheckBox
ScRange GetDataRange(const ScRange &rRange)
std::unique_ptr< weld::Label > mxErrorMessage
void WriteRawRegressionResults(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, size_t nRegressionIndex)
OUString GetVariableNameFormula(bool bXVar, size_t nIndex, bool bWithLog)
std::unique_ptr< weld::CheckButton > mxNoInterceptCheckBox
virtual ScRange ApplyOutput(ScDocShell *pDocShell) override
OUString GetYVariableNameFormula(bool bWithLog)
std::unique_ptr< weld::CheckButton > mxWithLabelsCheckBox