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 .
20 #include <config_java.h>
22 #include "DBSetupConnectionPages.hxx"
23 #include <core_resource.hxx>
24 #include <sqlmessage.hxx>
25 #include <strings.hrc>
26 #include <svl/itemset.hxx>
27 #include <svl/stritem.hxx>
28 #include <svl/eitem.hxx>
29 #include <svl/intitem.hxx>
30 #include <dsitems.hxx>
31 #include "dsnItem.hxx"
34 #include <jvmaccess/virtualmachine.hxx>
37 #include <connectivity/CommonTools.hxx>
38 #include <dbwizsetup.hxx>
39 #include "TextConnectionHelper.hxx"
40 #include <osl/diagnose.h>
42 #include <IItemSetHelper.hxx>
43 #include <comphelper/string.hxx>
47 using namespace ::com::sun::star
;
49 std::unique_ptr
<OGenericAdministrationPage
> OTextConnectionPageSetup::CreateTextTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
51 return std::make_unique
<OTextConnectionPageSetup
>(pPage
, pController
, _rAttrSet
);
54 // OTextConnectionPageSetup
55 OTextConnectionPageSetup::OTextConnectionPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
)
56 : OConnectionTabPageSetup(pPage
, pController
, u
"dbaccess/ui/dbwiztextpage.ui"_ustr
, u
"DBWizTextPage"_ustr
,
57 rCoreAttrs
, STR_TEXT_HELPTEXT
, STR_TEXT_HEADERTEXT
, STR_TEXT_PATH_OR_FILE
)
58 , m_xSubContainer(m_xBuilder
->weld_widget(u
"TextPageContainer"_ustr
))
59 , m_xTextConnectionHelper(new OTextConnectionHelper(m_xSubContainer
.get(), TC_EXTENSION
| TC_SEPARATORS
))
61 m_xTextConnectionHelper
->SetClickHandler(LINK( this, OTextConnectionPageSetup
, ImplGetExtensionHdl
) );
64 OTextConnectionPageSetup::~OTextConnectionPageSetup()
66 m_xTextConnectionHelper
.reset();
69 IMPL_LINK_NOARG(OTextConnectionPageSetup
, ImplGetExtensionHdl
, OTextConnectionHelper
*, void)
71 SetRoadmapStateValue(!m_xTextConnectionHelper
->GetExtension().isEmpty() && OConnectionTabPageSetup::checkTestConnection());
75 bool OTextConnectionPageSetup::checkTestConnection()
77 bool bDoEnable
= OConnectionTabPageSetup::checkTestConnection();
78 bDoEnable
= !m_xTextConnectionHelper
->GetExtension().isEmpty() && bDoEnable
;
82 void OTextConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
84 OConnectionTabPageSetup::fillControls(_rControlList
);
85 m_xTextConnectionHelper
->fillControls(_rControlList
);
88 void OTextConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
90 OConnectionTabPageSetup::fillWindows(_rControlList
);
91 m_xTextConnectionHelper
->fillWindows(_rControlList
);
94 void OTextConnectionPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
96 // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
97 bool bValid
, bReadonly
;
98 getFlags(_rSet
, bValid
, bReadonly
);
99 OConnectionTabPageSetup::implInitControls( _rSet
, _bSaveValue
);
100 m_xTextConnectionHelper
->implInitControls(_rSet
, bValid
);
103 bool OTextConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
105 bool bChangedSomething
= OConnectionTabPageSetup::FillItemSet(_rSet
);
106 bChangedSomething
= m_xTextConnectionHelper
->FillItemSet(*_rSet
, bChangedSomething
);
107 return bChangedSomething
;
110 bool OTextConnectionPageSetup::prepareLeave()
112 return m_xTextConnectionHelper
->prepareLeave();
115 std::unique_ptr
<OGenericAdministrationPage
> OLDAPConnectionPageSetup::CreateLDAPTabPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
117 return std::make_unique
<OLDAPConnectionPageSetup
>(pPage
, pController
, _rAttrSet
);
121 OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
)
122 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/ldapconnectionpage.ui"_ustr
, u
"LDAPConnectionPage"_ustr
, _rCoreAttrs
)
123 , m_xFTHelpText(m_xBuilder
->weld_label(u
"helpLabel"_ustr
))
124 , m_xFTHostServer(m_xBuilder
->weld_label(u
"hostNameLabel"_ustr
))
125 , m_xETHostServer(m_xBuilder
->weld_entry(u
"hostNameEntry"_ustr
))
126 , m_xFTBaseDN(m_xBuilder
->weld_label(u
"baseDNLabel"_ustr
))
127 , m_xETBaseDN(m_xBuilder
->weld_entry(u
"baseDNEntry"_ustr
))
128 , m_xFTPortNumber(m_xBuilder
->weld_label(u
"portNumLabel"_ustr
))
129 , m_xNFPortNumber(m_xBuilder
->weld_spin_button(u
"portNumEntry"_ustr
))
130 , m_xFTDefaultPortNumber(m_xBuilder
->weld_label(u
"portNumDefLabel"_ustr
))
131 , m_xCBUseSSL(m_xBuilder
->weld_check_button(u
"useSSLCheckbutton"_ustr
))
133 m_xETHostServer
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
134 m_xETBaseDN
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
135 m_xNFPortNumber
->connect_value_changed(LINK(this, OGenericAdministrationPage
, OnControlSpinButtonModifyHdl
));
136 m_xCBUseSSL
->connect_toggled( LINK(this, OGenericAdministrationPage
, OnControlModifiedButtonClick
) );
137 SetRoadmapStateValue(false);
140 OLDAPConnectionPageSetup::~OLDAPConnectionPageSetup()
144 bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
146 bool bChangedSomething
= false;
147 fillString(*_rSet
,m_xETBaseDN
.get(),DSID_CONN_LDAP_BASEDN
, bChangedSomething
);
148 fillInt32(*_rSet
,m_xNFPortNumber
.get(),DSID_CONN_LDAP_PORTNUMBER
,bChangedSomething
);
150 if ( m_xETHostServer
->get_value_changed_from_saved() )
152 const DbuTypeCollectionItem
* pCollectionItem
= dynamic_cast<const DbuTypeCollectionItem
*>( _rSet
->GetItem(DSID_TYPECOLLECTION
) );
153 ::dbaccess::ODsnTypeCollection
* pCollection
= nullptr;
155 pCollection
= pCollectionItem
->getCollection();
156 OSL_ENSURE(pCollection
, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
159 OUString sUrl
= pCollection
->getPrefix( u
"sdbc:address:ldap:") + m_xETHostServer
->get_text();
160 _rSet
->Put(SfxStringItem(DSID_CONNECTURL
, sUrl
));
161 bChangedSomething
= true;
165 fillBool(*_rSet
,m_xCBUseSSL
.get(),DSID_CONN_LDAP_USESSL
,false,bChangedSomething
);
166 return bChangedSomething
;
168 void OLDAPConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
170 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETHostServer
.get()));
171 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETBaseDN
.get()));
172 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::SpinButton
>(m_xNFPortNumber
.get()));
173 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xCBUseSSL
.get()));
175 void OLDAPConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
177 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTHelpText
.get()));
178 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTHostServer
.get()));
179 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTBaseDN
.get()));
180 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTPortNumber
.get()));
181 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTDefaultPortNumber
.get()));
183 void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
185 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
186 bool bValid
, bReadonly
;
187 getFlags(_rSet
, bValid
, bReadonly
);
189 const SfxStringItem
* pBaseDN
= _rSet
.GetItem
<SfxStringItem
>(DSID_CONN_LDAP_BASEDN
);
190 const SfxInt32Item
* pPortNumber
= _rSet
.GetItem
<SfxInt32Item
>(DSID_CONN_LDAP_PORTNUMBER
);
194 m_xETBaseDN
->set_text(pBaseDN
->GetValue());
195 m_xNFPortNumber
->set_value(pPortNumber
->GetValue());
197 OGenericAdministrationPage::implInitControls(_rSet
, _bSaveValue
);
201 void OLDAPConnectionPageSetup::callModifiedHdl(weld::Widget
*)
203 bool bRoadmapState
= ((!m_xETHostServer
->get_text().isEmpty() ) && ( !m_xETBaseDN
->get_text().isEmpty() ) && (!m_xFTPortNumber
->get_label().isEmpty() ));
204 SetRoadmapStateValue(bRoadmapState
);
205 OGenericAdministrationPage::callModifiedHdl();
208 std::unique_ptr
<OMySQLIntroPageSetup
> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& rAttrSet
)
210 return std::make_unique
<OMySQLIntroPageSetup
>(pPage
, pController
, rAttrSet
);
213 OMySQLIntroPageSetup::OMySQLIntroPageSetup(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& _rCoreAttrs
)
214 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/dbwizmysqlintropage.ui"_ustr
, u
"DBWizMysqlIntroPage"_ustr
, _rCoreAttrs
)
215 , m_xODBCDatabase(m_xBuilder
->weld_radio_button(u
"odbc"_ustr
))
216 , m_xJDBCDatabase(m_xBuilder
->weld_radio_button(u
"jdbc"_ustr
))
217 , m_xNATIVEDatabase(m_xBuilder
->weld_radio_button(u
"directly"_ustr
))
219 m_xODBCDatabase
->connect_toggled(LINK(this, OMySQLIntroPageSetup
, OnSetupModeSelected
));
220 m_xJDBCDatabase
->connect_toggled(LINK(this, OMySQLIntroPageSetup
, OnSetupModeSelected
));
221 m_xNATIVEDatabase
->connect_toggled(LINK(this, OMySQLIntroPageSetup
, OnSetupModeSelected
));
222 pController
->SetIntroPage(this);
225 OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
229 IMPL_LINK_NOARG(OMySQLIntroPageSetup
, OnSetupModeSelected
, weld::Toggleable
&, void)
231 maClickHdl
.Call( this );
234 void OMySQLIntroPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool /*_bSaveValue*/)
236 // show the "Connect directly" option only if the driver is installed
237 const DbuTypeCollectionItem
* pCollectionItem
= dynamic_cast<const DbuTypeCollectionItem
*>( _rSet
.GetItem(DSID_TYPECOLLECTION
) );
238 bool bHasMySQLNative
= ( pCollectionItem
!= nullptr ) && pCollectionItem
->getCollection()->hasDriver( u
"sdbc:mysql:mysqlc:" );
239 if ( bHasMySQLNative
)
240 m_xNATIVEDatabase
->show();
242 // tdf#103068: if any of the options is checked, then just update the selected kind:
243 // it could happen that the selection and the wizard path are not in sync
244 if ( m_xODBCDatabase
->get_active() || m_xJDBCDatabase
->get_active() || m_xNATIVEDatabase
->get_active() )
246 maClickHdl
.Call(this);
250 // prefer "native" or "JDBC"
251 if ( bHasMySQLNative
)
252 m_xNATIVEDatabase
->set_active(true);
254 m_xJDBCDatabase
->set_active(true);
257 void OMySQLIntroPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& /*_rControlList*/)
261 void OMySQLIntroPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& /*_rControlList*/)
265 bool OMySQLIntroPageSetup::FillItemSet(SfxItemSet
* /*_rSet*/)
267 OSL_FAIL("Who called me?! Please ask oj for more information.");
271 OMySQLIntroPageSetup::ConnectionType
OMySQLIntroPageSetup::getMySQLMode() const
273 if (m_xJDBCDatabase
->get_active())
275 else if (m_xNATIVEDatabase
->get_active())
281 // MySQLNativeSetupPage
282 MySQLNativeSetupPage::MySQLNativeSetupPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
)
283 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/dbwizmysqlnativepage.ui"_ustr
, u
"DBWizMysqlNativePage"_ustr
, rCoreAttrs
)
284 , m_xHelpText(m_xBuilder
->weld_label(u
"helptext"_ustr
))
285 , m_xSettingsContainer(m_xBuilder
->weld_container(u
"MySQLSettingsContainer"_ustr
))
286 , m_xMySQLSettings(new MySQLNativeSettings(m_xSettingsContainer
.get(), LINK(this, OGenericAdministrationPage
, OnControlModified
)))
288 SetRoadmapStateValue(false);
291 MySQLNativeSetupPage::~MySQLNativeSetupPage()
293 m_xMySQLSettings
.reset();
296 std::unique_ptr
<OGenericAdministrationPage
> MySQLNativeSetupPage::Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rAttrSet
)
298 return std::make_unique
<MySQLNativeSetupPage
>(pPage
, pController
, rAttrSet
);
301 void MySQLNativeSetupPage::fillControls( std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
303 m_xMySQLSettings
->fillControls( _rControlList
);
306 void MySQLNativeSetupPage::fillWindows(std::vector
<std::unique_ptr
<ISaveValueWrapper
>>& rControlList
)
308 rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xHelpText
.get()));
309 m_xMySQLSettings
->fillWindows(rControlList
);
312 bool MySQLNativeSetupPage::FillItemSet( SfxItemSet
* _rSet
)
314 return m_xMySQLSettings
->FillItemSet( _rSet
);
317 void MySQLNativeSetupPage::implInitControls( const SfxItemSet
& _rSet
, bool _bSaveValue
)
319 m_xMySQLSettings
->implInitControls( _rSet
);
321 OGenericAdministrationPage::implInitControls( _rSet
, _bSaveValue
);
326 void MySQLNativeSetupPage::callModifiedHdl(weld::Widget
*)
328 SetRoadmapStateValue( m_xMySQLSettings
->canAdvance() );
330 OGenericAdministrationPage::callModifiedHdl();
333 // OMySQLJDBCConnectionPageSetup
334 OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
,sal_uInt16 _nPortId
, TranslateId pDefaultPortResId
, TranslateId pHelpTextResId
, TranslateId pHeaderTextResId
, TranslateId pDriverClassId
)
335 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/specialjdbcconnectionpage.ui"_ustr
, u
"SpecialJDBCConnectionPage"_ustr
, _rCoreAttrs
)
336 , m_nPortId(_nPortId
)
337 , m_xHeaderText(m_xBuilder
->weld_label(u
"header"_ustr
))
338 , m_xFTHelpText(m_xBuilder
->weld_label(u
"helpLabel"_ustr
))
339 , m_xFTDatabasename(m_xBuilder
->weld_label(u
"dbNameLabel"_ustr
))
340 , m_xETDatabasename(m_xBuilder
->weld_entry(u
"dbNameEntry"_ustr
))
341 , m_xFTHostname(m_xBuilder
->weld_label(u
"hostNameLabel"_ustr
))
342 , m_xETHostname(m_xBuilder
->weld_entry(u
"hostNameEntry"_ustr
))
343 , m_xFTPortNumber(m_xBuilder
->weld_label(u
"portNumLabel"_ustr
))
344 , m_xFTDefaultPortNumber(m_xBuilder
->weld_label(u
"portNumDefLabel"_ustr
))
345 , m_xNFPortNumber(m_xBuilder
->weld_spin_button(u
"portNumEntry"_ustr
))
346 , m_xFTDriverClass(m_xBuilder
->weld_label(u
"jdbcDriverLabel"_ustr
))
347 , m_xETDriverClass(m_xBuilder
->weld_entry(u
"jdbcDriverEntry"_ustr
))
348 , m_xPBTestJavaDriver(m_xBuilder
->weld_button(u
"testDriverButton"_ustr
))
350 m_xFTDriverClass
->set_label(DBA_RES(pDriverClassId
));
352 m_xFTDefaultPortNumber
->set_label(DBA_RES(pDefaultPortResId
));
353 OUString sHelpText
= DBA_RES(pHelpTextResId
);
354 m_xFTHelpText
->set_label(sHelpText
);
355 //TODO this code snippet is redundant
356 m_xHeaderText
->set_label(DBA_RES(pHeaderTextResId
));
358 m_xETDatabasename
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
359 m_xETHostname
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
360 m_xNFPortNumber
->connect_value_changed(LINK(this, OGenericAdministrationPage
, OnControlSpinButtonModifyHdl
));
362 m_xETDriverClass
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
363 m_xPBTestJavaDriver
->connect_clicked(LINK(this,OGeneralSpecialJDBCConnectionPageSetup
,OnTestJavaClickHdl
));
365 const SfxStringItem
* pUrlItem
= _rCoreAttrs
.GetItem
<SfxStringItem
>(DSID_CONNECTURL
);
366 const DbuTypeCollectionItem
* pTypesItem
= _rCoreAttrs
.GetItem
<DbuTypeCollectionItem
>(DSID_TYPECOLLECTION
);
367 ::dbaccess::ODsnTypeCollection
* pTypeCollection
= pTypesItem
? pTypesItem
->getCollection() : nullptr;
368 if (pTypeCollection
&& pUrlItem
&& pUrlItem
->GetValue().getLength() )
370 m_sDefaultJdbcDriverName
= pTypeCollection
->getJavaDriverClass(pUrlItem
->GetValue());
373 SetRoadmapStateValue(false);
376 OGeneralSpecialJDBCConnectionPageSetup::~OGeneralSpecialJDBCConnectionPageSetup()
380 std::unique_ptr
<OGenericAdministrationPage
> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
382 return std::make_unique
<OGeneralSpecialJDBCConnectionPageSetup
>(pPage
, pController
,
384 DSID_MYSQL_PORTNUMBER
,
386 STR_MYSQLJDBC_HELPTEXT
,
387 STR_MYSQLJDBC_HEADERTEXT
,
388 STR_MYSQL_DRIVERCLASSTEXT
);
391 std::unique_ptr
<OGenericAdministrationPage
> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
393 return std::make_unique
<OGeneralSpecialJDBCConnectionPageSetup
>(pPage
, pController
,
395 DSID_ORACLE_PORTNUMBER
,
398 STR_ORACLE_HEADERTEXT
,
399 STR_ORACLE_DRIVERCLASSTEXT
);
402 void OGeneralSpecialJDBCConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
404 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETDatabasename
.get()));
405 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETDriverClass
.get()));
406 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETHostname
.get()));
407 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::SpinButton
>(m_xNFPortNumber
.get()));
410 void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
412 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTHelpText
.get()));
413 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTDatabasename
.get()));
414 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTHostname
.get()));
415 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTPortNumber
.get()));
416 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTDefaultPortNumber
.get()));
417 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTDriverClass
.get()));
420 bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
422 bool bChangedSomething
= false;
423 fillString(*_rSet
,m_xETDriverClass
.get(),DSID_JDBCDRIVERCLASS
,bChangedSomething
);
424 fillString(*_rSet
,m_xETHostname
.get(),DSID_CONN_HOSTNAME
,bChangedSomething
);
425 fillString(*_rSet
,m_xETDatabasename
.get(),DSID_DATABASENAME
,bChangedSomething
);
426 fillInt32(*_rSet
,m_xNFPortNumber
.get(),m_nPortId
,bChangedSomething
);
427 return bChangedSomething
;
430 void OGeneralSpecialJDBCConnectionPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
432 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
433 bool bValid
, bReadonly
;
434 getFlags(_rSet
, bValid
, bReadonly
);
436 const SfxStringItem
* pDatabaseName
= _rSet
.GetItem
<SfxStringItem
>(DSID_DATABASENAME
);
437 const SfxStringItem
* pDrvItem
= _rSet
.GetItem
<SfxStringItem
>(DSID_JDBCDRIVERCLASS
);
438 const SfxStringItem
* pHostName
= _rSet
.GetItem
<SfxStringItem
>(DSID_CONN_HOSTNAME
);
439 const SfxInt32Item
* pPortNumber
= _rSet
.GetItem
<SfxInt32Item
>(m_nPortId
);
443 m_xETDatabasename
->set_text(pDatabaseName
->GetValue());
444 m_xETDatabasename
->save_value();
446 m_xETDriverClass
->set_text(pDrvItem
->GetValue());
447 m_xETDriverClass
->save_value();
449 m_xETHostname
->set_text(pHostName
->GetValue());
450 m_xETHostname
->save_value();
452 m_xNFPortNumber
->set_value(pPortNumber
->GetValue());
453 m_xNFPortNumber
->save_value();
455 OGenericAdministrationPage::implInitControls(_rSet
, _bSaveValue
);
457 // to get the correct value when saveValue was called by base class
458 if ( o3tl::trim(m_xETDriverClass
->get_text()).empty() )
460 m_xETDriverClass
->set_text(m_sDefaultJdbcDriverName
);
461 m_xETDriverClass
->save_value();
465 bool bRoadmapState
= ((!m_xETDatabasename
->get_text().isEmpty() ) && (!m_xETHostname
->get_text().isEmpty()) && (!m_xNFPortNumber
->get_text().isEmpty() ) && ( !m_xETDriverClass
->get_text().isEmpty() ));
466 SetRoadmapStateValue(bRoadmapState
);
469 IMPL_LINK_NOARG(OGeneralSpecialJDBCConnectionPageSetup
, OnTestJavaClickHdl
, weld::Button
&, void)
471 assert(m_pAdminDialog
&& "No Admin dialog set! ->GPF");
473 bool bSuccess
= false;
474 #if HAVE_FEATURE_JAVA
477 if ( !o3tl::trim(m_xETDriverClass
->get_text()).empty() )
479 // TODO change jvmaccess
480 ::rtl::Reference
< jvmaccess::VirtualMachine
> xJVM
= ::connectivity::getJavaVM( m_pAdminDialog
->getORB() );
481 m_xETDriverClass
->set_text(m_xETDriverClass
->get_text().trim()); // fdo#68341
482 bSuccess
= ::connectivity::existsJavaClassByName(xJVM
,m_xETDriverClass
->get_text());
485 catch(css::uno::Exception
&)
489 TranslateId pMessage
= bSuccess
? STR_JDBCDRIVER_SUCCESS
: STR_JDBCDRIVER_NO_SUCCESS
;
490 const MessageType mt
= bSuccess
? MessageType::Info
: MessageType::Error
;
491 OSQLMessageBox
aMsg(GetFrameWeld(), DBA_RES(pMessage
), OUString(), MessBoxStyle::Ok
| MessBoxStyle::DefaultOk
, mt
);
495 void OGeneralSpecialJDBCConnectionPageSetup::callModifiedHdl(weld::Widget
* pControl
)
497 if (pControl
== m_xETDriverClass
.get())
498 m_xPBTestJavaDriver
->set_sensitive( !o3tl::trim(m_xETDriverClass
->get_text()).empty() );
499 bool bRoadmapState
= ((!m_xETDatabasename
->get_text().isEmpty() ) && ( !m_xETHostname
->get_text().isEmpty() ) && (!m_xNFPortNumber
->get_text().isEmpty() ) && ( !o3tl::trim(m_xETDriverClass
->get_text()).empty() ));
500 SetRoadmapStateValue(bRoadmapState
);
501 OGenericAdministrationPage::callModifiedHdl();
504 std::unique_ptr
<OGenericAdministrationPage
> OJDBCConnectionPageSetup::CreateJDBCTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
506 return std::make_unique
<OJDBCConnectionPageSetup
>(pPage
, pController
, _rAttrSet
);
509 // OPostgresConnectionPageSetup
510 OPostgresConnectionPageSetup::OPostgresConnectionPageSetup( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
, sal_uInt16 _nPortId
)
511 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/postgrespage.ui"_ustr
, u
"SpecialPostgresPage"_ustr
, _rCoreAttrs
)
512 , m_nPortId(_nPortId
)
513 , m_xETDatabasename(m_xBuilder
->weld_entry(u
"dbNameEntry"_ustr
))
514 , m_xETHostname(m_xBuilder
->weld_entry(u
"hostNameEntry"_ustr
))
515 , m_xNFPortNumber(m_xBuilder
->weld_spin_button(u
"portNumEntry"_ustr
))
516 , m_xConnectionURL(new OConnectionURLEdit(m_xBuilder
->weld_entry(u
"browseurl"_ustr
), m_xBuilder
->weld_label(u
"browselabel"_ustr
)))
518 m_xETDatabasename
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
519 m_xETHostname
->connect_changed(LINK(this, OGenericAdministrationPage
, OnControlEntryModifyHdl
));
520 m_xNFPortNumber
->connect_value_changed(LINK(this, OGenericAdministrationPage
, OnControlSpinButtonModifyHdl
));
521 const DbuTypeCollectionItem
* pCollectionItem
= dynamic_cast<const DbuTypeCollectionItem
*>( _rCoreAttrs
.GetItem(DSID_TYPECOLLECTION
) );
523 m_pCollection
= pCollectionItem
->getCollection();
524 OSL_ENSURE(m_pCollection
, "OConnectionHelper::OConnectionHelper : really need a DSN type collection !");
525 m_xConnectionURL
->SetTypeCollection(m_pCollection
);
527 SetRoadmapStateValue(false);
530 OPostgresConnectionPageSetup::~OPostgresConnectionPageSetup()
534 std::unique_ptr
<OGenericAdministrationPage
> OPostgresConnectionPageSetup::CreatePostgresTabPage( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
536 return std::make_unique
<OPostgresConnectionPageSetup
>(pPage
, pController
,
538 DSID_POSTGRES_PORTNUMBER
);
541 void OPostgresConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
543 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETDatabasename
.get()));
544 _rControlList
.emplace_back( new OSaveValueWidgetWrapper
<OConnectionURLEdit
>( m_xConnectionURL
.get() ) );
545 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETHostname
.get()));
546 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::SpinButton
>(m_xNFPortNumber
.get()));
549 bool OPostgresConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
551 bool bChangedSomething
= false;
552 fillString(*_rSet
,m_xConnectionURL
.get(), DSID_CONNECTURL
, bChangedSomething
);
553 fillString(*_rSet
,m_xETHostname
.get(),DSID_CONN_HOSTNAME
,bChangedSomething
);
554 fillString(*_rSet
,m_xETDatabasename
.get(),DSID_DATABASENAME
,bChangedSomething
);
555 fillInt32(*_rSet
,m_xNFPortNumber
.get(),m_nPortId
,bChangedSomething
);
556 return bChangedSomething
;
559 void OPostgresConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& /*_rControlList*/)
563 void OPostgresConnectionPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
565 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
566 SetRoadmapStateValue(true);
567 bool bValid
, bReadonly
;
568 getFlags(_rSet
, bValid
, bReadonly
);
570 m_xConnectionURL
->show();
571 m_xConnectionURL
->ShowPrefix( false);
573 const SfxStringItem
* pDatabaseName
= _rSet
.GetItem
<SfxStringItem
>(DSID_DATABASENAME
);
574 const SfxStringItem
* pUrlItem
= _rSet
.GetItem
<SfxStringItem
>(DSID_CONNECTURL
);
575 const SfxStringItem
* pHostName
= _rSet
.GetItem
<SfxStringItem
>(DSID_CONN_HOSTNAME
);
576 const SfxInt32Item
* pPortNumber
= _rSet
.GetItem
<SfxInt32Item
>(m_nPortId
);
580 m_xETDatabasename
->set_text(pDatabaseName
->GetValue());
581 m_xETDatabasename
->save_value();
583 OUString sUrl
= pUrlItem
->GetValue();
585 m_xConnectionURL
->save_value();
587 m_xETHostname
->set_text(pHostName
->GetValue());
588 m_xETHostname
->save_value();
590 m_xNFPortNumber
->set_value(pPortNumber
->GetValue());
591 m_xNFPortNumber
->save_value();
594 OGenericAdministrationPage::implInitControls(_rSet
, _bSaveValue
);
599 bool OPostgresConnectionPageSetup::commitPage( ::vcl::WizardTypes::CommitPageReason
/*_eReason*/ )
604 bool OPostgresConnectionPageSetup::commitURL()
606 OUString sURL
= m_xConnectionURL
->GetTextNoPrefix();
607 setURLNoPrefix(sURL
);
608 m_xConnectionURL
->SaveValueNoPrefix();
612 void OPostgresConnectionPageSetup::impl_setURL( std::u16string_view _rURL
, bool _bPrefix
)
614 OUString
sURL( comphelper::string::stripEnd(_rURL
, '*') );
615 OSL_ENSURE( m_pCollection
, "OConnectionHelper::impl_setURL: have no interpreter for the URLs!" );
617 m_xConnectionURL
->SetText( sURL
);
619 m_xConnectionURL
->SetTextNoPrefix( sURL
);
622 void OPostgresConnectionPageSetup::setURLNoPrefix( std::u16string_view _rURL
)
624 impl_setURL( _rURL
,false);
627 void OPostgresConnectionPageSetup::setURL( std::u16string_view _rURL
)
629 impl_setURL( _rURL
, true);
632 // OMySQLJDBCConnectionPageSetup
633 OJDBCConnectionPageSetup::OJDBCConnectionPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
)
634 : OConnectionTabPageSetup(pPage
, pController
, u
"dbaccess/ui/jdbcconnectionpage.ui"_ustr
, u
"JDBCConnectionPage"_ustr
, rCoreAttrs
,
635 STR_JDBC_HELPTEXT
, STR_JDBC_HEADERTEXT
, STR_COMMONURL
)
636 , m_xFTDriverClass(m_xBuilder
->weld_label(u
"jdbcLabel"_ustr
))
637 , m_xETDriverClass(m_xBuilder
->weld_entry(u
"jdbcEntry"_ustr
))
638 , m_xPBTestJavaDriver(m_xBuilder
->weld_button(u
"jdbcButton"_ustr
))
640 m_xETDriverClass
->connect_changed(LINK(this, OJDBCConnectionPageSetup
, OnEditModified
));
641 m_xPBTestJavaDriver
->connect_clicked(LINK(this,OJDBCConnectionPageSetup
,OnTestJavaClickHdl
));
644 OJDBCConnectionPageSetup::~OJDBCConnectionPageSetup()
648 void OJDBCConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
650 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETDriverClass
.get()));
653 void OJDBCConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
655 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTDriverClass
.get()));
658 bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
660 bool bChangedSomething
= OConnectionTabPageSetup::FillItemSet(_rSet
);
661 fillString(*_rSet
,m_xETDriverClass
.get(),DSID_JDBCDRIVERCLASS
,bChangedSomething
);
662 return bChangedSomething
;
665 void OJDBCConnectionPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool _bSaveValue
)
667 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
668 bool bValid
, bReadonly
;
669 getFlags(_rSet
, bValid
, bReadonly
);
671 const SfxStringItem
* pDrvItem
= _rSet
.GetItem
<SfxStringItem
>(DSID_JDBCDRIVERCLASS
);
675 if ( !pDrvItem
->GetValue().getLength() )
677 OUString sDefaultJdbcDriverName
= m_pCollection
->getJavaDriverClass(m_eType
);
678 if ( !sDefaultJdbcDriverName
.isEmpty() )
680 m_xETDriverClass
->set_text(sDefaultJdbcDriverName
);
681 m_xETDriverClass
->save_value();
686 m_xETDriverClass
->set_text(pDrvItem
->GetValue());
687 m_xETDriverClass
->save_value();
690 bool bEnable
= pDrvItem
->GetValue().getLength() != 0;
691 m_xPBTestJavaDriver
->set_sensitive(bEnable
);
692 OConnectionTabPageSetup::implInitControls(_rSet
, _bSaveValue
);
694 SetRoadmapStateValue(checkTestConnection());
697 bool OJDBCConnectionPageSetup::checkTestConnection()
699 OSL_ENSURE(m_pAdminDialog
,"No Admin dialog set! ->GPF");
700 bool bEnableTestConnection
= !m_xConnectionURL
->get_visible() || !m_xConnectionURL
->GetTextNoPrefix().isEmpty();
701 bEnableTestConnection
= bEnableTestConnection
&& (!m_xETDriverClass
->get_text().isEmpty());
702 return bEnableTestConnection
;
705 IMPL_LINK_NOARG(OJDBCConnectionPageSetup
, OnTestJavaClickHdl
, weld::Button
&, void)
707 assert(m_pAdminDialog
&& "No Admin dialog set! ->GPF");
708 bool bSuccess
= false;
709 #if HAVE_FEATURE_JAVA
712 if ( !m_xETDriverClass
->get_text().isEmpty() )
714 // TODO change jvmaccess
715 ::rtl::Reference
< jvmaccess::VirtualMachine
> xJVM
= ::connectivity::getJavaVM( m_pAdminDialog
->getORB() );
716 m_xETDriverClass
->set_text(m_xETDriverClass
->get_text().trim()); // fdo#68341
717 bSuccess
= xJVM
.is() && ::connectivity::existsJavaClassByName(xJVM
,m_xETDriverClass
->get_text());
720 catch(css::uno::Exception
&)
724 TranslateId pMessage
= bSuccess
? STR_JDBCDRIVER_SUCCESS
: STR_JDBCDRIVER_NO_SUCCESS
;
725 const MessageType mt
= bSuccess
? MessageType::Info
: MessageType::Error
;
726 OSQLMessageBox
aMsg(GetFrameWeld(), DBA_RES(pMessage
), OUString(), MessBoxStyle::Ok
| MessBoxStyle::DefaultOk
, mt
);
730 IMPL_LINK(OJDBCConnectionPageSetup
, OnEditModified
, weld::Entry
&, rEdit
, void)
732 if (&rEdit
== m_xETDriverClass
.get())
733 m_xPBTestJavaDriver
->set_sensitive(!m_xETDriverClass
->get_text().isEmpty());
734 SetRoadmapStateValue(checkTestConnection());
735 // tell the listener we were modified
739 std::unique_ptr
<OGenericAdministrationPage
> OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
741 return std::make_unique
<OSpreadSheetConnectionPageSetup
>(pPage
, pController
, _rAttrSet
);
744 OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rCoreAttrs
)
745 : OConnectionTabPageSetup(pPage
, pController
, u
"dbaccess/ui/dbwizspreadsheetpage.ui"_ustr
, u
"DBWizSpreadsheetPage"_ustr
,
746 rCoreAttrs
, STR_SPREADSHEET_HELPTEXT
, STR_SPREADSHEET_HEADERTEXT
, STR_SPREADSHEETPATH
)
747 , m_xPasswordrequired(m_xBuilder
->weld_check_button(u
"passwordrequired"_ustr
))
749 m_xPasswordrequired
->connect_toggled(LINK(this, OGenericAdministrationPage
, OnControlModifiedButtonClick
));
752 OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
756 void OSpreadSheetConnectionPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& /*_rControlList*/)
760 void OSpreadSheetConnectionPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
762 OConnectionTabPageSetup::fillControls(_rControlList
);
763 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xPasswordrequired
.get()));
767 bool OSpreadSheetConnectionPageSetup::FillItemSet( SfxItemSet
* _rSet
)
769 bool bChangedSomething
= OConnectionTabPageSetup::FillItemSet(_rSet
);
770 fillBool(*_rSet
,m_xPasswordrequired
.get(),DSID_PASSWORDREQUIRED
,false,bChangedSomething
);
771 return bChangedSomething
;
774 std::unique_ptr
<OGenericAdministrationPage
> OAuthentificationPageSetup::CreateAuthentificationTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rAttrSet
)
776 return std::make_unique
<OAuthentificationPageSetup
>(pPage
, pController
, _rAttrSet
);
779 OAuthentificationPageSetup::OAuthentificationPageSetup(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& _rCoreAttrs
)
780 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/authentificationpage.ui"_ustr
, u
"AuthentificationPage"_ustr
, _rCoreAttrs
)
781 , m_xFTHelpText(m_xBuilder
->weld_label(u
"helptext"_ustr
))
782 , m_xFTUserName(m_xBuilder
->weld_label(u
"generalUserNameLabel"_ustr
))
783 , m_xETUserName(m_xBuilder
->weld_entry(u
"generalUserNameEntry"_ustr
))
784 , m_xCBPasswordRequired(m_xBuilder
->weld_check_button(u
"passRequiredCheckbutton"_ustr
))
785 , m_xPBTestConnection(m_xBuilder
->weld_button(u
"testConnectionButton"_ustr
))
787 m_xETUserName
->connect_changed(LINK(this,OGenericAdministrationPage
,OnControlEntryModifyHdl
));
788 m_xCBPasswordRequired
->connect_toggled(LINK(this,OGenericAdministrationPage
,OnControlModifiedButtonClick
));
789 m_xPBTestConnection
->connect_clicked(LINK(this,OGenericAdministrationPage
,OnTestConnectionButtonClickHdl
));
792 OAuthentificationPageSetup::~OAuthentificationPageSetup()
796 void OAuthentificationPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
798 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTHelpText
.get()));
799 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTUserName
.get()));
800 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Button
>(m_xPBTestConnection
.get()));
803 void OAuthentificationPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
805 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Entry
>(m_xETUserName
.get()));
806 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xCBPasswordRequired
.get()));
809 void OAuthentificationPageSetup::implInitControls(const SfxItemSet
& _rSet
, bool /*_bSaveValue*/)
811 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
812 bool bValid
, bReadonly
;
813 getFlags(_rSet
, bValid
, bReadonly
);
814 const SfxStringItem
* pUidItem
= _rSet
.GetItem
<SfxStringItem
>(DSID_USER
);
815 const SfxBoolItem
* pAllowEmptyPwd
= _rSet
.GetItem
<SfxBoolItem
>(DSID_PASSWORDREQUIRED
);
817 m_xETUserName
->set_text(pUidItem
->GetValue());
818 m_xCBPasswordRequired
->set_active(pAllowEmptyPwd
->GetValue());
820 m_xETUserName
->save_value();
823 bool OAuthentificationPageSetup::FillItemSet( SfxItemSet
* _rSet
)
825 bool bChangedSomething
= false;
827 if (m_xETUserName
->get_value_changed_from_saved())
829 _rSet
->Put(SfxStringItem(DSID_USER
, m_xETUserName
->get_text()));
830 _rSet
->Put(SfxStringItem(DSID_PASSWORD
, OUString()));
831 bChangedSomething
= true;
833 fillBool(*_rSet
, m_xCBPasswordRequired
.get(), DSID_PASSWORDREQUIRED
, false, bChangedSomething
);
834 return bChangedSomething
;
837 std::unique_ptr
<OGenericAdministrationPage
> OFinalDBPageSetup::CreateFinalDBTabPageSetup(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& _rAttrSet
)
839 return std::make_unique
<OFinalDBPageSetup
>(pPage
, pController
, _rAttrSet
);
842 OFinalDBPageSetup::OFinalDBPageSetup(weld::Container
* pPage
, ODbTypeWizDialogSetup
* pController
, const SfxItemSet
& _rCoreAttrs
)
843 : OGenericAdministrationPage(pPage
, pController
, u
"dbaccess/ui/finalpagewizard.ui"_ustr
, u
"PageFinal"_ustr
, _rCoreAttrs
)
844 , m_xFTFinalHeader(m_xBuilder
->weld_label(u
"headerText"_ustr
))
845 , m_xFTFinalHelpText(m_xBuilder
->weld_label(u
"helpText"_ustr
))
846 , m_xRBRegisterDataSource(m_xBuilder
->weld_radio_button(u
"yesregister"_ustr
))
847 , m_xRBDontregisterDataSource(m_xBuilder
->weld_radio_button(u
"noregister"_ustr
))
848 , m_xFTAdditionalSettings(m_xBuilder
->weld_label(u
"additionalText"_ustr
))
849 , m_xCBOpenAfterwards(m_xBuilder
->weld_check_button(u
"openediting"_ustr
))
850 , m_xCBStartTableWizard(m_xBuilder
->weld_check_button(u
"usewizard"_ustr
))
851 , m_xFTFinalText(m_xBuilder
->weld_label(u
"finishText"_ustr
))
853 m_xCBOpenAfterwards
->connect_toggled(LINK(this, OFinalDBPageSetup
, OnOpenSelected
));
854 m_xRBRegisterDataSource
->set_active(true);
855 pController
->SetFinalPage(this);
858 OFinalDBPageSetup::~OFinalDBPageSetup()
862 bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered() const
864 return m_xRBRegisterDataSource
->get_active() && m_xRBRegisterDataSource
->get_sensitive();
867 bool OFinalDBPageSetup::IsDatabaseDocumentToBeOpened() const
869 return m_xCBOpenAfterwards
->get_active() && m_xCBOpenAfterwards
->get_sensitive();
872 bool OFinalDBPageSetup::IsTableWizardToBeStarted() const
874 return m_xCBStartTableWizard
->get_active() && m_xCBStartTableWizard
->get_sensitive();
877 void OFinalDBPageSetup::fillWindows(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
879 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTFinalHeader
.get()));
880 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTFinalHelpText
.get()));
881 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTAdditionalSettings
.get()));
882 _rControlList
.emplace_back(new ODisableWidgetWrapper
<weld::Label
>(m_xFTFinalText
.get()));
885 void OFinalDBPageSetup::fillControls(std::vector
< std::unique_ptr
<ISaveValueWrapper
> >& _rControlList
)
887 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xCBOpenAfterwards
.get()));
888 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xCBStartTableWizard
.get()));
889 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xRBRegisterDataSource
.get()));
890 _rControlList
.emplace_back(new OSaveValueWidgetWrapper
<weld::Toggleable
>(m_xRBDontregisterDataSource
.get()));
893 void OFinalDBPageSetup::implInitControls(const SfxItemSet
& /*_rSet*/, bool /*_bSaveValue*/)
895 m_xCBOpenAfterwards
->set_active(true);
898 void OFinalDBPageSetup::enableTableWizardCheckBox( bool _bSupportsTableCreation
)
900 m_xCBStartTableWizard
->set_sensitive(_bSupportsTableCreation
);
903 bool OFinalDBPageSetup::FillItemSet( SfxItemSet
* /*_rSet*/ )
908 IMPL_LINK(OFinalDBPageSetup
, OnOpenSelected
, weld::Toggleable
&, rBox
, void)
910 m_xCBStartTableWizard
->set_sensitive(rBox
.get_sensitive() && rBox
.get_active());
916 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */