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::RadioButton> mxPowerRadioButton;
28  std::unique_ptr<weld::Label> mxErrorMessage;
29  std::unique_ptr<weld::SpinButton> mxConfidenceLevelField;
30  std::unique_ptr<weld::CheckButton> mxCalcResidualsCheckBox;
31  std::unique_ptr<weld::CheckButton> mxNoInterceptCheckBox;
32 
33 public:
35  SfxBindings* pB, SfxChildWindow* pCW,
36  weld::Window* pParent, ScViewData& rViewData );
37 
38  virtual ~ScRegressionDialog() override;
39 
40  virtual void Close() override;
41 
42 protected:
43  virtual TranslateId GetUndoNameId() override;
44  virtual ScRange ApplyOutput(ScDocShell* pDocShell) override;
45  virtual bool InputRangesValid() override;
46 
47 private:
48 
49  using CellValueGetter = const OUString&(size_t, size_t);
50  using CellWriter = void(const OUString&, size_t, size_t);
51 
52  size_t GetRegressionTypeIndex() const;
53  ScRange GetDataRange(const ScRange& rRange);
54  OUString GetVariableNameFormula(bool bXVar, size_t nIndex, bool bWithLog);
55  OUString GetXVariableNameFormula(size_t nIndex, bool bWithLog);
56  OUString GetYVariableNameFormula(bool bWithLog);
57 
58  // Helper methods for writing different parts of regression results.
60  FormulaTemplate& rTemplate,
61  size_t nRegressionIndex);
63  FormulaTemplate& rTemplate);
65  FormulaTemplate& rTemplate);
67  FormulaTemplate& rTemplate,
68  bool bTakeLogX);
70  FormulaTemplate& rTemplate,
71  size_t nRegressionIndex);
72  // Generic table writer
73  static void WriteTable(const std::function<CellValueGetter>& rCellGetter, size_t nRowsInTable,
74  size_t nColsInTable, AddressWalkerWriter& rOutput,
75  const std::function<CellWriter>& rFunc);
76 
77  DECL_LINK( CheckBoxHdl, weld::Toggleable&, void );
78  DECL_LINK( NumericFieldHdl, weld::SpinButton&, void );
79 };
80 
81 
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Close() override
DECL_LINK(CheckBoxHdl, weld::Toggleable &, void)
std::unique_ptr< weld::CheckButton > mxNoInterceptCheckBox
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)
virtual TranslateId GetUndoNameId() override
void(const OUString &, size_t, size_t) CellWriter
virtual ~ScRegressionDialog() 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