LibreOffice Module dbaccess (master) 1
detailpages.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <config_java.h>
21#include <core_resource.hxx>
22#include "detailpages.hxx"
23#include <sqlmessage.hxx>
24#include <dsmeta.hxx>
25#include "advancedsettings.hxx"
26#include "DbAdminImpl.hxx"
27#include <dsitems.hxx>
28#include "dbfindex.hxx"
29#include "dsnItem.hxx"
30
31#include <IItemSetHelper.hxx>
32#include <strings.hrc>
33
34#include <svl/itemset.hxx>
35#include <svl/stritem.hxx>
36#include <svl/eitem.hxx>
37#include <svl/intitem.hxx>
38#if HAVE_FEATURE_JAVA
40#endif
42#include "DriverSettings.hxx"
43
44namespace dbaui
45{
46
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::sdbc;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::container;
52 using namespace ::dbtools;
53
55 const OUString& rUIXMLDescription, const OUString& rId, const SfxItemSet& rCoreAttrs,
56 OCommonBehaviourTabPageFlags nControlFlags)
57 : OGenericAdministrationPage(pPage, pController, rUIXMLDescription, rId, rCoreAttrs)
58 , m_nControlFlags(nControlFlags)
59 {
61 {
62 m_xOptionsLabel = m_xBuilder->weld_label("optionslabel");
63 m_xOptionsLabel->show();
64 m_xOptions = m_xBuilder->weld_entry("options");
65 m_xOptions->show();
66 m_xOptions->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
67 }
68
70 {
71 m_xDataConvertLabel = m_xBuilder->weld_label("charsetheader");
72 m_xDataConvertLabel->show();
73 m_xCharsetLabel = m_xBuilder->weld_label("charsetlabel");
74 m_xCharsetLabel->show();
75 m_xCharset.reset(new CharSetListBox(m_xBuilder->weld_combo_box("charset")));
76 m_xCharset->show();
77 m_xCharset->connect_changed(LINK(this, OCommonBehaviourTabPage, CharsetSelectHdl));
78 }
79 }
80
82 {
83 callModifiedHdl();
84 }
85
87 {
88 m_xCharset.reset();
89 }
90
91 void OCommonBehaviourTabPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
92 {
94 {
95 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xOptionsLabel.get()));
96 }
97
99 {
100 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xCharsetLabel.get()));
101 }
102 }
103
104 void OCommonBehaviourTabPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
105 {
107 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xOptions.get()));
108
110 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ComboBox>(m_xCharset->get_widget()));
111 }
112
113 void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
114 {
115 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
116 bool bValid, bReadonly;
117 getFlags(_rSet, bValid, bReadonly);
118
119 // collect the items
120 const SfxStringItem* pOptionsItem = _rSet.GetItem<SfxStringItem>(DSID_ADDITIONALOPTIONS);
121 const SfxStringItem* pCharsetItem = _rSet.GetItem<SfxStringItem>(DSID_CHARSET);
122
123 // forward the values to the controls
124 if (bValid)
125 {
127 {
128 m_xOptions->set_text(pOptionsItem->GetValue());
129 m_xOptions->save_value();
130 }
131
133 {
134 m_xCharset->SelectEntryByIanaName( pCharsetItem->GetValue() );
135 }
136 }
138 }
139
141 {
142 bool bChangedSomething = false;
143
145 {
146 fillString(*_rSet,m_xOptions.get(),DSID_ADDITIONALOPTIONS,bChangedSomething);
147 }
148
150 {
151 if ( m_xCharset->StoreSelectedCharSet( *_rSet, DSID_CHARSET ) )
152 bChangedSomething = true;
153 }
154
155 return bChangedSomething;
156 }
157
158 // ODbaseDetailsPage
160 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/dbasepage.ui", "DbasePage",
162 , m_xShowDeleted(m_xBuilder->weld_check_button("showDelRowsCheckbutton"))
163 , m_xFT_Message(m_xBuilder->weld_label("specMessageLabel"))
164 , m_xIndexes(m_xBuilder->weld_button("indiciesButton"))
165 {
166 m_xIndexes->connect_clicked(LINK(this, ODbaseDetailsPage, OnButtonClicked));
167 m_xShowDeleted->connect_toggled(LINK(this, ODbaseDetailsPage, OnButtonToggled));
168 }
169
171 {
172 }
173
174 std::unique_ptr<SfxTabPage> ODriversSettings::CreateDbase(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
175 {
176 return std::make_unique<ODbaseDetailsPage>(pPage, pController, *_rAttrSet);
177 }
178
179 void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
180 {
181 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
182 bool bValid, bReadonly;
183 getFlags(_rSet, bValid, bReadonly);
184
185 // get the DSN string (needed for the index dialog)
186 const SfxStringItem* pUrlItem = _rSet.GetItem<SfxStringItem>(DSID_CONNECTURL);
188 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
189 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength())
190 m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
191
192 // get the other relevant items
193 const SfxBoolItem* pDeletedItem = _rSet.GetItem<SfxBoolItem>(DSID_SHOWDELETEDROWS);
194
195 if ( bValid )
196 {
197 m_xShowDeleted->set_active(pDeletedItem->GetValue());
198 m_xFT_Message->set_visible(m_xShowDeleted->get_active());
199 }
200
202 }
203
205 {
206 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
207
208 fillBool(*_rSet, m_xShowDeleted.get(), DSID_SHOWDELETEDROWS, false, bChangedSomething);
209 return bChangedSomething;
210 }
211
213 {
214 ODbaseIndexDialog aIndexDialog(GetFrameWeld(), m_sDsn);
215 aIndexDialog.run();
216 }
217
219 {
220 m_xFT_Message->set_visible(m_xShowDeleted->get_active());
221 // it was the checkbox -> we count as modified from now on
222 callModifiedHdl();
223 }
224
225
226 // OAdoDetailsPage
228 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/autocharsetpage.ui", "AutoCharset",
230 {
231
232 }
233
234 std::unique_ptr<SfxTabPage> ODriversSettings::CreateAdo(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
235 {
236 return std::make_unique<OAdoDetailsPage>(pPage, pController, *rAttrSet);
237 }
238
239 // OOdbcDetailsPage
241 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/odbcpage.ui", "ODBC", rCoreAttrs,
243 , m_xUseCatalog(m_xBuilder->weld_check_button("useCatalogCheckbutton"))
244 {
245 m_xUseCatalog->connect_toggled(LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick));
246 }
247
249 {
250 }
251
252 std::unique_ptr<SfxTabPage> ODriversSettings::CreateODBC(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pAttrSet)
253 {
254 return std::make_unique<OOdbcDetailsPage>(pPage, pController, *pAttrSet);
255 }
256
258 {
259 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
260 fillBool(*_rSet,m_xUseCatalog.get(),DSID_USECATALOG,false,bChangedSomething);
261 return bChangedSomething;
262 }
263 void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
264 {
265 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
266 bool bValid, bReadonly;
267 getFlags(_rSet, bValid, bReadonly);
268
269 const SfxBoolItem* pUseCatalogItem = _rSet.GetItem<SfxBoolItem>(DSID_USECATALOG);
270
271 if ( bValid )
272 m_xUseCatalog->set_active(pUseCatalogItem->GetValue());
273
275 }
276 // OOdbcDetailsPage
278 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/userdetailspage.ui", "UserDetailsPage",
280 , m_xFTHostname(m_xBuilder->weld_label("hostnameft"))
281 , m_xEDHostname(m_xBuilder->weld_entry("hostname"))
282 , m_xPortNumber(m_xBuilder->weld_label("portnumberft"))
283 , m_xNFPortNumber(m_xBuilder->weld_spin_button("portnumber"))
284 , m_xUseCatalog(m_xBuilder->weld_check_button("usecatalog"))
285 {
286 m_xUseCatalog->connect_toggled(LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick));
287 }
288
290 {
291 }
292
293 std::unique_ptr<SfxTabPage> ODriversSettings::CreateUser(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pAttrSet)
294 {
295 return std::make_unique<OUserDriverDetailsPage>(pPage, pController, *pAttrSet);
296 }
297
299 {
300 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
301
302 fillInt32(*_rSet,m_xNFPortNumber.get(),DSID_CONN_PORTNUMBER,bChangedSomething);
303 fillString(*_rSet,m_xEDHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething);
304 fillBool(*_rSet,m_xUseCatalog.get(),DSID_USECATALOG,false,bChangedSomething);
305
306 return bChangedSomething;
307 }
308 void OUserDriverDetailsPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
309 {
311 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xEDHostname.get()));
312 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xUseCatalog.get()));
313 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get()));
314 }
315 void OUserDriverDetailsPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
316 {
318 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHostname.get()));
319 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xPortNumber.get()));
320 }
321 void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
322 {
323 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
324 bool bValid, bReadonly;
325 getFlags(_rSet, bValid, bReadonly);
326
327 const SfxBoolItem* pUseCatalogItem = _rSet.GetItem<SfxBoolItem>(DSID_USECATALOG);
328 const SfxStringItem* pHostName = _rSet.GetItem<SfxStringItem>(DSID_CONN_HOSTNAME);
329 const SfxInt32Item* pPortNumber = _rSet.GetItem<SfxInt32Item>(DSID_CONN_PORTNUMBER);
330
331 if ( bValid )
332 {
333 m_xEDHostname->set_text(pHostName->GetValue());
334 m_xEDHostname->save_value();
335
336 m_xNFPortNumber->set_value(pPortNumber->GetValue());
337 m_xNFPortNumber->save_value();
338
339 m_xUseCatalog->set_active(pUseCatalogItem->GetValue());
340 }
341
343 }
344 // OMySQLODBCDetailsPage
346 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/autocharsetpage.ui", "AutoCharset",
348 {
349 }
350
351 std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLODBC(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pAttrSet)
352 {
353 return std::make_unique<OMySQLODBCDetailsPage>(pPage, pController, *pAttrSet);
354 }
355
356 // OMySQLJDBCDetailsPage
357 OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket)
358 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/generalspecialjdbcdetailspage.ui", "GeneralSpecialJDBCDetails",
360 , m_nPortId(_nPortId)
361 , m_bUseClass(true)
362 , m_xEDHostname(m_xBuilder->weld_entry("hostNameEntry"))
363 , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
364 , m_xFTSocket(m_xBuilder->weld_label("socketLabel"))
365 , m_xEDSocket(m_xBuilder->weld_entry("socketEntry"))
366 , m_xFTDriverClass(m_xBuilder->weld_label("driverClassLabel"))
367 , m_xEDDriverClass(m_xBuilder->weld_entry("jdbcDriverClassEntry"))
368 , m_xTestJavaDriver(m_xBuilder->weld_button("testDriverClassButton"))
369 {
370 const SfxStringItem* pUrlItem = rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL);
372 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
373 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength() )
374 {
375 m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
376 }
377 if ( m_sDefaultJdbcDriverName.getLength() )
378 {
379 m_xEDDriverClass->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
380 m_xTestJavaDriver->connect_clicked(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
381 }
382 else
383 {
384 m_bUseClass = false;
385 m_xFTDriverClass->hide();
386 m_xEDDriverClass->hide();
387 m_xTestJavaDriver->hide();
388 }
389
390 m_xFTSocket->set_visible(bShowSocket && !m_bUseClass);
391 m_xEDSocket->set_visible(bShowSocket && !m_bUseClass);
392
393 m_xEDHostname->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
394 m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
395 m_xEDSocket->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
396 }
397
399 {
400 }
401
403 {
404 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
405 if ( m_bUseClass )
406 fillString(*_rSet,m_xEDDriverClass.get(),DSID_JDBCDRIVERCLASS,bChangedSomething);
407 fillString(*_rSet,m_xEDHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething);
408 fillString(*_rSet,m_xEDSocket.get(),DSID_CONN_SOCKET,bChangedSomething);
409 fillInt32(*_rSet,m_xNFPortNumber.get(),m_nPortId,bChangedSomething );
410
411 return bChangedSomething;
412 }
414 {
415 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
416 bool bValid, bReadonly;
417 getFlags(_rSet, bValid, bReadonly);
418
420 const SfxStringItem* pHostName = _rSet.GetItem<SfxStringItem>(DSID_CONN_HOSTNAME);
421 const SfxInt32Item* pPortNumber = _rSet.GetItem<SfxInt32Item>(m_nPortId);
422 const SfxStringItem* pSocket = _rSet.GetItem<SfxStringItem>(DSID_CONN_SOCKET);
423
424 if ( bValid )
425 {
426 if ( m_bUseClass )
427 {
428 m_xEDDriverClass->set_text(pDrvItem->GetValue());
429 m_xEDDriverClass->save_value();
430 }
431
432 m_xEDHostname->set_text(pHostName->GetValue());
433 m_xEDHostname->save_value();
434
435 m_xNFPortNumber->set_value(pPortNumber->GetValue());
436 m_xNFPortNumber->save_value();
437
438 m_xEDSocket->set_text(pSocket->GetValue());
439 m_xEDSocket->save_value();
440 }
441
443
444 // to get the correct value when saveValue was called by base class
445 if ( m_bUseClass && o3tl::trim(m_xEDDriverClass->get_text()).empty() )
446 {
448 m_xEDDriverClass->save_value();
449 }
450 }
452 {
453 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
454 OSL_ENSURE(m_bUseClass,"Who called me?");
455
456 bool bSuccess = false;
457#if HAVE_FEATURE_JAVA
458 try
459 {
460 if (!o3tl::trim(m_xEDDriverClass->get_text()).empty())
461 {
462// TODO change jvmaccess
463 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
464 m_xEDDriverClass->set_text(m_xEDDriverClass->get_text().trim()); // fdo#68341
465 bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xEDDriverClass->get_text());
466 }
467 }
468 catch(Exception&)
469 {
470 }
471#endif
472 TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
473 const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error;
474 OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt);
475 aMsg.run();
476 }
477
479 {
480 if (m_bUseClass && pControl == m_xEDDriverClass.get())
481 m_xTestJavaDriver->set_sensitive(!o3tl::trim(m_xEDDriverClass->get_text()).empty());
482
483 // tell the listener we were modified
485 }
486
487 // MySQLNativePage
489 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/mysqlnativepage.ui", "MysqlNativePage", rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
490 , m_xMySQLSettingsContainer(m_xBuilder->weld_widget("MySQLSettingsContainer"))
491 , m_xMySQLSettings(new MySQLNativeSettings(m_xMySQLSettingsContainer.get(), LINK(this,OGenericAdministrationPage,OnControlModified)))
492 , m_xSeparator1(m_xBuilder->weld_label("connectionheader"))
493 , m_xSeparator2(m_xBuilder->weld_label("userheader"))
494 , m_xUserNameLabel(m_xBuilder->weld_label("usernamelabel"))
495 , m_xUserName(m_xBuilder->weld_entry("username"))
496 , m_xPasswordRequired(m_xBuilder->weld_check_button("passwordrequired"))
497 {
498 m_xUserName->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
499 }
500
502 {
503 m_xMySQLSettings.reset();
504 }
505
506 void MySQLNativePage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
507 {
509 m_xMySQLSettings->fillControls( _rControlList );
510
511 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xUserName.get()));
512 _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Toggleable>(m_xPasswordRequired.get()));
513 }
514
515 void MySQLNativePage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
516 {
518 m_xMySQLSettings->fillWindows( _rControlList);
519
520 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xSeparator1.get()));
521 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xSeparator2.get()));
522 _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xUserNameLabel.get()));
523 }
524
526 {
527 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
528
529 bChangedSomething |= m_xMySQLSettings->FillItemSet( _rSet );
530
531 if (m_xUserName->get_value_changed_from_saved())
532 {
533 _rSet->Put( SfxStringItem( DSID_USER, m_xUserName->get_text() ) );
534 _rSet->Put( SfxStringItem( DSID_PASSWORD, OUString()));
535 bChangedSomething = true;
536 }
537 fillBool(*_rSet,m_xPasswordRequired.get(),DSID_PASSWORDREQUIRED,false,bChangedSomething);
538
539 return bChangedSomething;
540 }
541 void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
542 {
543 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
544 bool bValid, bReadonly;
545 getFlags(_rSet, bValid, bReadonly);
546
547 m_xMySQLSettings->implInitControls( _rSet );
548
549 const SfxStringItem* pUidItem = _rSet.GetItem<SfxStringItem>(DSID_USER);
550 const SfxBoolItem* pAllowEmptyPwd = _rSet.GetItem<SfxBoolItem>(DSID_PASSWORDREQUIRED);
551
552 if ( bValid )
553 {
554 m_xUserName->set_text(pUidItem->GetValue());
555 m_xUserName->save_value();
556 m_xPasswordRequired->set_active(pAllowEmptyPwd->GetValue());
557 }
558
560 }
561
562 std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet )
563 {
564 return std::make_unique<OGeneralSpecialJDBCDetailsPage>(pPage, pController, *_rAttrSet,DSID_MYSQL_PORTNUMBER);
565 }
566
567 std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pAttrSet)
568 {
569 return std::make_unique<MySQLNativePage>(pPage, pController, *pAttrSet);
570 }
571
572 std::unique_ptr<SfxTabPage> ODriversSettings::CreateOracleJDBC(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
573 {
574 return std::make_unique<OGeneralSpecialJDBCDetailsPage>(pPage, pController, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false);
575 }
576
577 // OLDAPDetailsPage
579 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/ldappage.ui", "LDAP",
581 , m_xETBaseDN(m_xBuilder->weld_entry("baseDNEntry"))
582 , m_xCBUseSSL(m_xBuilder->weld_check_button("useSSLCheckbutton"))
583 , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
584 , m_xNFRowCount(m_xBuilder->weld_spin_button("LDAPRowCountspinbutton"))
585 {
586 m_xETBaseDN->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
587 m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
588 m_xNFRowCount->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
589
590 m_iNormalPort = 389;
591 m_iSSLPort = 636;
592 m_xCBUseSSL->connect_toggled(LINK(this, OLDAPDetailsPage, OnCheckBoxClick));
593 }
594
596 {
597 }
598
599 std::unique_ptr<SfxTabPage> ODriversSettings::CreateLDAP(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
600 {
601 return std::make_unique<OLDAPDetailsPage>(pPage, pController, *_rAttrSet);
602 }
603
605 {
606 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
607
608 fillString(*_rSet,m_xETBaseDN.get(),DSID_CONN_LDAP_BASEDN,bChangedSomething);
609 fillInt32(*_rSet,m_xNFPortNumber.get(),DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
610 fillInt32(*_rSet,m_xNFRowCount.get(),DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
611 fillBool(*_rSet,m_xCBUseSSL.get(),DSID_CONN_LDAP_USESSL,false,bChangedSomething);
612 return bChangedSomething;
613 }
614
615 IMPL_LINK(OLDAPDetailsPage, OnCheckBoxClick, weld::Toggleable&, rCheckBox, void)
616 {
617 OnControlModifiedButtonClick(rCheckBox);
618 callModifiedHdl();
619 if (m_xCBUseSSL->get_active())
620 {
621 m_iNormalPort = m_xNFPortNumber->get_value();
622 m_xNFPortNumber->set_value(m_iSSLPort);
623 }
624 else
625 {
626 m_iSSLPort = m_xNFPortNumber->get_value();
627 m_xNFPortNumber->set_value(m_iNormalPort);
628 }
629 }
630
631 void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
632 {
633 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
634 bool bValid, bReadonly;
635 getFlags(_rSet, bValid, bReadonly);
636
638 const SfxBoolItem* pUseSSL = _rSet.GetItem<SfxBoolItem>(DSID_CONN_LDAP_USESSL);
639 const SfxInt32Item* pPortNumber = _rSet.GetItem<SfxInt32Item>(DSID_CONN_LDAP_PORTNUMBER);
640 const SfxInt32Item* pRowCount = _rSet.GetItem<SfxInt32Item>(DSID_CONN_LDAP_ROWCOUNT);
641
642 if ( bValid )
643 {
644 m_xETBaseDN->set_text(pBaseDN->GetValue());
645 m_xNFPortNumber->set_value(pPortNumber->GetValue());
646 m_xNFRowCount->set_value(pRowCount->GetValue());
647 m_xCBUseSSL->set_active(pUseSSL->GetValue());
648 }
649
651 }
652
653 // OTextDetailsPage
655 : OCommonBehaviourTabPage(pPage, pController, "dbaccess/ui/emptypage.ui", "EmptyPage", rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
657 {
658 }
659
661 {
663 }
664
665 std::unique_ptr<SfxTabPage> ODriversSettings::CreateText(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pAttrSet)
666 {
667 return std::make_unique<OTextDetailsPage>(pPage, pController, *pAttrSet);
668 }
669
670 void OTextDetailsPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
671 {
673 m_xTextConnectionHelper->fillControls(_rControlList);
674
675 }
676 void OTextDetailsPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
677 {
679 m_xTextConnectionHelper->fillWindows(_rControlList);
680
681 }
682 void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
683 {
684 // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
685 bool bValid, bReadonly;
686 getFlags(_rSet, bValid, bReadonly);
687
688 m_xTextConnectionHelper->implInitControls(_rSet, bValid);
690 }
691
693 {
694 bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet);
695 bChangedSomething = m_xTextConnectionHelper->FillItemSet(*rSet, bChangedSomething);
696 return bChangedSomething;
697 }
698
700 {
701 return m_xTextConnectionHelper->prepareLeave();
702 }
703
704 std::unique_ptr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
705 {
706 return std::make_unique<GeneratedValuesPage>(pPage, pController, *_rAttrSet);
707 }
708
709 std::unique_ptr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* _rAttrSet)
710 {
712 DataSourceMetaData aMetaData( eType );
713 return std::make_unique<SpecialSettingsPage>(pPage, pController, *_rAttrSet, aMetaData);
714 }
715} // namespace dbaui
716
717/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define TC_HEADER
#define TC_CHARSET
#define TC_SEPARATORS
#define TC_EXTENSION
const OUString & GetValue() const
bool GetValue() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
encapsulates meta data for a data source
Definition: dsmeta.hxx:55
allows an ODsnTypeCollection to be transported in an SfxItemSet
Definition: dsnItem.hxx:34
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::Label > m_xSeparator2
std::unique_ptr< weld::Entry > m_xUserName
std::unique_ptr< weld::Label > m_xUserNameLabel
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
std::unique_ptr< weld::Label > m_xSeparator1
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
MySQLNativePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual ~MySQLNativePage() override
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< MySQLNativeSettings > m_xMySQLSettings
std::unique_ptr< weld::CheckButton > m_xPasswordRequired
OAdoDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
eases the implementation of tab pages handling user/password and/or character set and/or generic opti...
Definition: detailpages.hxx:47
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< weld::Label > m_xCharsetLabel
Definition: detailpages.hxx:54
std::unique_ptr< weld::Label > m_xOptionsLabel
Definition: detailpages.hxx:50
virtual ~OCommonBehaviourTabPage() override
Definition: detailpages.cxx:86
OCommonBehaviourTabPage(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OUString &rId, const SfxItemSet &_rCoreAttrs, OCommonBehaviourTabPageFlags nControlFlags)
Definition: detailpages.cxx:54
std::unique_ptr< weld::Entry > m_xOptions
Definition: detailpages.hxx:51
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
Definition: detailpages.cxx:91
std::unique_ptr< weld::Label > m_xDataConvertLabel
Definition: detailpages.hxx:53
std::unique_ptr< CharSetListBox > m_xCharset
Definition: detailpages.hxx:55
OCommonBehaviourTabPageFlags m_nControlFlags
Definition: detailpages.hxx:48
static OUString getDatasourceType(const SfxItemSet &_rSet)
extracts the connection type from the given setThe connection type is determined by the value of the ...
std::unique_ptr< weld::Button > m_xIndexes
Definition: detailpages.hxx:91
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::Label > m_xFT_Message
Definition: detailpages.hxx:90
ODbaseDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rCoreAttrs)
virtual ~ODbaseDetailsPage() override
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< weld::CheckButton > m_xShowDeleted
Definition: detailpages.hxx:89
static std::unique_ptr< SfxTabPage > CreateMySQLODBC(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for MySQLODBC.
static std::unique_ptr< SfxTabPage > CreateSpecialSettingsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
creates the "Special Settings" page of the "Advanced Settings" dialog
static std::unique_ptr< SfxTabPage > CreateLDAP(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for LDAP.
static std::unique_ptr< SfxTabPage > CreateODBC(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for ODBC.
static std::unique_ptr< SfxTabPage > CreateText(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for Text.
static std::unique_ptr< SfxTabPage > CreateAdo(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for ado.
static std::unique_ptr< SfxTabPage > CreateOracleJDBC(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for Oracle JDBC.
static std::unique_ptr< SfxTabPage > CreateDbase(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for ado.
static std::unique_ptr< SfxTabPage > CreateGeneratedValuesPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
creates the GeneratedValues page
static std::unique_ptr< SfxTabPage > CreateMySQLJDBC(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for MySQLJDBC.
static std::unique_ptr< SfxTabPage > CreateMySQLNATIVE(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for MySQLNATIVE.
static std::unique_ptr< SfxTabPage > CreateUser(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *_rAttrSet)
Creates the detail page for user.
std::unique_ptr< weld::Button > m_xTestJavaDriver
std::unique_ptr< weld::Label > m_xFTDriverClass
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
virtual ~OGeneralSpecialJDBCDetailsPage() override
std::unique_ptr< weld::Label > m_xFTSocket
std::unique_ptr< weld::Entry > m_xEDHostname
TypedWhichId< SfxInt32Item > m_nPortId
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
virtual void callModifiedHdl(weld::Widget *pControl=nullptr) override
OGeneralSpecialJDBCDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rCoreAttrs, sal_uInt16 _nPortId, bool bShowSocket=true)
std::unique_ptr< weld::SpinButton > m_xNFPortNumber
std::unique_ptr< weld::Entry > m_xEDDriverClass
std::unique_ptr< weld::Entry > m_xEDSocket
static void getFlags(const SfxItemSet &_rSet, bool &_rValid, bool &_rReadonly)
analyze the invalid and the readonly flag which may be present in the set
Definition: adminpages.cxx:93
static void fillString(SfxItemSet &_rSet, const weld::Entry *pEdit, TypedWhichId< SfxStringItem > _nID, bool &_bChangedSomething)
fills the String value into the item set when the value changed.
Definition: adminpages.cxx:219
virtual void callModifiedHdl(weld::Widget *=nullptr)
Definition: adminpages.hxx:157
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue)
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
Definition: adminpages.cxx:150
static void fillBool(SfxItemSet &_rSet, const weld::CheckButton *pCheckBox, sal_uInt16 _nID, bool bOptionalBool, bool &_bChangedSomething, bool _bRevertValue=false)
fills the Boolean value into the item set when the value changed.
Definition: adminpages.cxx:190
static void fillInt32(SfxItemSet &_rSet, const weld::SpinButton *pEdit, TypedWhichId< SfxInt32Item > _nID, bool &_bChangedSomething)
fills the int value into the item set when the value changed.
Definition: adminpages.cxx:211
std::unique_ptr< weld::Entry > m_xETBaseDN
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< weld::CheckButton > m_xCBUseSSL
virtual ~OLDAPDetailsPage() override
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
OLDAPDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
std::unique_ptr< weld::SpinButton > m_xNFPortNumber
std::unique_ptr< weld::SpinButton > m_xNFRowCount
OMySQLODBCDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::CheckButton > m_xUseCatalog
virtual ~OOdbcDetailsPage() override
OOdbcDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
std::unique_ptr< OTextConnectionHelper > m_xTextConnectionHelper
virtual ~OTextDetailsPage() override
virtual bool prepareLeave() override
called from within DeactivatePage. The page is allowed to be deactivated if this method returns sal_T...
OTextDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rCoreAttrs)
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::Entry > m_xEDHostname
virtual void fillControls(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to save the value if necessary
OUserDriverDetailsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &_rCoreAttrs)
std::unique_ptr< weld::Label > m_xPortNumber
virtual ~OUserDriverDetailsPage() override
std::unique_ptr< weld::CheckButton > m_xUseCatalog
virtual void implInitControls(const SfxItemSet &_rSet, bool _bSaveValue) override
called from within Reset and ActivatePage, use to initialize the controls with the items from the giv...
std::unique_ptr< weld::SpinButton > m_xNFPortNumber
virtual void fillWindows(std::vector< std::unique_ptr< ISaveValueWrapper > > &_rControlList) override
will be called inside <method>implInitControls</method> to disable if necessary
virtual bool FillItemSet(SfxItemSet *_rCoreAttrs) override
std::unique_ptr< weld::Label > m_xFTHostname
virtual short run()
#define DBA_RES(id)
OCommonBehaviourTabPageFlags
Definition: detailpages.hxx:29
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define DSID_CHARSET
Definition: dsitems.hxx:44
#define DSID_CONN_LDAP_BASEDN
Definition: dsitems.hxx:65
#define DSID_PASSWORD
Definition: dsitems.hxx:42
#define DSID_CONN_LDAP_PORTNUMBER
Definition: dsitems.hxx:66
#define DSID_SHOWDELETEDROWS
Definition: dsitems.hxx:46
#define DSID_CONN_LDAP_USESSL
Definition: dsitems.hxx:81
#define DSID_CONNECTURL
Definition: dsitems.hxx:36
#define DSID_CONN_SOCKET
Definition: dsitems.hxx:88
#define DSID_CONN_LDAP_ROWCOUNT
Definition: dsitems.hxx:67
#define DSID_TYPECOLLECTION
Definition: dsitems.hxx:38
#define DSID_CONN_HOSTNAME
Definition: dsitems.hxx:64
#define DSID_MYSQL_PORTNUMBER
Definition: dsitems.hxx:73
#define DSID_ADDITIONALOPTIONS
Definition: dsitems.hxx:43
#define DSID_CONN_PORTNUMBER
Definition: dsitems.hxx:56
#define DSID_USECATALOG
Definition: dsitems.hxx:63
#define DSID_JDBCDRIVERCLASS
Definition: dsitems.hxx:48
#define DSID_USER
Definition: dsitems.hxx:41
#define DSID_ORACLE_PORTNUMBER
Definition: dsitems.hxx:76
#define DSID_PASSWORDREQUIRED
Definition: dsitems.hxx:45
OUString eType
Definition: generalpage.cxx:78
NONE
@ Exception
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Reference< XNameAccess > m_xContainer
Definition: objectnames.cxx:80
static SfxItemSet & rSet