Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / inc / StatisticsTwoVariableDialog.hxx
blob25871ec1ea4f00f3531d02fd984c3f9dbef95c9b
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 */
11 #ifndef INCLUDED_SC_SOURCE_UI_INC_STATISTICSTWOVARIABLEDIALOG_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_STATISTICSTWOVARIABLEDIALOG_HXX
14 #include <address.hxx>
15 #include "anyrefdg.hxx"
16 #include "viewdata.hxx"
18 class ScStatisticsTwoVariableDialog : public ScAnyRefDlgController
20 public:
21 enum GroupedBy {
22 BY_COLUMN,
23 BY_ROW
26 ScStatisticsTwoVariableDialog(
27 SfxBindings* pB, SfxChildWindow* pCW,
28 weld::Window* pParent, ScViewData* pViewData,
29 const OUString& rUIXMLDescription, const OString& rID);
31 virtual ~ScStatisticsTwoVariableDialog() override;
33 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override;
34 virtual void SetActive() override;
36 protected:
37 void CalculateInputAndWriteToOutput();
39 virtual ScRange ApplyOutput(ScDocShell* pDocShell) = 0;
40 virtual const char* GetUndoNameId() = 0;
41 virtual bool InputRangesValid();
42 void ValidateDialogInput();
44 // Widgets
45 std::unique_ptr<weld::Label> mxVariable1RangeLabel;
46 std::unique_ptr<formula::RefEdit> mxVariable1RangeEdit;
47 std::unique_ptr<formula::RefButton> mxVariable1RangeButton;
49 std::unique_ptr<weld::Label> mxVariable2RangeLabel;
50 std::unique_ptr<formula::RefEdit> mxVariable2RangeEdit;
51 std::unique_ptr<formula::RefButton> mxVariable2RangeButton;
53 std::unique_ptr<weld::Label> mxOutputRangeLabel;
54 std::unique_ptr<formula::RefEdit> mxOutputRangeEdit;
55 std::unique_ptr<formula::RefButton> mxOutputRangeButton;
57 // Data
58 ScViewData* const mViewData;
59 ScDocument* const mDocument;
61 ScRange mVariable1Range;
62 ScRange mVariable2Range;
64 ScAddress::Details const mAddressDetails;
65 ScAddress mOutputAddress;
66 GroupedBy mGroupedBy;
68 private:
69 // Widgets
70 std::unique_ptr<weld::Button> mxButtonOk;
72 std::unique_ptr<weld::RadioButton> mxGroupByColumnsRadio;
73 std::unique_ptr<weld::RadioButton> mxGroupByRowsRadio;
75 formula::RefEdit* mpActiveEdit;
76 ScAddress const mCurrentAddress;
77 bool mDialogLostFocus;
79 void Init();
80 void GetRangeFromSelection();
82 DECL_LINK( GroupByChanged, weld::ToggleButton&, void );
83 DECL_LINK( OkClicked, weld::Button&, void );
84 DECL_LINK( GetEditFocusHandler, formula::RefEdit&, void );
85 DECL_LINK( GetButtonFocusHandler, formula::RefButton&, void );
86 DECL_LINK( LoseEditFocusHandler, formula::RefEdit&, void );
87 DECL_LINK( LoseButtonFocusHandler, formula::RefButton&, void );
88 DECL_LINK( RefInputModifyHandler, formula::RefEdit&, void );
91 #endif
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */