Line data Source code
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_features.h>
21 :
22 : #include "DBSetupConnectionPages.hxx"
23 : #include "sqlmessage.hxx"
24 : #include "dbu_dlg.hrc"
25 : #include "dbu_resource.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"
32 : #include "dbaccess_helpid.hrc"
33 : #include "localresaccess.hxx"
34 : #include <vcl/msgbox.hxx>
35 : #include <vcl/mnemonic.hxx>
36 : #include <svl/cjkoptions.hxx>
37 : #if HAVE_FEATURE_JAVA
38 : #include <jvmaccess/virtualmachine.hxx>
39 : #endif
40 : #include <connectivity/CommonTools.hxx>
41 : #include "DriverSettings.hxx"
42 : #include "dbadmin.hxx"
43 : #include <comphelper/types.hxx>
44 :
45 : #include <com/sun/star/task/XInteractionHandler.hpp>
46 : #include <com/sun/star/sdbc/XDriverAccess.hpp>
47 : #include "dbustrings.hrc"
48 : #include <svl/filenotation.hxx>
49 :
50 : #include <unotools/localfilehelper.hxx>
51 : #include <unotools/ucbhelper.hxx>
52 : #include <ucbhelper/commandenvironment.hxx>
53 : #include "finteraction.hxx"
54 : #include <unotools/pathoptions.hxx>
55 : #include <svtools/roadmapwizard.hxx>
56 : #include "TextConnectionHelper.hxx"
57 : #include <osl/diagnose.h>
58 :
59 : namespace dbaui
60 : {
61 : using namespace ::com::sun::star;
62 :
63 0 : VclPtr<OGenericAdministrationPage> OTextConnectionPageSetup::CreateTextTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
64 : {
65 0 : return VclPtr<OTextConnectionPageSetup>::Create( pParent, _rAttrSet );
66 : }
67 :
68 : // OTextConnectionPageSetup
69 0 : OTextConnectionPageSetup::OTextConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
70 0 : :OConnectionTabPageSetup(pParent, "DBWizTextPage", "dbaccess/ui/dbwiztextpage.ui", _rCoreAttrs, STR_TEXT_HELPTEXT, STR_TEXT_HEADERTEXT, STR_TEXT_PATH_OR_FILE)
71 : {
72 :
73 0 : m_pTextConnectionHelper = VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_EXTENSION | TC_SEPARATORS );
74 0 : m_pTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) );
75 0 : }
76 :
77 0 : OTextConnectionPageSetup::~OTextConnectionPageSetup()
78 : {
79 0 : disposeOnce();
80 0 : }
81 :
82 0 : void OTextConnectionPageSetup::dispose()
83 : {
84 0 : m_pTextConnectionHelper.disposeAndClear();
85 0 : OConnectionTabPageSetup::dispose();
86 0 : }
87 :
88 0 : IMPL_LINK_NOARG_TYPED(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, void)
89 : {
90 0 : SetRoadmapStateValue(!m_pTextConnectionHelper->GetExtension().isEmpty() && OConnectionTabPageSetup::checkTestConnection());
91 0 : callModifiedHdl();
92 0 : }
93 :
94 0 : bool OTextConnectionPageSetup::checkTestConnection()
95 : {
96 0 : bool bDoEnable = OConnectionTabPageSetup::checkTestConnection();
97 0 : bDoEnable = !m_pTextConnectionHelper->GetExtension().isEmpty() && bDoEnable;
98 0 : return bDoEnable;
99 : }
100 :
101 0 : void OTextConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
102 : {
103 0 : OConnectionTabPageSetup::fillControls(_rControlList);
104 0 : m_pTextConnectionHelper->fillControls(_rControlList);
105 0 : }
106 0 : void OTextConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
107 : {
108 0 : OConnectionTabPageSetup::fillWindows(_rControlList);
109 0 : m_pTextConnectionHelper->fillWindows(_rControlList);
110 0 : }
111 0 : void OTextConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
112 : {
113 : // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
114 : bool bValid, bReadonly;
115 0 : getFlags(_rSet, bValid, bReadonly);
116 0 : OConnectionTabPageSetup::implInitControls( _rSet, _bSaveValue);
117 0 : m_pTextConnectionHelper->implInitControls(_rSet, bValid);
118 0 : }
119 :
120 0 : bool OTextConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
121 : {
122 0 : bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
123 0 : bChangedSomething = m_pTextConnectionHelper->FillItemSet(*_rSet, bChangedSomething);
124 0 : return bChangedSomething;
125 : }
126 :
127 0 : bool OTextConnectionPageSetup::prepareLeave(){
128 0 : return m_pTextConnectionHelper->prepareLeave();
129 : }
130 :
131 0 : VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
132 : {
133 0 : return VclPtr<OLDAPConnectionPageSetup>::Create( pParent, _rAttrSet );
134 : }
135 :
136 : // OLDAPPageSetup
137 0 : OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
138 0 : :OGenericAdministrationPage(pParent, "LDAPConnectionPage", "dbaccess/ui/ldapconnectionpage.ui",_rCoreAttrs)
139 : {
140 0 : get(m_pFTHelpText, "helpLabel");
141 0 : get(m_pFTHostServer, "hostNameLabel");
142 0 : get(m_pETHostServer, "hostNameEntry");
143 0 : get(m_pFTBaseDN, "baseDNLabel");
144 0 : get(m_pETBaseDN, "baseDNEntry");
145 0 : get(m_pFTPortNumber, "portNumLabel");
146 0 : get(m_pNFPortNumber, "portNumEntry");
147 0 : m_pNFPortNumber->SetUseThousandSep(false);
148 0 : get(m_pFTDefaultPortNumber, "portNumDefLabel");
149 0 : get(m_pCBUseSSL, "useSSLCheckbutton");
150 :
151 0 : m_pETHostServer->SetModifyHdl(getControlModifiedLink());
152 0 : m_pETBaseDN->SetModifyHdl(getControlModifiedLink());
153 0 : m_pNFPortNumber->SetModifyHdl(getControlModifiedLink());
154 0 : m_pCBUseSSL->SetToggleHdl(getControlModifiedLink());
155 0 : SetRoadmapStateValue(false);
156 0 : }
157 :
158 0 : OLDAPConnectionPageSetup::~OLDAPConnectionPageSetup()
159 : {
160 0 : disposeOnce();
161 0 : }
162 :
163 0 : void OLDAPConnectionPageSetup::dispose()
164 : {
165 0 : m_pFTHelpText.clear();
166 0 : m_pFTHostServer.clear();
167 0 : m_pETHostServer.clear();
168 0 : m_pFTBaseDN.clear();
169 0 : m_pETBaseDN.clear();
170 0 : m_pFTPortNumber.clear();
171 0 : m_pNFPortNumber.clear();
172 0 : m_pFTDefaultPortNumber.clear();
173 0 : m_pCBUseSSL.clear();
174 0 : OGenericAdministrationPage::dispose();
175 0 : }
176 :
177 0 : bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
178 : {
179 0 : bool bChangedSomething = false;
180 0 : fillString(*_rSet,m_pETBaseDN,DSID_CONN_LDAP_BASEDN, bChangedSomething);
181 0 : fillInt32(*_rSet,m_pNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
182 :
183 0 : if ( m_pETHostServer->IsValueChangedFromSaved() )
184 : {
185 0 : const DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet->GetItem(DSID_TYPECOLLECTION));
186 0 : ::dbaccess::ODsnTypeCollection* pCollection = NULL;
187 0 : if (pCollectionItem)
188 0 : pCollection = pCollectionItem->getCollection();
189 : OSL_ENSURE(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
190 0 : if (pCollection)
191 : {
192 0 : OUString sUrl = pCollection->getPrefix( OUString("sdbc:address:ldap:"));
193 0 : sUrl += m_pETHostServer->GetText();
194 0 : _rSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl));
195 0 : bChangedSomething = true;
196 : }
197 : }
198 :
199 0 : fillBool(*_rSet,m_pCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
200 0 : return bChangedSomething;
201 : }
202 0 : void OLDAPConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
203 : {
204 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETHostServer));
205 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETBaseDN));
206 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pNFPortNumber));
207 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pCBUseSSL));
208 0 : }
209 0 : void OLDAPConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
210 : {
211 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTHelpText));
212 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTHostServer));
213 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTBaseDN));
214 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTPortNumber));
215 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTDefaultPortNumber));
216 0 : }
217 0 : void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
218 : {
219 : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
220 : bool bValid, bReadonly;
221 0 : getFlags(_rSet, bValid, bReadonly);
222 :
223 0 : SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, true);
224 0 : SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, true);
225 :
226 0 : if ( bValid )
227 : {
228 0 : m_pETBaseDN->SetText(pBaseDN->GetValue());
229 0 : m_pNFPortNumber->SetValue(pPortNumber->GetValue());
230 : }
231 0 : OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
232 0 : callModifiedHdl();
233 0 : }
234 :
235 0 : IMPL_LINK(OLDAPConnectionPageSetup, OnEditModified, Edit*, /*_pEdit*/)
236 : {
237 0 : bool bRoadmapState = ((!m_pETHostServer->GetText().isEmpty() ) && ( !m_pETBaseDN->GetText().isEmpty() ) && (!m_pFTPortNumber->GetText().isEmpty() ));
238 0 : SetRoadmapStateValue(bRoadmapState);
239 0 : callModifiedHdl();
240 0 : return 0L;
241 : }
242 :
243 0 : VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
244 : {
245 0 : return VclPtr<OMySQLIntroPageSetup>::Create( _pParent, _rAttrSet);
246 : }
247 :
248 :
249 0 : OMySQLIntroPageSetup::OMySQLIntroPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
250 0 : :OGenericAdministrationPage(pParent, "DBWizMysqlIntroPage", "dbaccess/ui/dbwizmysqlintropage.ui", _rCoreAttrs)
251 : {
252 0 : get(m_pODBCDatabase, "odbc");
253 0 : get(m_pJDBCDatabase, "jdbc");
254 0 : get(m_pNATIVEDatabase, "directly");
255 :
256 0 : m_pODBCDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
257 0 : m_pJDBCDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
258 0 : m_pNATIVEDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
259 0 : }
260 :
261 0 : OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
262 : {
263 0 : disposeOnce();
264 0 : }
265 :
266 0 : void OMySQLIntroPageSetup::dispose()
267 : {
268 0 : m_pODBCDatabase.clear();
269 0 : m_pJDBCDatabase.clear();
270 0 : m_pNATIVEDatabase.clear();
271 0 : OGenericAdministrationPage::dispose();
272 0 : }
273 :
274 0 : IMPL_LINK(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton*, /*_pBox*/)
275 : {
276 0 : maClickHdl.Call( this );
277 0 : return long(true);
278 : }
279 :
280 0 : void OMySQLIntroPageSetup::implInitControls(const SfxItemSet& _rSet, bool /*_bSaveValue*/)
281 : {
282 : // show the "Connect directly" option only if the driver is installed
283 0 : const DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, _rSet.GetItem(DSID_TYPECOLLECTION));
284 0 : bool bHasMySQLNative = ( pCollectionItem != NULL ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysqlc:" );
285 0 : if ( bHasMySQLNative )
286 0 : m_pNATIVEDatabase->Show();
287 :
288 : // if any of the options is checked, then there's nothing to do
289 0 : if ( m_pODBCDatabase->IsChecked() || m_pJDBCDatabase->IsChecked() || m_pNATIVEDatabase->IsChecked() )
290 0 : return;
291 :
292 : // prefer "native" or "JDBC"
293 0 : if ( bHasMySQLNative )
294 0 : m_pNATIVEDatabase->Check();
295 : else
296 0 : m_pJDBCDatabase->Check();
297 : }
298 :
299 0 : void OMySQLIntroPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
300 : {
301 0 : }
302 :
303 0 : void OMySQLIntroPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
304 : {
305 0 : }
306 :
307 0 : bool OMySQLIntroPageSetup::FillItemSet(SfxItemSet* /*_rSet*/)
308 : {
309 : OSL_FAIL("Who called me?! Please ask oj for more information.");
310 0 : return true;
311 : }
312 :
313 0 : OMySQLIntroPageSetup::ConnectionType OMySQLIntroPageSetup::getMySQLMode()
314 : {
315 0 : if (m_pJDBCDatabase->IsChecked())
316 0 : return VIA_JDBC;
317 0 : else if (m_pNATIVEDatabase->IsChecked())
318 0 : return VIA_NATIVE;
319 : else
320 0 : return VIA_ODBC;
321 : }
322 :
323 : // MySQLNativeSetupPage
324 0 : MySQLNativeSetupPage::MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs )
325 : :OGenericAdministrationPage( _pParent, "DBWizMysqlNativePage", "dbaccess/ui/dbwizmysqlnativepage.ui", _rCoreAttrs )
326 0 : ,m_aMySQLSettings ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), getControlModifiedLink()) )
327 : {
328 0 : get(m_pHelpText, "helptext");
329 0 : m_aMySQLSettings->Show();
330 :
331 0 : SetRoadmapStateValue(false);
332 0 : }
333 :
334 0 : MySQLNativeSetupPage::~MySQLNativeSetupPage()
335 : {
336 0 : disposeOnce();
337 0 : }
338 :
339 0 : void MySQLNativeSetupPage::dispose()
340 : {
341 0 : m_aMySQLSettings.disposeAndClear();
342 0 : m_pHelpText.clear();
343 0 : OGenericAdministrationPage::dispose();
344 0 : }
345 :
346 0 : VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
347 : {
348 0 : return VclPtr<MySQLNativeSetupPage>::Create( pParent, _rAttrSet );
349 : }
350 :
351 0 : void MySQLNativeSetupPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
352 : {
353 0 : m_aMySQLSettings->fillControls( _rControlList );
354 0 : }
355 :
356 0 : void MySQLNativeSetupPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
357 : {
358 0 : _rControlList.push_back( new ODisableWrapper< FixedText >( m_pHelpText ) );
359 0 : m_aMySQLSettings->fillWindows( _rControlList );
360 0 : }
361 :
362 0 : bool MySQLNativeSetupPage::FillItemSet( SfxItemSet* _rSet )
363 : {
364 0 : return m_aMySQLSettings->FillItemSet( _rSet );
365 : }
366 :
367 0 : void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue )
368 : {
369 0 : m_aMySQLSettings->implInitControls( _rSet );
370 :
371 0 : OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
372 :
373 0 : OnModified( NULL );
374 0 : }
375 :
376 0 : Link<> MySQLNativeSetupPage::getControlModifiedLink()
377 : {
378 0 : return LINK( this, MySQLNativeSetupPage, OnModified );
379 : }
380 :
381 0 : IMPL_LINK( MySQLNativeSetupPage, OnModified, Edit*, _pEdit )
382 : {
383 0 : SetRoadmapStateValue( m_aMySQLSettings->canAdvance() );
384 :
385 0 : return OGenericAdministrationPage::getControlModifiedLink().Call( _pEdit );
386 : }
387 :
388 : // OMySQLJDBCConnectionPageSetup
389 0 : OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, sal_uInt16 _nDefaultPortResId, sal_uInt16 _nHelpTextResId, sal_uInt16 _nHeaderTextResId, sal_uInt16 _nDriverClassId)
390 : :OGenericAdministrationPage(pParent, "SpecialJDBCConnectionPage", "dbaccess/ui/specialjdbcconnectionpage.ui", _rCoreAttrs)
391 0 : ,m_nPortId(_nPortId)
392 : {
393 0 : get(m_pHeaderText, "header");
394 0 : get(m_pFTHelpText, "helpLabel");
395 0 : get(m_pFTDatabasename, "dbNameLabel");
396 0 : get(m_pETDatabasename, "dbNameEntry");
397 0 : get(m_pFTHostname, "hostNameLabel");
398 0 : get(m_pETHostname, "hostNameEntry");
399 0 : get(m_pFTPortNumber, "portNumLabel");
400 0 : get(m_pFTDefaultPortNumber, "portNumDefLabel");
401 0 : get(m_pNFPortNumber, "portNumEntry");
402 0 : m_pNFPortNumber->SetUseThousandSep(false);
403 0 : get(m_pFTDriverClass, "jdbcDriverLabel");
404 0 : get(m_pETDriverClass, "jdbcDriverEntry");
405 0 : get(m_pPBTestJavaDriver, "testDriverButton");
406 :
407 0 : m_pFTDriverClass->SetText(OUString(ModuleRes(_nDriverClassId)));
408 :
409 0 : m_pFTDefaultPortNumber->SetText(OUString(ModuleRes(_nDefaultPortResId)));
410 0 : OUString sHelpText = OUString(ModuleRes(_nHelpTextResId));
411 0 : m_pFTHelpText->SetText(sHelpText);
412 : //TODO this code snippet is redundant
413 0 : m_pHeaderText->SetText(ModuleRes(_nHeaderTextResId));
414 :
415 0 : m_pETDatabasename->SetModifyHdl(getControlModifiedLink());
416 0 : m_pETHostname->SetModifyHdl(getControlModifiedLink());
417 0 : m_pNFPortNumber->SetModifyHdl(getControlModifiedLink());
418 :
419 0 : m_pETDriverClass->SetModifyHdl(LINK(this, OGeneralSpecialJDBCConnectionPageSetup, OnEditModified));
420 0 : m_pPBTestJavaDriver->SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl));
421 :
422 0 : SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, true);
423 0 : SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, true);
424 0 : ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
425 0 : if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength() )
426 : {
427 0 : m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
428 : }
429 :
430 0 : SetRoadmapStateValue(false);
431 0 : }
432 :
433 0 : OGeneralSpecialJDBCConnectionPageSetup::~OGeneralSpecialJDBCConnectionPageSetup()
434 : {
435 0 : disposeOnce();
436 0 : }
437 :
438 0 : void OGeneralSpecialJDBCConnectionPageSetup::dispose()
439 : {
440 0 : m_pHeaderText.clear();
441 0 : m_pFTHelpText.clear();
442 0 : m_pFTDatabasename.clear();
443 0 : m_pETDatabasename.clear();
444 0 : m_pFTHostname.clear();
445 0 : m_pETHostname.clear();
446 0 : m_pFTPortNumber.clear();
447 0 : m_pFTDefaultPortNumber.clear();
448 0 : m_pNFPortNumber.clear();
449 0 : m_pFTDriverClass.clear();
450 0 : m_pETDriverClass.clear();
451 0 : m_pPBTestJavaDriver.clear();
452 0 : OGenericAdministrationPage::dispose();
453 0 : }
454 :
455 0 : VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
456 : {
457 : return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
458 : _rAttrSet,
459 : DSID_MYSQL_PORTNUMBER ,
460 : STR_MYSQL_DEFAULT,
461 : STR_MYSQLJDBC_HELPTEXT,
462 : STR_MYSQLJDBC_HEADERTEXT,
463 0 : STR_MYSQL_DRIVERCLASSTEXT);
464 : }
465 :
466 0 : VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
467 : {
468 : return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent,
469 : _rAttrSet,
470 : DSID_ORACLE_PORTNUMBER,
471 : STR_ORACLE_DEFAULT,
472 : STR_ORACLE_HELPTEXT,
473 : STR_ORACLE_HEADERTEXT,
474 0 : STR_ORACLE_DRIVERCLASSTEXT);
475 : }
476 :
477 0 : void OGeneralSpecialJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
478 : {
479 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETDatabasename));
480 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETDriverClass));
481 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETHostname));
482 0 : _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pNFPortNumber));
483 0 : }
484 0 : void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
485 : {
486 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTHelpText));
487 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTDatabasename));
488 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTHostname));
489 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTPortNumber));
490 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTDefaultPortNumber));
491 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTDriverClass));
492 0 : }
493 :
494 0 : bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
495 : {
496 0 : bool bChangedSomething = false;
497 0 : fillString(*_rSet,m_pETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
498 0 : fillString(*_rSet,m_pETHostname,DSID_CONN_HOSTNAME,bChangedSomething);
499 0 : fillString(*_rSet,m_pETDatabasename,DSID_DATABASENAME,bChangedSomething);
500 0 : fillInt32(*_rSet,m_pNFPortNumber,m_nPortId,bChangedSomething );
501 0 : return bChangedSomething;
502 : }
503 :
504 0 : void OGeneralSpecialJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
505 : {
506 : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
507 : bool bValid, bReadonly;
508 0 : getFlags(_rSet, bValid, bReadonly);
509 :
510 0 : SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, true);
511 0 : SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, true);
512 0 : SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, true);
513 0 : SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, true);
514 :
515 0 : if ( bValid )
516 : {
517 0 : m_pETDatabasename->SetText(pDatabaseName->GetValue());
518 0 : m_pETDatabasename->ClearModifyFlag();
519 :
520 0 : m_pETDriverClass->SetText(pDrvItem->GetValue());
521 0 : m_pETDriverClass->ClearModifyFlag();
522 :
523 0 : m_pETHostname->SetText(pHostName->GetValue());
524 0 : m_pETHostname->ClearModifyFlag();
525 :
526 0 : m_pNFPortNumber->SetValue(pPortNumber->GetValue());
527 0 : m_pNFPortNumber->ClearModifyFlag();
528 : }
529 0 : OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
530 :
531 : // to get the correct value when saveValue was called by base class
532 0 : if ( m_pETDriverClass->GetText().trim().isEmpty() )
533 : {
534 0 : m_pETDriverClass->SetText(m_sDefaultJdbcDriverName);
535 0 : m_pETDriverClass->SetModifyFlag();
536 : }
537 0 : callModifiedHdl();
538 :
539 0 : bool bRoadmapState = ((!m_pETDatabasename->GetText().isEmpty() ) && (!m_pETHostname->GetText().isEmpty()) && (!m_pNFPortNumber->GetText().isEmpty() ) && ( !m_pETDriverClass->GetText().isEmpty() ));
540 0 : SetRoadmapStateValue(bRoadmapState);
541 0 : }
542 :
543 0 : IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
544 : {
545 : OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
546 :
547 0 : bool bSuccess = false;
548 : #if HAVE_FEATURE_JAVA
549 : try
550 : {
551 0 : if ( !m_pETDriverClass->GetText().trim().isEmpty() )
552 : {
553 : // TODO change jvmaccess
554 0 : ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
555 0 : m_pETDriverClass->SetText(m_pETDriverClass->GetText().trim()); // fdo#68341
556 0 : bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_pETDriverClass->GetText());
557 : }
558 : }
559 0 : catch(::com::sun::star::uno::Exception&)
560 : {
561 : }
562 : #endif
563 0 : const sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
564 0 : const OSQLMessageBox::MessageType mt = bSuccess ? OSQLMessageBox::Info : OSQLMessageBox::Error;
565 0 : ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString(), WB_OK | WB_DEF_OK, mt );
566 0 : aMsg->Execute();
567 0 : return 0L;
568 : }
569 :
570 0 : IMPL_LINK(OGeneralSpecialJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
571 : {
572 0 : if ( _pEdit == m_pETDriverClass )
573 0 : m_pPBTestJavaDriver->Enable( !m_pETDriverClass->GetText().trim().isEmpty() );
574 0 : bool bRoadmapState = ((!m_pETDatabasename->GetText().isEmpty() ) && ( !m_pETHostname->GetText().isEmpty() ) && (!m_pNFPortNumber->GetText().isEmpty() ) && ( !m_pETDriverClass->GetText().trim().isEmpty() ));
575 0 : SetRoadmapStateValue(bRoadmapState);
576 0 : callModifiedHdl();
577 0 : return 0L;
578 : }
579 :
580 0 : VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
581 : {
582 0 : return VclPtr<OJDBCConnectionPageSetup>::Create( pParent, _rAttrSet);
583 : }
584 :
585 : // OMySQLJDBCConnectionPageSetup
586 0 : OJDBCConnectionPageSetup::OJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs)
587 : :OConnectionTabPageSetup(pParent, "JDBCConnectionPage", "dbaccess/ui/jdbcconnectionpage.ui", _rCoreAttrs,
588 0 : STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
589 : {
590 0 : get(m_pFTDriverClass, "jdbcLabel");
591 0 : get(m_pETDriverClass, "jdbcEntry");
592 0 : get(m_pPBTestJavaDriver, "jdbcButton");
593 0 : m_pETDriverClass->SetModifyHdl(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
594 0 : m_pPBTestJavaDriver->SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
595 0 : }
596 :
597 0 : OJDBCConnectionPageSetup::~OJDBCConnectionPageSetup()
598 : {
599 0 : disposeOnce();
600 0 : }
601 :
602 0 : void OJDBCConnectionPageSetup::dispose()
603 : {
604 0 : m_pFTDriverClass.clear();
605 0 : m_pETDriverClass.clear();
606 0 : m_pPBTestJavaDriver.clear();
607 0 : OConnectionTabPageSetup::dispose();
608 0 : }
609 :
610 0 : void OJDBCConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
611 : {
612 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETDriverClass));
613 0 : }
614 :
615 0 : void OJDBCConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
616 : {
617 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTDriverClass));
618 0 : }
619 :
620 0 : bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
621 : {
622 0 : bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
623 0 : fillString(*_rSet,m_pETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
624 0 : return bChangedSomething;
625 : }
626 :
627 0 : void OJDBCConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
628 : {
629 : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
630 : bool bValid, bReadonly;
631 0 : getFlags(_rSet, bValid, bReadonly);
632 :
633 0 : SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, true);
634 :
635 0 : if ( bValid )
636 : {
637 0 : if ( !pDrvItem->GetValue().getLength() )
638 : {
639 0 : OUString sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
640 0 : if ( !sDefaultJdbcDriverName.isEmpty() )
641 : {
642 0 : m_pETDriverClass->SetText(sDefaultJdbcDriverName);
643 0 : m_pETDriverClass->SetModifyFlag();
644 0 : }
645 : }
646 : else
647 : {
648 0 : m_pETDriverClass->SetText(pDrvItem->GetValue());
649 0 : m_pETDriverClass->ClearModifyFlag();
650 : }
651 : }
652 0 : bool bEnable = pDrvItem->GetValue().getLength() != 0;
653 0 : m_pPBTestJavaDriver->Enable(bEnable);
654 0 : OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
655 :
656 0 : SetRoadmapStateValue(checkTestConnection());
657 0 : }
658 :
659 0 : bool OJDBCConnectionPageSetup::checkTestConnection()
660 : {
661 : OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
662 0 : bool bEnableTestConnection = !m_pConnectionURL->IsVisible() || !m_pConnectionURL->GetTextNoPrefix().isEmpty();
663 0 : bEnableTestConnection = bEnableTestConnection && (!m_pETDriverClass->GetText().isEmpty());
664 0 : return bEnableTestConnection;
665 : }
666 :
667 0 : IMPL_LINK(OJDBCConnectionPageSetup, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
668 : {
669 : OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
670 0 : bool bSuccess = false;
671 : #if HAVE_FEATURE_JAVA
672 : try
673 : {
674 0 : if ( !m_pETDriverClass->GetText().isEmpty() )
675 : {
676 : // TODO change jvmaccess
677 0 : ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
678 0 : m_pETDriverClass->SetText(m_pETDriverClass->GetText().trim()); // fdo#68341
679 0 : bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_pETDriverClass->GetText());
680 : }
681 : }
682 0 : catch(::com::sun::star::uno::Exception&)
683 : {
684 : }
685 : #endif
686 0 : sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
687 0 : ScopedVclPtrInstance< OSQLMessageBox > aMsg( this, OUString( ModuleRes( nMessage ) ), OUString() );
688 0 : aMsg->Execute();
689 0 : return 0L;
690 : }
691 :
692 0 : IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, Edit*, _pEdit)
693 : {
694 0 : if ( _pEdit == m_pETDriverClass )
695 0 : m_pPBTestJavaDriver->Enable( !m_pETDriverClass->GetText().isEmpty() );
696 0 : SetRoadmapStateValue(checkTestConnection());
697 : // tell the listener we were modified
698 0 : callModifiedHdl();
699 0 : return 0L;
700 : }
701 :
702 0 : VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateSpreadSheetTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
703 : {
704 0 : return VclPtr<OSpreadSheetConnectionPageSetup>::Create( pParent, _rAttrSet );
705 : }
706 :
707 :
708 0 : OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
709 0 : :OConnectionTabPageSetup(pParent, "DBWizSpreadsheetPage", "dbaccess/ui/dbwizspreadsheetpage.ui", _rCoreAttrs, STR_SPREADSHEET_HELPTEXT, STR_SPREADSHEET_HEADERTEXT, STR_SPREADSHEETPATH)
710 : {
711 0 : get(m_pPasswordrequired, "passwordrequired");
712 0 : m_pPasswordrequired->SetToggleHdl(getControlModifiedLink());
713 0 : }
714 :
715 0 : OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup()
716 : {
717 0 : disposeOnce();
718 0 : }
719 :
720 0 : void OSpreadSheetConnectionPageSetup::dispose()
721 : {
722 0 : m_pPasswordrequired.clear();
723 0 : OConnectionTabPageSetup::dispose();
724 0 : }
725 :
726 0 : void OSpreadSheetConnectionPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& /*_rControlList*/)
727 : {
728 0 : }
729 :
730 0 : void OSpreadSheetConnectionPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
731 : {
732 0 : OConnectionTabPageSetup::fillControls(_rControlList);
733 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pPasswordrequired));
734 :
735 0 : }
736 :
737 0 : void OSpreadSheetConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
738 : {
739 0 : OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
740 0 : }
741 :
742 0 : bool OSpreadSheetConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
743 : {
744 0 : bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
745 0 : fillBool(*_rSet,m_pPasswordrequired,DSID_PASSWORDREQUIRED,bChangedSomething);
746 0 : return bChangedSomething;
747 : }
748 :
749 0 : VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
750 : {
751 0 : return VclPtr<OAuthentificationPageSetup>::Create( pParent, _rAttrSet);
752 : }
753 :
754 :
755 0 : OAuthentificationPageSetup::OAuthentificationPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
756 0 : :OGenericAdministrationPage(pParent, "AuthentificationPage", "dbaccess/ui/authentificationpage.ui", _rCoreAttrs )
757 : {
758 0 : get(m_pFTHelpText, "helptext");
759 0 : get(m_pFTUserName, "generalUserNameLabel");
760 0 : get(m_pETUserName, "generalUserNameEntry");
761 0 : get(m_pCBPasswordRequired, "passRequiredCheckbutton");
762 0 : get(m_pPBTestConnection, "testConnectionButton");
763 0 : m_pETUserName->SetModifyHdl(getControlModifiedLink());
764 0 : m_pCBPasswordRequired->SetClickHdl(getControlModifiedLink());
765 0 : m_pPBTestConnection->SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl));
766 :
767 0 : LayoutHelper::fitSizeRightAligned( *m_pPBTestConnection );
768 0 : }
769 :
770 0 : OAuthentificationPageSetup::~OAuthentificationPageSetup()
771 : {
772 0 : disposeOnce();
773 0 : }
774 :
775 0 : void OAuthentificationPageSetup::dispose()
776 : {
777 0 : m_pFTHelpText.clear();
778 0 : m_pFTUserName.clear();
779 0 : m_pETUserName.clear();
780 0 : m_pCBPasswordRequired.clear();
781 0 : m_pPBTestConnection.clear();
782 0 : OGenericAdministrationPage::dispose();
783 0 : }
784 :
785 0 : void OAuthentificationPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
786 : {
787 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTHelpText));
788 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTUserName));
789 0 : _rControlList.push_back(new ODisableWrapper<PushButton>(m_pPBTestConnection));
790 0 : }
791 :
792 0 : void OAuthentificationPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
793 : {
794 0 : _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pETUserName));
795 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pCBPasswordRequired));
796 0 : }
797 :
798 0 : void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, bool /*_bSaveValue*/)
799 : {
800 : // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
801 : bool bValid, bReadonly;
802 0 : getFlags(_rSet, bValid, bReadonly);
803 0 : SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, true);
804 0 : SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, true);
805 :
806 0 : m_pETUserName->SetText(pUidItem->GetValue());
807 0 : m_pCBPasswordRequired->Check(pAllowEmptyPwd->GetValue());
808 :
809 0 : m_pETUserName->ClearModifyFlag();
810 0 : }
811 :
812 0 : bool OAuthentificationPageSetup::FillItemSet( SfxItemSet* _rSet )
813 : {
814 0 : bool bChangedSomething = false;
815 :
816 0 : if (m_pETUserName->IsValueChangedFromSaved())
817 : {
818 0 : _rSet->Put(SfxStringItem(DSID_USER, m_pETUserName->GetText()));
819 0 : _rSet->Put(SfxStringItem(DSID_PASSWORD, OUString()));
820 0 : bChangedSomething = true;
821 : }
822 0 : fillBool(*_rSet,m_pCBPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
823 0 : return bChangedSomething;
824 : }
825 :
826 0 : VclPtr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup( vcl::Window* pParent, const SfxItemSet& _rAttrSet)
827 : {
828 0 : return VclPtr<OFinalDBPageSetup>::Create( pParent, _rAttrSet);
829 : }
830 :
831 :
832 0 : OFinalDBPageSetup::OFinalDBPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs)
833 : : OGenericAdministrationPage(pParent, "PageFinal",
834 0 : "dbaccess/ui/finalpagewizard.ui", _rCoreAttrs)
835 : {
836 0 : get(m_pFTFinalHeader, "headerText");
837 0 : get(m_pFTFinalHelpText, "helpText");
838 0 : get(m_pRBRegisterDataSource, "yesregister");
839 0 : get(m_pRBDontregisterDataSource, "noregister");
840 0 : get(m_pFTAdditionalSettings, "additionalText");
841 0 : get(m_pCBOpenAfterwards, "openediting");
842 0 : get(m_pCBStartTableWizard, "usewizard");
843 0 : get(m_pFTFinalText, "finishText");
844 :
845 0 : m_pCBOpenAfterwards->SetClickHdl(LINK(this, OFinalDBPageSetup, OnOpenSelected));
846 0 : m_pCBStartTableWizard->SetClickHdl(getControlModifiedLink());
847 0 : m_pRBRegisterDataSource->SetState(true);
848 0 : }
849 :
850 0 : OFinalDBPageSetup::~OFinalDBPageSetup()
851 : {
852 0 : disposeOnce();
853 0 : }
854 :
855 0 : void OFinalDBPageSetup::dispose()
856 : {
857 0 : m_pFTFinalHeader.clear();
858 0 : m_pFTFinalHelpText.clear();
859 0 : m_pRBRegisterDataSource.clear();
860 0 : m_pRBDontregisterDataSource.clear();
861 0 : m_pFTAdditionalSettings.clear();
862 0 : m_pCBOpenAfterwards.clear();
863 0 : m_pCBStartTableWizard.clear();
864 0 : m_pFTFinalText.clear();
865 0 : OGenericAdministrationPage::dispose();
866 0 : }
867 :
868 0 : bool OFinalDBPageSetup::IsDatabaseDocumentToBeRegistered()
869 : {
870 0 : return m_pRBRegisterDataSource->IsChecked() && m_pRBRegisterDataSource->IsEnabled();
871 : }
872 :
873 0 : bool OFinalDBPageSetup::IsDatabaseDocumentToBeOpened()
874 : {
875 0 : return m_pCBOpenAfterwards->IsChecked() && m_pCBOpenAfterwards->IsEnabled();
876 : }
877 :
878 0 : bool OFinalDBPageSetup::IsTableWizardToBeStarted()
879 : {
880 0 : return m_pCBStartTableWizard->IsChecked() && m_pCBStartTableWizard->IsEnabled();
881 : }
882 :
883 0 : void OFinalDBPageSetup::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
884 : {
885 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTFinalHeader));
886 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTFinalHelpText));
887 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTAdditionalSettings));
888 0 : _rControlList.push_back(new ODisableWrapper<FixedText>(m_pFTFinalText));
889 0 : }
890 :
891 0 : void OFinalDBPageSetup::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
892 : {
893 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pCBOpenAfterwards));
894 0 : _rControlList.push_back(new OSaveValueWrapper<CheckBox>(m_pCBStartTableWizard));
895 0 : _rControlList.push_back(new OSaveValueWrapper<RadioButton>(m_pRBRegisterDataSource));
896 0 : _rControlList.push_back(new OSaveValueWrapper<RadioButton>(m_pRBDontregisterDataSource));
897 0 : }
898 :
899 0 : void OFinalDBPageSetup::implInitControls(const SfxItemSet& /*_rSet*/, bool /*_bSaveValue*/)
900 : {
901 0 : m_pCBOpenAfterwards->Check();
902 0 : }
903 :
904 0 : void OFinalDBPageSetup::enableTableWizardCheckBox( bool _bSupportsTableCreation)
905 : {
906 0 : m_pCBStartTableWizard->Enable(_bSupportsTableCreation);
907 0 : }
908 :
909 0 : bool OFinalDBPageSetup::FillItemSet( SfxItemSet* /*_rSet*/ )
910 : {
911 0 : return true;
912 : }
913 :
914 0 : IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, CheckBox*, _pBox)
915 : {
916 0 : m_pCBStartTableWizard->Enable( _pBox->IsEnabled() && _pBox->IsChecked() );
917 0 : callModifiedHdl();
918 : // outta here
919 0 : return 0L;
920 : }
921 36 : }
922 :
923 : // namespace dbaui
924 :
925 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|