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 .
22 #include "ConnectionPageSetup.hxx"
24 #include "adminpages.hxx"
25 #include "admincontrols.hxx"
26 #include "TextConnectionHelper.hxx"
28 #include <curledit.hxx>
32 class ODbTypeWizDialogSetup
;
34 // OSpreadSheetConnectionPageSetup
35 class OSpreadSheetConnectionPageSetup final
: public OConnectionTabPageSetup
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
;
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
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
;
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
;
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
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
;
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
;
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
101 std::unique_ptr
<weld::Label
> m_xHelpText
;
102 std::unique_ptr
<weld::Container
> m_xSettingsContainer
;
103 std::unique_ptr
<MySQLNativeSettings
> m_xMySQLSettings
;
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
);
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
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
);
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
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
);
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
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
; }
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
;
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
223 OPostgresConnectionPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
224 , const SfxItemSet
& _rCoreAttrs
225 , sal_uInt16 _nPortId
226 , TranslateId pDefaultPortResId
227 , TranslateId pHelpTextResId
228 , TranslateId pHeaderTextResId
229 , TranslateId pConnectionTextResId
);
230 virtual ~OPostgresConnectionPageSetup() override
;
231 static std::unique_ptr
<OGenericAdministrationPage
> CreatePostgresTabPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
);
232 ::dbaccess::ODsnTypeCollection
* m_pCollection
;
235 DECL_LINK(OnEditModified
, weld::Entry
&, void);
236 virtual bool FillItemSet( SfxItemSet
* _rCoreAttrs
) override
;
237 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
238 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
239 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
240 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason
) override
;
242 TypedWhichId
<SfxInt32Item
> m_nPortId
;
244 std::unique_ptr
<weld::Label
> m_xHeaderText
;
245 std::unique_ptr
<weld::Label
> m_xFTHelpText
;
246 std::unique_ptr
<weld::Label
> m_xFTDatabasename
;
247 std::unique_ptr
<weld::Entry
> m_xETDatabasename
;
248 std::unique_ptr
<weld::Label
> m_xFTHostname
;
249 std::unique_ptr
<weld::Entry
> m_xETHostname
;
250 std::unique_ptr
<weld::Label
> m_xFTPortNumber
;
251 std::unique_ptr
<weld::Label
> m_xFTDefaultPortNumber
;
252 std::unique_ptr
<weld::SpinButton
> m_xNFPortNumber
;
254 std::unique_ptr
<weld::Label
> m_xFTConnection
;
255 std::unique_ptr
<OConnectionURLEdit
> m_xConnectionURL
;
257 /** used for the connection URL
261 void impl_setURL( std::u16string_view _rURL
, bool _bPrefix
);
262 void setURLNoPrefix( std::u16string_view _rURL
);
263 void setURL( std::u16string_view _rURL
);
264 OUString
getURLNoPrefix( ) const;
265 OUString
impl_getURL() const;
271 // OAuthentificationPageSetup
272 class OAuthentificationPageSetup final
: public OGenericAdministrationPage
275 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
276 static std::unique_ptr
<OGenericAdministrationPage
> CreateAuthentificationTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
);
277 OAuthentificationPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
);
278 virtual ~OAuthentificationPageSetup() override
;
281 std::unique_ptr
<weld::Label
> m_xFTHelpText
;
282 std::unique_ptr
<weld::Label
> m_xFTUserName
;
283 std::unique_ptr
<weld::Entry
> m_xETUserName
;
284 std::unique_ptr
<weld::CheckButton
> m_xCBPasswordRequired
;
285 std::unique_ptr
<weld::Button
> m_xPBTestConnection
;
287 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
288 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
289 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
293 class OFinalDBPageSetup
: public OGenericAdministrationPage
296 virtual bool FillItemSet ( SfxItemSet
* _rCoreAttrs
) override
;
297 static std::unique_ptr
<OGenericAdministrationPage
> CreateFinalDBTabPageSetup(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& _rAttrSet
);
299 OFinalDBPageSetup(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& _rCoreAttrs
);
300 virtual ~OFinalDBPageSetup() override
;
301 bool IsDatabaseDocumentToBeRegistered() const;
302 bool IsDatabaseDocumentToBeOpened() const;
303 bool IsTableWizardToBeStarted() const;
304 void enableTableWizardCheckBox( bool _bSupportsTableCreation
);
306 DECL_LINK(OnOpenSelected
, weld::Toggleable
&, void);
308 virtual void implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
) override
;
309 virtual void fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
310 virtual void fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
) override
;
312 std::unique_ptr
<weld::Label
> m_xFTFinalHeader
;
313 std::unique_ptr
<weld::Label
> m_xFTFinalHelpText
;
314 std::unique_ptr
<weld::RadioButton
> m_xRBRegisterDataSource
;
315 std::unique_ptr
<weld::RadioButton
> m_xRBDontregisterDataSource
;
316 std::unique_ptr
<weld::Label
> m_xFTAdditionalSettings
;
317 std::unique_ptr
<weld::CheckButton
> m_xCBOpenAfterwards
;
318 std::unique_ptr
<weld::CheckButton
> m_xCBStartTableWizard
;
319 std::unique_ptr
<weld::Label
> m_xFTFinalText
;
324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */