LCOV - code coverage report
Current view: top level - dbaccess/source/ui/dlg - advancedsettings.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 268 2.2 %
Date: 2015-06-13 12:38:46 Functions: 3 38 7.9 %
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 <sal/config.h>
      21             : 
      22             : #include <memory>
      23             : 
      24             : #include "advancedsettings.hxx"
      25             : #include "advancedsettingsdlg.hxx"
      26             : #include "moduledbu.hxx"
      27             : #include "dsitems.hxx"
      28             : #include "DbAdminImpl.hxx"
      29             : #include "DriverSettings.hxx"
      30             : #include "optionalboolitem.hxx"
      31             : #include "dbu_resource.hrc"
      32             : #include "dbu_dlg.hrc"
      33             : 
      34             : #include <svl/eitem.hxx>
      35             : #include <svl/intitem.hxx>
      36             : #include <svl/stritem.hxx>
      37             : 
      38             : #include <vcl/msgbox.hxx>
      39             : 
      40             : namespace dbaui
      41             : {
      42             : 
      43             :     using ::com::sun::star::uno::Reference;
      44             :     using ::com::sun::star::lang::XMultiServiceFactory;
      45             :     using ::com::sun::star::uno::Any;
      46             :     using ::com::sun::star::uno::XComponentContext;
      47             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      48             :     using ::com::sun::star::beans::XPropertySet;
      49             :     using ::com::sun::star::sdbc::XConnection;
      50             :     using ::com::sun::star::sdbc::XDriver;
      51             : 
      52             :     // SpecialSettingsPage
      53           0 :     struct BooleanSettingDesc
      54             :     {
      55             :         VclPtr<CheckBox>* ppControl;    // the dialog's control which displays this setting
      56             :         OString     sControlId;         // the widget name of the control in the .ui
      57             :         sal_uInt16  nItemId;            // the ID of the item (in an SfxItemSet) which corresponds to this setting
      58             :         bool        bInvertedDisplay;   // true if and only if the checkbox is checked when the item is sal_False, and vice versa
      59             :     };
      60             : 
      61             :     // SpecialSettingsPage
      62           0 :     SpecialSettingsPage::SpecialSettingsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta )
      63             :         : OGenericAdministrationPage(pParent, "SpecialSettingsPage",
      64             :             "dbaccess/ui/specialsettingspage.ui", _rCoreAttrs)
      65             :         , m_pIsSQL92Check( NULL )
      66             :         , m_pAppendTableAlias( NULL )
      67             :         , m_pAsBeforeCorrelationName( NULL )
      68             :         , m_pEnableOuterJoin( NULL )
      69             :         , m_pIgnoreDriverPrivileges( NULL )
      70             :         , m_pParameterSubstitution( NULL )
      71             :         , m_pSuppressVersionColumn( NULL )
      72             :         , m_pCatalog( NULL )
      73             :         , m_pSchema( NULL )
      74             :         , m_pIndexAppendix( NULL )
      75             :         , m_pDosLineEnds( NULL )
      76             :         , m_pCheckRequiredFields( NULL )
      77             :         , m_pIgnoreCurrency(NULL)
      78             :         , m_pEscapeDateTime(NULL)
      79             :         , m_pPrimaryKeySupport(NULL)
      80             :         , m_pRespectDriverResultSetType(NULL)
      81             :         , m_pBooleanComparisonModeLabel( NULL )
      82             :         , m_pBooleanComparisonMode( NULL )
      83             :         , m_pMaxRowScanLabel( NULL )
      84             :         , m_pMaxRowScan( NULL )
      85             :         , m_aControlDependencies()
      86             :         , m_aBooleanSettings()
      87           0 :         , m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
      88           0 :         , m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) )
      89             :     {
      90           0 :         impl_initBooleanSettings();
      91             : 
      92           0 :         const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
      93             :         // create all the check boxes for the boolean settings
      94           0 :         for (   BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
      95           0 :                 setting != m_aBooleanSettings.end();
      96             :                 ++setting
      97             :              )
      98             :         {
      99           0 :             sal_uInt16 nItemId = setting->nItemId;
     100           0 :             if ( rFeatures.has( nItemId ) )
     101             :             {
     102           0 :                 get(*setting->ppControl, setting->sControlId);
     103           0 :                 (*setting->ppControl)->SetClickHdl( getControlModifiedLink() );
     104           0 :                 (*setting->ppControl)->Show();
     105             : 
     106             :                 // check whether this must be a tristate check box
     107           0 :                 const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId );
     108           0 :                 if ( rItem.ISA( OptionalBoolItem ) )
     109           0 :                     (*setting->ppControl)->EnableTriState( true );
     110             :             }
     111             :         }
     112             : 
     113           0 :         if ( m_pAsBeforeCorrelationName && m_pAppendTableAlias )
     114             :             // make m_pAsBeforeCorrelationName depend on m_pAppendTableAlias
     115           0 :             m_aControlDependencies.enableOnCheckMark( *m_pAppendTableAlias, *m_pAsBeforeCorrelationName );
     116             : 
     117             :         // create the controls for the boolean comparison mode
     118           0 :         if ( m_bHasBooleanComparisonMode )
     119             :         {
     120           0 :             get(m_pBooleanComparisonModeLabel, "comparisonft");
     121           0 :             get(m_pBooleanComparisonMode, "comparison");
     122           0 :             m_pBooleanComparisonMode->SetDropDownLineCount( 4 );
     123           0 :             m_pBooleanComparisonMode->SetSelectHdl( getControlModifiedLink() );
     124           0 :             m_pBooleanComparisonModeLabel->Show();
     125           0 :             m_pBooleanComparisonMode->Show();
     126             :         }
     127             :         // create the controls for the max row scan
     128           0 :         if ( m_bHasMaxRowScan )
     129             :         {
     130           0 :             get(m_pMaxRowScanLabel, "rowsft");
     131           0 :             get(m_pMaxRowScan, "rows");
     132           0 :             m_pMaxRowScan->SetModifyHdl(getControlModifiedLink());
     133           0 :             m_pMaxRowScan->SetUseThousandSep(false);
     134           0 :             m_pMaxRowScanLabel->Show();
     135           0 :             m_pMaxRowScan->Show();
     136             :         }
     137           0 :     }
     138             : 
     139           0 :     SpecialSettingsPage::~SpecialSettingsPage()
     140             :     {
     141           0 :         disposeOnce();
     142           0 :     }
     143             : 
     144           0 :     void SpecialSettingsPage::dispose()
     145             :     {
     146           0 :         m_aControlDependencies.clear();
     147           0 :         m_pIsSQL92Check.clear();
     148           0 :         m_pAppendTableAlias.clear();
     149           0 :         m_pAsBeforeCorrelationName.clear();
     150           0 :         m_pEnableOuterJoin.clear();
     151           0 :         m_pIgnoreDriverPrivileges.clear();
     152           0 :         m_pParameterSubstitution.clear();
     153           0 :         m_pSuppressVersionColumn.clear();
     154           0 :         m_pCatalog.clear();
     155           0 :         m_pSchema.clear();
     156           0 :         m_pIndexAppendix.clear();
     157           0 :         m_pDosLineEnds.clear();
     158           0 :         m_pCheckRequiredFields.clear();
     159           0 :         m_pIgnoreCurrency.clear();
     160           0 :         m_pEscapeDateTime.clear();
     161           0 :         m_pPrimaryKeySupport.clear();
     162           0 :         m_pRespectDriverResultSetType.clear();
     163           0 :         m_pBooleanComparisonModeLabel.clear();
     164           0 :         m_pBooleanComparisonMode.clear();
     165           0 :         m_pMaxRowScanLabel.clear();
     166           0 :         m_pMaxRowScan.clear();
     167           0 :         OGenericAdministrationPage::dispose();
     168           0 :     }
     169             : 
     170           0 :     void SpecialSettingsPage::impl_initBooleanSettings()
     171             :     {
     172             :         OSL_PRECOND( m_aBooleanSettings.empty(), "SpecialSettingsPage::impl_initBooleanSettings: called twice!" );
     173             : 
     174             :         // for easier maintenance, write the table in this form, then copy it to m_aBooleanSettings
     175             :         BooleanSettingDesc aSettings[] = {
     176           0 :             { std::addressof(m_pIsSQL92Check),                 "usesql92",        DSID_SQL92CHECK,            false },
     177           0 :             { std::addressof(m_pAppendTableAlias),             "append",          DSID_APPEND_TABLE_ALIAS,    false },
     178           0 :             { std::addressof(m_pAsBeforeCorrelationName),      "useas",           DSID_AS_BEFORE_CORRNAME,    false },
     179           0 :             { std::addressof(m_pEnableOuterJoin),              "useoj",           DSID_ENABLEOUTERJOIN,       false },
     180           0 :             { std::addressof(m_pIgnoreDriverPrivileges),       "ignoreprivs",     DSID_IGNOREDRIVER_PRIV,     false },
     181           0 :             { std::addressof(m_pParameterSubstitution),        "replaceparams",   DSID_PARAMETERNAMESUBST,    false },
     182           0 :             { std::addressof(m_pSuppressVersionColumn),        "displayver",      DSID_SUPPRESSVERSIONCL,     true  },
     183           0 :             { std::addressof(m_pCatalog),                      "usecatalogname",  DSID_CATALOG,               false },
     184           0 :             { std::addressof(m_pSchema),                       "useschemaname",   DSID_SCHEMA,                false },
     185           0 :             { std::addressof(m_pIndexAppendix),                "createindex",     DSID_INDEXAPPENDIX,         false },
     186           0 :             { std::addressof(m_pDosLineEnds),                  "eol",             DSID_DOSLINEENDS,           false },
     187           0 :             { std::addressof(m_pCheckRequiredFields),          "ignorecurrency",  DSID_CHECK_REQUIRED_FIELDS, false },
     188           0 :             { std::addressof(m_pIgnoreCurrency),               "inputchecks",     DSID_IGNORECURRENCY,        false },
     189           0 :             { std::addressof(m_pEscapeDateTime),               "useodbcliterals", DSID_ESCAPE_DATETIME,       false },
     190           0 :             { std::addressof(m_pPrimaryKeySupport),            "primarykeys",     DSID_PRIMARY_KEY_SUPPORT,   false },
     191           0 :             { std::addressof(m_pRespectDriverResultSetType),   "resulttype",      DSID_RESPECTRESULTSETTYPE,  false }
     192           0 :         };
     193             : 
     194           0 :         for ( const BooleanSettingDesc& pCopy : aSettings )
     195             :         {
     196           0 :             m_aBooleanSettings.push_back( pCopy );
     197           0 :         }
     198           0 :     }
     199             : 
     200           0 :     void SpecialSettingsPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
     201             :     {
     202           0 :         if ( m_bHasBooleanComparisonMode )
     203             :         {
     204           0 :             _rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) );
     205             :         }
     206           0 :         if ( m_bHasMaxRowScan )
     207             :         {
     208           0 :             _rControlList.push_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) );
     209             :         }
     210           0 :     }
     211             : 
     212           0 :     void SpecialSettingsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
     213             :     {
     214           0 :         for (   BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
     215           0 :                 setting != m_aBooleanSettings.end();
     216             :                 ++setting
     217             :              )
     218             :         {
     219           0 :             if ( (*setting->ppControl) )
     220             :             {
     221           0 :                 _rControlList.push_back( new OSaveValueWrapper< CheckBox >( *setting->ppControl ) );
     222             :             }
     223             :         }
     224             : 
     225           0 :         if ( m_bHasBooleanComparisonMode )
     226           0 :             _rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) );
     227           0 :         if ( m_bHasMaxRowScan )
     228           0 :             _rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan));
     229           0 :     }
     230             : 
     231           0 :     void SpecialSettingsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
     232             :     {
     233             :         // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
     234             :         bool bValid, bReadonly;
     235           0 :         getFlags( _rSet, bValid, bReadonly );
     236             : 
     237           0 :         if ( !bValid )
     238             :         {
     239           0 :             OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
     240           0 :             return;
     241             :         }
     242             : 
     243             :         // the boolean items
     244           0 :         for (   BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
     245           0 :                 setting != m_aBooleanSettings.end();
     246             :                 ++setting
     247             :              )
     248             :         {
     249           0 :             if ( !(*setting->ppControl) )
     250           0 :                 continue;
     251             : 
     252           0 :             ::boost::optional< bool > aValue(false);
     253           0 :             aValue.reset();
     254             : 
     255           0 :             SFX_ITEMSET_GET( _rSet, pItem, SfxPoolItem, setting->nItemId, true );
     256           0 :             if (const SfxBoolItem *pBoolItem = PTR_CAST(SfxBoolItem, pItem))
     257             :             {
     258           0 :                 aValue.reset( pBoolItem->GetValue() );
     259             :             }
     260           0 :             else if (const OptionalBoolItem *pOptionalItem = PTR_CAST(OptionalBoolItem, pItem))
     261             :             {
     262           0 :                 aValue = pOptionalItem->GetFullValue();
     263             :             }
     264             :             else
     265             :                 OSL_FAIL( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
     266             : 
     267           0 :             if ( !aValue )
     268             :             {
     269           0 :                 (*setting->ppControl)->SetState( TRISTATE_INDET );
     270             :             }
     271             :             else
     272             :             {
     273           0 :                 bool bValue = *aValue;
     274           0 :                 if ( setting->bInvertedDisplay )
     275           0 :                     bValue = !bValue;
     276           0 :                 (*setting->ppControl)->Check( bValue );
     277             :             }
     278           0 :         }
     279             : 
     280             :         // the non-boolean items
     281           0 :         if ( m_bHasBooleanComparisonMode )
     282             :         {
     283           0 :             SFX_ITEMSET_GET( _rSet, pBooleanComparison, SfxInt32Item, DSID_BOOLEANCOMPARISON, true );
     284           0 :             m_pBooleanComparisonMode->SelectEntryPos( static_cast< sal_uInt16 >( pBooleanComparison->GetValue() ) );
     285             :         }
     286             : 
     287           0 :         if ( m_bHasMaxRowScan )
     288             :         {
     289           0 :             SFX_ITEMSET_GET(_rSet, pMaxRowScan, SfxInt32Item, DSID_MAX_ROW_SCAN, true);
     290           0 :             m_pMaxRowScan->SetValue(pMaxRowScan->GetValue());
     291             :         }
     292             : 
     293           0 :         OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
     294             :     }
     295             : 
     296           0 :     bool SpecialSettingsPage::FillItemSet( SfxItemSet* _rSet )
     297             :     {
     298           0 :         bool bChangedSomething = false;
     299             : 
     300             :         // the boolean items
     301           0 :         for (   BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
     302           0 :                 setting != m_aBooleanSettings.end();
     303             :                 ++setting
     304             :              )
     305             :         {
     306           0 :             if ( !*setting->ppControl )
     307           0 :                 continue;
     308           0 :             fillBool( *_rSet, *setting->ppControl, setting->nItemId, bChangedSomething, setting->bInvertedDisplay );
     309             :         }
     310             : 
     311             :         // the non-boolean items
     312           0 :         if ( m_bHasBooleanComparisonMode )
     313             :         {
     314           0 :             if ( m_pBooleanComparisonMode->IsValueChangedFromSaved() )
     315             :             {
     316           0 :                 _rSet->Put( SfxInt32Item( DSID_BOOLEANCOMPARISON, m_pBooleanComparisonMode->GetSelectEntryPos() ) );
     317           0 :                 bChangedSomething = true;
     318             :             }
     319             :         }
     320           0 :         if ( m_bHasMaxRowScan )
     321             :         {
     322           0 :             fillInt32(*_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething);
     323             :         }
     324           0 :         return bChangedSomething;
     325             :     }
     326             : 
     327             :     // GeneratedValuesPage
     328           0 :     GeneratedValuesPage::GeneratedValuesPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
     329             :         : OGenericAdministrationPage(pParent, "GeneratedValuesPage",
     330           0 :             "dbaccess/ui/generatedvaluespage.ui", _rCoreAttrs)
     331             :     {
     332           0 :         get(m_pAutoFrame, "GeneratedValuesPage");
     333           0 :         get(m_pAutoRetrievingEnabled, "autoretrieve");
     334           0 :         get(m_pAutoIncrementLabel, "statementft");
     335           0 :         get(m_pAutoIncrement, "statement");
     336           0 :         get(m_pAutoRetrievingLabel, "queryft");
     337           0 :         get(m_pAutoRetrieving, "query");
     338             : 
     339           0 :         m_pAutoRetrievingEnabled->SetClickHdl( getControlModifiedLink() );
     340           0 :         m_pAutoIncrement->SetModifyHdl( getControlModifiedLink() );
     341           0 :         m_pAutoRetrieving->SetModifyHdl( getControlModifiedLink() );
     342             : 
     343           0 :         m_aControlDependencies.enableOnCheckMark( *m_pAutoRetrievingEnabled,
     344           0 :             *m_pAutoIncrementLabel, *m_pAutoIncrement, *m_pAutoRetrievingLabel, *m_pAutoRetrieving );
     345           0 :     }
     346             : 
     347           0 :     GeneratedValuesPage::~GeneratedValuesPage()
     348             :     {
     349           0 :         disposeOnce();
     350           0 :     }
     351             : 
     352           0 :     void GeneratedValuesPage::dispose()
     353             :     {
     354           0 :         m_aControlDependencies.clear();
     355           0 :         m_pAutoFrame.clear();
     356           0 :         m_pAutoRetrievingEnabled.clear();
     357           0 :         m_pAutoIncrementLabel.clear();
     358           0 :         m_pAutoIncrement.clear();
     359           0 :         m_pAutoRetrievingLabel.clear();
     360           0 :         m_pAutoRetrieving.clear();
     361           0 :         OGenericAdministrationPage::dispose();
     362           0 :     }
     363             : 
     364           0 :     void GeneratedValuesPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
     365             :     {
     366           0 :         _rControlList.push_back( new ODisableWrapper< VclFrame >( m_pAutoFrame ) );
     367           0 :     }
     368             : 
     369           0 :     void GeneratedValuesPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
     370             :     {
     371           0 :         _rControlList.push_back( new OSaveValueWrapper< CheckBox >( m_pAutoRetrievingEnabled ) );
     372           0 :         _rControlList.push_back( new OSaveValueWrapper< Edit >( m_pAutoIncrement ) );
     373           0 :         _rControlList.push_back( new OSaveValueWrapper< Edit >( m_pAutoRetrieving ) );
     374           0 :     }
     375             : 
     376           0 :     void GeneratedValuesPage::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue )
     377             :     {
     378             :         // check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
     379             :         bool bValid, bReadonly;
     380           0 :         getFlags(_rSet, bValid, bReadonly);
     381             : 
     382             :         // collect the items
     383           0 :         SFX_ITEMSET_GET(_rSet, pAutoIncrementItem, SfxStringItem, DSID_AUTOINCREMENTVALUE, true);
     384           0 :         SFX_ITEMSET_GET(_rSet, pAutoRetrieveValueItem, SfxStringItem, DSID_AUTORETRIEVEVALUE, true);
     385           0 :         SFX_ITEMSET_GET(_rSet, pAutoRetrieveEnabledItem, SfxBoolItem, DSID_AUTORETRIEVEENABLED, true);
     386             : 
     387             :         // forward the values to the controls
     388           0 :         if (bValid)
     389             :         {
     390           0 :             bool bEnabled = pAutoRetrieveEnabledItem->GetValue();
     391           0 :             m_pAutoRetrievingEnabled->Check( bEnabled );
     392             : 
     393           0 :             m_pAutoIncrement->SetText( pAutoIncrementItem->GetValue() );
     394           0 :             m_pAutoIncrement->ClearModifyFlag();
     395           0 :             m_pAutoRetrieving->SetText( pAutoRetrieveValueItem->GetValue() );
     396           0 :             m_pAutoRetrieving->ClearModifyFlag();
     397             :         }
     398           0 :         OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
     399           0 :     }
     400             : 
     401           0 :     bool GeneratedValuesPage::FillItemSet(SfxItemSet* _rSet)
     402             :     {
     403           0 :         bool bChangedSomething = false;
     404             : 
     405           0 :         fillString( *_rSet, m_pAutoIncrement, DSID_AUTOINCREMENTVALUE, bChangedSomething );
     406           0 :         fillBool( *_rSet, m_pAutoRetrievingEnabled, DSID_AUTORETRIEVEENABLED, bChangedSomething );
     407           0 :         fillString( *_rSet, m_pAutoRetrieving, DSID_AUTORETRIEVEVALUE, bChangedSomething );
     408             : 
     409           0 :         return bChangedSomething;
     410             :     }
     411             : 
     412             :     // AdvancedSettingsDialog
     413           0 :     AdvancedSettingsDialog::AdvancedSettingsDialog( vcl::Window* _pParent, SfxItemSet* _pItems,
     414             :         const Reference< XComponentContext >& _rxContext, const Any& _aDataSourceName )
     415             :         : SfxTabDialog(_pParent, "AdvancedSettingsDialog",
     416           0 :             "dbaccess/ui/advancedsettingsdialog.ui", _pItems)
     417             :     {
     418           0 :         m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxContext,_pParent,this));
     419           0 :         m_pImpl->setDataSourceOrName(_aDataSourceName);
     420           0 :         Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
     421           0 :         m_pImpl->translateProperties(xDatasource, *_pItems);
     422           0 :         SetInputSet(_pItems);
     423             :         // propagate this set as our new input set and reset the example set
     424           0 :         delete pExampleSet;
     425           0 :         pExampleSet = new SfxItemSet(*GetInputSetImpl());
     426             : 
     427           0 :         const OUString eType = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(*_pItems);
     428             : 
     429           0 :         DataSourceMetaData aMeta( eType );
     430           0 :         const FeatureSet& rFeatures( aMeta.getFeatureSet() );
     431             : 
     432             :         // auto-generated values?
     433           0 :         if (rFeatures.supportsGeneratedValues())
     434           0 :             AddTabPage("generated", ODriversSettings::CreateGeneratedValuesPage, NULL);
     435             :         else
     436           0 :             RemoveTabPage("generated");
     437             : 
     438             :         // any "special settings"?
     439           0 :         if (rFeatures.supportsAnySpecialSetting())
     440           0 :             AddTabPage("special", ODriversSettings::CreateSpecialSettingsPage, NULL);
     441             :         else
     442           0 :             RemoveTabPage("special");
     443             : 
     444             :         // remove the reset button - it's meaning is much too ambiguous in this dialog
     445           0 :         RemoveResetButton();
     446           0 :     }
     447             : 
     448           0 :     AdvancedSettingsDialog::~AdvancedSettingsDialog()
     449             :     {
     450           0 :         disposeOnce();
     451           0 :     }
     452             : 
     453           0 :     void AdvancedSettingsDialog::dispose()
     454             :     {
     455           0 :         SetInputSet(NULL);
     456           0 :         DELETEZ(pExampleSet);
     457           0 :         SfxTabDialog::dispose();
     458           0 :     }
     459             : 
     460           6 :     bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const OUString& _sURL )
     461             :     {
     462           6 :         DataSourceMetaData aMeta( _sURL );
     463           6 :         const FeatureSet& rFeatures( aMeta.getFeatureSet() );
     464           6 :         if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() )
     465           6 :             return true;
     466           0 :         return false;
     467             :     }
     468             : 
     469           0 :     short AdvancedSettingsDialog::Execute()
     470             :     {
     471           0 :         short nRet = SfxTabDialog::Execute();
     472           0 :         if ( nRet == RET_OK )
     473             :         {
     474           0 :             pExampleSet->Put(*GetOutputItemSet());
     475           0 :             m_pImpl->saveChanges(*pExampleSet);
     476             :         }
     477           0 :         return nRet;
     478             :     }
     479             : 
     480           0 :     void AdvancedSettingsDialog::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage)
     481             :     {
     482             :         // register ourself as modified listener
     483           0 :         static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory( getORB() );
     484           0 :         static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
     485             : 
     486           0 :         vcl::Window *pWin = GetViewWindow();
     487           0 :         if(pWin)
     488           0 :             pWin->Invalidate();
     489             : 
     490           0 :         SfxTabDialog::PageCreated(_nId, _rPage);
     491           0 :     }
     492             : 
     493           0 :     const SfxItemSet* AdvancedSettingsDialog::getOutputSet() const
     494             :     {
     495           0 :         return pExampleSet;
     496             :     }
     497             : 
     498           0 :     SfxItemSet* AdvancedSettingsDialog::getWriteOutputSet()
     499             :     {
     500           0 :         return pExampleSet;
     501             :     }
     502             : 
     503           0 :     ::std::pair< Reference< XConnection >, sal_Bool > AdvancedSettingsDialog::createConnection()
     504             :     {
     505           0 :         return m_pImpl->createConnection();
     506             :     }
     507             : 
     508           0 :     Reference< XComponentContext > AdvancedSettingsDialog::getORB() const
     509             :     {
     510           0 :         return m_pImpl->getORB();
     511             :     }
     512             : 
     513           0 :     Reference< XDriver > AdvancedSettingsDialog::getDriver()
     514             :     {
     515           0 :         return m_pImpl->getDriver();
     516             :     }
     517             : 
     518           0 :     OUString AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
     519             :     {
     520           0 :         return dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(_rSet);
     521             :     }
     522             : 
     523           0 :     void AdvancedSettingsDialog::clearPassword()
     524             :     {
     525           0 :         m_pImpl->clearPassword();
     526           0 :     }
     527             : 
     528           0 :     void AdvancedSettingsDialog::setTitle(const OUString& _sTitle)
     529             :     {
     530           0 :         SetText(_sTitle);
     531           0 :     }
     532             : 
     533           0 :     void AdvancedSettingsDialog::enableConfirmSettings( bool _bEnable )
     534             :     {
     535             :         (void)_bEnable;
     536           0 :     }
     537             : 
     538           0 :     bool AdvancedSettingsDialog::saveDatasource()
     539             :     {
     540           0 :         return PrepareLeaveCurrentPage();
     541             :     }
     542             : 
     543          36 : } // namespace dbaui
     544             : 
     545             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11