LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - dbadmin.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 73 197 37.1 %
Date: 2014-11-03 Functions: 3 24 12.5 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10