xref: /aoo4110/main/sc/source/ui/inc/dpgroupdlg.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_DPGROUPDLG_HXX
25 #define SC_DPGROUPDLG_HXX
26 
27 #ifndef _FIXED_HXX
28 #include <vcl/fixed.hxx>
29 #endif
30 #ifndef _DIALOG_HXX
31 #include <vcl/dialog.hxx>
32 #endif
33 #ifndef _BUTTON_HXX
34 #include <vcl/button.hxx>
35 #endif
36 #include <vcl/field.hxx>
37 #include <svx/checklbx.hxx>
38 #include "editfield.hxx"
39 #include "dpgroup.hxx"
40 
41 // ============================================================================
42 
43 class ScDPGroupEditHelper
44 {
45 public:
46     explicit            ScDPGroupEditHelper(
47                             RadioButton& rRbAuto, RadioButton& rRbMan,
48                             Edit& rEdValue );
49 
50     bool                IsAuto() const;
51     double              GetValue() const;
52     void                SetValue( bool bAuto, double fValue );
53 
54 private:
55     virtual bool        ImplGetValue( double& rfValue ) const = 0;
56     virtual void        ImplSetValue( double fValue ) = 0;
57 
58     DECL_LINK( ClickHdl, RadioButton* );
59 
60 private:
61     RadioButton&        mrRbAuto;
62     RadioButton&        mrRbMan;
63     Edit&               mrEdValue;
64 };
65 
66 // ----------------------------------------------------------------------------
67 
68 class ScDPNumGroupEditHelper : public ScDPGroupEditHelper
69 {
70 public:
71     explicit            ScDPNumGroupEditHelper(
72                             RadioButton& rRbAuto, RadioButton& rRbMan,
73                             ScDoubleField& rEdValue );
74 
75 private:
76     virtual bool        ImplGetValue( double& rfValue ) const;
77     virtual void        ImplSetValue( double fValue );
78 
79 private:
80     ScDoubleField&      mrEdValue;
81 };
82 
83 // ----------------------------------------------------------------------------
84 
85 class ScDPDateGroupEditHelper : public ScDPGroupEditHelper
86 {
87 public:
88     explicit            ScDPDateGroupEditHelper(
89                             RadioButton& rRbAuto, RadioButton& rRbMan,
90                             DateField& rEdValue, const Date& rNullDate );
91 
92 private:
93     virtual bool        ImplGetValue( double& rfValue ) const;
94     virtual void        ImplSetValue( double fValue );
95 
96 private:
97     DateField&          mrEdValue;
98     Date                maNullDate;
99 };
100 
101 // ============================================================================
102 // ============================================================================
103 
104 class ScDPNumGroupDlg : public ModalDialog
105 {
106 public:
107     explicit            ScDPNumGroupDlg( Window* pParent, const ScDPNumGroupInfo& rInfo );
108 
109     ScDPNumGroupInfo    GetGroupInfo() const;
110 
111 private:
112     FixedLine           maFlStart;
113     RadioButton         maRbAutoStart;
114     RadioButton         maRbManStart;
115     ScDoubleField       maEdStart;
116     FixedLine           maFlEnd;
117     RadioButton         maRbAutoEnd;
118     RadioButton         maRbManEnd;
119     ScDoubleField       maEdEnd;
120     FixedLine           maFlBy;
121     ScDoubleField       maEdBy;
122     OKButton            maBtnOk;
123     CancelButton        maBtnCancel;
124     HelpButton          maBtnHelp;
125     ScDPNumGroupEditHelper maStartHelper;
126     ScDPNumGroupEditHelper maEndHelper;
127 };
128 
129 // ============================================================================
130 
131 class ScDPDateGroupDlg : public ModalDialog
132 {
133 public:
134     explicit            ScDPDateGroupDlg( Window* pParent, const ScDPNumGroupInfo& rInfo,
135                             sal_Int32 nDatePart, const Date& rNullDate );
136 
137     ScDPNumGroupInfo    GetGroupInfo() const;
138     sal_Int32           GetDatePart() const;
139 
140 private:
141     DECL_LINK( ClickHdl, RadioButton* );
142     DECL_LINK( CheckHdl, SvxCheckListBox* );
143 
144 private:
145     FixedLine           maFlStart;
146     RadioButton         maRbAutoStart;
147     RadioButton         maRbManStart;
148     DateField           maEdStart;
149     FixedLine           maFlEnd;
150     RadioButton         maRbAutoEnd;
151     RadioButton         maRbManEnd;
152     DateField           maEdEnd;
153     FixedLine           maFlBy;
154     RadioButton         maRbNumDays;
155     RadioButton         maRbUnits;
156     NumericField        maEdNumDays;
157     SvxCheckListBox     maLbUnits;
158     OKButton            maBtnOk;
159     CancelButton        maBtnCancel;
160     HelpButton          maBtnHelp;
161     ScDPDateGroupEditHelper maStartHelper;
162     ScDPDateGroupEditHelper maEndHelper;
163 };
164 
165 // ============================================================================
166 
167 #endif
168 
169