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 _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
25 #define _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
26 
27 #include "controlwizard.hxx"
28 #include "commonpagesdbp.hxx"
29 
30 //.........................................................................
31 namespace dbp
32 {
33 //.........................................................................
34 
35 	//=====================================================================
36 	//= OOptionGroupSettings
37 	//=====================================================================
38 	struct OOptionGroupSettings : public OControlWizardSettings
39 	{
40 		StringArray		aLabels;
41 		StringArray		aValues;
42 		String			sDefaultField;
43 		String			sDBField;
44 		String			sName;
45 	};
46 
47 	//=====================================================================
48 	//= OGroupBoxWizard
49 	//=====================================================================
50 	class OGroupBoxWizard : public OControlWizard
51 	{
52 	protected:
53 		OOptionGroupSettings		m_aSettings;
54 
55 		sal_Bool		m_bVisitedDefault	: 1;
56 		sal_Bool		m_bVisitedDB		: 1;
57 
58 	public:
59 		OGroupBoxWizard(
60 			Window* _pParent,
61 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
62 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
63 		);
64 
getSettings()65 		OOptionGroupSettings& getSettings() { return m_aSettings; }
66 
67 	protected:
68 		// OWizardMachine overridables
69 		virtual ::svt::OWizardPage*	createPage( WizardState _nState );
70 		virtual WizardState	        determineNextState( WizardState _nCurrentState ) const;
71 		virtual	void			    enterState( WizardState _nState );
72 		virtual sal_Bool            onFinish();
73 
74 		virtual sal_Bool approveControl(sal_Int16 _nClassId);
75 
76 	protected:
77 		void createRadios();
78 	};
79 
80 	//=====================================================================
81 	//= OGBWPage
82 	//=====================================================================
83 	class OGBWPage : public OControlWizardPage
84 	{
85 	public:
OGBWPage(OControlWizard * _pParent,const ResId & _rId)86 		OGBWPage( OControlWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { }
87 
88 	protected:
getSettings()89 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
90 	};
91 
92 	//=====================================================================
93 	//= ORadioSelectionPage
94 	//=====================================================================
95 	class ORadioSelectionPage : public OGBWPage
96 	{
97 	protected:
98 		FixedLine		m_aFrame;
99 		FixedText		m_aRadioNameLabel;
100 		Edit			m_aRadioName;
101 		PushButton		m_aMoveRight;
102 		PushButton		m_aMoveLeft;
103 		FixedText		m_aExistingRadiosLabel;
104 		ListBox			m_aExistingRadios;
105 
106 	public:
107 		ORadioSelectionPage( OControlWizard* _pParent );
108 
109 	protected:
110 		// TabPage overridables
111 		void ActivatePage();
112 
113 		// OWizardPage overridables
114 		virtual void		initializePage();
115 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
116 		virtual bool        canAdvance() const;
117 
118 		DECL_LINK( OnMoveEntry, PushButton* );
119 		DECL_LINK( OnEntrySelected, ListBox* );
120 		DECL_LINK( OnNameModified, Edit* );
121 
122 		void implCheckMoveButtons();
123 	};
124 
125 	//=====================================================================
126 	//= ODefaultFieldSelectionPage
127 	//=====================================================================
128 	class ODefaultFieldSelectionPage : public OMaybeListSelectionPage
129 	{
130 	protected:
131 		FixedLine		m_aFrame;
132 		FixedText		m_aDefaultSelectionLabel;
133 		RadioButton		m_aDefSelYes;
134 		RadioButton		m_aDefSelNo;
135 		ListBox			m_aDefSelection;
136 
137 	public:
138 		ODefaultFieldSelectionPage( OControlWizard* _pParent );
139 
140 	protected:
141 		// OWizardPage overridables
142 		virtual void		initializePage();
143 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
144 
getSettings()145 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
146 	};
147 
148 	//=====================================================================
149 	//= OOptionValuesPage
150 	//=====================================================================
151 	class OOptionValuesPage : public OGBWPage
152 	{
153 	protected:
154 		FixedLine		m_aFrame;
155 		FixedText		m_aDescription;
156 		FixedText		m_aValueLabel;
157 		Edit			m_aValue;
158 		FixedText		m_aOptionsLabel;
159 		ListBox			m_aOptions;
160 
161 		StringArray		m_aUncommittedValues;
162 		::svt::WizardTypes::WizardState
163                         m_nLastSelection;
164 
165 	public:
166 		OOptionValuesPage( OControlWizard* _pParent );
167 
168 	protected:
169 		// TabPage overridables
170 		void ActivatePage();
171 
172 		// OWizardPage overridables
173 		virtual void		initializePage();
174 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
175 
176 		void implTraveledOptions();
177 
178 		DECL_LINK( OnOptionSelected, ListBox* );
179 	};
180 
181 	//=====================================================================
182 	//= OOptionDBFieldPage
183 	//=====================================================================
184 	class OOptionDBFieldPage : public ODBFieldPage
185 	{
186 	public:
187 		OOptionDBFieldPage( OControlWizard* _pParent );
188 
189 	protected:
getSettings()190 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
191 
192 		// ODBFieldPage overridables
193 		virtual String& getDBFieldSetting();
194 	};
195 
196 	//=====================================================================
197 	//= OFinalizeGBWPage
198 	//=====================================================================
199 	class OFinalizeGBWPage : public OGBWPage
200 	{
201 	protected:
202 		FixedLine		m_aFrame;
203 		FixedText		m_aNameLabel;
204 		Edit			m_aName;
205 		FixedText		m_aThatsAll;
206 
207 	public:
208 		OFinalizeGBWPage( OControlWizard* _pParent );
209 
210 	protected:
211 		// TabPage overridables
212 		void ActivatePage();
213 
214 		// OWizardPage overridables
215 		virtual void		initializePage();
216 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
217 		virtual bool        canAdvance() const;
218 	};
219 
220 //.........................................................................
221 }	// namespace dbp
222 //.........................................................................
223 
224 #endif // _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
225 
226