Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / dbwizsetup.hxx
blob74db493b37c5c01f3a39259c778f6c459591d7e1
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 INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
23 #include <sfx2/tabdlg.hxx>
24 #include "dsntypes.hxx"
25 #include "IItemSetHelper.hxx"
26 #include <comphelper/uno3.hxx>
27 #include <tools/urlobj.hxx>
28 #include <memory>
29 #include <svtools/roadmapwizard.hxx>
30 #include <connectivity/dbtools.hxx>
31 #include "moduledbu.hxx"
33 namespace com { namespace sun { namespace star {
34 namespace beans {
35 class XPropertySet;
37 namespace sdbc {
38 class XConnection;
40 namespace lang {
41 class XMultiServiceFactory;
43 }}}
45 namespace dbaui
48 class OGenericAdministrationPage;
50 // ODbTypeWizDialogSetup
51 class OGeneralPage;
52 class OGeneralPageWizard;
53 class ODbDataSourceAdministrationHelper;
54 /** tab dialog for administrating the office wide registered data sources
56 class OMySQLIntroPageSetup;
57 class OFinalDBPageSetup;
59 class ODbTypeWizDialogSetup : public svt::RoadmapWizard , public IItemSetHelper, public IDatabaseSettingsDialog,public dbaui::OModuleClient
62 private:
63 OModuleClient m_aModuleClient;
64 ::std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
65 SfxItemSet* m_pOutSet;
66 OUString m_sURL;
67 OUString m_sOldURL;
68 bool m_bResetting : 1; /// sal_True while we're resetting the pages
69 bool m_bApplied : 1; /// sal_True if any changes have been applied while the dialog was executing
70 bool m_bUIEnabled : 1; /// <TRUE/> if the UI is enabled, false otherwise. Cannot be switched back to <TRUE/>, once it is <FALSE/>
71 bool m_bIsConnectable : 1;
72 OUString m_sRM_IntroText;
73 OUString m_sRM_dBaseText;
74 OUString m_sRM_TextText;
75 OUString m_sRM_MSAccessText;
76 OUString m_sRM_LDAPText;
77 OUString m_sRM_ADOText;
78 OUString m_sRM_JDBCText;
79 OUString m_sRM_MySQLNativePageTitle;
80 OUString m_sRM_OracleText;
81 OUString m_sRM_MySQLText;
82 OUString m_sRM_ODBCText;
83 OUString m_sRM_SpreadSheetText;
84 OUString m_sRM_AuthentificationText;
85 OUString m_sRM_FinalText;
86 INetURLObject m_aDocURL;
87 OUString m_sWorkPath;
88 VclPtr<OGeneralPageWizard> m_pGeneralPage;
89 VclPtr<OMySQLIntroPageSetup> m_pMySQLIntroPage;
90 VclPtr<OFinalDBPageSetup> m_pFinalPage;
92 ::dbaccess::ODsnTypeCollection*
93 m_pCollection; /// the DSN type collection instance
95 public:
96 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
97 after the dialog has been destroyed
99 ODbTypeWizDialogSetup(vcl::Window* pParent
100 ,SfxItemSet* _pItems
101 ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB
102 ,const ::com::sun::star::uno::Any& _aDataSourceName
104 virtual ~ODbTypeWizDialogSetup();
105 virtual void dispose() SAL_OVERRIDE;
107 virtual const SfxItemSet* getOutputSet() const SAL_OVERRIDE;
108 virtual SfxItemSet* getWriteOutputSet() SAL_OVERRIDE;
110 // forwards to ODbDataSourceAdministrationHelper
111 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getORB() const SAL_OVERRIDE;
112 virtual ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >,sal_Bool> createConnection() SAL_OVERRIDE;
113 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver() SAL_OVERRIDE;
114 virtual OUString getDatasourceType(const SfxItemSet& _rSet) const SAL_OVERRIDE;
115 virtual void clearPassword() SAL_OVERRIDE;
116 virtual void setTitle(const OUString& _sTitle) SAL_OVERRIDE;
117 virtual void enableConfirmSettings( bool _bEnable ) SAL_OVERRIDE;
118 virtual bool saveDatasource() SAL_OVERRIDE;
119 virtual OUString getStateDisplayName( WizardState _nState ) const SAL_OVERRIDE;
121 /** returns <TRUE/> if the database should be opened, otherwise <FALSE/>.
123 bool IsDatabaseDocumentToBeOpened() const;
125 /** returns <TRUE/> if the table wizard should be opened, otherwise <FALSE/>.
127 bool IsTableWizardToBeStarted() const;
129 protected:
130 /// to override to create new pages
131 virtual VclPtr<TabPage> createPage(WizardState _nState) SAL_OVERRIDE;
132 virtual bool leaveState(WizardState _nState) SAL_OVERRIDE;
133 virtual void enterState(WizardState _nState) SAL_OVERRIDE;
134 virtual ::svt::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const SAL_OVERRIDE;
135 virtual bool onFinish() SAL_OVERRIDE;
137 protected:
138 inline bool isUIEnabled() const { return m_bUIEnabled; }
139 inline void disabledUI() { m_bUIEnabled = false; }
141 /// select a datasource with a given name, adjust the item set accordingly, and everything like that ..
142 void implSelectDatasource(const OUString& _rRegisteredName);
143 void resetPages(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDatasource);
145 enum ApplyResult
147 AR_LEAVE_MODIFIED, // something was modified and has successfully been committed
148 AR_LEAVE_UNCHANGED, // no changes were made
149 AR_KEEP // don't leave the page (e.g. because an error occurred)
152 private:
153 /** declares a path with or without authentication, as indicated by the database type
155 @param _sURL
156 the data source type for which the path is declared. If this
157 data source type does not support authentication, the PAGE_DBSETUPWIZARD_AUTHENTIFICATION
158 state will be stripped from the sequence of states.
159 @param _nPathId
160 the ID of the path
161 @path
162 the first state in this path, following by an arbitrary number of others, as in
163 RoadmapWizard::declarePath.
165 void declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const svt::RoadmapWizardTypes::WizardPath& _rPaths);
167 void RegisterDataSourceByLocation(const OUString& sPath);
168 bool SaveDatabaseDocument();
169 void activateDatabasePath();
170 OUString createUniqueFileName(const INetURLObject& rURL);
171 void CreateDatabase();
172 void createUniqueFolderName(INetURLObject* pURL);
173 ::dbaccess::DATASOURCE_TYPE VerifyDataSourceType(const ::dbaccess::DATASOURCE_TYPE _DatabaseType) const;
175 void updateTypeDependentStates();
176 bool callSaveAsDialog();
177 bool IsConnectionUrlRequired();
178 DECL_LINK(OnTypeSelected, OGeneralPage*);
179 DECL_LINK_TYPED(OnChangeCreationMode, OGeneralPageWizard*, void);
180 DECL_LINK(OnRecentDocumentSelected, OGeneralPageWizard*);
181 DECL_LINK(OnSingleDocumentChosen, OGeneralPageWizard*);
182 DECL_LINK_TYPED(ImplClickHdl, OMySQLIntroPageSetup*, void);
183 DECL_LINK_TYPED(ImplModifiedHdl, OGenericAdministrationPage const *, void);
186 } // namespace dbaui
188 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DBWIZSETUP_HXX
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */