1*46dbaceeSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*46dbaceeSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*46dbaceeSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*46dbaceeSAndrew Rist  * distributed with this work for additional information
6*46dbaceeSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*46dbaceeSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*46dbaceeSAndrew Rist  * "License"); you may not use this file except in compliance
9*46dbaceeSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*46dbaceeSAndrew Rist  *
11*46dbaceeSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*46dbaceeSAndrew Rist  *
13*46dbaceeSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*46dbaceeSAndrew Rist  * software distributed under the License is distributed on an
15*46dbaceeSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*46dbaceeSAndrew Rist  * KIND, either express or implied.  See the License for the
17*46dbaceeSAndrew Rist  * specific language governing permissions and limitations
18*46dbaceeSAndrew Rist  * under the License.
19*46dbaceeSAndrew Rist  *
20*46dbaceeSAndrew Rist  *************************************************************/
21*46dbaceeSAndrew Rist 
22*46dbaceeSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
25cdf0e10cSrcweir #define _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "controlwizard.hxx"
28cdf0e10cSrcweir #include <vcl/fixed.hxx>
29cdf0e10cSrcweir #include <vcl/lstbox.hxx>
30cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //.........................................................................
33cdf0e10cSrcweir namespace dbp
34cdf0e10cSrcweir {
35cdf0e10cSrcweir //.........................................................................
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 	//=====================================================================
38cdf0e10cSrcweir 	//= OTableSelectionPage
39cdf0e10cSrcweir 	//=====================================================================
40cdf0e10cSrcweir 	class OTableSelectionPage : public OControlWizardPage
41cdf0e10cSrcweir 	{
42cdf0e10cSrcweir 	protected:
43cdf0e10cSrcweir 		FixedLine		m_aData;
44cdf0e10cSrcweir 		FixedText		m_aExplanation;
45cdf0e10cSrcweir 		FixedText		m_aDatasourceLabel;
46cdf0e10cSrcweir 		ListBox			m_aDatasource;
47cdf0e10cSrcweir 		PushButton		m_aSearchDatabase;
48cdf0e10cSrcweir 		FixedText		m_aTableLabel;
49cdf0e10cSrcweir 		ListBox			m_aTable;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
52cdf0e10cSrcweir 						m_xDSContext;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	public:
55cdf0e10cSrcweir 		OTableSelectionPage(OControlWizard* _pParent);
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	protected:
58cdf0e10cSrcweir 		// TabPage overridables
59cdf0e10cSrcweir 		void ActivatePage();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 		// OWizardPage overridables
62cdf0e10cSrcweir 		virtual void		initializePage();
63cdf0e10cSrcweir 		virtual sal_Bool	commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	protected:
66cdf0e10cSrcweir 		DECL_LINK( OnListboxSelection, ListBox* );
67cdf0e10cSrcweir 		DECL_LINK( OnListboxDoubleClicked, ListBox* );
68cdf0e10cSrcweir 		DECL_LINK( OnSearchClicked, PushButton* );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 		void implCollectDatasource();
71cdf0e10cSrcweir 		void implFillTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
72cdf0e10cSrcweir 						_rxConn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >());
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		// OControlWizardPage overridables
75cdf0e10cSrcweir 		virtual bool    canAdvance() const;
76cdf0e10cSrcweir 	};
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	//=====================================================================
79cdf0e10cSrcweir 	//= OMaybeListSelectionPage
80cdf0e10cSrcweir 	//=====================================================================
81cdf0e10cSrcweir 	class OMaybeListSelectionPage : public OControlWizardPage
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 	protected:
84cdf0e10cSrcweir 		RadioButton*	m_pYes;
85cdf0e10cSrcweir 		RadioButton*	m_pNo;
86cdf0e10cSrcweir 		ListBox*		m_pList;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	public:
89cdf0e10cSrcweir 		OMaybeListSelectionPage( OControlWizard* _pParent, const ResId& _rId );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	protected:
92cdf0e10cSrcweir 		DECL_LINK( OnRadioSelected, RadioButton* );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 		// TabPage overridables
95cdf0e10cSrcweir 		void ActivatePage();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 		// own helper
98cdf0e10cSrcweir 		void	announceControls(
99cdf0e10cSrcweir 			RadioButton& _rYesButton,
100cdf0e10cSrcweir 			RadioButton& _rNoButton,
101cdf0e10cSrcweir 			ListBox& _rSelection);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 		void implEnableWindows();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		void implInitialize(const String& _rSelection);
106cdf0e10cSrcweir 		void implCommit(String& _rSelection);
107cdf0e10cSrcweir 	};
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	//=====================================================================
110cdf0e10cSrcweir 	//= ODBFieldPage
111cdf0e10cSrcweir 	//=====================================================================
112cdf0e10cSrcweir 	class ODBFieldPage : public OMaybeListSelectionPage
113cdf0e10cSrcweir 	{
114cdf0e10cSrcweir 	protected:
115cdf0e10cSrcweir 		FixedLine		m_aFrame;
116cdf0e10cSrcweir 		FixedText		m_aDescription;
117cdf0e10cSrcweir 		FixedText		m_aQuestion;
118cdf0e10cSrcweir 		RadioButton		m_aStoreYes;
119cdf0e10cSrcweir 		RadioButton		m_aStoreNo;
120cdf0e10cSrcweir 		ListBox			m_aStoreWhere;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	public:
123cdf0e10cSrcweir 		ODBFieldPage( OControlWizard* _pParent );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	protected:
setDescriptionText(const String & _rDesc)126cdf0e10cSrcweir 		void setDescriptionText(const String& _rDesc) { m_aDescription.SetText(_rDesc); }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 		// OWizardPage overridables
129cdf0e10cSrcweir 		virtual void initializePage();
130cdf0e10cSrcweir 		virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 		// own overridables
133cdf0e10cSrcweir 		virtual String& getDBFieldSetting() = 0;
134cdf0e10cSrcweir 	};
135cdf0e10cSrcweir 
136cdf0e10cSrcweir //.........................................................................
137cdf0e10cSrcweir }	// namespace dbp
138cdf0e10cSrcweir //.........................................................................
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 
141cdf0e10cSrcweir #endif // _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_
142cdf0e10cSrcweir 
143