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

Generated by: LCOV version 1.10