1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbwiz.hxx,v $
10 * $Revision: 1.9.68.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBAUI_DBWIZ_HXX
32 #define DBAUI_DBWIZ_HXX
34 #ifndef _SFXTABDLG_HXX
35 #include <sfx2/tabdlg.hxx>
37 #ifndef _DBAUI_DSNTYPES_HXX_
38 #include "dsntypes.hxx"
40 #ifndef DBAUI_ITEMSETHELPER_HXX
41 #include "IItemSetHelper.hxx"
43 #ifndef _COMPHELPER_UNO3_HXX_
44 #include <comphelper/uno3.hxx>
46 #ifndef _SVTOOLS_WIZARDMACHINE_HXX_
47 #include <svtools/wizardmachine.hxx>
49 #ifndef _DBAUI_MODULE_DBU_HXX_
50 #include "moduledbu.hxx"
54 FORWARD_DECLARE_INTERFACE(beans
,XPropertySet
)
55 FORWARD_DECLARE_INTERFACE(sdbc
,XConnection
)
56 FORWARD_DECLARE_INTERFACE(lang
,XMultiServiceFactory
)
60 class ODsnTypeCollection
;
62 //.........................................................................
65 //.........................................................................
67 //=========================================================================
69 //=========================================================================
71 class ODbDataSourceAdministrationHelper
;
72 /** tab dialog for administrating the office wide registered data sources
74 class ODbTypeWizDialog
: public svt::OWizardMachine
, public IItemSetHelper
, public IDatabaseSettingsDialog
,public dbaui::OModuleClient
77 OModuleClient m_aModuleClient
;
78 ::std::auto_ptr
<ODbDataSourceAdministrationHelper
> m_pImpl
;
79 SfxItemSet
* m_pOutSet
;
80 ::dbaccess::ODsnTypeCollection
*
81 m_pCollection
; /// the DSN type collection instance
82 ::rtl::OUString m_eType
;
84 sal_Bool m_bResetting
: 1; /// sal_True while we're resetting the pages
85 sal_Bool m_bApplied
: 1; /// sal_True if any changes have been applied while the dialog was executing
86 sal_Bool m_bUIEnabled
: 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
89 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
90 after the dialog has been destroyed
92 ODbTypeWizDialog(Window
* pParent
94 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
95 ,const ::com::sun::star::uno::Any
& _aDataSourceName
97 virtual ~ODbTypeWizDialog();
99 virtual const SfxItemSet
* getOutputSet() const;
100 virtual SfxItemSet
* getWriteOutputSet();
102 // forwards to ODbDataSourceAdministrationHelper
103 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> getORB() const;
104 virtual ::std::pair
< ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>,sal_Bool
> createConnection();
105 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDriver
> getDriver();
106 virtual ::rtl::OUString
getDatasourceType(const SfxItemSet
& _rSet
) const;
107 virtual void clearPassword();
108 virtual sal_Bool
saveDatasource();
109 virtual void setTitle(const ::rtl::OUString
& _sTitle
);
110 virtual void enableConfirmSettings( bool _bEnable
);
113 /// to override to create new pages
114 virtual TabPage
* createPage(WizardState _nState
);
115 virtual WizardState
determineNextState(WizardState _nCurrentState
) const;
116 virtual sal_Bool
leaveState(WizardState _nState
);
117 virtual ::svt::IWizardPage
* getWizardPage(TabPage
* _pCurrentPage
) const;
118 virtual sal_Bool
onFinish(sal_Int32 _nResult
);
121 inline sal_Bool
isUIEnabled() const { return m_bUIEnabled
; }
122 inline void disabledUI() { m_bUIEnabled
= sal_False
; }
124 /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
125 void implSelectDatasource(const ::rtl::OUString
& _rRegisteredName
);
126 void resetPages(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDatasource
);
130 AR_LEAVE_MODIFIED
, // somthing was modified and has successfully been committed
131 AR_LEAVE_UNCHANGED
, // no changes were made
132 AR_KEEP
// don't leave the page (e.g. because an error occured)
134 /** apply all changes made
136 ApplyResult
implApplyChanges();
139 DECL_LINK(OnTypeSelected
, OGeneralPage
*);
142 //.........................................................................
144 //.........................................................................
146 #endif // DBAUI_DBWIZ_HXX