xref: /trunk/main/dbaccess/source/ui/inc/dbwiz.hxx (revision 07a3d7f1)
12e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52e2212a7SAndrew Rist  * distributed with this work for additional information
62e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
82e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
92e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
102e2212a7SAndrew Rist  *
112e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122e2212a7SAndrew Rist  *
132e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
142e2212a7SAndrew Rist  * software distributed under the License is distributed on an
152e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
172e2212a7SAndrew Rist  * specific language governing permissions and limitations
182e2212a7SAndrew Rist  * under the License.
192e2212a7SAndrew Rist  *
202e2212a7SAndrew Rist  *************************************************************/
212e2212a7SAndrew Rist 
222e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef DBAUI_DBWIZ_HXX
25cdf0e10cSrcweir #define DBAUI_DBWIZ_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _SFXTABDLG_HXX
28cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBAUI_DSNTYPES_HXX_
31cdf0e10cSrcweir #include "dsntypes.hxx"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef DBAUI_ITEMSETHELPER_HXX
34cdf0e10cSrcweir #include "IItemSetHelper.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COMPHELPER_UNO3_HXX_
37cdf0e10cSrcweir #include <comphelper/uno3.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _SVTOOLS_WIZARDMACHINE_HXX_
40cdf0e10cSrcweir #include <svtools/wizardmachine.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_
43cdf0e10cSrcweir #include "moduledbu.hxx"
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #include <memory>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
48cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(sdbc,XConnection)
49cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(lang,XMultiServiceFactory)
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace dbaccess
52cdf0e10cSrcweir {
53cdf0e10cSrcweir     class ODsnTypeCollection;
54cdf0e10cSrcweir }
55cdf0e10cSrcweir //.........................................................................
56cdf0e10cSrcweir namespace dbaui
57cdf0e10cSrcweir {
58cdf0e10cSrcweir //.........................................................................
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //=========================================================================
61cdf0e10cSrcweir //= ODbTypeWizDialog
62cdf0e10cSrcweir //=========================================================================
63cdf0e10cSrcweir class OGeneralPage;
64cdf0e10cSrcweir class ODbDataSourceAdministrationHelper;
65cdf0e10cSrcweir /** tab dialog for administrating the office wide registered data sources
66cdf0e10cSrcweir */
67cdf0e10cSrcweir class ODbTypeWizDialog : public svt::OWizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog,public dbaui::OModuleClient
68cdf0e10cSrcweir {
69cdf0e10cSrcweir private:
70cdf0e10cSrcweir 	OModuleClient m_aModuleClient;
71cdf0e10cSrcweir 	::std::auto_ptr<ODbDataSourceAdministrationHelper>	m_pImpl;
72cdf0e10cSrcweir 	SfxItemSet*				m_pOutSet;
73cdf0e10cSrcweir     ::dbaccess::ODsnTypeCollection*
74cdf0e10cSrcweir                             m_pCollection;	/// the DSN type collection instance
75cdf0e10cSrcweir 	::rtl::OUString         m_eType;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	sal_Bool				m_bResetting : 1;	/// sal_True while we're resetting the pages
78cdf0e10cSrcweir 	sal_Bool				m_bApplied : 1;		/// sal_True if any changes have been applied while the dialog was executing
79cdf0e10cSrcweir 	sal_Bool				m_bUIEnabled : 1;	/// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
80cdf0e10cSrcweir 
81cdf0e10cSrcweir public:
82cdf0e10cSrcweir 	/** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
83cdf0e10cSrcweir 		after the dialog has been destroyed
84cdf0e10cSrcweir 	*/
85cdf0e10cSrcweir 	ODbTypeWizDialog(Window* pParent
86cdf0e10cSrcweir 		,SfxItemSet* _pItems
87cdf0e10cSrcweir 		,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
88cdf0e10cSrcweir 		,const ::com::sun::star::uno::Any& _aDataSourceName
89cdf0e10cSrcweir 		);
90cdf0e10cSrcweir 	virtual ~ODbTypeWizDialog();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	virtual const SfxItemSet* getOutputSet() const;
93cdf0e10cSrcweir 	virtual SfxItemSet* getWriteOutputSet();
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	// forwards to ODbDataSourceAdministrationHelper
96cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const;
97cdf0e10cSrcweir 	virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
98cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >	getDriver();
99cdf0e10cSrcweir 	virtual ::rtl::OUString getDatasourceType(const SfxItemSet& _rSet) const;
100cdf0e10cSrcweir 	virtual void clearPassword();
101cdf0e10cSrcweir 	virtual sal_Bool saveDatasource();
102cdf0e10cSrcweir 	virtual void setTitle(const ::rtl::OUString& _sTitle);
103cdf0e10cSrcweir     virtual void enableConfirmSettings( bool _bEnable );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir protected:
106cdf0e10cSrcweir 	/// to override to create new pages
107cdf0e10cSrcweir 	virtual TabPage*	createPage(WizardState _nState);
108cdf0e10cSrcweir 	virtual WizardState	determineNextState(WizardState _nCurrentState) const;
109cdf0e10cSrcweir 	virtual	sal_Bool	leaveState(WizardState _nState);
110cdf0e10cSrcweir 	virtual ::svt::IWizardPageController*
111cdf0e10cSrcweir                         getPageController( TabPage* _pCurrentPage ) const;
112cdf0e10cSrcweir 	virtual sal_Bool    onFinish();
113cdf0e10cSrcweir 
114cdf0e10cSrcweir protected:
isUIEnabled() const115cdf0e10cSrcweir 	inline sal_Bool	isUIEnabled() const { return m_bUIEnabled; }
disabledUI()116cdf0e10cSrcweir 	inline void		disabledUI() { m_bUIEnabled = sal_False; }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	/// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
119cdf0e10cSrcweir 	void implSelectDatasource(const ::rtl::OUString& _rRegisteredName);
120cdf0e10cSrcweir 	void resetPages(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatasource);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	enum ApplyResult
123cdf0e10cSrcweir 	{
124cdf0e10cSrcweir 		AR_LEAVE_MODIFIED,		// somthing was modified and has successfully been committed
125cdf0e10cSrcweir 		AR_LEAVE_UNCHANGED,		// no changes were made
126*07a3d7f1SPedro Giffuni 		AR_KEEP					// don't leave the page (e.g. because an error occurred)
127cdf0e10cSrcweir 	};
128cdf0e10cSrcweir 	/** apply all changes made
129cdf0e10cSrcweir 	*/
130cdf0e10cSrcweir 	ApplyResult	implApplyChanges();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir private:
133cdf0e10cSrcweir 	DECL_LINK(OnTypeSelected, OGeneralPage*);
134cdf0e10cSrcweir };
135cdf0e10cSrcweir 
136cdf0e10cSrcweir //.........................................................................
137cdf0e10cSrcweir }	// namespace dbaui
138cdf0e10cSrcweir //.........................................................................
139cdf0e10cSrcweir 
140cdf0e10cSrcweir #endif // DBAUI_DBWIZ_HXX
141cdf0e10cSrcweir 
142