update dev300-m58
[ooovba.git] / dbaccess / source / ui / dlg / detailpages.cxx
blob419723748dc4f49d929ba9aeca2fd7a7df16752d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: detailpages.cxx,v $
10 * $Revision: 1.53.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #include "detailpages.hxx"
35 #include "sqlmessage.hxx"
36 #include "dsmeta.hxx"
37 #include "advancedsettings.hxx"
38 #include "DbAdminImpl.hxx"
39 #include "dsitems.hxx"
40 #include "dbfindex.hxx"
41 #include "localresaccess.hxx"
42 #include "dsnItem.hxx"
44 #include "dbaccess_helpid.hrc"
45 #include "dbu_dlg.hrc"
46 #include "dbadmin.hrc"
48 #ifndef _SFXITEMSET_HXX
49 #include <svtools/itemset.hxx>
50 #endif
51 #ifndef _SFXSTRITEM_HXX
52 #include <svtools/stritem.hxx>
53 #endif
54 #ifndef _SFXENUMITEM_HXX
55 #include <svtools/eitem.hxx>
56 #endif
57 #ifndef _SFXINTITEM_HXX
58 #include <svtools/intitem.hxx>
59 #endif
60 #ifndef _SV_MSGBOX_HXX
61 #include <vcl/msgbox.hxx>
62 #endif
63 #ifndef _SV_MNEMONIC_HXX
64 #include <vcl/mnemonic.hxx>
65 #endif
66 #ifndef _SVTOOLS_CJKOPTIONS_HXX
67 #include <svtools/cjkoptions.hxx>
68 #endif
69 #include <jvmaccess/virtualmachine.hxx>
70 #ifndef DBAUI_ADABASPAGE_HRC
71 #include "AdabasPage.hrc"
72 #endif
73 #ifndef _DBAUI_ADASTAT_HXX_
74 #include "AdabasStat.hxx"
75 #endif
76 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
77 #include <connectivity/CommonTools.hxx>
78 #endif
79 #ifndef DBAUI_DRIVERSETTINGS_HXX
80 #include "DriverSettings.hxx"
81 #endif
82 #ifndef _DBAUI_DBADMIN_HXX_
83 #include "dbadmin.hxx"
84 #endif
85 #ifndef _COMPHELPER_TYPES_HXX_
86 #include <comphelper/types.hxx>
87 #endif
88 #include "AutoControls.hrc"
90 //.........................................................................
91 namespace dbaui
93 //.........................................................................
95 using namespace ::com::sun::star::uno;
96 using namespace ::com::sun::star::sdbc;
97 using namespace ::com::sun::star::beans;
98 using namespace ::com::sun::star::lang;
99 using namespace ::com::sun::star::container;
100 using namespace ::dbtools;
102 //========================================================================
103 //= OCommonBehaviourTabPage
104 //========================================================================
105 DBG_NAME(OCommonBehaviourTabPage)
106 //------------------------------------------------------------------------
107 OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, USHORT nResId, const SfxItemSet& _rCoreAttrs,
108 sal_uInt32 nControlFlags,bool _bFreeResource)
110 :OGenericAdministrationPage(pParent, ModuleRes(nResId), _rCoreAttrs)
111 ,m_pOptionsLabel(NULL)
112 ,m_pOptions(NULL)
113 ,m_pDataConvertFixedLine(NULL)
114 ,m_pCharsetLabel(NULL)
115 ,m_pCharset(NULL)
116 ,m_pAutoFixedLine(NULL)
117 ,m_pAutoRetrievingEnabled(NULL)
118 ,m_pAutoIncrementLabel(NULL)
119 ,m_pAutoIncrement(NULL)
120 ,m_pAutoRetrievingLabel(NULL)
121 ,m_pAutoRetrieving(NULL)
122 ,m_nControlFlags(nControlFlags)
124 DBG_CTOR(OCommonBehaviourTabPage,NULL);
126 if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
128 m_pOptionsLabel = new FixedText(this, ModuleRes(FT_OPTIONS));
129 m_pOptions = new Edit(this, ModuleRes(ET_OPTIONS));
130 m_pOptions->SetModifyHdl(getControlModifiedLink());
133 if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
135 m_pDataConvertFixedLine = new FixedLine(this, ModuleRes(FL_DATACONVERT));
136 m_pCharsetLabel = new FixedText(this, ModuleRes(FT_CHARSET));
137 m_pCharset = new CharSetListBox(this, ModuleRes(LB_CHARSET));
138 m_pCharset->SetSelectHdl(getControlModifiedLink());
141 Window* pWindows[] = { m_pAutoRetrievingEnabled, m_pAutoFixedLine,
142 m_pAutoIncrementLabel, m_pAutoIncrement,
143 m_pAutoRetrievingLabel, m_pAutoRetrieving };
145 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
146 for (sal_Int32 i=1; i < nCount; ++i)
148 if ( pWindows[i] )
150 Window* pPrev = pWindows[i-1];
151 for (sal_Int32 j = i-1; pPrev == NULL && j >= 0 ; --j)
153 pPrev = pWindows[j];
155 if ( pPrev )
156 pWindows[i]->SetZOrder(pPrev, WINDOW_ZORDER_BEHIND);
160 if ( _bFreeResource )
161 FreeResource();
164 // -----------------------------------------------------------------------
165 OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
167 DELETEZ(m_pOptionsLabel);
168 DELETEZ(m_pOptions);
170 DELETEZ(m_pDataConvertFixedLine);
171 DELETEZ(m_pCharsetLabel);
172 DELETEZ(m_pCharset);
174 DELETEZ(m_pAutoFixedLine);
175 DELETEZ(m_pAutoIncrementLabel);
176 DELETEZ(m_pAutoIncrement);
178 DELETEZ(m_pAutoRetrievingEnabled);
179 DELETEZ(m_pAutoRetrievingLabel);
180 DELETEZ(m_pAutoRetrieving);
182 DBG_DTOR(OCommonBehaviourTabPage,NULL);
185 // -----------------------------------------------------------------------
186 void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
188 if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
190 _rControlList.push_back(new ODisableWrapper<FixedText>(m_pOptionsLabel));
193 if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
195 _rControlList.push_back(new ODisableWrapper<FixedLine>(m_pDataConvertFixedLine));
196 _rControlList.push_back(new ODisableWrapper<FixedText>(m_pCharsetLabel));
199 // -----------------------------------------------------------------------
200 void OCommonBehaviourTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
202 if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
203 _rControlList.push_back(new OSaveValueWrapper<Edit>(m_pOptions));
205 if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
206 _rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pCharset));
209 // -----------------------------------------------------------------------
210 void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
212 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
213 sal_Bool bValid, bReadonly;
214 getFlags(_rSet, bValid, bReadonly);
216 // collect the items
217 SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True);
218 SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True);
220 // forward the values to the controls
221 if (bValid)
223 if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
225 m_pOptions->SetText(pOptionsItem->GetValue());
226 m_pOptions->ClearModifyFlag();
229 if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
231 m_pCharset->SelectEntryByIanaName( pCharsetItem->GetValue() );
234 OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
236 // -----------------------------------------------------------------------
237 sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
239 sal_Bool bChangedSomething = sal_False;
241 if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
243 fillString(_rSet,m_pOptions,DSID_ADDITIONALOPTIONS,bChangedSomething);
246 if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
248 if ( m_pCharset->StoreSelectedCharSet( _rSet, DSID_CHARSET ) )
249 bChangedSomething = sal_True;
252 return bChangedSomething;
255 //========================================================================
256 //= ODbaseDetailsPage
257 //========================================================================
258 DBG_NAME(ODbaseDetailsPage)
259 //------------------------------------------------------------------------
260 ODbaseDetailsPage::ODbaseDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
261 :OCommonBehaviourTabPage(pParent, PAGE_DBASE, _rCoreAttrs, CBTP_USE_CHARSET ,false)
262 ,m_aShowDeleted (this, ModuleRes(CB_SHOWDELETEDROWS))
263 ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
264 ,m_aFT_Message (this, ModuleRes( FT_SPECIAL_MESSAGE) )
265 ,m_aIndexes (this, ModuleRes(PB_INDICIES))
267 DBG_CTOR(ODbaseDetailsPage,NULL);
269 m_aIndexes.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
270 m_aShowDeleted.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
272 // correct the z-order which is mixed-up because the base class constructed some controls before we did
273 m_pCharset->SetZOrder(&m_aShowDeleted, WINDOW_ZORDER_BEFOR);
275 FreeResource();
278 // -----------------------------------------------------------------------
279 ODbaseDetailsPage::~ODbaseDetailsPage()
282 DBG_DTOR(ODbaseDetailsPage,NULL);
285 // -----------------------------------------------------------------------
286 SfxTabPage* ODriversSettings::CreateDbase( Window* pParent, const SfxItemSet& _rAttrSet )
288 return ( new ODbaseDetailsPage( pParent, _rAttrSet ) );
291 // -----------------------------------------------------------------------
292 void ODbaseDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
294 OCommonBehaviourTabPage::fillControls(_rControlList);
295 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aShowDeleted));
297 // -----------------------------------------------------------------------
298 void ODbaseDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
300 OCommonBehaviourTabPage::fillWindows(_rControlList);
301 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
302 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Message));
303 _rControlList.push_back(new ODisableWrapper<PushButton>(&m_aIndexes));
305 // -----------------------------------------------------------------------
306 void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
308 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
309 sal_Bool bValid, bReadonly;
310 getFlags(_rSet, bValid, bReadonly);
312 // get the DSN string (needed for the index dialog)
313 SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
314 SFX_ITEMSET_GET(_rSet, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
315 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
316 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len())
317 m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
319 // get the other relevant items
320 SFX_ITEMSET_GET(_rSet, pDeletedItem, SfxBoolItem, DSID_SHOWDELETEDROWS, sal_True);
322 if ( bValid )
324 m_aShowDeleted.Check( pDeletedItem->GetValue() );
325 m_aFT_Message.Show(m_aShowDeleted.IsChecked());
328 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
331 // -----------------------------------------------------------------------
332 sal_Bool ODbaseDetailsPage::FillItemSet( SfxItemSet& _rSet )
334 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
336 fillBool(_rSet,&m_aShowDeleted,DSID_SHOWDELETEDROWS,bChangedSomething);
337 return bChangedSomething;
340 //------------------------------------------------------------------------
341 IMPL_LINK( ODbaseDetailsPage, OnButtonClicked, Button*, pButton )
343 if (&m_aIndexes == pButton)
345 ODbaseIndexDialog aIndexDialog(this, m_sDsn);
346 aIndexDialog.Execute();
348 else
350 m_aFT_Message.Show(m_aShowDeleted.IsChecked());
351 // it was one of the checkboxes -> we count as modified from now on
352 callModifiedHdl();
355 return 0;
358 //========================================================================
359 //= OAdoDetailsPage
360 //========================================================================
361 DBG_NAME(OAdoDetailsPage)
362 // -----------------------------------------------------------------------
363 OAdoDetailsPage::OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
364 :OCommonBehaviourTabPage(pParent, PAGE_ADO, _rCoreAttrs, CBTP_USE_CHARSET )
366 DBG_CTOR(OAdoDetailsPage,NULL);
370 // -----------------------------------------------------------------------
371 OAdoDetailsPage::~OAdoDetailsPage()
374 DBG_DTOR(OAdoDetailsPage,NULL);
376 // -----------------------------------------------------------------------
377 SfxTabPage* ODriversSettings::CreateAdo( Window* pParent, const SfxItemSet& _rAttrSet )
379 return ( new OAdoDetailsPage( pParent, _rAttrSet ) );
382 // -----------------------------------------------------------------------
383 //========================================================================
384 //= OOdbcDetailsPage
385 //========================================================================
386 OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
387 :OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_CHARSET | CBTP_USE_OPTIONS,false)
388 ,m_aFL_1 (this, ModuleRes(FL_SEPARATOR1))
389 ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
391 m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
392 FreeResource();
394 Window* pWindows[] = { m_pCharsetLabel, m_pCharset
395 ,m_pOptionsLabel,m_pOptions,&m_aUseCatalog
398 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
399 for (sal_Int32 i=1; i < nCount; ++i)
400 pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
403 // -----------------------------------------------------------------------
404 SfxTabPage* ODriversSettings::CreateODBC( Window* pParent, const SfxItemSet& _rAttrSet )
406 return ( new OOdbcDetailsPage( pParent, _rAttrSet ) );
409 // -----------------------------------------------------------------------
410 sal_Bool OOdbcDetailsPage::FillItemSet( SfxItemSet& _rSet )
412 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
413 fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
414 return bChangedSomething;
416 // -----------------------------------------------------------------------
417 void OOdbcDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
419 OCommonBehaviourTabPage::fillControls(_rControlList);
420 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
422 // -----------------------------------------------------------------------
423 void OOdbcDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
425 OCommonBehaviourTabPage::fillWindows(_rControlList);
426 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
428 // -----------------------------------------------------------------------
429 void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
431 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
432 sal_Bool bValid, bReadonly;
433 getFlags(_rSet, bValid, bReadonly);
435 SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
437 if ( bValid )
438 m_aUseCatalog.Check(pUseCatalogItem->GetValue());
440 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
442 //========================================================================
443 //= OOdbcDetailsPage
444 //========================================================================
445 OUserDriverDetailsPage::OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
446 :OCommonBehaviourTabPage(pParent, PAGE_USERDRIVER, _rCoreAttrs,
447 CBTP_USE_CHARSET | CBTP_USE_OPTIONS ,false)
448 ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
449 ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
450 ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
451 ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
452 ,m_aUseCatalog (this, ModuleRes(CB_USECATALOG))
454 m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
455 FreeResource();
458 // -----------------------------------------------------------------------
459 SfxTabPage* ODriversSettings::CreateUser( Window* pParent, const SfxItemSet& _rAttrSet )
461 return ( new OUserDriverDetailsPage( pParent, _rAttrSet ) );
464 // -----------------------------------------------------------------------
465 sal_Bool OUserDriverDetailsPage::FillItemSet( SfxItemSet& _rSet )
467 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
469 fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_PORTNUMBER,bChangedSomething);
470 fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
471 fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
473 return bChangedSomething;
475 // -----------------------------------------------------------------------
476 void OUserDriverDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
478 OCommonBehaviourTabPage::fillControls(_rControlList);
479 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
480 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
481 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
483 // -----------------------------------------------------------------------
484 void OUserDriverDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
486 OCommonBehaviourTabPage::fillWindows(_rControlList);
487 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
488 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
490 // -----------------------------------------------------------------------
491 void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
493 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
494 sal_Bool bValid, bReadonly;
495 getFlags(_rSet, bValid, bReadonly);
497 SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
498 SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
499 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_PORTNUMBER, sal_True);
501 if ( bValid )
503 m_aEDHostname.SetText(pHostName->GetValue());
504 m_aEDHostname.ClearModifyFlag();
506 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
507 m_aNFPortNumber.ClearModifyFlag();
509 m_aUseCatalog.Check(pUseCatalogItem->GetValue());
512 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
514 //========================================================================
515 //= OMySQLODBCDetailsPage
516 //========================================================================
517 OMySQLODBCDetailsPage::OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
518 :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_ODBC, _rCoreAttrs, CBTP_USE_CHARSET )
522 // -----------------------------------------------------------------------
523 SfxTabPage* ODriversSettings::CreateMySQLODBC( Window* pParent, const SfxItemSet& _rAttrSet )
525 return ( new OMySQLODBCDetailsPage( pParent, _rAttrSet ) );
528 //========================================================================
529 //= OMySQLJDBCDetailsPage
530 //========================================================================
531 OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,USHORT _nResId, const SfxItemSet& _rCoreAttrs ,USHORT _nPortId)
532 :OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
533 ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
534 ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
535 ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
536 ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
537 ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
538 ,m_aFTSocket (this, ModuleRes(FT_SOCKET))
539 ,m_aEDSocket (this, ModuleRes(ET_SOCKET))
540 ,m_aFTDriverClass (this, ModuleRes(FT_JDBCDRIVERCLASS))
541 ,m_aEDDriverClass (this, ModuleRes(ET_JDBCDRIVERCLASS))
542 ,m_aTestJavaDriver (this, ModuleRes(PB_TESTDRIVERCLASS))
543 ,m_nPortId(_nPortId)
544 ,m_bUseClass(true)
546 SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
547 SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
548 ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
549 if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
551 m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
553 if ( m_sDefaultJdbcDriverName.Len() )
555 m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
556 m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
557 m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
559 else
561 m_bUseClass = false;
562 m_aFTDriverClass.Show(FALSE);
563 m_aEDDriverClass.Show(FALSE);
564 m_aTestJavaDriver.Show(FALSE);
567 m_aFTSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
568 m_aEDSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
570 m_aEDHostname.SetModifyHdl(getControlModifiedLink());
571 m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
572 m_aEDSocket.SetModifyHdl(getControlModifiedLink());
574 // #98982# OJ
575 m_aNFPortNumber.SetUseThousandSep(sal_False);
577 Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname,
578 &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
579 &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver,
580 m_pCharsetLabel, m_pCharset};
582 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
583 for (sal_Int32 i=1; i < nCount; ++i)
584 pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
586 FreeResource();
589 // -----------------------------------------------------------------------
590 void OGeneralSpecialJDBCDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
592 OCommonBehaviourTabPage::fillControls(_rControlList);
593 if ( m_bUseClass )
594 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDDriverClass));
595 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
596 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
597 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
599 // -----------------------------------------------------------------------
600 void OGeneralSpecialJDBCDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
602 OCommonBehaviourTabPage::fillWindows(_rControlList);
603 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
604 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
605 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
606 if ( m_bUseClass )
607 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
608 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
611 // -----------------------------------------------------------------------
612 sal_Bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet& _rSet )
614 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
615 if ( m_bUseClass )
616 fillString(_rSet,&m_aEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
617 fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
618 fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
619 fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
621 return bChangedSomething;
623 // -----------------------------------------------------------------------
624 void OGeneralSpecialJDBCDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
626 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
627 sal_Bool bValid, bReadonly;
628 getFlags(_rSet, bValid, bReadonly);
630 SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
631 SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
632 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
633 SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
635 if ( bValid )
637 if ( m_bUseClass )
639 m_aEDDriverClass.SetText(pDrvItem->GetValue());
640 m_aEDDriverClass.ClearModifyFlag();
643 m_aEDHostname.SetText(pHostName->GetValue());
644 m_aEDHostname.ClearModifyFlag();
646 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
647 m_aNFPortNumber.ClearModifyFlag();
649 m_aEDSocket.SetText(pSocket->GetValue());
650 m_aEDSocket.ClearModifyFlag();
653 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
655 // to get the correcxt value when saveValue was called by base class
656 if ( m_bUseClass && !m_aEDDriverClass.GetText().Len() )
658 m_aEDDriverClass.SetText(m_sDefaultJdbcDriverName);
659 m_aEDDriverClass.SetModifyFlag();
662 // -----------------------------------------------------------------------
663 IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
665 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
666 OSL_ENSURE(m_bUseClass,"Who called me?");
668 sal_Bool bSuccess = sal_False;
671 if ( m_aEDDriverClass.GetText().Len() )
673 // TODO chage jvmaccess
674 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
675 bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText());
678 catch(Exception&)
682 USHORT nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
683 OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
684 aMsg.Execute();
685 return 0L;
687 // -----------------------------------------------------------------------
688 IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit)
690 if ( m_bUseClass && _pEdit == &m_aEDDriverClass )
691 m_aTestJavaDriver.Enable( m_aEDDriverClass.GetText().Len() != 0 );
693 // tell the listener we were modified
694 callModifiedHdl();
695 return 0L;
698 //========================================================================
699 //= MySQLNativePage
700 //========================================================================
701 MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs )
702 :OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false )
703 ,m_aSeparator1 ( this, ModuleRes( FL_SEPARATOR1) )
704 ,m_aDatabaseNameLabel ( this, ModuleRes( FT_AUTODATABASENAME ) )
705 ,m_aDatabaseName ( this, ModuleRes( ET_AUTODATABASENAME ) )
706 ,m_aFTHostname ( this, ModuleRes(FT_HOSTNAME))
707 ,m_aEDHostname ( this, ModuleRes(ET_HOSTNAME))
708 ,m_aPortNumber ( this, ModuleRes(FT_PORTNUMBER))
709 ,m_aNFPortNumber ( this, ModuleRes(NF_PORTNUMBER))
710 ,m_aFTSocket ( this, ModuleRes(FT_SOCKET))
711 ,m_aEDSocket ( this, ModuleRes(ET_SOCKET))
712 ,m_aSeparator2 ( this, ModuleRes(FL_SEPARATOR2))
713 ,m_aUserNameLabel ( this, ModuleRes(FT_USERNAME))
714 ,m_aUserName ( this, ModuleRes(ET_USERNAME))
715 ,m_aPasswordRequired ( this, ModuleRes(CB_PASSWORD_REQUIRED))
717 m_aDatabaseName.SetModifyHdl(getControlModifiedLink());
718 m_aEDHostname.SetModifyHdl(getControlModifiedLink());
719 m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
720 m_aEDSocket.SetModifyHdl(getControlModifiedLink());
721 m_aUserName.SetModifyHdl(getControlModifiedLink());
723 // #98982# OJ
724 m_aNFPortNumber.SetUseThousandSep(sal_False);
726 Window* pWindows[] = { &m_aDatabaseNameLabel, &m_aDatabaseName, &m_aFTHostname, &m_aEDHostname,
727 &m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
728 &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, &m_aPasswordRequired,
729 m_pCharsetLabel, m_pCharset};
731 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
732 for (sal_Int32 i=1; i < nCount; ++i)
733 pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
735 FreeResource();
738 // -----------------------------------------------------------------------
739 void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
741 OCommonBehaviourTabPage::fillControls(_rControlList);
743 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aDatabaseName));
744 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
745 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
746 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
747 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
748 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
750 // -----------------------------------------------------------------------
751 void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
753 OCommonBehaviourTabPage::fillWindows(_rControlList);
755 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1));
756 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aDatabaseNameLabel));
757 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
758 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
759 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
760 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2));
761 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
764 // -----------------------------------------------------------------------
765 sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet )
767 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
769 fillString(_rSet,&m_aDatabaseName,DSID_DATABASENAME,bChangedSomething);
770 fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
771 fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
772 fillInt32(_rSet,&m_aNFPortNumber,DSID_MYSQL_PORTNUMBER,bChangedSomething );
774 if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() )
776 _rSet.Put( SfxStringItem( DSID_USER, m_aUserName.GetText() ) );
777 _rSet.Put( SfxStringItem( DSID_PASSWORD, String()));
778 bChangedSomething = sal_True;
780 fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
782 return bChangedSomething;
784 // -----------------------------------------------------------------------
785 void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
787 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
788 sal_Bool bValid, bReadonly;
789 getFlags(_rSet, bValid, bReadonly);
791 SFX_ITEMSET_GET(_rSet, pDatabaseName, SfxStringItem, DSID_DATABASENAME, sal_True);
792 SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
793 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_MYSQL_PORTNUMBER, sal_True);
794 SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
795 SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
796 SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
798 if ( bValid )
800 m_aDatabaseName.SetText( pDatabaseName->GetValue() );
801 m_aDatabaseName.ClearModifyFlag();
803 m_aEDHostname.SetText(pHostName->GetValue());
804 m_aEDHostname.ClearModifyFlag();
806 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
807 m_aNFPortNumber.ClearModifyFlag();
809 m_aEDSocket.SetText(pSocket->GetValue());
810 m_aEDSocket.ClearModifyFlag();
812 m_aUserName.SetText(pUidItem->GetValue());
813 m_aUserName.ClearModifyFlag();
814 m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
817 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
820 // -----------------------------------------------------------------------
821 SfxTabPage* ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
823 return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
825 // -----------------------------------------------------------------------
826 SfxTabPage* ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
828 return ( new MySQLNativePage( pParent, _rAttrSet ) );
831 // -----------------------------------------------------------------------
832 SfxTabPage* ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
834 return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
838 //========================================================================
839 //= OAdabasDetailsPage
840 //========================================================================
841 OAdabasDetailsPage::OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
842 :OCommonBehaviourTabPage(pParent, PAGE_ADABAS, _rCoreAttrs, CBTP_USE_CHARSET ,false)
843 ,m_aFTHostname (this, ModuleRes(FT_HOSTNAME))
844 ,m_aEDHostname (this, ModuleRes(ET_HOSTNAME))
845 ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
846 ,m_FT_CACHE_SIZE( this, ModuleRes( FT_CACHE_SIZE ) )
847 ,m_NF_CACHE_SIZE( this, ModuleRes( NF_CACHE_SIZE ) )
848 ,m_FT_DATA_INCREMENT( this, ModuleRes( FT_DATA_INCREMENT ) )
849 ,m_NF_DATA_INCREMENT( this, ModuleRes( NF_DATA_INCREMENT ) )
850 ,m_aFL_2( this, ModuleRes( FL_SEPARATOR2 ) )
851 ,m_FT_CTRLUSERNAME( this, ModuleRes( FT_CTRLUSERNAME ) )
852 ,m_ET_CTRLUSERNAME( this, ModuleRes( ET_CTRLUSERNAME ) )
853 ,m_FT_CTRLPASSWORD( this, ModuleRes( FT_CTRLPASSWORD ) )
854 ,m_ET_CTRLPASSWORD( this, ModuleRes( ET_CTRLPASSWORD ) )
855 ,m_CB_SHUTDB( this, ModuleRes( CB_SHUTDB ) )
856 ,m_PB_STAT( this, ModuleRes( PB_STAT ) )
858 m_aEDHostname.SetModifyHdl(getControlModifiedLink());
860 FreeResource();
862 m_PB_STAT.SetClickHdl( LINK(this,OAdabasDetailsPage,PBClickHdl));
864 m_CB_SHUTDB.SetClickHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
865 m_NF_CACHE_SIZE.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
866 m_NF_DATA_INCREMENT.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
867 m_ET_CTRLUSERNAME.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
868 m_ET_CTRLPASSWORD.SetModifyHdl( LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
870 m_ET_CTRLUSERNAME.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl));
871 m_ET_CTRLPASSWORD.SetLoseFocusHdl( LINK(this,OAdabasDetailsPage,LoseFocusHdl));
873 m_NF_DATA_INCREMENT.SetMin(20);
874 m_NF_DATA_INCREMENT.SetMax(LONG_MAX);
875 m_NF_DATA_INCREMENT.SetValue(20);
876 m_NF_DATA_INCREMENT.SetDecimalDigits(0);
878 m_NF_CACHE_SIZE.SetMin(4);
879 m_NF_CACHE_SIZE.SetMax(LONG_MAX);
880 m_NF_CACHE_SIZE.SetValue(4);
881 m_NF_CACHE_SIZE.SetDecimalDigits(0);
883 Window* pWindows[] = { &m_aFTHostname,&m_aEDHostname
884 ,&m_FT_CACHE_SIZE,&m_NF_CACHE_SIZE
885 ,&m_FT_DATA_INCREMENT,&m_NF_DATA_INCREMENT
886 ,&m_FT_CTRLUSERNAME,&m_ET_CTRLUSERNAME
887 ,&m_FT_CTRLPASSWORD,&m_ET_CTRLPASSWORD
888 ,&m_CB_SHUTDB
889 ,m_pCharsetLabel, m_pCharset,&m_PB_STAT};
891 sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
892 for (sal_Int32 i=1; i < nCount; ++i)
893 pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
896 // -----------------------------------------------------------------------
897 SfxTabPage* ODriversSettings::CreateAdabas( Window* pParent, const SfxItemSet& _rAttrSet )
899 return ( new OAdabasDetailsPage( pParent, _rAttrSet ) );
902 // -----------------------------------------------------------------------
903 void OAdabasDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
905 OCommonBehaviourTabPage::fillControls(_rControlList);
906 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
907 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_CACHE_SIZE));
908 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_DATA_INCREMENT));
909 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLUSERNAME));
910 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLPASSWORD));
911 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_CB_SHUTDB));
913 // -----------------------------------------------------------------------
914 void OAdabasDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
916 OCommonBehaviourTabPage::fillWindows(_rControlList);
917 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
918 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
919 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CACHE_SIZE));
920 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_DATA_INCREMENT));
921 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_2));
922 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLUSERNAME));
923 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLPASSWORD));
924 _rControlList.push_back(new ODisableWrapper<PushButton>(&m_PB_STAT));
926 // -----------------------------------------------------------------------
927 void OAdabasDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
929 // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
930 sal_Bool bValid, bReadonly;
931 getFlags(_rSet, bValid, bReadonly);
933 SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
934 SFX_ITEMSET_GET(_rSet, pCtrlUserItem, SfxStringItem, DSID_CONN_CTRLUSER, sal_True);
935 SFX_ITEMSET_GET(_rSet, pCtrlPwdItem, SfxStringItem, DSID_CONN_CTRLPWD, sal_True);
936 SFX_ITEMSET_GET(_rSet, pShutItem, SfxBoolItem, DSID_CONN_SHUTSERVICE, sal_True);
937 SFX_ITEMSET_GET(_rSet, pIncItem, SfxInt32Item, DSID_CONN_DATAINC, sal_True);
938 SFX_ITEMSET_GET(_rSet, pCacheItem, SfxInt32Item, DSID_CONN_CACHESIZE, sal_True);
939 if ( bValid )
941 m_aEDHostname.SetText(pHostName->GetValue());
942 m_aEDHostname.ClearModifyFlag();
943 m_CB_SHUTDB.Check( pShutItem->GetValue() );
944 m_NF_DATA_INCREMENT.SetValue( pIncItem->GetValue() );
945 m_NF_CACHE_SIZE.SetValue( pCacheItem->GetValue() );
946 m_ET_CTRLUSERNAME.SetText(pCtrlUserItem->GetValue());
947 m_ET_CTRLPASSWORD.SetText(pCtrlPwdItem->GetValue());
948 m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
951 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
953 // -----------------------------------------------------------------------
954 sal_Bool OAdabasDetailsPage::FillItemSet( SfxItemSet& _rSet )
956 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
958 fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
959 fillBool(_rSet,&m_CB_SHUTDB,DSID_CONN_SHUTSERVICE,bChangedSomething);
960 fillInt32(_rSet,&m_NF_DATA_INCREMENT,DSID_CONN_DATAINC,bChangedSomething );
961 fillInt32(_rSet,&m_NF_CACHE_SIZE,DSID_CONN_CACHESIZE,bChangedSomething );
962 fillString(_rSet,&m_ET_CTRLUSERNAME,DSID_CONN_CTRLUSER,bChangedSomething );
963 fillString(_rSet,&m_ET_CTRLPASSWORD,DSID_CONN_CTRLPWD,bChangedSomething );
965 return bChangedSomething;
967 //------------------------------------------------------------------------
968 IMPL_LINK( OAdabasDetailsPage, AttributesChangedHdl, void *, EMPTYARG )
970 m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
971 bAttrsChanged = TRUE;
972 callModifiedHdl();
973 return 0;
975 //------------------------------------------------------------------------
976 IMPL_LINK( OAdabasDetailsPage, LoseFocusHdl, Edit *, /*pEdit*/ )
978 m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
979 return 0;
981 //------------------------------------------------------------------------
982 IMPL_LINK( OAdabasDetailsPage, PBClickHdl, Button *, /*pButton*/ )
984 OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
985 if ( m_pAdminDialog )
987 m_pAdminDialog->saveDatasource();
990 Reference< XConnection > xConnection = m_pAdminDialog->createConnection().first;
991 if ( xConnection.is() )
993 OAdabasStatistics aDlg(this,m_sUser,xConnection,m_pAdminDialog->getORB());
994 aDlg.Execute();
995 ::comphelper::disposeComponent(xConnection);
998 catch(Exception&)
1003 return 0;
1007 //========================================================================
1008 //= OLDAPDetailsPage
1009 //========================================================================
1010 OLDAPDetailsPage::OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
1011 :OCommonBehaviourTabPage(pParent, PAGE_LDAP, _rCoreAttrs,0,false)
1012 ,m_aFL_1 (this, ModuleRes( FL_SEPARATOR1) )
1013 ,m_aBaseDN (this, ModuleRes(FT_BASEDN))
1014 ,m_aETBaseDN (this, ModuleRes(ET_BASEDN))
1015 ,m_aCBUseSSL (this, ModuleRes(CB_USESSL))
1016 ,m_aPortNumber (this, ModuleRes(FT_PORTNUMBER))
1017 ,m_aNFPortNumber (this, ModuleRes(NF_PORTNUMBER))
1018 ,m_aFTRowCount (this, ModuleRes(FT_LDAPROWCOUNT))
1019 ,m_aNFRowCount (this, ModuleRes(NF_LDAPROWCOUNT))
1021 m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
1022 m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
1023 m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
1024 m_aNFRowCount.SetModifyHdl(getControlModifiedLink());
1026 // #98982# OJ
1027 m_aNFPortNumber.SetUseThousandSep(sal_False);
1028 m_aNFRowCount.SetUseThousandSep(sal_False);
1029 m_iNormalPort = 389;
1030 m_iSSLPort = 636;
1031 m_aCBUseSSL.SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
1032 FreeResource();
1035 // -----------------------------------------------------------------------
1036 SfxTabPage* ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet )
1038 return ( new OLDAPDetailsPage( pParent, _rAttrSet ) );
1041 // -----------------------------------------------------------------------
1042 sal_Bool OLDAPDetailsPage::FillItemSet( SfxItemSet& _rSet )
1044 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
1046 fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething);
1047 fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
1048 fillInt32(_rSet,&m_aNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
1049 fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
1050 return bChangedSomething;
1052 //------------------------------------------------------------------------
1053 IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, CheckBox*, pCheckBox )
1055 callModifiedHdl();
1056 if ( pCheckBox == &m_aCBUseSSL)
1058 if ( m_aCBUseSSL.IsChecked() )
1060 m_iNormalPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
1061 m_aNFPortNumber.SetValue(m_iSSLPort);
1063 else
1065 m_iSSLPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
1066 m_aNFPortNumber.SetValue(m_iNormalPort);
1069 return 0;
1072 // -----------------------------------------------------------------------
1073 void OLDAPDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
1075 OCommonBehaviourTabPage::fillControls(_rControlList);
1076 _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
1077 _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
1078 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
1079 _rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFRowCount));
1081 // -----------------------------------------------------------------------
1082 void OLDAPDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
1084 OCommonBehaviourTabPage::fillWindows(_rControlList);
1085 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aBaseDN));
1086 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
1087 _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTRowCount));
1088 _rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
1090 // -----------------------------------------------------------------------
1091 void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
1093 // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
1094 sal_Bool bValid, bReadonly;
1095 getFlags(_rSet, bValid, bReadonly);
1098 SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
1099 SFX_ITEMSET_GET(_rSet, pUseSSL, SfxBoolItem, DSID_CONN_LDAP_USESSL, sal_True);
1100 SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
1101 SFX_ITEMSET_GET(_rSet, pRowCount, SfxInt32Item, DSID_CONN_LDAP_ROWCOUNT, sal_True);
1103 if ( bValid )
1105 m_aETBaseDN.SetText(pBaseDN->GetValue());
1106 m_aNFPortNumber.SetValue(pPortNumber->GetValue());
1107 m_aNFRowCount.SetValue(pRowCount->GetValue());
1108 m_aCBUseSSL.Check(pUseSSL->GetValue());
1111 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
1115 //========================================================================
1116 //= OTextDetailsPage
1117 //========================================================================
1118 DBG_NAME(OTextDetailsPage)
1119 //------------------------------------------------------------------------
1120 OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
1121 :OCommonBehaviourTabPage(pParent, PAGE_TEXT, _rCoreAttrs, 0, false )
1123 DBG_CTOR(OTextDetailsPage,NULL);
1125 m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
1126 FreeResource();
1129 // -----------------------------------------------------------------------
1130 OTextDetailsPage::~OTextDetailsPage()
1132 DELETEZ(m_pTextConnectionHelper);
1134 DBG_DTOR(OTextDetailsPage,NULL);
1137 // -----------------------------------------------------------------------
1138 SfxTabPage* ODriversSettings::CreateText( Window* pParent, const SfxItemSet& _rAttrSet )
1140 return ( new OTextDetailsPage( pParent, _rAttrSet ) );
1142 // -----------------------------------------------------------------------
1143 void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
1145 OCommonBehaviourTabPage::fillControls(_rControlList);
1146 m_pTextConnectionHelper->fillControls(_rControlList);
1149 // -----------------------------------------------------------------------
1150 void OTextDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
1152 OCommonBehaviourTabPage::fillWindows(_rControlList);
1153 m_pTextConnectionHelper->fillWindows(_rControlList);
1156 // -----------------------------------------------------------------------
1157 void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
1159 // first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
1160 sal_Bool bValid, bReadonly;
1161 getFlags(_rSet, bValid, bReadonly);
1163 m_pTextConnectionHelper->implInitControls(_rSet, bValid);
1164 OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
1167 // -----------------------------------------------------------------------
1168 sal_Bool OTextDetailsPage::FillItemSet( SfxItemSet& rSet )
1170 sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet);
1171 bChangedSomething = m_pTextConnectionHelper->FillItemSet(rSet, bChangedSomething);
1172 return bChangedSomething;
1175 // -----------------------------------------------------------------------
1176 sal_Bool OTextDetailsPage::prepareLeave()
1178 return m_pTextConnectionHelper->prepareLeave();
1181 //------------------------------------------------------------------------
1182 SfxTabPage* ODriversSettings::CreateGeneratedValuesPage( Window* _pParent, const SfxItemSet& _rAttrSet )
1184 return new GeneratedValuesPage( _pParent, _rAttrSet );
1187 //------------------------------------------------------------------------
1188 SfxTabPage* ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
1190 ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
1191 DataSourceMetaData aMetaData( eType );
1192 return new SpecialSettingsPage( _pParent, _rAttrSet, aMetaData );
1194 //.........................................................................
1195 } // namespace dbaui
1196 //.........................................................................