1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
23 #include <sfx2/tabdlg.hxx>
24 #include "dsntypes.hxx"
25 #include "IItemSetHelper.hxx"
26 #include <comphelper/uno3.hxx>
27 #include <svtools/wizardmachine.hxx>
28 #include "moduledbu.hxx"
31 namespace com
{ namespace sun
{ namespace star
{
39 class XMultiServiceFactory
;
45 class ODsnTypeCollection
;
52 class ODbDataSourceAdministrationHelper
;
53 /** tab dialog for administrating the office wide registered data sources
55 class ODbTypeWizDialog
: public svt::OWizardMachine
, public IItemSetHelper
, public IDatabaseSettingsDialog
,public dbaui::OModuleClient
58 OModuleClient m_aModuleClient
;
59 ::std::unique_ptr
<ODbDataSourceAdministrationHelper
> m_pImpl
;
60 SfxItemSet
* m_pOutSet
;
61 ::dbaccess::ODsnTypeCollection
*
62 m_pCollection
; /// the DSN type collection instance
65 bool m_bResetting
: 1; /// sal_True while we're resetting the pages
66 bool m_bApplied
: 1; /// sal_True if any changes have been applied while the dialog was executing
67 bool m_bUIEnabled
: 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
70 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
71 after the dialog has been destroyed
73 ODbTypeWizDialog(vcl::Window
* pParent
75 ,const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxORB
76 ,const ::com::sun::star::uno::Any
& _aDataSourceName
78 virtual ~ODbTypeWizDialog();
79 virtual void dispose() SAL_OVERRIDE
;
81 virtual const SfxItemSet
* getOutputSet() const SAL_OVERRIDE
;
82 virtual SfxItemSet
* getWriteOutputSet() SAL_OVERRIDE
;
84 // forwards to ODbDataSourceAdministrationHelper
85 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> getORB() const SAL_OVERRIDE
;
86 virtual ::std::pair
< ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>,sal_Bool
> createConnection() SAL_OVERRIDE
;
87 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDriver
> getDriver() SAL_OVERRIDE
;
88 virtual OUString
getDatasourceType(const SfxItemSet
& _rSet
) const SAL_OVERRIDE
;
89 virtual void clearPassword() SAL_OVERRIDE
;
90 virtual bool saveDatasource() SAL_OVERRIDE
;
91 virtual void setTitle(const OUString
& _sTitle
) SAL_OVERRIDE
;
92 virtual void enableConfirmSettings( bool _bEnable
) SAL_OVERRIDE
;
95 /// to override to create new pages
96 virtual VclPtr
<TabPage
> createPage(WizardState _nState
) SAL_OVERRIDE
;
97 virtual WizardState
determineNextState(WizardState _nCurrentState
) const SAL_OVERRIDE
;
98 virtual bool leaveState(WizardState _nState
) SAL_OVERRIDE
;
99 virtual ::svt::IWizardPageController
*
100 getPageController( TabPage
* _pCurrentPage
) const SAL_OVERRIDE
;
101 virtual bool onFinish() SAL_OVERRIDE
;
104 inline bool isUIEnabled() const { return m_bUIEnabled
; }
105 inline void disabledUI() { m_bUIEnabled
= false; }
107 /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
108 void implSelectDatasource(const OUString
& _rRegisteredName
);
109 void resetPages(const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDatasource
);
113 AR_LEAVE_MODIFIED
, // something was modified and has successfully been committed
114 AR_LEAVE_UNCHANGED
, // no changes were made
115 AR_KEEP
// don't leave the page (e.g. because an error occurred)
117 /** apply all changes made
119 ApplyResult
implApplyChanges();
122 DECL_LINK(OnTypeSelected
, OGeneralPage
*);
127 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZ_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */