Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / dbwizsetup.hxx
blob50f463fac42a20fe40e839888c9e5cf4e4270206
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 #pragma once
22 #include <dsntypes.hxx>
23 #include "IItemSetHelper.hxx"
24 #include <tools/urlobj.hxx>
25 #include <memory>
26 #include <vcl/roadmapwizard.hxx>
28 namespace com::sun::star {
29 namespace beans {
30 class XPropertySet;
32 namespace sdbc {
33 class XConnection;
35 namespace lang {
36 class XMultiServiceFactory;
40 using vcl::WizardTypes::WizardState;
41 using vcl::RoadmapWizardTypes::PathId;
43 namespace dbaui
46 class OGenericAdministrationPage;
48 // ODbTypeWizDialogSetup
49 class OGeneralPage;
50 class OGeneralPageWizard;
51 class ODbDataSourceAdministrationHelper;
52 /** tab dialog for administrating the office wide registered data sources
54 class OMySQLIntroPageSetup;
55 class OFinalDBPageSetup;
57 class ODbTypeWizDialogSetup final : public vcl::RoadmapWizardMachine, public IItemSetHelper, public IDatabaseSettingsDialog
59 private:
60 std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl;
61 std::unique_ptr<SfxItemSet> m_pOutSet;
62 OUString m_sURL;
63 OUString m_sOldURL;
64 bool m_bIsConnectable : 1;
65 OUString m_sRM_IntroText;
66 OUString m_sRM_dBaseText;
67 OUString m_sRM_TextText;
68 OUString m_sRM_MSAccessText;
69 OUString m_sRM_LDAPText;
70 OUString m_sRM_ADOText;
71 OUString m_sRM_JDBCText;
72 OUString m_sRM_MySQLNativePageTitle;
73 OUString m_sRM_OracleText;
74 OUString m_sRM_PostgresText;
75 OUString m_sRM_MySQLText;
76 OUString m_sRM_ODBCText;
77 OUString m_sRM_DocumentOrSpreadSheetText;
78 OUString m_sRM_AuthentificationText;
79 OUString m_sRM_FinalText;
80 INetURLObject m_aDocURL;
81 OUString m_sWorkPath;
82 OGeneralPageWizard* m_pGeneralPage;
83 OMySQLIntroPageSetup* m_pMySQLIntroPage;
84 OFinalDBPageSetup* m_pFinalPage;
86 ::dbaccess::ODsnTypeCollection*
87 m_pCollection; /// the DSN type collection instance
89 public:
90 /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed
91 after the dialog has been destroyed
93 ODbTypeWizDialogSetup(weld::Window* pParent
94 ,SfxItemSet const * _pItems
95 ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB
96 ,const css::uno::Any& _aDataSourceName
98 virtual ~ODbTypeWizDialogSetup() override;
100 virtual const SfxItemSet* getOutputSet() const override;
101 virtual SfxItemSet* getWriteOutputSet() override;
103 // forwards to ODbDataSourceAdministrationHelper
104 virtual css::uno::Reference< css::uno::XComponentContext > getORB() const override;
105 virtual std::pair< css::uno::Reference< css::sdbc::XConnection >,bool> createConnection() override;
106 virtual css::uno::Reference< css::sdbc::XDriver > getDriver() override;
107 virtual OUString getDatasourceType(const SfxItemSet& _rSet) const override;
108 virtual void clearPassword() override;
109 virtual void setTitle(const OUString& _sTitle) override;
110 virtual void enableConfirmSettings( bool _bEnable ) override;
111 virtual void saveDatasource() override;
112 virtual OUString getStateDisplayName( WizardState _nState ) const override;
114 /** returns <TRUE/> if the database should be opened, otherwise <FALSE/>.
116 bool IsDatabaseDocumentToBeOpened() const;
118 /** returns <TRUE/> if the table wizard should be opened, otherwise <FALSE/>.
120 bool IsTableWizardToBeStarted() const;
122 void SetIntroPage(OMySQLIntroPageSetup* pPage);
123 void SetGeneralPage(OGeneralPageWizard* pPage);
124 void SetFinalPage(OFinalDBPageSetup* pPage);
126 private:
127 /// to override to create new pages
128 virtual std::unique_ptr<BuilderPage> createPage(WizardState _nState) override;
129 virtual bool leaveState(WizardState _nState) override;
130 virtual void enterState(WizardState _nState) override;
131 virtual ::vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override;
132 virtual bool onFinish() override;
134 void resetPages(const css::uno::Reference< css::beans::XPropertySet >& _rxDatasource);
136 /** declares a path with or without authentication, as indicated by the database type
138 @param _sURL
139 the data source type for which the path is declared. If this
140 data source type does not support authentication, the PAGE_DBSETUPWIZARD_AUTHENTIFICATION
141 state will be stripped from the sequence of states.
142 @param _nPathId
143 the ID of the path
144 @path
145 the first state in this path, following by an arbitrary number of others, as in
146 RoadmapWizard::declarePath.
148 void declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const vcl::RoadmapWizardTypes::WizardPath& _rPaths);
150 void RegisterDataSourceByLocation(std::u16string_view sPath);
151 bool SaveDatabaseDocument();
152 void activateDatabasePath();
153 OUString createUniqueFileName(const INetURLObject& rURL);
154 void CreateDatabase();
155 void createUniqueFolderName(INetURLObject* pURL);
156 ::dbaccess::DATASOURCE_TYPE VerifyDataSourceType(const ::dbaccess::DATASOURCE_TYPE DatabaseType) const;
158 void updateTypeDependentStates();
159 bool callSaveAsDialog();
160 DECL_LINK(OnTypeSelected, OGeneralPage&, void);
161 DECL_LINK(OnChangeCreationMode, OGeneralPageWizard&, void);
162 DECL_LINK(OnRecentDocumentSelected, OGeneralPageWizard&, void);
163 DECL_LINK(OnSingleDocumentChosen, OGeneralPageWizard&, void);
164 DECL_LINK(ImplClickHdl, OMySQLIntroPageSetup*, void);
165 DECL_LINK(ImplModifiedHdl, OGenericAdministrationPage const *, void);
168 } // namespace dbaui
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */