tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / ui / dlg / DBSetupConnectionPages.hxx
blob909cfede58068940e558cbf0f8e1ea6d9fd8ab20
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 "ConnectionPageSetup.hxx"
24 #include "adminpages.hxx"
25 #include "admincontrols.hxx"
26 #include "TextConnectionHelper.hxx"
28 #include <curledit.hxx>
30 namespace dbaui
32 class ODbTypeWizDialogSetup;
34 // OSpreadSheetConnectionPageSetup
35 class OSpreadSheetConnectionPageSetup final : public OConnectionTabPageSetup
37 public:
38 virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
39 static std::unique_ptr<OGenericAdministrationPage> CreateDocumentOrSpreadSheetTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet);
40 OSpreadSheetConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs);
41 virtual ~OSpreadSheetConnectionPageSetup() override;
43 private:
44 std::unique_ptr<weld::CheckButton> m_xPasswordrequired;
46 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
47 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
50 // OTextConnectionPage
51 class OTextConnectionPageSetup : public OConnectionTabPageSetup
53 public:
54 virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
55 static std::unique_ptr<OGenericAdministrationPage> CreateTextTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
56 OTextConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs);
57 virtual ~OTextConnectionPageSetup() override;
58 protected:
59 virtual bool prepareLeave() override;
60 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
61 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
62 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
63 bool checkTestConnection() override;
64 private:
65 DECL_LINK(ImplGetExtensionHdl, OTextConnectionHelper*, void);
66 std::unique_ptr<weld::Widget> m_xSubContainer;
67 std::unique_ptr<OTextConnectionHelper> m_xTextConnectionHelper;
70 // OLDAPConnectionPageSetup
71 class OLDAPConnectionPageSetup : public OGenericAdministrationPage
73 public:
74 virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
75 static std::unique_ptr<OGenericAdministrationPage> CreateLDAPTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
76 OLDAPConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs );
77 virtual ~OLDAPConnectionPageSetup() override;
78 virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override;
80 protected:
81 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
82 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
83 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
85 private:
86 std::unique_ptr<weld::Label> m_xFTHelpText;
87 std::unique_ptr<weld::Label> m_xFTHostServer;
88 std::unique_ptr<weld::Entry> m_xETHostServer;
89 std::unique_ptr<weld::Label> m_xFTBaseDN;
90 std::unique_ptr<weld::Entry> m_xETBaseDN;
91 std::unique_ptr<weld::Label> m_xFTPortNumber;
92 std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
93 std::unique_ptr<weld::Label> m_xFTDefaultPortNumber;
94 std::unique_ptr<weld::CheckButton> m_xCBUseSSL;
97 // MySQLNativeSetupPage
98 class MySQLNativeSetupPage : public OGenericAdministrationPage
100 private:
101 std::unique_ptr<weld::Label> m_xHelpText;
102 std::unique_ptr<weld::Container> m_xSettingsContainer;
103 std::unique_ptr<MySQLNativeSettings> m_xMySQLSettings;
105 public:
106 MySQLNativeSetupPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs);
107 virtual ~MySQLNativeSetupPage() override;
109 static std::unique_ptr<OGenericAdministrationPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
111 protected:
112 virtual void fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) override;
113 virtual void fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) override;
115 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override;
116 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
118 virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override;
121 // OGeneralSpecialJDBCConnectionPageSetup
122 class OGeneralSpecialJDBCConnectionPageSetup final : public OGenericAdministrationPage
124 public:
125 OGeneralSpecialJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController
126 , const SfxItemSet& _rCoreAttrs
127 , sal_uInt16 _nPortId
128 , TranslateId pDefaultPortResId
129 , TranslateId pHelpTextResId
130 , TranslateId pHeaderTextResId
131 , TranslateId pDriverClassId );
132 virtual ~OGeneralSpecialJDBCConnectionPageSetup() override;
133 static std::unique_ptr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
134 static std::unique_ptr<OGenericAdministrationPage> CreateOracleJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
136 private:
137 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override;
138 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
139 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
140 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
141 virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override;
143 DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
145 OUString m_sDefaultJdbcDriverName;
146 TypedWhichId<SfxInt32Item> m_nPortId;
148 std::unique_ptr<weld::Label> m_xHeaderText;
149 std::unique_ptr<weld::Label> m_xFTHelpText;
150 std::unique_ptr<weld::Label> m_xFTDatabasename;
151 std::unique_ptr<weld::Entry> m_xETDatabasename;
152 std::unique_ptr<weld::Label> m_xFTHostname;
153 std::unique_ptr<weld::Entry> m_xETHostname;
154 std::unique_ptr<weld::Label> m_xFTPortNumber;
155 std::unique_ptr<weld::Label> m_xFTDefaultPortNumber;
156 std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
158 std::unique_ptr<weld::Label> m_xFTDriverClass;
159 std::unique_ptr<weld::Entry> m_xETDriverClass;
160 std::unique_ptr<weld::Button> m_xPBTestJavaDriver;
163 // OJDBCConnectionPageSetup
164 class OJDBCConnectionPageSetup final : public OConnectionTabPageSetup
166 public:
167 OJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs);
168 virtual ~OJDBCConnectionPageSetup() override;
169 static std::unique_ptr<OGenericAdministrationPage> CreateJDBCTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
171 private:
172 virtual bool checkTestConnection() override;
174 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override;
175 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
176 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
177 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
179 DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
180 DECL_LINK(OnEditModified, weld::Entry&, void);
181 std::unique_ptr<weld::Label> m_xFTDriverClass;
182 std::unique_ptr<weld::Entry> m_xETDriverClass;
183 std::unique_ptr<weld::Button> m_xPBTestJavaDriver;
186 // OMySQLIntroPageSetup
187 class OMySQLIntroPageSetup : public OGenericAdministrationPage
189 public:
190 enum ConnectionType
192 VIA_ODBC,
193 VIA_JDBC,
194 VIA_NATIVE
197 OMySQLIntroPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rCoreAttrs);
198 virtual ~OMySQLIntroPageSetup() override;
200 static std::unique_ptr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet);
201 ConnectionType getMySQLMode() const;
202 void SetClickHdl( const Link<OMySQLIntroPageSetup *, void>& rLink ) { maClickHdl = rLink; }
204 protected:
205 virtual bool FillItemSet(SfxItemSet* _rSet) override;
206 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
207 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
208 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
210 private:
211 std::unique_ptr<weld::RadioButton> m_xODBCDatabase;
212 std::unique_ptr<weld::RadioButton> m_xJDBCDatabase;
213 std::unique_ptr<weld::RadioButton> m_xNATIVEDatabase;
214 Link<OMySQLIntroPageSetup *, void> maClickHdl;
216 DECL_LINK(OnSetupModeSelected, weld::Toggleable&, void);
219 // OPostgresPageSetup
220 class OPostgresConnectionPageSetup final : public OGenericAdministrationPage
222 public:
223 OPostgresConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController
224 , const SfxItemSet& _rCoreAttrs
225 , sal_uInt16 _nPortId );
226 virtual ~OPostgresConnectionPageSetup() override;
227 static std::unique_ptr<OGenericAdministrationPage> CreatePostgresTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet );
228 ::dbaccess::ODsnTypeCollection* m_pCollection;
230 private:
231 virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override;
232 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
233 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
234 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
235 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
237 TypedWhichId<SfxInt32Item> m_nPortId;
239 std::unique_ptr<weld::Entry> m_xETDatabasename;
240 std::unique_ptr<weld::Entry> m_xETHostname;
241 std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
242 std::unique_ptr<OConnectionURLEdit> m_xConnectionURL;
244 /** used for the connection URL
245 @param _rURL
246 The URL to check.
248 void impl_setURL( std::u16string_view _rURL, bool _bPrefix );
249 void setURLNoPrefix( std::u16string_view _rURL );
250 void setURL( std::u16string_view _rURL );
251 bool commitURL();
255 // OAuthentificationPageSetup
256 class OAuthentificationPageSetup final : public OGenericAdministrationPage
258 public:
259 virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
260 static std::unique_ptr<OGenericAdministrationPage> CreateAuthentificationTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet);
261 OAuthentificationPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs);
262 virtual ~OAuthentificationPageSetup() override;
264 private:
265 std::unique_ptr<weld::Label> m_xFTHelpText;
266 std::unique_ptr<weld::Label> m_xFTUserName;
267 std::unique_ptr<weld::Entry> m_xETUserName;
268 std::unique_ptr<weld::CheckButton> m_xCBPasswordRequired;
269 std::unique_ptr<weld::Button> m_xPBTestConnection;
271 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
272 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
273 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
276 // OFinalDBPageSetup
277 class OFinalDBPageSetup : public OGenericAdministrationPage
279 public:
280 virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
281 static std::unique_ptr<OGenericAdministrationPage> CreateFinalDBTabPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rAttrSet);
283 OFinalDBPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs);
284 virtual ~OFinalDBPageSetup() override;
285 bool IsDatabaseDocumentToBeRegistered() const;
286 bool IsDatabaseDocumentToBeOpened() const;
287 bool IsTableWizardToBeStarted() const;
288 void enableTableWizardCheckBox( bool _bSupportsTableCreation);
290 DECL_LINK(OnOpenSelected, weld::Toggleable&, void);
291 protected:
292 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
293 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
294 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
295 private:
296 std::unique_ptr<weld::Label> m_xFTFinalHeader;
297 std::unique_ptr<weld::Label> m_xFTFinalHelpText;
298 std::unique_ptr<weld::RadioButton> m_xRBRegisterDataSource;
299 std::unique_ptr<weld::RadioButton> m_xRBDontregisterDataSource;
300 std::unique_ptr<weld::Label> m_xFTAdditionalSettings;
301 std::unique_ptr<weld::CheckButton> m_xCBOpenAfterwards;
302 std::unique_ptr<weld::CheckButton> m_xCBStartTableWizard;
303 std::unique_ptr<weld::Label> m_xFTFinalText;
306 } // namespace dbaui
308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */