1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
29*cdf0e10cSrcweir #define _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "controlwizard.hxx"
32*cdf0e10cSrcweir #include "commonpagesdbp.hxx"
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir //.........................................................................
35*cdf0e10cSrcweir namespace dbp
36*cdf0e10cSrcweir {
37*cdf0e10cSrcweir //.........................................................................
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 	//=====================================================================
40*cdf0e10cSrcweir 	//= OOptionGroupSettings
41*cdf0e10cSrcweir 	//=====================================================================
42*cdf0e10cSrcweir 	struct OOptionGroupSettings : public OControlWizardSettings
43*cdf0e10cSrcweir 	{
44*cdf0e10cSrcweir 		StringArray		aLabels;
45*cdf0e10cSrcweir 		StringArray		aValues;
46*cdf0e10cSrcweir 		String			sDefaultField;
47*cdf0e10cSrcweir 		String			sDBField;
48*cdf0e10cSrcweir 		String			sName;
49*cdf0e10cSrcweir 	};
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 	//=====================================================================
52*cdf0e10cSrcweir 	//= OGroupBoxWizard
53*cdf0e10cSrcweir 	//=====================================================================
54*cdf0e10cSrcweir 	class OGroupBoxWizard : public OControlWizard
55*cdf0e10cSrcweir 	{
56*cdf0e10cSrcweir 	protected:
57*cdf0e10cSrcweir 		OOptionGroupSettings		m_aSettings;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 		sal_Bool		m_bVisitedDefault	: 1;
60*cdf0e10cSrcweir 		sal_Bool		m_bVisitedDB		: 1;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir 	public:
63*cdf0e10cSrcweir 		OGroupBoxWizard(
64*cdf0e10cSrcweir 			Window* _pParent,
65*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel,
66*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
67*cdf0e10cSrcweir 		);
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 		OOptionGroupSettings& getSettings() { return m_aSettings; }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	protected:
72*cdf0e10cSrcweir 		// OWizardMachine overridables
73*cdf0e10cSrcweir 		virtual ::svt::OWizardPage*	createPage( WizardState _nState );
74*cdf0e10cSrcweir 		virtual WizardState	        determineNextState( WizardState _nCurrentState ) const;
75*cdf0e10cSrcweir 		virtual	void			    enterState( WizardState _nState );
76*cdf0e10cSrcweir 		virtual sal_Bool            onFinish();
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 		virtual sal_Bool approveControl(sal_Int16 _nClassId);
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 	protected:
81*cdf0e10cSrcweir 		void createRadios();
82*cdf0e10cSrcweir 	};
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 	//=====================================================================
85*cdf0e10cSrcweir 	//= OGBWPage
86*cdf0e10cSrcweir 	//=====================================================================
87*cdf0e10cSrcweir 	class OGBWPage : public OControlWizardPage
88*cdf0e10cSrcweir 	{
89*cdf0e10cSrcweir 	public:
90*cdf0e10cSrcweir 		OGBWPage( OControlWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	protected:
93*cdf0e10cSrcweir 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
94*cdf0e10cSrcweir 	};
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	//=====================================================================
97*cdf0e10cSrcweir 	//= ORadioSelectionPage
98*cdf0e10cSrcweir 	//=====================================================================
99*cdf0e10cSrcweir 	class ORadioSelectionPage : public OGBWPage
100*cdf0e10cSrcweir 	{
101*cdf0e10cSrcweir 	protected:
102*cdf0e10cSrcweir 		FixedLine		m_aFrame;
103*cdf0e10cSrcweir 		FixedText		m_aRadioNameLabel;
104*cdf0e10cSrcweir 		Edit			m_aRadioName;
105*cdf0e10cSrcweir 		PushButton		m_aMoveRight;
106*cdf0e10cSrcweir 		PushButton		m_aMoveLeft;
107*cdf0e10cSrcweir 		FixedText		m_aExistingRadiosLabel;
108*cdf0e10cSrcweir 		ListBox			m_aExistingRadios;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	public:
111*cdf0e10cSrcweir 		ORadioSelectionPage( OControlWizard* _pParent );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	protected:
114*cdf0e10cSrcweir 		// TabPage overridables
115*cdf0e10cSrcweir 		void ActivatePage();
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 		// OWizardPage overridables
118*cdf0e10cSrcweir 		virtual void		initializePage();
119*cdf0e10cSrcweir 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
120*cdf0e10cSrcweir 		virtual bool        canAdvance() const;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 		DECL_LINK( OnMoveEntry, PushButton* );
123*cdf0e10cSrcweir 		DECL_LINK( OnEntrySelected, ListBox* );
124*cdf0e10cSrcweir 		DECL_LINK( OnNameModified, Edit* );
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 		void implCheckMoveButtons();
127*cdf0e10cSrcweir 	};
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 	//=====================================================================
130*cdf0e10cSrcweir 	//= ODefaultFieldSelectionPage
131*cdf0e10cSrcweir 	//=====================================================================
132*cdf0e10cSrcweir 	class ODefaultFieldSelectionPage : public OMaybeListSelectionPage
133*cdf0e10cSrcweir 	{
134*cdf0e10cSrcweir 	protected:
135*cdf0e10cSrcweir 		FixedLine		m_aFrame;
136*cdf0e10cSrcweir 		FixedText		m_aDefaultSelectionLabel;
137*cdf0e10cSrcweir 		RadioButton		m_aDefSelYes;
138*cdf0e10cSrcweir 		RadioButton		m_aDefSelNo;
139*cdf0e10cSrcweir 		ListBox			m_aDefSelection;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	public:
142*cdf0e10cSrcweir 		ODefaultFieldSelectionPage( OControlWizard* _pParent );
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 	protected:
145*cdf0e10cSrcweir 		// OWizardPage overridables
146*cdf0e10cSrcweir 		virtual void		initializePage();
147*cdf0e10cSrcweir 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
150*cdf0e10cSrcweir 	};
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	//=====================================================================
153*cdf0e10cSrcweir 	//= OOptionValuesPage
154*cdf0e10cSrcweir 	//=====================================================================
155*cdf0e10cSrcweir 	class OOptionValuesPage : public OGBWPage
156*cdf0e10cSrcweir 	{
157*cdf0e10cSrcweir 	protected:
158*cdf0e10cSrcweir 		FixedLine		m_aFrame;
159*cdf0e10cSrcweir 		FixedText		m_aDescription;
160*cdf0e10cSrcweir 		FixedText		m_aValueLabel;
161*cdf0e10cSrcweir 		Edit			m_aValue;
162*cdf0e10cSrcweir 		FixedText		m_aOptionsLabel;
163*cdf0e10cSrcweir 		ListBox			m_aOptions;
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 		StringArray		m_aUncommittedValues;
166*cdf0e10cSrcweir 		::svt::WizardTypes::WizardState
167*cdf0e10cSrcweir                         m_nLastSelection;
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 	public:
170*cdf0e10cSrcweir 		OOptionValuesPage( OControlWizard* _pParent );
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	protected:
173*cdf0e10cSrcweir 		// TabPage overridables
174*cdf0e10cSrcweir 		void ActivatePage();
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 		// OWizardPage overridables
177*cdf0e10cSrcweir 		virtual void		initializePage();
178*cdf0e10cSrcweir 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		void implTraveledOptions();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 		DECL_LINK( OnOptionSelected, ListBox* );
183*cdf0e10cSrcweir 	};
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	//=====================================================================
186*cdf0e10cSrcweir 	//= OOptionDBFieldPage
187*cdf0e10cSrcweir 	//=====================================================================
188*cdf0e10cSrcweir 	class OOptionDBFieldPage : public ODBFieldPage
189*cdf0e10cSrcweir 	{
190*cdf0e10cSrcweir 	public:
191*cdf0e10cSrcweir 		OOptionDBFieldPage( OControlWizard* _pParent );
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	protected:
194*cdf0e10cSrcweir 		OOptionGroupSettings& getSettings() { return static_cast<OGroupBoxWizard*>(getDialog())->getSettings(); }
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 		// ODBFieldPage overridables
197*cdf0e10cSrcweir 		virtual String& getDBFieldSetting();
198*cdf0e10cSrcweir 	};
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	//=====================================================================
201*cdf0e10cSrcweir 	//= OFinalizeGBWPage
202*cdf0e10cSrcweir 	//=====================================================================
203*cdf0e10cSrcweir 	class OFinalizeGBWPage : public OGBWPage
204*cdf0e10cSrcweir 	{
205*cdf0e10cSrcweir 	protected:
206*cdf0e10cSrcweir 		FixedLine		m_aFrame;
207*cdf0e10cSrcweir 		FixedText		m_aNameLabel;
208*cdf0e10cSrcweir 		Edit			m_aName;
209*cdf0e10cSrcweir 		FixedText		m_aThatsAll;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	public:
212*cdf0e10cSrcweir 		OFinalizeGBWPage( OControlWizard* _pParent );
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	protected:
215*cdf0e10cSrcweir 		// TabPage overridables
216*cdf0e10cSrcweir 		void ActivatePage();
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 		// OWizardPage overridables
219*cdf0e10cSrcweir 		virtual void		initializePage();
220*cdf0e10cSrcweir 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
221*cdf0e10cSrcweir 		virtual bool        canAdvance() const;
222*cdf0e10cSrcweir 	};
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir //.........................................................................
225*cdf0e10cSrcweir }	// namespace dbp
226*cdf0e10cSrcweir //.........................................................................
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir #endif // _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_
229*cdf0e10cSrcweir 
230