diff options
author | Tomaž Vajngerl <quikee@gmail.com> | 2013-07-22 18:35:07 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2013-07-23 20:52:45 +0200 |
commit | ba17605d5e75dc926c3f7c61795c77d855aa3458 (patch) | |
tree | fabd2a9533f295bfe175794855b6957e0afbae7d /sc/source/ui/inc | |
parent | 19efbd8d9886e7a346b73aaabe644c56cb2a8e05 (diff) |
Add ANOVA (analysis of variance) calculation to Statistics.
Currently supported calculation is one factor ANOVA calculation.
Additionally refactor "descriptive statistics" and extract common
functionallity with ANOVA into StatisticsInputOutput class.
Change-Id: Ib9c3083019058c63738b3e92097411ba1b428648
Diffstat (limited to 'sc/source/ui/inc')
-rw-r--r-- | sc/source/ui/inc/AnalysisOfVarianceDialog.hxx | 44 | ||||
-rw-r--r-- | sc/source/ui/inc/DescriptiveStatisticsDialog.hxx | 48 | ||||
-rw-r--r-- | sc/source/ui/inc/StatisticsInputOutputDialog.hxx | 82 | ||||
-rw-r--r-- | sc/source/ui/inc/reffact.hxx | 22 |
4 files changed, 151 insertions, 45 deletions
diff --git a/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx new file mode 100644 index 000000000000..366c02ad3912 --- /dev/null +++ b/sc/source/ui/inc/AnalysisOfVarianceDialog.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef ANOVA_ONE_FACTOR_DIALOG_HXX +#define ANOVA_ONE_FACTOR_DIALOG_HXX + +#include "global.hxx" +#include "address.hxx" +#include "anyrefdg.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/group.hxx> +#include <vcl/lstbox.hxx> + +#include "StatisticsInputOutputDialog.hxx" + +class ScAnalysisOfVarianceDialog : public ScStatisticsInputOutputDialog +{ +public: + ScAnalysisOfVarianceDialog( + SfxBindings* pB, SfxChildWindow* pCW, + Window* pParent, ScViewData* pViewData ); + + virtual ~ScAnalysisOfVarianceDialog(); + + virtual sal_Bool Close(); + + NumericField* mpAlpha; + +protected: + virtual void CalculateInputAndWriteToOutput(); +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx index c375d27158ff..b2003b6b5191 100644 --- a/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx +++ b/sc/source/ui/inc/DescriptiveStatisticsDialog.hxx @@ -19,7 +19,9 @@ #include <vcl/group.hxx> #include <vcl/lstbox.hxx> -class ScDescriptiveStatisticsDialog : public ScAnyRefDlg +#include "StatisticsInputOutputDialog.hxx" + +class ScDescriptiveStatisticsDialog : public ScStatisticsInputOutputDialog { public: ScDescriptiveStatisticsDialog( @@ -28,48 +30,10 @@ public: virtual ~ScDescriptiveStatisticsDialog(); - virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); - virtual void SetActive(); - virtual sal_Bool Close(); - -private: - // Widgets - FixedText* mpInputRangeLabel; - formula::RefEdit* mpInputRangeEdit; - formula::RefButton* mpInputRangeButton; - - FixedText* mpOutputRangeLabel; - formula::RefEdit* mpOutputRangeEdit; - formula::RefButton* mpOutputRangeButton; - - PushButton* mpButtonApply; - OKButton* mpButtonOk; - CloseButton* mpButtonClose; - - // - formula::RefEdit* mpActiveEdit; - - // Data - ScViewData* mViewData; - ScDocument* mDocument; - - ScRange mInputRange; - ScAddress::Details mAddressDetails; - ScAddress mOutputAddress; - - ScAddress mCurrentAddress; - - bool mDialogLostFocus; - - void Init(); - void GetRangeFromSelection(); - void ApplyCalculationsFormulas(); + virtual sal_Bool Close(); - DECL_LINK( OkClicked, PushButton* ); - DECL_LINK( CloseClicked, PushButton* ); - DECL_LINK( ApplyClicked, PushButton* ); - DECL_LINK( GetFocusHandler, Control* ); - DECL_LINK( LoseFocusHandler, void* ); +protected: + virtual void CalculateInputAndWriteToOutput(); }; #endif diff --git a/sc/source/ui/inc/StatisticsInputOutputDialog.hxx b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx new file mode 100644 index 000000000000..4d0c0bbc9533 --- /dev/null +++ b/sc/source/ui/inc/StatisticsInputOutputDialog.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef STATISTICS_INPUT_OUTPUT_DIALOG_HXX +#define STATISTICS_INPUT_OUTPUT_DIALOG_HXX + +#include "global.hxx" +#include "address.hxx" +#include "anyrefdg.hxx" + +#include <vcl/fixed.hxx> +#include <vcl/group.hxx> +#include <vcl/lstbox.hxx> + +class ScStatisticsInputOutputDialog : public ScAnyRefDlg +{ +public: + ScStatisticsInputOutputDialog( + SfxBindings* pB, SfxChildWindow* pCW, + Window* pParent, ScViewData* pViewData, + const OString& rID, const OUString& rUIXMLDescription ); + + virtual ~ScStatisticsInputOutputDialog(); + + virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); + virtual void SetActive(); + +protected: + virtual void CalculateInputAndWriteToOutput() = 0; + + // Widgets + FixedText* mpInputRangeLabel; + formula::RefEdit* mpInputRangeEdit; + formula::RefButton* mpInputRangeButton; + + FixedText* mpOutputRangeLabel; + formula::RefEdit* mpOutputRangeEdit; + formula::RefButton* mpOutputRangeButton; + + // Data + ScViewData* mViewData; + ScDocument* mDocument; + + ScRange mInputRange; + ScAddress::Details mAddressDetails; + ScAddress mOutputAddress; + +private: + // Widgets + PushButton* mpButtonApply; + OKButton* mpButtonOk; + CloseButton* mpButtonClose; + + + formula::RefEdit* mpActiveEdit; + + + ScAddress mCurrentAddress; + + bool mDialogLostFocus; + + void Init(); + void GetRangeFromSelection(); + + DECL_LINK( OkClicked, PushButton* ); + DECL_LINK( CloseClicked, PushButton* ); + DECL_LINK( ApplyClicked, PushButton* ); + DECL_LINK( GetFocusHandler, Control* ); + DECL_LINK( LoseFocusHandler, void* ); +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index b0490f373efc..eb131e3cfcb3 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -21,9 +21,12 @@ #define SC_REFFACT_HXX #include <sfx2/childwin.hxx> +#include "ChildWindowWrapper.hxx" #include "dbfunc.hxx" +#include "sc.hrc" + #define DECL_WRAPPER_WITHID(Class) \ class Class : public SfxChildWindow \ { \ @@ -50,9 +53,22 @@ DECL_WRAPPER_WITHID(ScColRowNameRangesDlgWrapper) DECL_WRAPPER_WITHID(ScFormulaDlgWrapper) DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper) -DECL_WRAPPER_WITHID(ScRandomNumberGeneratorDialogWrapper) -DECL_WRAPPER_WITHID(ScSamplingDialogWrapper) -DECL_WRAPPER_WITHID(ScDescriptiveStatisticsDialogWrapper) +class ScDescriptiveStatisticsDialogWrapper : + public ChildWindowWrapper<SID_DESCRIPTIVE_STATISTICS_DIALOG> +{}; + +class ScSamplingDialogWrapper : + public ChildWindowWrapper<SID_SAMPLING_DIALOG> +{}; + +class ScRandomNumberGeneratorDialogWrapper : + public ChildWindowWrapper<SID_RANDOM_NUMBER_GENERATOR_DIALOG> +{}; + +class ScAnalysisOfVarianceDialogWrapper : + public ChildWindowWrapper<SID_ANALYSIS_OF_VARIANCE_DIALOG> +{}; + class ScAcceptChgDlgWrapper: public SfxChildWindow { |