xref: /trunk/main/dbaccess/source/ui/dlg/dbadmin.cxx (revision cdf0e10c)
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 "ConnectionPage.hxx"
32 #include "DbAdminImpl.hxx"
33 #include "DriverSettings.hxx"
34 #include "adminpages.hxx"
35 #include "dbadmin.hrc"
36 #include "dbadmin.hxx"
37 #include "dbu_dlg.hrc"
38 #include <svl/stritem.hxx>
39 #include <svl/eitem.hxx>
40 #include <svl/intitem.hxx>
41 #include "dbustrings.hrc"
42 #include "dsitems.hxx"
43 #include "dsnItem.hxx"
44 #include "localresaccess.hxx"
45 #include "optionalboolitem.hxx"
46 #include "propertysetitem.hxx"
47 #include "stringlistitem.hxx"
48 
49 #include <svl/eitem.hxx>
50 #include <svl/intitem.hxx>
51 #include <svl/stritem.hxx>
52 #include <unotools/confignode.hxx>
53 #include <vcl/msgbox.hxx>
54 
55 //.........................................................................
56 namespace dbaui
57 {
58 //.........................................................................
59 using namespace com::sun::star::uno;
60 using namespace com::sun::star::sdbc;
61 using namespace com::sun::star::lang;
62 using namespace com::sun::star::util;
63 using namespace com::sun::star::beans;
64 using namespace com::sun::star::container;
65 
66 //=========================================================================
67 //= ODbAdminDialog
68 //=========================================================================
69 DBG_NAME(ODbAdminDialog)
70 //-------------------------------------------------------------------------
71 ODbAdminDialog::ODbAdminDialog(Window* _pParent
72 							   , SfxItemSet* _pItems
73 							   , const Reference< XMultiServiceFactory >& _rxORB
74 							   )
75 	:SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_ADMINISTRATION), _pItems)
76 	,m_bApplied(sal_False)
77 	,m_bUIEnabled( sal_True )
78     ,m_nMainPageID( PAGE_CONNECTION )
79 {
80     DBG_CTOR(ODbAdminDialog,NULL);
81 
82 	m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,this,this));
83 
84     // add the initial tab page
85     AddTabPage( m_nMainPageID, String( ModuleRes( STR_PAGETITLE_GENERAL ) ), OConnectionTabPage::Create, NULL );
86 
87 	// remove the reset button - it's meaning is much too ambiguous in this dialog
88 	RemoveResetButton();
89 	// no local resources needed anymore
90 	FreeResource();
91 }
92 
93 //-------------------------------------------------------------------------
94 ODbAdminDialog::~ODbAdminDialog()
95 {
96 	SetInputSet(NULL);
97 	DELETEZ(pExampleSet);
98 
99     DBG_DTOR(ODbAdminDialog,NULL);
100 }
101 //-------------------------------------------------------------------------
102 short ODbAdminDialog::Ok()
103 {
104 	SfxTabDialog::Ok();
105 	disabledUI();
106 	return ( AR_LEAVE_MODIFIED == implApplyChanges() ) ? RET_OK : RET_CANCEL;
107 		// TODO : AR_ERROR is not handled correctly, we always close the dialog here
108 }
109 
110 //-------------------------------------------------------------------------
111 void ODbAdminDialog::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage)
112 {
113 	// register ourself as modified listener
114 	static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory(m_pImpl->getORB());
115 	static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
116 
117 	AdjustLayout();
118 	Window *pWin = GetViewWindow();
119 	if(pWin)
120 		pWin->Invalidate();
121 
122 	SfxTabDialog::PageCreated(_nId, _rPage);
123 }
124 
125 // -----------------------------------------------------------------------------
126 void ODbAdminDialog::addDetailPage(sal_uInt16 _nPageId, sal_uInt16 _nTextId, CreateTabPage _pCreateFunc)
127 {
128 	// open our own resource block, as the page titles are strings local to this block
129 	LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
130 
131 	AddTabPage(_nPageId, String(ModuleRes(_nTextId)), _pCreateFunc, NULL);
132 	m_aCurrentDetailPages.push(_nPageId);
133 }
134 
135 //-------------------------------------------------------------------------
136 void ODbAdminDialog::impl_selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName)
137 {
138 	m_pImpl->setDataSourceOrName(_aDataSourceName);
139 	Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
140 	impl_resetPages( xDatasource );
141 
142     DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
143 	::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
144     ::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
145 
146 	// and insert the new ones
147 	switch ( eType )
148 	{
149 		case  ::dbaccess::DST_DBASE:
150 			addDetailPage(PAGE_DBASE, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateDbase);
151 			//	bResetPasswordRequired = sal_True;
152 			break;
153 
154 		case  ::dbaccess::DST_ADO:
155 			addDetailPage(PAGE_ADO, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdo);
156 			break;
157 
158 		case  ::dbaccess::DST_FLAT:
159 			addDetailPage(PAGE_TEXT, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateText);
160 			//	bResetPasswordRequired = sal_True;
161 			break;
162 
163 		case  ::dbaccess::DST_ODBC:
164 			addDetailPage(PAGE_ODBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateODBC);
165 			break;
166 
167 		case  ::dbaccess::DST_MYSQL_ODBC:
168 			addDetailPage(PAGE_MYSQL_ODBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLODBC);
169 			break;
170 
171         case  ::dbaccess::DST_MYSQL_JDBC:
172 			addDetailPage(PAGE_MYSQL_JDBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateMySQLJDBC);
173 			break;
174 
175         case  ::dbaccess::DST_ORACLE_JDBC:
176 			addDetailPage(PAGE_ORACLE_JDBC, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateOracleJDBC);
177 			break;
178 
179 		case  ::dbaccess::DST_ADABAS:
180 			// for adabas we have more than one page
181 			// CAUTION: the order of inserting pages matters.
182 			// the major detail page should be inserted last always (thus, it becomes the first page after
183 			// the general page)
184 			addDetailPage(PAGE_ADABAS, STR_PAGETITLE_ADVANCED, ODriversSettings::CreateAdabas);
185 			break;
186 
187 		case  ::dbaccess::DST_LDAP:
188 			addDetailPage(PAGE_LDAP,STR_PAGETITLE_ADVANCED,ODriversSettings::CreateLDAP);
189 			break;
190 		case  ::dbaccess::DST_USERDEFINE1:	/// first user defined driver
191 		case  ::dbaccess::DST_USERDEFINE2:
192 		case  ::dbaccess::DST_USERDEFINE3:
193 		case  ::dbaccess::DST_USERDEFINE4:
194 		case  ::dbaccess::DST_USERDEFINE5:
195 		case  ::dbaccess::DST_USERDEFINE6:
196 		case  ::dbaccess::DST_USERDEFINE7:
197 		case  ::dbaccess::DST_USERDEFINE8:
198 		case  ::dbaccess::DST_USERDEFINE9:
199 		case  ::dbaccess::DST_USERDEFINE10:
200 			{
201 				LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
202 				String aTitle(ModuleRes(STR_PAGETITLE_ADVANCED));
203 				AddTabPage(PAGE_USERDRIVER, aTitle, ODriversSettings::CreateUser, 0, sal_False, 1);
204 				m_aCurrentDetailPages.push(PAGE_USERDRIVER);
205 			}
206 			break;
207         default:
208             break;
209 	}
210 }
211 
212 //-------------------------------------------------------------------------
213 void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasource)
214 {
215 	// the selection is valid if and only if we have a datasource now
216 	GetInputSetImpl()->Put(SfxBoolItem(DSID_INVALID_SELECTION, !_rxDatasource.is()));
217 		// (sal_False tells the tab pages to disable and reset all their controls, which is different
218 		// from "just set them to readonly")
219 
220 	// reset the pages
221 
222 	// prevent flicker
223 	SetUpdateMode(sal_False);
224 
225 	// remove all items which relate to indirect properties from the input set
226 	// (without this, the following may happen: select an arbitrary data source where some indirect properties
227 	// are set. Select another data source of the same type, where the indirect props are not set (yet). Then,
228 	// the indirect property values of the first ds are shown in the second ds ...)
229 	const ODbDataSourceAdministrationHelper::MapInt2String& rMap = m_pImpl->getIndirectProperties();
230 	for	(	ODbDataSourceAdministrationHelper::ConstMapInt2StringIterator aIndirect = rMap.begin();
231 			aIndirect != rMap.end();
232 			++aIndirect
233 		)
234 		GetInputSetImpl()->ClearItem( (sal_uInt16)aIndirect->first );
235 
236 	// extract all relevant data from the property set of the data source
237 	m_pImpl->translateProperties(_rxDatasource, *GetInputSetImpl());
238 
239 	// propagate this set as our new input set and reset the example set
240 	SetInputSet(GetInputSetImpl());
241 	delete pExampleSet;
242 	pExampleSet = new SfxItemSet(*GetInputSetImpl());
243 
244     // special case: MySQL Native does not have the generic PAGE_CONNECTION page
245 
246     DbuTypeCollectionItem* pCollectionItem = PTR_CAST(DbuTypeCollectionItem, getOutputSet()->GetItem(DSID_TYPECOLLECTION));
247 	::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
248     if ( pCollection->determineType(getDatasourceType( *pExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
249     {
250 	    LocalResourceAccess aDummy(DLG_DATABASE_ADMINISTRATION, RSC_TABDIALOG);
251         AddTabPage( PAGE_MYSQL_NATIVE, String( ModuleRes( STR_PAGETITLE_CONNECTION ) ), ODriversSettings::CreateMySQLNATIVE, NULL );
252         RemoveTabPage( PAGE_CONNECTION );
253         m_nMainPageID = PAGE_MYSQL_NATIVE;
254     }
255 
256     ShowPage( m_nMainPageID );
257 	SfxTabPage* pConnectionPage = GetTabPage( m_nMainPageID );
258 	if ( pConnectionPage )
259 		pConnectionPage->Reset(*GetInputSetImpl());
260 	// if this is NULL, the page has not been created yet, which means we're called before the
261 	// dialog was displayed (probably from inside the ctor)
262 
263 	SetUpdateMode(sal_True);
264 }
265 // -----------------------------------------------------------------------------
266 void ODbAdminDialog::setTitle(const ::rtl::OUString& _sTitle)
267 {
268 	SetText(_sTitle);
269 }
270 //-------------------------------------------------------------------------
271 void ODbAdminDialog::enableConfirmSettings( bool _bEnable )
272 {
273     (void)_bEnable;
274 }
275 //-------------------------------------------------------------------------
276 sal_Bool ODbAdminDialog::saveDatasource()
277 {
278 	return PrepareLeaveCurrentPage();
279 }
280 //-------------------------------------------------------------------------
281 ODbAdminDialog::ApplyResult ODbAdminDialog::implApplyChanges()
282 {
283 	if (!PrepareLeaveCurrentPage())
284 	{	// the page did not allow us to leave
285 		return AR_KEEP;
286 	}
287 
288 	if ( !m_pImpl->saveChanges(*pExampleSet) )
289 		return AR_KEEP;
290 
291 	if ( isUIEnabled() )
292 		ShowPage(GetCurPageId());
293 		// This does the usual ActivatePage, so the pages can save their current status.
294 		// This way, next time they're asked what has changed since now and here, they really
295 		// can compare with the status they have _now_ (not the one they had before this apply call).
296 
297 	m_bApplied = sal_True;
298 
299 	return AR_LEAVE_MODIFIED;
300 }
301 //-------------------------------------------------------------------------
302 void ODbAdminDialog::selectDataSource(const ::com::sun::star::uno::Any& _aDataSourceName)
303 {
304 	impl_selectDataSource(_aDataSourceName);
305 }
306 
307 // -----------------------------------------------------------------------------
308 const SfxItemSet* ODbAdminDialog::getOutputSet() const
309 {
310 	return GetExampleSet();
311 }
312 // -----------------------------------------------------------------------------
313 SfxItemSet* ODbAdminDialog::getWriteOutputSet()
314 {
315 	return pExampleSet;
316 }
317 // -----------------------------------------------------------------------------
318 ::std::pair< Reference<XConnection>,sal_Bool> ODbAdminDialog::createConnection()
319 {
320 	return m_pImpl->createConnection();
321 }
322 // -----------------------------------------------------------------------------
323 Reference< XMultiServiceFactory > ODbAdminDialog::getORB() const
324 {
325 	return m_pImpl->getORB();
326 }
327 // -----------------------------------------------------------------------------
328 Reference< XDriver > ODbAdminDialog::getDriver()
329 {
330 	return m_pImpl->getDriver();
331 }
332 // -----------------------------------------------------------------------------
333 ::rtl::OUString	ODbAdminDialog::getDatasourceType(const SfxItemSet& _rSet) const
334 {
335 	return m_pImpl->getDatasourceType(_rSet);
336 }
337 // -----------------------------------------------------------------------------
338 void ODbAdminDialog::clearPassword()
339 {
340 	m_pImpl->clearPassword();
341 }
342 //-------------------------------------------------------------------------
343 SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection)
344 {
345 	// just to be sure ....
346 	_rpSet = NULL;
347 	_rpPool = NULL;
348 	_rppDefaults = NULL;
349 
350 	const ::rtl::OUString sFilterAll( "%", 1, RTL_TEXTENCODING_ASCII_US );
351 	// create and initialize the defaults
352 	_rppDefaults = new SfxPoolItem*[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1];
353 	SfxPoolItem** pCounter = _rppDefaults;	// want to modify this without affecting the out param _rppDefaults
354 	*pCounter++ = new SfxStringItem(DSID_NAME, String());
355 	*pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, String());
356 	*pCounter++ = new SfxStringItem(DSID_CONNECTURL, String());
357 	*pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< ::rtl::OUString >(&sFilterAll, 1));
358 	*pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection);
359 	*pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, sal_False);
360 	*pCounter++ = new SfxBoolItem(DSID_READONLY, sal_False);
361 	*pCounter++ = new SfxStringItem(DSID_USER, String());
362 	*pCounter++ = new SfxStringItem(DSID_PASSWORD, String());
363 	*pCounter++ = new SfxStringItem(DSID_ADDITIONALOPTIONS, String());
364 	*pCounter++ = new SfxStringItem(DSID_CHARSET, String());
365 	*pCounter++ = new SfxBoolItem(DSID_PASSWORDREQUIRED, sal_False);
366 	*pCounter++ = new SfxBoolItem(DSID_SHOWDELETEDROWS, sal_False);
367 	*pCounter++ = new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, sal_False);
368 	*pCounter++ = new SfxStringItem(DSID_JDBCDRIVERCLASS, String());
369 	*pCounter++ = new SfxStringItem(DSID_FIELDDELIMITER, ',');
370 	*pCounter++ = new SfxStringItem(DSID_TEXTDELIMITER, '"');
371 	*pCounter++ = new SfxStringItem(DSID_DECIMALDELIMITER, '.');
372 	*pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, String());
373 	*pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, String::CreateFromAscii("txt"));
374 	*pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, sal_True);
375 	*pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, sal_False);
376 	*pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100);
377 	*pCounter++ = new SfxBoolItem(DSID_SUPPRESSVERSIONCL, sal_False);
378 	*pCounter++ = new OPropertySetItem(DSID_DATASOURCE_UNO);
379 	*pCounter++ = new SfxBoolItem(DSID_CONN_SHUTSERVICE, sal_False);
380 	*pCounter++ = new SfxInt32Item(DSID_CONN_DATAINC, 20);
381 	*pCounter++ = new SfxInt32Item(DSID_CONN_CACHESIZE, 20);
382 	*pCounter++ = new SfxStringItem(DSID_CONN_CTRLUSER, String());
383 	*pCounter++ = new SfxStringItem(DSID_CONN_CTRLPWD, String());
384 	*pCounter++ = new SfxBoolItem(DSID_USECATALOG, sal_False);
385 	*pCounter++ = new SfxStringItem(DSID_CONN_HOSTNAME, String());
386 	*pCounter++ = new SfxStringItem(DSID_CONN_LDAP_BASEDN, String());
387 	*pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389);
388 	*pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100);
389 	*pCounter++ = new SfxBoolItem(DSID_SQL92CHECK, sal_False);
390 	*pCounter++ = new SfxStringItem(DSID_AUTOINCREMENTVALUE, String());
391 	*pCounter++ = new SfxStringItem(DSID_AUTORETRIEVEVALUE, String());
392 	*pCounter++ = new SfxBoolItem(DSID_AUTORETRIEVEENABLED, sal_False);
393 	*pCounter++ = new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, sal_False);
394 	*pCounter++ = new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306);
395 	*pCounter++ = new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, sal_True);
396 	*pCounter++ = new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0);
397 	*pCounter++ = new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521);
398 	*pCounter++ = new SfxBoolItem(DSID_ENABLEOUTERJOIN, sal_True);
399 	*pCounter++ = new SfxBoolItem(DSID_CATALOG, sal_True);
400 	*pCounter++ = new SfxBoolItem(DSID_SCHEMA, sal_True);
401 	*pCounter++ = new SfxBoolItem(DSID_INDEXAPPENDIX, sal_True);
402     *pCounter++ = new SfxBoolItem(DSID_CONN_LDAP_USESSL, sal_False);
403 	*pCounter++ = new SfxStringItem(DSID_DOCUMENT_URL, String());
404 	*pCounter++ = new SfxBoolItem(DSID_DOSLINEENDS, sal_False);
405 	*pCounter++ = new SfxStringItem(DSID_DATABASENAME, String());
406 	*pCounter++ = new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, sal_True);
407 	*pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, sal_True);
408     *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, sal_False);
409     *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, String());
410     *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True);
411     *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String());
412     *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT );
413     *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100);
414     *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,sal_False );
415 
416 	// create the pool
417 	static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] =
418 	{
419 		{0,0},
420         {0,0},
421         {0,0},
422         {0,0},
423         {0,0},
424 		{0,0},
425 		{0,0},
426 		{0,0},
427 		{0,0},
428 		{0,0},
429 		{0,0},
430 		{0,0},
431 		{0,0},
432 		{0,0},
433 		{0,0},
434 		{0,0},
435 		{0,0},
436 		{0,0},
437 		{0,0},
438 		{0,0},
439 		{0,0},
440 		{0,0},
441 		{0,0},
442 		{0,0},
443 		{0,0},
444 		{0,0},
445 		{0,0},
446 		{0,0},
447 		{0,0},
448 		{0,0},
449 		{0,0},
450 		{0,0},
451 		{0,0},
452 		{0,0},
453 		{0,0},
454 		{0,0},
455 		{0,0},
456 		{0,0},
457 		{0,0},
458 		{0,0},
459 		{0,0},
460 		{0,0},
461 		{0,0},
462 		{0,0},
463 		{0,0},
464 		{0,0},
465 		{0,0},
466 		{0,0},
467 		{0,0},
468 		{0,0},
469 		{0,0},
470 		{0,0},
471 		{0,0},
472         {0,0},
473         {0,0},
474         {0,0},
475         {0,0},
476         {0,0},
477         {0,0},
478         {0,0},
479         {0,0}
480 	};
481 
482 	OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invalid Ids!");
483 	_rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID,
484 		aItemInfos, _rppDefaults);
485 	_rpPool->FreezeIdRanges();
486 
487 	// and, finally, the set
488 	_rpSet = new SfxItemSet(*_rpPool, sal_True);
489 
490 	return _rpSet;
491 }
492 //-------------------------------------------------------------------------
493 void ODbAdminDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults)
494 {
495 	// _first_ delete the set (refering the pool)
496 	if (_rpSet)
497 	{
498 		delete _rpSet;
499 		_rpSet = NULL;
500 	}
501 
502 	// delete the pool
503 	if (_rpPool)
504 	{
505 		_rpPool->ReleaseDefaults(sal_True);
506 			// the "true" means delete the items, too
507         SfxItemPool::Free(_rpPool);
508 		_rpPool = NULL;
509 	}
510 
511 	// reset the defaults ptr
512 	_rppDefaults = NULL;
513 		// no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
514 }
515 
516 //.........................................................................
517 }	// namespace dbaui
518 //.........................................................................
519 
520