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