bump product version to 4.1.6.2
[LibreOffice.git] / dbaccess / source / ui / inc / dbwiz.hxx
blob63748ff23fac002e12ee58f2e9f7737e214c2aaf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 DBAUI_DBWIZ_HXX
21 #define DBAUI_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"
29 #include <memory>
31 namespace com { namespace sun { namespace star {
32 namespace beans {
33 class XPropertySet;
35 namespace sdbc {
36 class XConnection;
38 namespace lang {
39 class XMultiServiceFactory;
41 }}}
43 namespace dbaccess
45 class ODsnTypeCollection;
47 //.........................................................................
48 namespace dbaui
50 //.........................................................................
52 //=========================================================================
53 //= ODbTypeWizDialog
54 //=========================================================================
55 class OGeneralPage;
56 class ODbDataSourceAdministrationHelper;
57 /** tab dialog for administrating the office wide registered data sources
59 class ODbTypeWizDialog : public svt::OWizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog,public dbaui::OModuleClient
61 private:
62 OModuleClient m_aModuleClient;
63 ::std::auto_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
64 SfxItemSet* m_pOutSet;
65 ::dbaccess::ODsnTypeCollection*
66 m_pCollection; /// the DSN type collection instance
67 OUString m_eType;
69 sal_Bool m_bResetting : 1; /// sal_True while we're resetting the pages
70 sal_Bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
71 sal_Bool m_bUIEnabled : 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
73 public:
74 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
75 after the dialog has been destroyed
77 ODbTypeWizDialog(Window* pParent
78 ,SfxItemSet* _pItems
79 ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
80 ,const ::com::sun::star::uno::Any& _aDataSourceName
82 virtual ~ODbTypeWizDialog();
84 virtual const SfxItemSet* getOutputSet() const;
85 virtual SfxItemSet* getWriteOutputSet();
87 // forwards to ODbDataSourceAdministrationHelper
88 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const;
89 virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection();
90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver();
91 virtual OUString getDatasourceType(const SfxItemSet& _rSet) const;
92 virtual void clearPassword();
93 virtual sal_Bool saveDatasource();
94 virtual void setTitle(const OUString& _sTitle);
95 virtual void enableConfirmSettings( bool _bEnable );
97 protected:
98 /// to override to create new pages
99 virtual TabPage* createPage(WizardState _nState);
100 virtual WizardState determineNextState(WizardState _nCurrentState) const;
101 virtual sal_Bool leaveState(WizardState _nState);
102 virtual ::svt::IWizardPageController*
103 getPageController( TabPage* _pCurrentPage ) const;
104 virtual sal_Bool onFinish();
106 protected:
107 inline sal_Bool isUIEnabled() const { return m_bUIEnabled; }
108 inline void disabledUI() { m_bUIEnabled = sal_False; }
110 /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
111 void implSelectDatasource(const OUString& _rRegisteredName);
112 void resetPages(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatasource);
114 enum ApplyResult
116 AR_LEAVE_MODIFIED, // something was modified and has successfully been committed
117 AR_LEAVE_UNCHANGED, // no changes were made
118 AR_KEEP // don't leave the page (e.g. because an error occurred)
120 /** apply all changes made
122 ApplyResult implApplyChanges();
124 private:
125 DECL_LINK(OnTypeSelected, OGeneralPage*);
128 //.........................................................................
129 } // namespace dbaui
130 //.........................................................................
132 #endif // DBAUI_DBWIZ_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */