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 #ifndef INCLUDED_SC_SOURCE_UI_INC_REGRESSIONDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_REGRESSIONDIALOG_HXX
13 
16 
18 {
24 
25  std::unique_ptr<weld::CheckButton> mxWithLabelsCheckBox;
26  std::unique_ptr<weld::RadioButton> mxLinearRadioButton;
27  std::unique_ptr<weld::RadioButton> mxLogarithmicRadioButton;
28  std::unique_ptr<weld::RadioButton> mxPowerRadioButton;
29  std::unique_ptr<weld::Label> mxErrorMessage;
30  std::unique_ptr<weld::SpinButton> mxConfidenceLevelField;
31  std::unique_ptr<weld::CheckButton> mxCalcResidualsCheckBox;
32  std::unique_ptr<weld::CheckButton> mxNoInterceptCheckBox;
33 
34 public:
36  SfxBindings* pB, SfxChildWindow* pCW,
37  weld::Window* pParent, ScViewData& rViewData );
38 
39  virtual ~ScRegressionDialog() override;
40 
41  virtual void Close() override;
42 
43 protected:
44  virtual const char* GetUndoNameId() override;
45  virtual ScRange ApplyOutput(ScDocShell* pDocShell) override;
46  virtual bool InputRangesValid() override;
47 
48 private:
49 
50  using CellValueGetter = const OUString&(size_t, size_t);
51  using CellWriter = void(const OUString&, size_t, size_t);
52 
53  size_t GetRegressionTypeIndex() const;
54  ScRange GetDataRange(const ScRange& rRange);
55  OUString GetVariableNameFormula(bool bXVar, size_t nIndex, bool bWithLog);
56  OUString GetXVariableNameFormula(size_t nIndex, bool bWithLog);
57  OUString GetYVariableNameFormula(bool bWithLog);
58 
59  // Helper methods for writing different parts of regression results.
61  FormulaTemplate& rTemplate,
62  size_t nRegressionIndex);
64  FormulaTemplate& rTemplate);
66  FormulaTemplate& rTemplate);
68  FormulaTemplate& rTemplate,
69  bool bTakeLogX);
71  FormulaTemplate& rTemplate,
72  size_t nRegressionIndex);
73  // Generic table writer
74  static void WriteTable(const std::function<CellValueGetter>& rCellGetter, size_t nRowsInTable,
75  size_t nColsInTable, AddressWalkerWriter& rOutput,
76  const std::function<CellWriter>& rFunc);
77 
78  DECL_LINK( CheckBoxHdl, weld::ToggleButton&, void );
79  DECL_LINK( NumericFieldHdl, weld::SpinButton&, void );
80 };
81 
82 
83 #endif
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Close() override
std::unique_ptr< weld::CheckButton > mxNoInterceptCheckBox
DECL_LINK(CheckBoxHdl, weld::ToggleButton &, void)
std::unique_ptr< weld::SpinButton > mxConfidenceLevelField
OUString GetYVariableNameFormula(bool bWithLog)
void WritePredictionsWithResiduals(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, size_t nRegressionIndex)
size_t GetRegressionTypeIndex() const
void WriteRawRegressionResults(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, size_t nRegressionIndex)
std::unique_ptr< weld::Label > mxErrorMessage
std::unique_ptr< weld::CheckButton > mxWithLabelsCheckBox
const OUString &(size_t, size_t) CellValueGetter
std::unique_ptr< weld::RadioButton > mxPowerRadioButton
virtual bool InputRangesValid() override
std::unique_ptr< weld::CheckButton > mxCalcResidualsCheckBox
void WriteRegressionStatistics(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate)
OUString GetVariableNameFormula(bool bXVar, size_t nIndex, bool bWithLog)
ScRegressionDialog(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData)
virtual ScRange ApplyOutput(ScDocShell *pDocShell) override
void WriteRegressionANOVAResults(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate)
void(const OUString &, size_t, size_t) CellWriter
virtual ~ScRegressionDialog() override
virtual const char * GetUndoNameId() override
void WriteRegressionEstimatesWithCI(AddressWalkerWriter &rOutput, FormulaTemplate &rTemplate, bool bTakeLogX)
static void WriteTable(const std::function< CellValueGetter > &rCellGetter, size_t nRowsInTable, size_t nColsInTable, AddressWalkerWriter &rOutput, const std::function< CellWriter > &rFunc)
OUString GetXVariableNameFormula(size_t nIndex, bool bWithLog)
ScRange GetDataRange(const ScRange &rRange)
std::unique_ptr< weld::RadioButton > mxLinearRadioButton
std::unique_ptr< weld::RadioButton > mxLogarithmicRadioButton
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo