1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 
31 #include "detailpages.hxx"
32 #include "sqlmessage.hxx"
33 #include "dsmeta.hxx"
34 #include "advancedsettings.hxx"
35 #include "DbAdminImpl.hxx"
36 #include "dsitems.hxx"
37 #include "dbfindex.hxx"
38 #include "localresaccess.hxx"
39 #include "dsnItem.hxx"
40 
41 #include "dbaccess_helpid.hrc"
42 #include "dbu_dlg.hrc"
43 #include "dbadmin.hrc"
44 
45 #ifndef _SFXITEMSET_HXX
46 #include <svl/itemset.hxx>
47 #endif
48 #ifndef _SFXSTRITEM_HXX
49 #include <svl/stritem.hxx>
50 #endif
51 #ifndef _SFXENUMITEM_HXX
52 #include <svl/eitem.hxx>
53 #endif
54 #ifndef _SFXINTITEM_HXX
55 #include <svl/intitem.hxx>
56 #endif
57 #ifndef _SV_MSGBOX_HXX
58 #include <vcl/msgbox.hxx>
59 #endif
60 #ifndef _SV_MNEMONIC_HXX
61 #include <vcl/mnemonic.hxx>
62 #endif
63 #ifndef _SVTOOLS_CJKOPTIONS_HXX
64 #include <svl/cjkoptions.hxx>
65 #endif
66 #include <jvmaccess/virtualmachine.hxx>
67 #ifndef DBAUI_ADABASPAGE_HRC
68 #include "AdabasPage.hrc"
69 #endif
70 #ifndef _DBAUI_ADASTAT_HXX_
71 #include "AdabasStat.hxx"
72 #endif
73 #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
74 #include <connectivity/CommonTools.hxx>
75 #endif
76 #ifndef DBAUI_DRIVERSETTINGS_HXX
77 #include "DriverSettings.hxx"
78 #endif
79 #ifndef _DBAUI_DBADMIN_HXX_
80 #include "dbadmin.hxx"
81 #endif
82 #ifndef _COMPHELPER_TYPES_HXX_
83 #include <comphelper/types.hxx>
84 #endif
85 #include "AutoControls.hrc"
86 
87 //.........................................................................
88 namespace dbaui
89 {
90 //.........................................................................
91 
92 	using namespace ::com::sun::star::uno;
93 	using namespace ::com::sun::star::sdbc;
94 	using namespace ::com::sun::star::beans;
95 	using namespace ::com::sun::star::lang;
96 	using namespace ::com::sun::star::container;
97 	using namespace ::dbtools;
98 
99 	//========================================================================
100 	//= OCommonBehaviourTabPage
101     //========================================================================
102     DBG_NAME(OCommonBehaviourTabPage)
103     //------------------------------------------------------------------------
104 	OCommonBehaviourTabPage::OCommonBehaviourTabPage(Window* pParent, sal_uInt16 nResId, const SfxItemSet& _rCoreAttrs,
105 		sal_uInt32 nControlFlags,bool _bFreeResource)
106 
107 		:OGenericAdministrationPage(pParent, ModuleRes(nResId), _rCoreAttrs)
108 		,m_pOptionsLabel(NULL)
109 		,m_pOptions(NULL)
110 		,m_pDataConvertFixedLine(NULL)
111 		,m_pCharsetLabel(NULL)
112 		,m_pCharset(NULL)
113         ,m_pAutoFixedLine(NULL)
114 		,m_pAutoRetrievingEnabled(NULL)
115 		,m_pAutoIncrementLabel(NULL)
116 		,m_pAutoIncrement(NULL)
117 		,m_pAutoRetrievingLabel(NULL)
118 		,m_pAutoRetrieving(NULL)
119 		,m_nControlFlags(nControlFlags)
120 	{
121         DBG_CTOR(OCommonBehaviourTabPage,NULL);
122 
123 		if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
124 		{
125 			m_pOptionsLabel = new FixedText(this, ModuleRes(FT_OPTIONS));
126 			m_pOptions = new Edit(this, ModuleRes(ET_OPTIONS));
127 			m_pOptions->SetModifyHdl(getControlModifiedLink());
128 		}
129 
130 		if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
131 		{
132 			m_pDataConvertFixedLine = new FixedLine(this, ModuleRes(FL_DATACONVERT));
133 			m_pCharsetLabel = new FixedText(this, ModuleRes(FT_CHARSET));
134 			m_pCharset = new CharSetListBox(this, ModuleRes(LB_CHARSET));
135 			m_pCharset->SetSelectHdl(getControlModifiedLink());
136 		}
137 
138 		Window* pWindows[] = { 	m_pAutoRetrievingEnabled, m_pAutoFixedLine,
139 								m_pAutoIncrementLabel, m_pAutoIncrement,
140 								m_pAutoRetrievingLabel, m_pAutoRetrieving };
141 
142 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
143 		for (sal_Int32 i=1; i < nCount; ++i)
144 		{
145 			if ( pWindows[i] )
146 			{
147 				Window* pPrev = pWindows[i-1];
148 				for (sal_Int32 j = i-1; pPrev == NULL && j >= 0 ; --j)
149 				{
150 					pPrev = pWindows[j];
151 				}
152 				if ( pPrev )
153 					pWindows[i]->SetZOrder(pPrev, WINDOW_ZORDER_BEHIND);
154 			}
155 		}
156 
157 		if ( _bFreeResource )
158 			FreeResource();
159 	}
160 
161 	// -----------------------------------------------------------------------
162 	OCommonBehaviourTabPage::~OCommonBehaviourTabPage()
163 	{
164 		DELETEZ(m_pOptionsLabel);
165 		DELETEZ(m_pOptions);
166 
167 		DELETEZ(m_pDataConvertFixedLine);
168 		DELETEZ(m_pCharsetLabel);
169 		DELETEZ(m_pCharset);
170 
171 		DELETEZ(m_pAutoFixedLine);
172 		DELETEZ(m_pAutoIncrementLabel);
173 		DELETEZ(m_pAutoIncrement);
174 
175 		DELETEZ(m_pAutoRetrievingEnabled);
176 		DELETEZ(m_pAutoRetrievingLabel);
177 		DELETEZ(m_pAutoRetrieving);
178 
179         DBG_DTOR(OCommonBehaviourTabPage,NULL);
180     }
181 
182 	// -----------------------------------------------------------------------
183 	void OCommonBehaviourTabPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
184 	{
185 		if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
186 		{
187 			_rControlList.push_back(new ODisableWrapper<FixedText>(m_pOptionsLabel));
188 		}
189 
190 		if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
191 		{
192 			_rControlList.push_back(new ODisableWrapper<FixedLine>(m_pDataConvertFixedLine));
193 			_rControlList.push_back(new ODisableWrapper<FixedText>(m_pCharsetLabel));
194 		}
195 	}
196 	// -----------------------------------------------------------------------
197 	void OCommonBehaviourTabPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
198 	{
199 		if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
200 			_rControlList.push_back(new OSaveValueWrapper<Edit>(m_pOptions));
201 
202 		if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
203 			_rControlList.push_back(new OSaveValueWrapper<ListBox>(m_pCharset));
204 	}
205 
206 	// -----------------------------------------------------------------------
207 	void OCommonBehaviourTabPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
208 	{
209 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
210 		sal_Bool bValid, bReadonly;
211 		getFlags(_rSet, bValid, bReadonly);
212 
213 		// collect the items
214 		SFX_ITEMSET_GET(_rSet, pOptionsItem, SfxStringItem, DSID_ADDITIONALOPTIONS, sal_True);
215 		SFX_ITEMSET_GET(_rSet, pCharsetItem, SfxStringItem, DSID_CHARSET, sal_True);
216 
217 		// forward the values to the controls
218 		if (bValid)
219 		{
220 			if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
221 			{
222 				m_pOptions->SetText(pOptionsItem->GetValue());
223 				m_pOptions->ClearModifyFlag();
224 			}
225 
226 			if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
227 			{
228                 m_pCharset->SelectEntryByIanaName( pCharsetItem->GetValue() );
229 			}
230 		}
231 		OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
232 	}
233 	// -----------------------------------------------------------------------
234 	sal_Bool OCommonBehaviourTabPage::FillItemSet(SfxItemSet& _rSet)
235 	{
236 		sal_Bool bChangedSomething = sal_False;
237 
238 		if ((m_nControlFlags & CBTP_USE_OPTIONS) == CBTP_USE_OPTIONS)
239 		{
240 			fillString(_rSet,m_pOptions,DSID_ADDITIONALOPTIONS,bChangedSomething);
241 		}
242 
243 		if ((m_nControlFlags & CBTP_USE_CHARSET) == CBTP_USE_CHARSET)
244 		{
245             if ( m_pCharset->StoreSelectedCharSet( _rSet, DSID_CHARSET ) )
246 				bChangedSomething = sal_True;
247 		}
248 
249 		return bChangedSomething;
250 	}
251 
252 	//========================================================================
253 	//= ODbaseDetailsPage
254 	//========================================================================
255     DBG_NAME(ODbaseDetailsPage)
256     //------------------------------------------------------------------------
257 	ODbaseDetailsPage::ODbaseDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
258 		:OCommonBehaviourTabPage(pParent, PAGE_DBASE, _rCoreAttrs, CBTP_USE_CHARSET ,false)
259 		,m_aShowDeleted		(this, ModuleRes(CB_SHOWDELETEDROWS))
260 		,m_aFL_1			(this, ModuleRes( FL_SEPARATOR1) )
261 		,m_aFT_Message		(this, ModuleRes( FT_SPECIAL_MESSAGE) )
262 		,m_aIndexes			(this, ModuleRes(PB_INDICIES))
263 	{
264         DBG_CTOR(ODbaseDetailsPage,NULL);
265 
266 		m_aIndexes.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
267 		m_aShowDeleted.SetClickHdl(LINK(this, ODbaseDetailsPage, OnButtonClicked));
268 
269 		// correct the z-order which is mixed-up because the base class constructed some controls before we did
270 		m_pCharset->SetZOrder(&m_aShowDeleted, WINDOW_ZORDER_BEFOR);
271 
272 		FreeResource();
273 	}
274 
275 	// -----------------------------------------------------------------------
276 	ODbaseDetailsPage::~ODbaseDetailsPage()
277 	{
278 
279         DBG_DTOR(ODbaseDetailsPage,NULL);
280     }
281 
282 	// -----------------------------------------------------------------------
283 	SfxTabPage*	ODriversSettings::CreateDbase( Window* pParent,	const SfxItemSet& _rAttrSet )
284 	{
285 		return ( new ODbaseDetailsPage( pParent, _rAttrSet ) );
286 	}
287 
288 	// -----------------------------------------------------------------------
289 	void ODbaseDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
290 	{
291 		OCommonBehaviourTabPage::fillControls(_rControlList);
292 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aShowDeleted));
293 	}
294 	// -----------------------------------------------------------------------
295 	void ODbaseDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
296 	{
297 		OCommonBehaviourTabPage::fillWindows(_rControlList);
298 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
299 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFT_Message));
300 		_rControlList.push_back(new ODisableWrapper<PushButton>(&m_aIndexes));
301 	}
302 	// -----------------------------------------------------------------------
303 	void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
304 	{
305 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
306 		sal_Bool bValid, bReadonly;
307 		getFlags(_rSet, bValid, bReadonly);
308 
309 		// get the DSN string (needed for the index dialog)
310 		SFX_ITEMSET_GET(_rSet, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
311 		SFX_ITEMSET_GET(_rSet, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
312 		::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
313 		if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len())
314 			m_sDsn = pTypeCollection->cutPrefix(pUrlItem->GetValue());
315 
316 		// get the other relevant items
317 		SFX_ITEMSET_GET(_rSet, pDeletedItem, SfxBoolItem, DSID_SHOWDELETEDROWS, sal_True);
318 
319 		if ( bValid )
320 		{
321 			m_aShowDeleted.Check( pDeletedItem->GetValue() );
322 			m_aFT_Message.Show(m_aShowDeleted.IsChecked());
323 		}
324 
325 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
326 	}
327 
328 	// -----------------------------------------------------------------------
329 	sal_Bool ODbaseDetailsPage::FillItemSet( SfxItemSet& _rSet )
330 	{
331 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
332 
333 		fillBool(_rSet,&m_aShowDeleted,DSID_SHOWDELETEDROWS,bChangedSomething);
334 		return bChangedSomething;
335 	}
336 
337 	//------------------------------------------------------------------------
338 	IMPL_LINK( ODbaseDetailsPage, OnButtonClicked, Button*, pButton )
339 	{
340 		if (&m_aIndexes == pButton)
341 		{
342 			ODbaseIndexDialog aIndexDialog(this, m_sDsn);
343 			aIndexDialog.Execute();
344 		}
345 		else
346 		{
347 			m_aFT_Message.Show(m_aShowDeleted.IsChecked());
348 			// it was one of the checkboxes -> we count as modified from now on
349 			callModifiedHdl();
350 		}
351 
352 		return 0;
353 	}
354 
355 	//========================================================================
356 	//= OAdoDetailsPage
357     //========================================================================
358     DBG_NAME(OAdoDetailsPage)
359 	// -----------------------------------------------------------------------
360 	OAdoDetailsPage::OAdoDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
361 		:OCommonBehaviourTabPage(pParent, PAGE_ADO, _rCoreAttrs, CBTP_USE_CHARSET )
362 	{
363         DBG_CTOR(OAdoDetailsPage,NULL);
364 
365 	}
366 
367 	// -----------------------------------------------------------------------
368 	OAdoDetailsPage::~OAdoDetailsPage()
369 	{
370 
371         DBG_DTOR(OAdoDetailsPage,NULL);
372     }
373 	// -----------------------------------------------------------------------
374 	SfxTabPage*	ODriversSettings::CreateAdo( Window* pParent,	const SfxItemSet& _rAttrSet )
375 	{
376 		return ( new OAdoDetailsPage( pParent, _rAttrSet ) );
377 	}
378 
379 	// -----------------------------------------------------------------------
380 	//========================================================================
381 	//= OOdbcDetailsPage
382 	//========================================================================
383 	OOdbcDetailsPage::OOdbcDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
384 		:OCommonBehaviourTabPage(pParent, PAGE_ODBC, _rCoreAttrs, CBTP_USE_CHARSET | CBTP_USE_OPTIONS,false)
385 		,m_aFL_1		(this, ModuleRes(FL_SEPARATOR1))
386 		,m_aUseCatalog	(this, ModuleRes(CB_USECATALOG))
387 	{
388 		m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
389 		FreeResource();
390 
391 		Window* pWindows[] = {  m_pCharsetLabel, m_pCharset
392 								,m_pOptionsLabel,m_pOptions,&m_aUseCatalog
393 								};
394 
395 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
396 		for (sal_Int32 i=1; i < nCount; ++i)
397 			pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
398 	}
399 
400 	// -----------------------------------------------------------------------
401 	SfxTabPage*	ODriversSettings::CreateODBC( Window* pParent, const SfxItemSet& _rAttrSet )
402 	{
403 		return ( new OOdbcDetailsPage( pParent, _rAttrSet ) );
404 	}
405 
406 	// -----------------------------------------------------------------------
407 	sal_Bool OOdbcDetailsPage::FillItemSet( SfxItemSet& _rSet )
408 	{
409 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
410 		fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
411 		return bChangedSomething;
412 	}
413 	// -----------------------------------------------------------------------
414 	void OOdbcDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
415 	{
416 		OCommonBehaviourTabPage::fillControls(_rControlList);
417 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
418 	}
419 	// -----------------------------------------------------------------------
420 	void OOdbcDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
421 	{
422 		OCommonBehaviourTabPage::fillWindows(_rControlList);
423 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
424 	}
425 	// -----------------------------------------------------------------------
426 	void OOdbcDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
427 	{
428 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
429 		sal_Bool bValid, bReadonly;
430 		getFlags(_rSet, bValid, bReadonly);
431 
432 		SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
433 
434 		if ( bValid )
435 			m_aUseCatalog.Check(pUseCatalogItem->GetValue());
436 
437 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
438 	}
439 	//========================================================================
440 	//= OOdbcDetailsPage
441 	//========================================================================
442 	OUserDriverDetailsPage::OUserDriverDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
443 		:OCommonBehaviourTabPage(pParent, PAGE_USERDRIVER, _rCoreAttrs,
444 		CBTP_USE_CHARSET | CBTP_USE_OPTIONS ,false)
445 		,m_aFTHostname		(this, ModuleRes(FT_HOSTNAME))
446 		,m_aEDHostname		(this, ModuleRes(ET_HOSTNAME))
447 		,m_aPortNumber		(this, ModuleRes(FT_PORTNUMBER))
448 		,m_aNFPortNumber	(this, ModuleRes(NF_PORTNUMBER))
449 		,m_aUseCatalog		(this, ModuleRes(CB_USECATALOG))
450 	{
451 		m_aUseCatalog.SetToggleHdl(getControlModifiedLink());
452 		FreeResource();
453 	}
454 
455 	// -----------------------------------------------------------------------
456 	SfxTabPage*	ODriversSettings::CreateUser( Window* pParent, const SfxItemSet& _rAttrSet )
457 	{
458 		return ( new OUserDriverDetailsPage( pParent, _rAttrSet ) );
459 	}
460 
461 	// -----------------------------------------------------------------------
462 	sal_Bool OUserDriverDetailsPage::FillItemSet( SfxItemSet& _rSet )
463 	{
464 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
465 
466 		fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_PORTNUMBER,bChangedSomething);
467 		fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
468 		fillBool(_rSet,&m_aUseCatalog,DSID_USECATALOG,bChangedSomething);
469 
470 		return bChangedSomething;
471 	}
472 	// -----------------------------------------------------------------------
473 	void OUserDriverDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
474 	{
475 		OCommonBehaviourTabPage::fillControls(_rControlList);
476 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
477 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aUseCatalog));
478 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
479 	}
480 	// -----------------------------------------------------------------------
481 	void OUserDriverDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
482 	{
483 		OCommonBehaviourTabPage::fillWindows(_rControlList);
484 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
485 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
486 	}
487 	// -----------------------------------------------------------------------
488 	void OUserDriverDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
489 	{
490 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
491 		sal_Bool bValid, bReadonly;
492 		getFlags(_rSet, bValid, bReadonly);
493 
494 		SFX_ITEMSET_GET(_rSet, pUseCatalogItem, SfxBoolItem, DSID_USECATALOG, sal_True);
495 		SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
496 		SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_PORTNUMBER, sal_True);
497 
498 		if ( bValid )
499 		{
500 			m_aEDHostname.SetText(pHostName->GetValue());
501 			m_aEDHostname.ClearModifyFlag();
502 
503 			m_aNFPortNumber.SetValue(pPortNumber->GetValue());
504 			m_aNFPortNumber.ClearModifyFlag();
505 
506 			m_aUseCatalog.Check(pUseCatalogItem->GetValue());
507 		}
508 
509 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
510 	}
511 	//========================================================================
512 	//= OMySQLODBCDetailsPage
513 	//========================================================================
514 	OMySQLODBCDetailsPage::OMySQLODBCDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
515 		:OCommonBehaviourTabPage(pParent, PAGE_MYSQL_ODBC, _rCoreAttrs, CBTP_USE_CHARSET )
516 	{
517 	}
518 
519 	// -----------------------------------------------------------------------
520 	SfxTabPage*	ODriversSettings::CreateMySQLODBC( Window* pParent, const SfxItemSet& _rAttrSet )
521 	{
522 		return ( new OMySQLODBCDetailsPage( pParent, _rAttrSet ) );
523 	}
524 
525 	//========================================================================
526 	//= OMySQLJDBCDetailsPage
527 	//========================================================================
528 	OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( Window* pParent,sal_uInt16 _nResId, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId)
529 		:OCommonBehaviourTabPage(pParent, _nResId, _rCoreAttrs, CBTP_USE_CHARSET ,false)
530 		,m_aFL_1			(this, ModuleRes( FL_SEPARATOR1) )
531 		,m_aFTHostname		(this, ModuleRes(FT_HOSTNAME))
532 		,m_aEDHostname		(this, ModuleRes(ET_HOSTNAME))
533 		,m_aPortNumber		(this, ModuleRes(FT_PORTNUMBER))
534 		,m_aNFPortNumber	(this, ModuleRes(NF_PORTNUMBER))
535         ,m_aFTSocket		(this, ModuleRes(FT_SOCKET))
536 		,m_aEDSocket		(this, ModuleRes(ET_SOCKET))
537 		,m_aFTDriverClass	(this, ModuleRes(FT_JDBCDRIVERCLASS))
538 		,m_aEDDriverClass	(this, ModuleRes(ET_JDBCDRIVERCLASS))
539 		,m_aTestJavaDriver	(this, ModuleRes(PB_TESTDRIVERCLASS))
540 		,m_nPortId(_nPortId)
541         ,m_bUseClass(true)
542 	{
543         SFX_ITEMSET_GET(_rCoreAttrs, pUrlItem, SfxStringItem, DSID_CONNECTURL, sal_True);
544         SFX_ITEMSET_GET(_rCoreAttrs, pTypesItem, DbuTypeCollectionItem, DSID_TYPECOLLECTION, sal_True);
545 	    ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : NULL;
546 	    if (pTypeCollection && pUrlItem && pUrlItem->GetValue().Len() )
547         {
548             m_sDefaultJdbcDriverName = pTypeCollection->getJavaDriverClass(pUrlItem->GetValue());
549         }
550         if ( m_sDefaultJdbcDriverName.Len() )
551         {
552             m_aEDDriverClass.SetModifyHdl(getControlModifiedLink());
553             m_aEDDriverClass.SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnEditModified));
554 		    m_aTestJavaDriver.SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
555         }
556         else
557         {
558             m_bUseClass = false;
559             m_aFTDriverClass.Show(sal_False);
560             m_aEDDriverClass.Show(sal_False);
561             m_aTestJavaDriver.Show(sal_False);
562         }
563 
564         m_aFTSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
565         m_aEDSocket.Show(PAGE_MYSQL_JDBC == _nResId && !m_bUseClass);
566 
567 		m_aEDHostname.SetModifyHdl(getControlModifiedLink());
568 		m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
569         m_aEDSocket.SetModifyHdl(getControlModifiedLink());
570 
571 		Window* pWindows[] = {  &m_aFTHostname,&m_aEDHostname,
572 								&m_aPortNumber,&m_aNFPortNumber,&m_aFTSocket,&m_aEDSocket,
573 								&m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver,
574 								m_pCharsetLabel, m_pCharset};
575 
576 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
577 		for (sal_Int32 i=1; i < nCount; ++i)
578 			pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
579 
580 		FreeResource();
581 	}
582 
583 	// -----------------------------------------------------------------------
584 	void OGeneralSpecialJDBCDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
585 	{
586 		OCommonBehaviourTabPage::fillControls(_rControlList);
587         if ( m_bUseClass )
588 		    _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDDriverClass));
589 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
590 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
591         _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDSocket));
592 	}
593 	// -----------------------------------------------------------------------
594 	void OGeneralSpecialJDBCDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
595 	{
596 		OCommonBehaviourTabPage::fillWindows(_rControlList);
597 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
598 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
599         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTSocket));
600         if ( m_bUseClass )
601 		    _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTDriverClass));
602 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
603 	}
604 
605 	// -----------------------------------------------------------------------
606 	sal_Bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet& _rSet )
607 	{
608 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
609         if ( m_bUseClass )
610 		    fillString(_rSet,&m_aEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
611 		fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
612         fillString(_rSet,&m_aEDSocket,DSID_CONN_SOCKET,bChangedSomething);
613 		fillInt32(_rSet,&m_aNFPortNumber,m_nPortId,bChangedSomething );
614 
615 		return bChangedSomething;
616 	}
617 	// -----------------------------------------------------------------------
618 	void OGeneralSpecialJDBCDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
619 	{
620 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
621 		sal_Bool bValid, bReadonly;
622 		getFlags(_rSet, bValid, bReadonly);
623 
624 		SFX_ITEMSET_GET(_rSet, pDrvItem, SfxStringItem, DSID_JDBCDRIVERCLASS, sal_True);
625 		SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
626 		SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, m_nPortId, sal_True);
627         SFX_ITEMSET_GET(_rSet, pSocket, SfxStringItem, DSID_CONN_SOCKET, sal_True);
628 
629 		if ( bValid )
630 		{
631             if ( m_bUseClass )
632             {
633 			    m_aEDDriverClass.SetText(pDrvItem->GetValue());
634 			    m_aEDDriverClass.ClearModifyFlag();
635             }
636 
637 			m_aEDHostname.SetText(pHostName->GetValue());
638 			m_aEDHostname.ClearModifyFlag();
639 
640 			m_aNFPortNumber.SetValue(pPortNumber->GetValue());
641 			m_aNFPortNumber.ClearModifyFlag();
642 
643             m_aEDSocket.SetText(pSocket->GetValue());
644 			m_aEDSocket.ClearModifyFlag();
645 		}
646 
647 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
648 
649 		// to get the correcxt value when saveValue was called by base class
650 		if ( m_bUseClass && !m_aEDDriverClass.GetText().Len() )
651 		{
652 			m_aEDDriverClass.SetText(m_sDefaultJdbcDriverName);
653 			m_aEDDriverClass.SetModifyFlag();
654 		}
655 	}
656 	// -----------------------------------------------------------------------
657 	IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, PushButton*, /*_pButton*/)
658 	{
659 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
660         OSL_ENSURE(m_bUseClass,"Who called me?");
661 
662 		sal_Bool bSuccess = sal_False;
663 		try
664 		{
665 			if ( m_aEDDriverClass.GetText().Len() )
666 			{
667 // TODO chage jvmaccess
668 				::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM(m_pAdminDialog->getORB());
669 				bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_aEDDriverClass.GetText());
670 			}
671 		}
672 		catch(Exception&)
673 		{
674 		}
675 
676 		sal_uInt16 nMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS;
677 		OSQLMessageBox aMsg( this, String( ModuleRes( nMessage ) ), String() );
678 		aMsg.Execute();
679 		return 0L;
680 	}
681 	// -----------------------------------------------------------------------
682 	IMPL_LINK(OGeneralSpecialJDBCDetailsPage, OnEditModified, Edit*, _pEdit)
683 	{
684 		if ( m_bUseClass && _pEdit == &m_aEDDriverClass )
685 			m_aTestJavaDriver.Enable( m_aEDDriverClass.GetText().Len() != 0 );
686 
687 		// tell the listener we were modified
688 		callModifiedHdl();
689 		return 0L;
690 	}
691 
692 	//========================================================================
693 	//= MySQLNativePage
694 	//========================================================================
695 	MySQLNativePage::MySQLNativePage( Window* pParent, const SfxItemSet& _rCoreAttrs )
696 		:OCommonBehaviourTabPage(pParent, PAGE_MYSQL_NATIVE, _rCoreAttrs, CBTP_USE_CHARSET, false )
697 		,m_aSeparator1          ( this, ModuleRes( FL_SEPARATOR1) )
698         ,m_aMySQLSettings       ( *this, getControlModifiedLink() )
699         ,m_aSeparator2          ( this, ModuleRes(FL_SEPARATOR2))
700         ,m_aUserNameLabel       ( this, ModuleRes(FT_USERNAME))
701         ,m_aUserName            ( this, ModuleRes(ET_USERNAME))
702         ,m_aPasswordRequired    ( this, ModuleRes(CB_PASSWORD_REQUIRED))
703 	{
704         m_aUserName.SetModifyHdl(getControlModifiedLink());
705 
706 		Window* pWindows[] = {  &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName,
707                                 &m_aPasswordRequired, m_pCharsetLabel, m_pCharset};
708 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
709 		for (sal_Int32 i=1; i < nCount; ++i)
710 			pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
711 
712         LayoutHelper::positionBelow( m_aSeparator1, m_aMySQLSettings, RelatedControls, 3 );
713         m_aMySQLSettings.Show();
714 
715 		FreeResource();
716 	}
717 
718 	// -----------------------------------------------------------------------
719 	void MySQLNativePage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
720 	{
721 		OCommonBehaviourTabPage::fillControls( _rControlList );
722         m_aMySQLSettings.fillControls( _rControlList );
723 
724         _rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aUserName));
725         _rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aPasswordRequired));
726 	}
727 	// -----------------------------------------------------------------------
728 	void MySQLNativePage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
729 	{
730 		OCommonBehaviourTabPage::fillWindows( _rControlList );
731         m_aMySQLSettings.fillWindows( _rControlList);
732 
733 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator1));
734 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aSeparator2));
735         _rControlList.push_back(new ODisableWrapper<FixedText>(&m_aUserNameLabel));
736 	}
737 
738 	// -----------------------------------------------------------------------
739 	sal_Bool MySQLNativePage::FillItemSet( SfxItemSet& _rSet )
740 	{
741 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet( _rSet );
742 
743         bChangedSomething |= m_aMySQLSettings.FillItemSet( _rSet );
744 
745         if ( m_aUserName.GetText() != m_aUserName.GetSavedValue() )
746 		{
747 			_rSet.Put( SfxStringItem( DSID_USER, m_aUserName.GetText() ) );
748 			_rSet.Put( SfxStringItem( DSID_PASSWORD, String()));
749 			bChangedSomething = sal_True;
750 		}
751 		fillBool(_rSet,&m_aPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething);
752 
753         return bChangedSomething;
754 	}
755 	// -----------------------------------------------------------------------
756 	void MySQLNativePage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
757 	{
758 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
759 		sal_Bool bValid, bReadonly;
760 		getFlags(_rSet, bValid, bReadonly);
761 
762         m_aMySQLSettings.implInitControls( _rSet );
763 
764 		SFX_ITEMSET_GET(_rSet, pUidItem, SfxStringItem, DSID_USER, sal_True);
765 		SFX_ITEMSET_GET(_rSet, pAllowEmptyPwd, SfxBoolItem, DSID_PASSWORDREQUIRED, sal_True);
766 
767 		if ( bValid )
768 		{
769             m_aUserName.SetText(pUidItem->GetValue());
770             m_aUserName.ClearModifyFlag();
771 			m_aPasswordRequired.Check(pAllowEmptyPwd->GetValue());
772 		}
773 
774 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
775 	}
776 
777 	// -----------------------------------------------------------------------
778 	SfxTabPage*	ODriversSettings::CreateMySQLJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
779 	{
780 		return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_MYSQL_JDBC, _rAttrSet,DSID_MYSQL_PORTNUMBER ) );
781 	}
782     // -----------------------------------------------------------------------
783 	SfxTabPage*	ODriversSettings::CreateMySQLNATIVE( Window* pParent, const SfxItemSet& _rAttrSet )
784 	{
785 		return ( new MySQLNativePage( pParent, _rAttrSet ) );
786 	}
787 
788 	// -----------------------------------------------------------------------
789 	SfxTabPage*	ODriversSettings::CreateOracleJDBC( Window* pParent, const SfxItemSet& _rAttrSet )
790 	{
791 		return ( new OGeneralSpecialJDBCDetailsPage( pParent,PAGE_ORACLE_JDBC, _rAttrSet,DSID_ORACLE_PORTNUMBER) );
792 	}
793 
794 
795 	//========================================================================
796 	//= OAdabasDetailsPage
797 	//========================================================================
798 	OAdabasDetailsPage::OAdabasDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
799 		:OCommonBehaviourTabPage(pParent, PAGE_ADABAS, _rCoreAttrs, CBTP_USE_CHARSET ,false)
800 		,m_aFTHostname		(this, ModuleRes(FT_HOSTNAME))
801 		,m_aEDHostname		(this, ModuleRes(ET_HOSTNAME))
802 		,m_aFL_1			(this, ModuleRes( FL_SEPARATOR1) )
803 		,m_FT_CACHE_SIZE(		this, ModuleRes( FT_CACHE_SIZE		) )
804 		,m_NF_CACHE_SIZE(		this, ModuleRes( NF_CACHE_SIZE		) )
805 		,m_FT_DATA_INCREMENT(	this, ModuleRes( FT_DATA_INCREMENT	) )
806 		,m_NF_DATA_INCREMENT(	this, ModuleRes( NF_DATA_INCREMENT	) )
807 		,m_aFL_2(				this, ModuleRes( FL_SEPARATOR2		) )
808 		,m_FT_CTRLUSERNAME(		this, ModuleRes( FT_CTRLUSERNAME	) )
809 		,m_ET_CTRLUSERNAME(		this, ModuleRes( ET_CTRLUSERNAME	) )
810 		,m_FT_CTRLPASSWORD(		this, ModuleRes( FT_CTRLPASSWORD	) )
811 		,m_ET_CTRLPASSWORD(		this, ModuleRes( ET_CTRLPASSWORD	) )
812         ,m_CB_SHUTDB(			this, ModuleRes( CB_SHUTDB			) )
813 		,m_PB_STAT(				this, ModuleRes( PB_STAT			) )
814 	{
815 		m_aEDHostname.SetModifyHdl(getControlModifiedLink());
816 
817 		FreeResource();
818 
819 		m_PB_STAT.SetClickHdl(				LINK(this,OAdabasDetailsPage,PBClickHdl));
820 
821 		m_CB_SHUTDB.SetClickHdl(			LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
822 		m_NF_CACHE_SIZE.SetModifyHdl(		LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
823 		m_NF_DATA_INCREMENT.SetModifyHdl(	LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
824 		m_ET_CTRLUSERNAME.SetModifyHdl(		LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
825 		m_ET_CTRLPASSWORD.SetModifyHdl(		LINK(this,OAdabasDetailsPage,AttributesChangedHdl));
826 
827 		m_ET_CTRLUSERNAME.SetLoseFocusHdl(	LINK(this,OAdabasDetailsPage,LoseFocusHdl));
828 		m_ET_CTRLPASSWORD.SetLoseFocusHdl(	LINK(this,OAdabasDetailsPage,LoseFocusHdl));
829 
830 		m_NF_DATA_INCREMENT.SetMin(20);
831 		m_NF_DATA_INCREMENT.SetMax(LONG_MAX);
832 		m_NF_DATA_INCREMENT.SetValue(20);
833 		m_NF_DATA_INCREMENT.SetDecimalDigits(0);
834 
835 		m_NF_CACHE_SIZE.SetMin(4);
836 		m_NF_CACHE_SIZE.SetMax(LONG_MAX);
837 		m_NF_CACHE_SIZE.SetValue(4);
838 		m_NF_CACHE_SIZE.SetDecimalDigits(0);
839 
840 		Window* pWindows[] = {  &m_aFTHostname,&m_aEDHostname
841 								,&m_FT_CACHE_SIZE,&m_NF_CACHE_SIZE
842 								,&m_FT_DATA_INCREMENT,&m_NF_DATA_INCREMENT
843 								,&m_FT_CTRLUSERNAME,&m_ET_CTRLUSERNAME
844 								,&m_FT_CTRLPASSWORD,&m_ET_CTRLPASSWORD
845 								,&m_CB_SHUTDB
846 								,m_pCharsetLabel, m_pCharset,&m_PB_STAT};
847 
848 		sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]);
849 		for (sal_Int32 i=1; i < nCount; ++i)
850 			pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND);
851 	}
852 
853 	// -----------------------------------------------------------------------
854 	SfxTabPage*	ODriversSettings::CreateAdabas( Window* pParent, const SfxItemSet& _rAttrSet )
855 	{
856 		return ( new OAdabasDetailsPage( pParent, _rAttrSet ) );
857 	}
858 
859 	// -----------------------------------------------------------------------
860 	void OAdabasDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
861 	{
862 		OCommonBehaviourTabPage::fillControls(_rControlList);
863 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aEDHostname));
864 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_CACHE_SIZE));
865 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_NF_DATA_INCREMENT));
866 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLUSERNAME));
867 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_ET_CTRLPASSWORD));
868 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_CB_SHUTDB));
869 	}
870 	// -----------------------------------------------------------------------
871 	void OAdabasDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
872 	{
873 		OCommonBehaviourTabPage::fillWindows(_rControlList);
874 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTHostname));
875 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
876 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CACHE_SIZE));
877 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_DATA_INCREMENT));
878 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_2));
879 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLUSERNAME));
880 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_FT_CTRLPASSWORD));
881 		_rControlList.push_back(new ODisableWrapper<PushButton>(&m_PB_STAT));
882 	}
883 	// -----------------------------------------------------------------------
884 	void OAdabasDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
885 	{
886 		// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
887 		sal_Bool bValid, bReadonly;
888 		getFlags(_rSet, bValid, bReadonly);
889 
890 		SFX_ITEMSET_GET(_rSet, pHostName, SfxStringItem, DSID_CONN_HOSTNAME, sal_True);
891 		SFX_ITEMSET_GET(_rSet, pCtrlUserItem, SfxStringItem, DSID_CONN_CTRLUSER, sal_True);
892 		SFX_ITEMSET_GET(_rSet, pCtrlPwdItem, SfxStringItem, DSID_CONN_CTRLPWD, sal_True);
893 		SFX_ITEMSET_GET(_rSet, pShutItem, SfxBoolItem, DSID_CONN_SHUTSERVICE, sal_True);
894 		SFX_ITEMSET_GET(_rSet, pIncItem, SfxInt32Item, DSID_CONN_DATAINC, sal_True);
895 		SFX_ITEMSET_GET(_rSet, pCacheItem, SfxInt32Item, DSID_CONN_CACHESIZE, sal_True);
896 		if ( bValid )
897 		{
898 			m_aEDHostname.SetText(pHostName->GetValue());
899 			m_aEDHostname.ClearModifyFlag();
900 			m_CB_SHUTDB.Check( pShutItem->GetValue() );
901 			m_NF_DATA_INCREMENT.SetValue( pIncItem->GetValue() );
902 			m_NF_CACHE_SIZE.SetValue( pCacheItem->GetValue() );
903 			m_ET_CTRLUSERNAME.SetText(pCtrlUserItem->GetValue());
904 			m_ET_CTRLPASSWORD.SetText(pCtrlPwdItem->GetValue());
905 			m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
906 		}
907 
908 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
909 	}
910 	// -----------------------------------------------------------------------
911 	sal_Bool OAdabasDetailsPage::FillItemSet( SfxItemSet& _rSet )
912 	{
913 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
914 
915 		fillString(_rSet,&m_aEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
916 		fillBool(_rSet,&m_CB_SHUTDB,DSID_CONN_SHUTSERVICE,bChangedSomething);
917 		fillInt32(_rSet,&m_NF_DATA_INCREMENT,DSID_CONN_DATAINC,bChangedSomething );
918 		fillInt32(_rSet,&m_NF_CACHE_SIZE,DSID_CONN_CACHESIZE,bChangedSomething );
919 		fillString(_rSet,&m_ET_CTRLUSERNAME,DSID_CONN_CTRLUSER,bChangedSomething );
920 		fillString(_rSet,&m_ET_CTRLPASSWORD,DSID_CONN_CTRLPWD,bChangedSomething );
921 
922 		return bChangedSomething;
923 	}
924 	//------------------------------------------------------------------------
925 	IMPL_LINK( OAdabasDetailsPage, AttributesChangedHdl, void *, EMPTYARG )
926 	{
927 		m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
928 		bAttrsChanged = sal_True;
929 		callModifiedHdl();
930 		return 0;
931 	}
932 	//------------------------------------------------------------------------
933 	IMPL_LINK( OAdabasDetailsPage, LoseFocusHdl, Edit *, /*pEdit*/ )
934 	{
935 		m_CB_SHUTDB.Enable(m_ET_CTRLUSERNAME.GetText().Len() && m_ET_CTRLPASSWORD.GetText().Len());
936 		return 0;
937 	}
938 	//------------------------------------------------------------------------
939 	IMPL_LINK( OAdabasDetailsPage, PBClickHdl, Button *, /*pButton*/ )
940 	{
941 		OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
942 		if ( m_pAdminDialog )
943 		{
944 			m_pAdminDialog->saveDatasource();
945 			try
946 			{
947 				Reference< XConnection > xConnection = m_pAdminDialog->createConnection().first;
948 				if ( xConnection.is() )
949 				{
950 					OAdabasStatistics aDlg(this,m_sUser,xConnection,m_pAdminDialog->getORB());
951 					aDlg.Execute();
952 					::comphelper::disposeComponent(xConnection);
953 				}
954 			}
955 			catch(Exception&)
956 			{
957 			}
958 		}
959 
960 		return 0;
961 	}
962 
963 
964 	//========================================================================
965 	//= OLDAPDetailsPage
966 	//========================================================================
967 	OLDAPDetailsPage::OLDAPDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
968 		:OCommonBehaviourTabPage(pParent, PAGE_LDAP, _rCoreAttrs,0,false)
969 		,m_aFL_1			(this, ModuleRes( FL_SEPARATOR1) )
970 		,m_aBaseDN			(this, ModuleRes(FT_BASEDN))
971 		,m_aETBaseDN		(this, ModuleRes(ET_BASEDN))
972  		,m_aCBUseSSL        (this, ModuleRes(CB_USESSL))
973 		,m_aPortNumber		(this, ModuleRes(FT_PORTNUMBER))
974 		,m_aNFPortNumber	(this, ModuleRes(NF_PORTNUMBER))
975 		,m_aFTRowCount		(this, ModuleRes(FT_LDAPROWCOUNT))
976 		,m_aNFRowCount		(this, ModuleRes(NF_LDAPROWCOUNT))
977 	{
978 		m_aETBaseDN.SetModifyHdl(getControlModifiedLink());
979 		m_aCBUseSSL.SetToggleHdl(getControlModifiedLink());
980 		m_aNFPortNumber.SetModifyHdl(getControlModifiedLink());
981 		m_aNFRowCount.SetModifyHdl(getControlModifiedLink());
982 
983 		m_aNFRowCount.SetUseThousandSep(sal_False);
984 		m_iNormalPort = 389;
985 		m_iSSLPort    = 636;
986 		m_aCBUseSSL.SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
987         FreeResource();
988 	}
989 
990 	// -----------------------------------------------------------------------
991 	SfxTabPage*	ODriversSettings::CreateLDAP( Window* pParent, const SfxItemSet& _rAttrSet )
992 	{
993 		return ( new OLDAPDetailsPage( pParent, _rAttrSet ) );
994 	}
995 
996 	// -----------------------------------------------------------------------
997 	sal_Bool OLDAPDetailsPage::FillItemSet( SfxItemSet& _rSet )
998 	{
999 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
1000 
1001 		fillString(_rSet,&m_aETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething);
1002 		fillInt32(_rSet,&m_aNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
1003 		fillInt32(_rSet,&m_aNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
1004 		fillBool(_rSet,&m_aCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
1005 		return bChangedSomething;
1006 	}
1007 	//------------------------------------------------------------------------
1008 	IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, CheckBox*, pCheckBox )
1009 	{
1010 		callModifiedHdl();
1011 		if ( pCheckBox == &m_aCBUseSSL)
1012 		{
1013 			if ( m_aCBUseSSL.IsChecked() )
1014 			{
1015 				m_iNormalPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
1016 				m_aNFPortNumber.SetValue(m_iSSLPort);
1017 			}
1018 			else
1019 			{
1020 				m_iSSLPort = static_cast<sal_Int32>(m_aNFPortNumber.GetValue());
1021 				m_aNFPortNumber.SetValue(m_iNormalPort);
1022 			}
1023 		}
1024 		return 0;
1025 	}
1026 
1027 	// -----------------------------------------------------------------------
1028 	void OLDAPDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
1029 	{
1030 		OCommonBehaviourTabPage::fillControls(_rControlList);
1031 		_rControlList.push_back(new OSaveValueWrapper<Edit>(&m_aETBaseDN));
1032 		_rControlList.push_back(new OSaveValueWrapper<CheckBox>(&m_aCBUseSSL));
1033 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFPortNumber));
1034 		_rControlList.push_back(new OSaveValueWrapper<NumericField>(&m_aNFRowCount));
1035 	}
1036 	// -----------------------------------------------------------------------
1037 	void OLDAPDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
1038 	{
1039 		OCommonBehaviourTabPage::fillWindows(_rControlList);
1040 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aBaseDN));
1041 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aPortNumber));
1042 		_rControlList.push_back(new ODisableWrapper<FixedText>(&m_aFTRowCount));
1043 		_rControlList.push_back(new ODisableWrapper<FixedLine>(&m_aFL_1));
1044 	}
1045 	// -----------------------------------------------------------------------
1046 	void OLDAPDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
1047 	{
1048 		// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
1049 		sal_Bool bValid, bReadonly;
1050 		getFlags(_rSet, bValid, bReadonly);
1051 
1052 
1053 		SFX_ITEMSET_GET(_rSet, pBaseDN, SfxStringItem, DSID_CONN_LDAP_BASEDN, sal_True);
1054         SFX_ITEMSET_GET(_rSet, pUseSSL, SfxBoolItem, DSID_CONN_LDAP_USESSL, sal_True);
1055 		SFX_ITEMSET_GET(_rSet, pPortNumber, SfxInt32Item, DSID_CONN_LDAP_PORTNUMBER, sal_True);
1056 		SFX_ITEMSET_GET(_rSet, pRowCount, SfxInt32Item, DSID_CONN_LDAP_ROWCOUNT, sal_True);
1057 
1058 		if ( bValid )
1059 		{
1060 			m_aETBaseDN.SetText(pBaseDN->GetValue());
1061 			m_aNFPortNumber.SetValue(pPortNumber->GetValue());
1062 			m_aNFRowCount.SetValue(pRowCount->GetValue());
1063 			m_aCBUseSSL.Check(pUseSSL->GetValue());
1064 		}
1065 
1066 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
1067 	}
1068 
1069 
1070 	//========================================================================
1071 	//= OTextDetailsPage
1072 	//========================================================================
1073     DBG_NAME(OTextDetailsPage)
1074     //------------------------------------------------------------------------
1075 	OTextDetailsPage::OTextDetailsPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
1076 		:OCommonBehaviourTabPage(pParent, PAGE_TEXT, _rCoreAttrs, 0, false )
1077 	{
1078         DBG_CTOR(OTextDetailsPage,NULL);
1079 
1080         m_pTextConnectionHelper = new OTextConnectionHelper( this, TC_EXTENSION | TC_HEADER | TC_SEPARATORS | TC_CHARSET );
1081 		FreeResource();
1082 	}
1083 
1084 	// -----------------------------------------------------------------------
1085 	OTextDetailsPage::~OTextDetailsPage()
1086 	{
1087         DELETEZ(m_pTextConnectionHelper);
1088 
1089         DBG_DTOR(OTextDetailsPage,NULL);
1090     }
1091 
1092 	// -----------------------------------------------------------------------
1093 	SfxTabPage*	ODriversSettings::CreateText( Window* pParent,	const SfxItemSet& _rAttrSet )
1094 	{
1095 		return ( new OTextDetailsPage( pParent, _rAttrSet ) );
1096 	}
1097 	// -----------------------------------------------------------------------
1098 	void OTextDetailsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
1099 	{
1100 		OCommonBehaviourTabPage::fillControls(_rControlList);
1101         m_pTextConnectionHelper->fillControls(_rControlList);
1102 
1103 	}
1104 	// -----------------------------------------------------------------------
1105 	void OTextDetailsPage::fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList)
1106 	{
1107 		OCommonBehaviourTabPage::fillWindows(_rControlList);
1108         m_pTextConnectionHelper->fillWindows(_rControlList);
1109 
1110 	}
1111 	// -----------------------------------------------------------------------
1112 	void OTextDetailsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
1113 	{
1114 		// first check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
1115 		sal_Bool bValid, bReadonly;
1116 		getFlags(_rSet, bValid, bReadonly);
1117 
1118 		m_pTextConnectionHelper->implInitControls(_rSet, bValid);
1119 		OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
1120 	}
1121 
1122 	// -----------------------------------------------------------------------
1123 	sal_Bool OTextDetailsPage::FillItemSet( SfxItemSet& rSet )
1124 	{
1125 		sal_Bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(rSet);
1126 		bChangedSomething = m_pTextConnectionHelper->FillItemSet(rSet, bChangedSomething);
1127 		return bChangedSomething;
1128 	}
1129 
1130 	// -----------------------------------------------------------------------
1131     sal_Bool OTextDetailsPage::prepareLeave()
1132     {
1133         return m_pTextConnectionHelper->prepareLeave();
1134     }
1135 
1136 	//------------------------------------------------------------------------
1137 	SfxTabPage*	ODriversSettings::CreateGeneratedValuesPage( Window* _pParent, const SfxItemSet& _rAttrSet )
1138 	{
1139 		return new GeneratedValuesPage( _pParent, _rAttrSet );
1140 	}
1141 
1142     //------------------------------------------------------------------------
1143 	SfxTabPage*	ODriversSettings::CreateSpecialSettingsPage( Window* _pParent, const SfxItemSet& _rAttrSet )
1144 	{
1145         ::rtl::OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( _rAttrSet );
1146         DataSourceMetaData aMetaData( eType );
1147 		return new SpecialSettingsPage(	_pParent, _rAttrSet, aMetaData );
1148 	}
1149 //.........................................................................
1150 }	// namespace dbaui
1151 //.........................................................................
1152