xref: /aoo41x/main/sc/source/ui/inc/dpgroupdlg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_DPGROUPDLG_HXX
29 #define SC_DPGROUPDLG_HXX
30 
31 #ifndef _FIXED_HXX
32 #include <vcl/fixed.hxx>
33 #endif
34 #ifndef _DIALOG_HXX
35 #include <vcl/dialog.hxx>
36 #endif
37 #ifndef _BUTTON_HXX
38 #include <vcl/button.hxx>
39 #endif
40 #include <vcl/field.hxx>
41 #include <svx/checklbx.hxx>
42 #include "editfield.hxx"
43 #include "dpgroup.hxx"
44 
45 // ============================================================================
46 
47 class ScDPGroupEditHelper
48 {
49 public:
50     explicit            ScDPGroupEditHelper(
51                             RadioButton& rRbAuto, RadioButton& rRbMan,
52                             Edit& rEdValue );
53 
54     bool                IsAuto() const;
55     double              GetValue() const;
56     void                SetValue( bool bAuto, double fValue );
57 
58 private:
59     virtual bool        ImplGetValue( double& rfValue ) const = 0;
60     virtual void        ImplSetValue( double fValue ) = 0;
61 
62     DECL_LINK( ClickHdl, RadioButton* );
63 
64 private:
65     RadioButton&        mrRbAuto;
66     RadioButton&        mrRbMan;
67     Edit&               mrEdValue;
68 };
69 
70 // ----------------------------------------------------------------------------
71 
72 class ScDPNumGroupEditHelper : public ScDPGroupEditHelper
73 {
74 public:
75     explicit            ScDPNumGroupEditHelper(
76                             RadioButton& rRbAuto, RadioButton& rRbMan,
77                             ScDoubleField& rEdValue );
78 
79 private:
80     virtual bool        ImplGetValue( double& rfValue ) const;
81     virtual void        ImplSetValue( double fValue );
82 
83 private:
84     ScDoubleField&      mrEdValue;
85 };
86 
87 // ----------------------------------------------------------------------------
88 
89 class ScDPDateGroupEditHelper : public ScDPGroupEditHelper
90 {
91 public:
92     explicit            ScDPDateGroupEditHelper(
93                             RadioButton& rRbAuto, RadioButton& rRbMan,
94                             DateField& rEdValue, const Date& rNullDate );
95 
96 private:
97     virtual bool        ImplGetValue( double& rfValue ) const;
98     virtual void        ImplSetValue( double fValue );
99 
100 private:
101     DateField&          mrEdValue;
102     Date                maNullDate;
103 };
104 
105 // ============================================================================
106 // ============================================================================
107 
108 class ScDPNumGroupDlg : public ModalDialog
109 {
110 public:
111     explicit            ScDPNumGroupDlg( Window* pParent, const ScDPNumGroupInfo& rInfo );
112 
113     ScDPNumGroupInfo    GetGroupInfo() const;
114 
115 private:
116     FixedLine           maFlStart;
117     RadioButton         maRbAutoStart;
118     RadioButton         maRbManStart;
119     ScDoubleField       maEdStart;
120     FixedLine           maFlEnd;
121     RadioButton         maRbAutoEnd;
122     RadioButton         maRbManEnd;
123     ScDoubleField       maEdEnd;
124     FixedLine           maFlBy;
125     ScDoubleField       maEdBy;
126     OKButton            maBtnOk;
127     CancelButton        maBtnCancel;
128     HelpButton          maBtnHelp;
129     ScDPNumGroupEditHelper maStartHelper;
130     ScDPNumGroupEditHelper maEndHelper;
131 };
132 
133 // ============================================================================
134 
135 class ScDPDateGroupDlg : public ModalDialog
136 {
137 public:
138     explicit            ScDPDateGroupDlg( Window* pParent, const ScDPNumGroupInfo& rInfo,
139                             sal_Int32 nDatePart, const Date& rNullDate );
140 
141     ScDPNumGroupInfo    GetGroupInfo() const;
142     sal_Int32           GetDatePart() const;
143 
144 private:
145     DECL_LINK( ClickHdl, RadioButton* );
146     DECL_LINK( CheckHdl, SvxCheckListBox* );
147 
148 private:
149     FixedLine           maFlStart;
150     RadioButton         maRbAutoStart;
151     RadioButton         maRbManStart;
152     DateField           maEdStart;
153     FixedLine           maFlEnd;
154     RadioButton         maRbAutoEnd;
155     RadioButton         maRbManEnd;
156     DateField           maEdEnd;
157     FixedLine           maFlBy;
158     RadioButton         maRbNumDays;
159     RadioButton         maRbUnits;
160     NumericField        maEdNumDays;
161     SvxCheckListBox     maLbUnits;
162     OKButton            maBtnOk;
163     CancelButton        maBtnCancel;
164     HelpButton          maBtnHelp;
165     ScDPDateGroupEditHelper maStartHelper;
166     ScDPDateGroupEditHelper maEndHelper;
167 };
168 
169 // ============================================================================
170 
171 #endif
172 
173