diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-04 10:38:39 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-02-04 10:38:39 +0100 |
commit | 1265c7385cb49b7484c115a86542f4dd3c9919c3 (patch) | |
tree | ec5da2b99a289fac24557c23139c7dd778efece8 /dbaccess/source/ui/dlg | |
parent | ed853a88ff6e0bfae048bb19615ab2cd255f07eb (diff) | |
parent | 1e1b1d60af9fbbb8d745d5ebebf9fa46444ded67 (diff) |
autorecovery: commit resolved merge (after rebase to m71)
Diffstat (limited to 'dbaccess/source/ui/dlg')
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 183 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DriverSettings.cxx | 51 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.cxx | 82 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.cxx | 72 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.hrc | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.src | 18 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/datasourceui.cxx | 99 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/datasourceui.hxx | 80 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbadmin.cxx | 66 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dsitems.hxx | 105 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/makefile.mk | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/optionalboolitem.cxx | 75 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/optionalboolitem.hxx | 66 |
14 files changed, 360 insertions, 550 deletions
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 30f67e7fb5b1..8b86519fa812 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -34,93 +34,41 @@ #include "DbAdminImpl.hxx" #include "dsmeta.hxx" -#ifndef _SFXPOOLITEM_HXX -#include <svl/poolitem.hxx> -#endif -#ifndef _SFXITEMPOOL_HXX -#include <svl/itempool.hxx> -#endif -#ifndef _SFXSTRITEM_HXX -#include <svl/stritem.hxx> -#endif -#ifndef _SFXINTITEM_HXX -#include <svl/intitem.hxx> -#endif -#ifndef _SFXENUMITEM_HXX -#include <svl/eitem.hxx> -#endif -#ifndef _COMPHELPER_PROPERTY_HXX_ -#include <comphelper/property.hxx> -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ -#include <comphelper/sequence.hxx> -#endif -#ifndef _SVTOOLS_LOGINDLG_HXX_ -#include <svtools/logindlg.hxx> -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> -#endif -#include <connectivity/DriversConfig.hxx> -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#endif -#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ -#include <com/sun/star/sdb/SQLContext.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_ -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_SDBC_XDRIVER_HPP_ -#include <com/sun/star/sdbc/XDriver.hpp> -#endif -#ifndef DBAUI_DRIVERSETTINGS_HXX #include "DriverSettings.hxx" -#endif -#ifndef _DBAUI_PROPERTYSETITEM_HXX_ -#include "propertysetitem.hxx" -#endif -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ -#include "dsitems.hxx" -#endif -#ifndef DBAUI_ITEMSETHELPER_HXX #include "IItemSetHelper.hxx" -#endif -#ifndef _DBU_DLG_HRC_ +#include "UITools.hxx" #include "dbu_dlg.hrc" -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _VCL_STDTEXT_HXX -#include <vcl/stdtext.hxx> -#endif -#ifndef _SV_MSGBOX_HXX -#include <vcl/msgbox.hxx> -#endif -#ifndef _SV_WAITOBJ_HXX -#include <vcl/waitobj.hxx> -#endif -#ifndef _TYPELIB_TYPEDESCRIPTION_HXX_ -#include <typelib/typedescription.hxx> -#endif - -#ifndef _OSL_FILE_HXX_ -#include <osl/file.hxx> -#endif -#ifndef _DBAUI_STRINGLISTITEM_HXX_ -#include "stringlistitem.hxx" -#endif -#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "dsitems.hxx" +#include "dsnItem.hxx" #include "moduledbu.hxx" -#endif -#ifndef DBAUI_TOOLS_HXX -#include "UITools.hxx" -#endif -#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_ +#include "optionalboolitem.hxx" +#include "propertysetitem.hxx" +#include "stringlistitem.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/frame/XStorable.hpp> -#endif -#include "dsnItem.hxx" +#include <com/sun/star/sdb/SQLContext.hpp> +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbc/XDriverAccess.hpp> +/** === end UNO includes === **/ + +#include <comphelper/property.hxx> +#include <comphelper/sequence.hxx> +#include <connectivity/DriversConfig.hxx> +#include <connectivity/dbexception.hxx> +#include <osl/file.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/itempool.hxx> +#include <svtools/logindlg.hxx> +#include <svl/poolitem.hxx> +#include <svl/stritem.hxx> +#include <typelib/typedescription.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/stdtext.hxx> +#include <vcl/waitobj.hxx> #include <algorithm> #include <functional> @@ -231,6 +179,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_AS_BEFORE_CORRNAME, INFO_AS_BEFORE_CORRELATION_NAME ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_CHECK_REQUIRED_FIELDS, INFO_FORMS_CHECK_REQUIRED_FIELDS ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_ESCAPE_DATETIME, INFO_ESCAPE_DATETIME ) ); + m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_PRIMARY_KEY_SUPPORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrimaryKeySupport" ) ) ) ); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_PARAMETERNAMESUBST, INFO_PARAMETERNAMESUBST)); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_IGNOREDRIVER_PRIV, INFO_IGNOREDRIVER_PRIV)); m_aIndirectPropTranslator.insert(MapInt2String::value_type(DSID_BOOLEANCOMPARISON, PROPERTY_BOOLEANCOMPARISONMODE)); @@ -909,14 +858,36 @@ Any ODbDataSourceAdministrationHelper::implTranslateProperty(const SfxPoolItem* { // translate the SfxPoolItem Any aValue; - if (_pItem->ISA(SfxStringItem)) - aValue <<= ::rtl::OUString(PTR_CAST(SfxStringItem, _pItem)->GetValue().GetBuffer()); - else if (_pItem->ISA(SfxBoolItem)) - aValue <<= PTR_CAST(SfxBoolItem, _pItem)->GetValue(); - else if (_pItem->ISA(SfxInt32Item)) - aValue <<= PTR_CAST(SfxInt32Item, _pItem)->GetValue(); - else if (_pItem->ISA(OStringListItem)) - aValue <<= PTR_CAST(OStringListItem, _pItem)->getList(); + + const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, _pItem ); + const SfxBoolItem* pBoolItem = PTR_CAST( SfxBoolItem, _pItem ); + const OptionalBoolItem* pOptBoolItem = PTR_CAST( OptionalBoolItem, _pItem ); + const SfxInt32Item* pInt32Item = PTR_CAST( SfxInt32Item, _pItem ); + const OStringListItem* pStringListItem = PTR_CAST( OStringListItem, _pItem ); + + if ( pStringItem ) + { + aValue <<= ::rtl::OUString( pStringItem->GetValue().GetBuffer() ); + } + else if ( pBoolItem ) + { + aValue <<= pBoolItem->GetValue(); + } + else if ( pOptBoolItem ) + { + if ( !pOptBoolItem->HasValue() ) + aValue.clear(); + else + aValue <<= (sal_Bool)pOptBoolItem->GetValue(); + } + else if ( pInt32Item ) + { + aValue <<= pInt32Item->GetValue(); + } + else if ( pStringListItem ) + { + aValue <<= pStringListItem->getList(); + } else { DBG_ERROR("ODbDataSourceAdministrationHelper::implTranslateProperty: unsupported item type!"); @@ -957,15 +928,14 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty(const Reference< X //------------------------------------------------------------------------- void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet, sal_Int32 _nId, const Any& _rValue ) { - USHORT nId = (USHORT)_nId; - switch (_rValue.getValueType().getTypeClass()) + switch ( _rValue.getValueType().getTypeClass() ) { case TypeClass_STRING: - if ( implCheckItemType( _rSet, nId, SfxStringItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, SfxStringItem::StaticType() ) ) { ::rtl::OUString sValue; _rValue >>= sValue; - _rSet.Put(SfxStringItem(nId, sValue.getStr())); + _rSet.Put(SfxStringItem(_nId, sValue.getStr())); } else { DBG_ERROR( @@ -978,11 +948,24 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_BOOLEAN: - if ( implCheckItemType( _rSet, nId, SfxBoolItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, SfxBoolItem::StaticType() ) ) { sal_Bool bVal = sal_False; _rValue >>= bVal; - _rSet.Put(SfxBoolItem(nId, bVal)); + _rSet.Put(SfxBoolItem(_nId, bVal)); + } + else if ( implCheckItemType( _rSet, _nId, OptionalBoolItem::StaticType() ) ) + { + OptionalBoolItem aItem( _nId ); + if ( _rValue.hasValue() ) + { + sal_Bool bValue = sal_False; + _rValue >>= bValue; + aItem.SetValue( bValue ); + } + else + aItem.ClearValue(); + _rSet.Put( aItem ); } else { DBG_ERROR( @@ -995,11 +978,11 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_LONG: - if ( implCheckItemType( _rSet, nId, SfxInt32Item::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, SfxInt32Item::StaticType() ) ) { sal_Int32 nValue = 0; _rValue >>= nValue; - _rSet.Put( SfxInt32Item( nId, nValue ) ); + _rSet.Put( SfxInt32Item( _nId, nValue ) ); } else { DBG_ERROR( @@ -1012,7 +995,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_SEQUENCE: - if ( implCheckItemType( _rSet, nId, OStringListItem::StaticType() ) ) + if ( implCheckItemType( _rSet, _nId, OStringListItem::StaticType() ) ) { // determine the element type TypeDescription aTD(_rValue.getValueType()); @@ -1027,7 +1010,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet { Sequence< ::rtl::OUString > aStringList; _rValue >>= aStringList; - _rSet.Put(OStringListItem(nId, aStringList)); + _rSet.Put(OStringListItem(_nId, aStringList)); } break; default: @@ -1045,7 +1028,7 @@ void ODbDataSourceAdministrationHelper::implTranslateProperty( SfxItemSet& _rSet break; case TypeClass_VOID: - _rSet.ClearItem(nId); + _rSet.ClearItem(_nId); break; default: diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx index cf5d2edd65fc..4977658daeac 100644 --- a/dbaccess/source/ui/dlg/DriverSettings.cxx +++ b/dbaccess/source/ui/dlg/DriverSettings.cxx @@ -32,13 +32,13 @@ #include "precompiled_dbaccess.hxx" #include "DriverSettings.hxx" -#include "dsitems.hxx" -#include "datasourceui.hxx" -#include <connectivity/DriversConfig.hxx> +#include "dsmeta.hxx" #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/NamedValue.hpp> +#include <connectivity/DriversConfig.hxx> + using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::NamedValue; @@ -47,34 +47,23 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR { // for a number of settings, we do not need to use hard-coded here, but can ask a // central DataSourceUI instance. - // TODO: isn't DataSourceUI obsolete, now that this is in the configuration? - DataSourceMetaData aMeta(_sURLPrefix); - DataSourceUI aDSUI( aMeta ); - const USHORT nGenericKnownSettings[] = + DataSourceMetaData aMeta( _sURLPrefix ); + const FeatureSet& rFeatures( aMeta.getFeatureSet() ); + for ( FeatureSet::const_iterator feature = rFeatures.begin(); + feature != rFeatures.end(); + ++feature + ) { - DSID_SQL92CHECK, - DSID_APPEND_TABLE_ALIAS, - DSID_AS_BEFORE_CORRNAME, - DSID_ENABLEOUTERJOIN, - DSID_IGNOREDRIVER_PRIV, - DSID_PARAMETERNAMESUBST, - DSID_SUPPRESSVERSIONCL, - DSID_CATALOG, - DSID_SCHEMA, - DSID_INDEXAPPENDIX, - DSID_CHECK_REQUIRED_FIELDS, - DSID_AUTORETRIEVEENABLED, - DSID_AUTOINCREMENTVALUE, - DSID_AUTORETRIEVEVALUE, - DSID_BOOLEANCOMPARISON, - DSID_ESCAPE_DATETIME, - 0 - }; - for ( const USHORT* pGenericKnowSetting = nGenericKnownSettings; *pGenericKnowSetting; ++pGenericKnowSetting ) - if ( aDSUI.hasSetting( *pGenericKnowSetting ) ) - _out_rDetailsIds.push_back( *pGenericKnowSetting ); + _out_rDetailsIds.push_back( *feature ); + } // the rest is configuration-based + // TODO: that's not really true: *everything* is configuration-based nowadays, even the FeatureSet obtained + // from the DataSourceMetaData has been initialized from the configuration. So in fact, we could consolidate + // the two blocks. + // The best approach would be to extend the FeatureSet to contain *all* known data source features, not only + // the ones from the "Advanced settings" UI. + ::connectivity::DriversConfig aDriverConfig(_xFactory); const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix); #if OSL_DEBUG_LEVEL > 0 @@ -117,7 +106,11 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR ,TProperties(0,::rtl::OUString()) }; // TODO: This mapping between IDs and property names already exists - in ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper. - // We should not duplicate it here. + // Another mapping (which is also duplicated in ODbDataSourceAdministrationHelper) exists in dsmeta.cxx. We should + // consolidate those three places into one. + // However, care has to be taken: We need to distinguish between "features" and "properties" of a data source (resp. driver). + // That is, a driver can support a certain property, but not allow to change it in the UI, which means it would + // not have the respective "feature". for ( TProperties* pProps = aProps; pProps->first; ++pProps ) { if ( aProperties.has(pProps->second) ) diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index b55e271a0988..c1b9ddbd33c5 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -31,70 +31,31 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBAUI_ADMINPAGES_HXX_ #include "adminpages.hxx" -#endif -#ifndef _DBAUI_DBADMIN_HRC_ #include "dbadmin.hrc" -#endif -#ifndef _DBU_DLG_HRC_ +#include "dbadmin.hxx" #include "dbu_dlg.hrc" -#endif -#ifndef _SFXSTRITEM_HXX -#include <svl/stritem.hxx> -#endif -#ifndef _SFXENUMITEM_HXX -#include <svl/eitem.hxx> -#endif -#ifndef _SFXINTITEM_HXX -#include <svl/intitem.hxx> -#endif -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ -#include "dsitems.hxx" -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _DBAUI_DBADMIN_HXX_ -#include "dbadmin.hxx" -#endif -#ifndef _SV_MSGBOX_HXX -#include <vcl/msgbox.hxx> -#endif -#ifndef _DBAUI_SQLMESSAGE_HXX_ -#include "sqlmessage.hxx" -#endif -#ifndef _SV_ACCEL_HXX -#include <vcl/accel.hxx> -#endif -#include <algorithm> -#include <stdlib.h> -#ifndef _OSL_FILE_HXX_ -#include <osl/file.hxx> -#endif -#ifndef _DBAUI_DSSELECT_HXX_ +#include "dsitems.hxx" #include "dsselect.hxx" -#endif -#ifndef _DBAUI_ODBC_CONFIG_HXX_ -#include "odbcconfig.hxx" -#endif -#ifndef _DBAUI_LOCALRESACCESS_HXX_ #include "localresaccess.hxx" -#endif -#ifndef _SV_FIELD_HXX +#include "odbcconfig.hxx" +#include "optionalboolitem.hxx" +#include "sqlmessage.hxx" + +#include <osl/file.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> +#include <vcl/accel.hxx> +#include <vcl/button.hxx> +#include <vcl/edit.hxx> #include <vcl/field.hxx> -#endif -#ifndef _SV_LSTBOX_HXX #include <vcl/lstbox.hxx> -#endif -#ifndef _SV_EDIT_HXX -#include <vcl/edit.hxx> -#endif -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif - +#include <vcl/msgbox.hxx> +#include <algorithm> +#include <stdlib.h> //......................................................................... namespace dbaui @@ -256,7 +217,16 @@ namespace dbaui if ( _bRevertValue ) bValue = !bValue; - _rSet.Put( SfxBoolItem( _nID, bValue ) ); + if ( _pCheckBox->IsTriStateEnabled() ) + { + OptionalBoolItem aValue( _nID ); + if ( _pCheckBox->GetState() != STATE_DONTKNOW ) + aValue.SetValue( bValue ); + _rSet.Put( aValue ); + } + else + _rSet.Put( SfxBoolItem( _nID, bValue ) ); + _bChangedSomething = sal_True; } } diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 1540b562f9af..1fbe6806df74 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -37,8 +37,7 @@ #include "dsitems.hxx" #include "DbAdminImpl.hxx" #include "DriverSettings.hxx" -#include "datasourceui.hxx" - +#include "optionalboolitem.hxx" #include "dbu_resource.hrc" #include "dbu_dlg.hrc" #include "dbadmin.hrc" @@ -98,15 +97,16 @@ namespace dbaui ,m_pCheckRequiredFields( NULL ) ,m_pIgnoreCurrency(NULL) ,m_pEscapeDateTime(NULL) + ,m_pPrimaryKeySupport(NULL) ,m_pBooleanComparisonModeLabel( NULL ) ,m_pBooleanComparisonMode( NULL ) ,m_aControlDependencies() ,m_aBooleanSettings() - ,m_aSupported( _rDSMeta.getAdvancedSettingsSupport() ) + ,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) ) { impl_initBooleanSettings(); - DataSourceUI aDSUI( _rDSMeta ); + const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() ); // create all the check boxes for the boolean settings for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin(); setting != m_aBooleanSettings.end(); @@ -114,11 +114,16 @@ namespace dbaui ) { USHORT nItemId = setting->nItemId; - if ( aDSUI.hasSetting( nItemId ) ) + if ( rFeatures.has( nItemId ) ) { - USHORT nID = setting->nControlResId; - (*setting->ppControl) = new CheckBox( this, ModuleRes( nID ) ); + USHORT nResourceId = setting->nControlResId; + (*setting->ppControl) = new CheckBox( this, ModuleRes( nResourceId ) ); (*setting->ppControl)->SetClickHdl( getControlModifiedLink() ); + + // check whether this must be a tristate check box + const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId ); + if ( rItem.ISA( OptionalBoolItem ) ) + (*setting->ppControl)->EnableTriState( TRUE ); } } @@ -148,7 +153,7 @@ namespace dbaui } // create the controls for the boolean comparison mode - if ( m_aSupported.bBooleanComparisonMode ) + if ( m_bHasBooleanComparisonMode ) { m_pBooleanComparisonModeLabel = new FixedText( this, ModuleRes( FT_BOOLEANCOMPARISON ) ); m_pBooleanComparisonMode = new ListBox( this, ModuleRes( LB_BOOLEANCOMPARISON ) ); @@ -185,6 +190,7 @@ namespace dbaui DELETEZ( m_pCheckRequiredFields ); DELETEZ( m_pIgnoreCurrency ); DELETEZ( m_pEscapeDateTime ); + DELETEZ( m_pPrimaryKeySupport ); DELETEZ( m_pBooleanComparisonModeLabel ); DELETEZ( m_pBooleanComparisonMode ); } @@ -210,13 +216,12 @@ namespace dbaui { &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false }, { &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false }, { &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false }, + { &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false }, { NULL, 0, 0, false } }; for ( const BooleanSettingDesc* pCopy = aSettings; pCopy->nItemId != 0; ++pCopy ) { - USHORT nID = pCopy->nItemId; - (void) nID; m_aBooleanSettings.push_back( *pCopy ); } } @@ -224,7 +229,7 @@ namespace dbaui // ----------------------------------------------------------------------- void SpecialSettingsPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList ) { - if ( m_aSupported.bBooleanComparisonMode ) + if ( m_bHasBooleanComparisonMode ) { _rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) ); } @@ -244,7 +249,7 @@ namespace dbaui } } - if ( m_aSupported.bBooleanComparisonMode ) + if ( m_bHasBooleanComparisonMode ) _rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) ); } @@ -270,16 +275,35 @@ namespace dbaui if ( !*setting->ppControl ) continue; - SFX_ITEMSET_GET( _rSet, pItem, SfxBoolItem, setting->nItemId, sal_True ); - bool bValue = pItem->GetValue(); - if ( setting->bInvertedDisplay ) - bValue = !bValue; + ::boost::optional< bool > aValue; - (*setting->ppControl)->Check( bValue ); + SFX_ITEMSET_GET( _rSet, pItem, SfxPoolItem, setting->nItemId, sal_True ); + if ( pItem->ISA( SfxBoolItem ) ) + { + aValue.reset( PTR_CAST( SfxBoolItem, pItem )->GetValue() ); + } + else if ( pItem->ISA( OptionalBoolItem ) ) + { + aValue = PTR_CAST( OptionalBoolItem, pItem )->GetFullValue(); + } + else + DBG_ERROR( "SpecialSettingsPage::implInitControls: unknown boolean item type!" ); + + if ( !aValue ) + { + (*setting->ppControl)->SetState( STATE_DONTKNOW ); + } + else + { + BOOL bValue = *aValue; + if ( setting->bInvertedDisplay ) + bValue = !bValue; + (*setting->ppControl)->Check( bValue ); + } } // the non-boolean items - if ( m_aSupported.bBooleanComparisonMode ) + if ( m_bHasBooleanComparisonMode ) { SFX_ITEMSET_GET( _rSet, pBooleanComparison, SfxInt32Item, DSID_BOOLEANCOMPARISON, sal_True ); m_pBooleanComparisonMode->SelectEntryPos( static_cast< USHORT >( pBooleanComparison->GetValue() ) ); @@ -305,7 +329,7 @@ namespace dbaui } // the non-boolean items - if ( m_aSupported.bBooleanComparisonMode ) + if ( m_bHasBooleanComparisonMode ) { if ( m_pBooleanComparisonMode->GetSelectEntryPos() != m_pBooleanComparisonMode->GetSavedValue() ) { @@ -420,14 +444,14 @@ namespace dbaui const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems); DataSourceMetaData aMeta( eType ); - const AdvancedSettingsSupport& rAdvancedSupport( aMeta.getAdvancedSettingsSupport() ); + const FeatureSet& rFeatures( aMeta.getFeatureSet() ); // auto-generated values? - if ( rAdvancedSupport.bGeneratedValues ) + if ( rFeatures.supportsGeneratedValues() ) AddTabPage( PAGE_GENERATED_VALUES, String( ModuleRes( STR_GENERATED_VALUE ) ), ODriversSettings::CreateGeneratedValuesPage, NULL ); // any "special settings"? - if ( rAdvancedSupport.supportsAnySpecialSetting() ) + if ( rFeatures.supportsAnySpecialSetting() ) AddTabPage( PAGE_ADVANCED_SETTINGS_SPECIAL, String( ModuleRes( STR_DS_BEHAVIOUR ) ), ODriversSettings::CreateSpecialSettingsPage, NULL ); // remove the reset button - it's meaning is much too ambiguous in this dialog @@ -446,8 +470,8 @@ namespace dbaui bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL ) { DataSourceMetaData aMeta( _sURL ); - const AdvancedSettingsSupport& rSupport( aMeta.getAdvancedSettingsSupport() ); - if ( rSupport.bGeneratedValues || rSupport.supportsAnySpecialSetting() ) + const FeatureSet& rFeatures( aMeta.getFeatureSet() ); + if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() ) return true; return false; } diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc index 9617df464bd3..66dedbb0086c 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hrc +++ b/dbaccess/source/ui/dlg/advancedsettings.hrc @@ -31,7 +31,7 @@ #ifndef DBAUI_ADVANCEDSETTINGS_HRC #define DBAUI_ADVANCEDSETTINGS_HRC -#define ADVANCED_CHECKBOX_OPTIONS 14 +#define ADVANCED_CHECKBOX_OPTIONS 15 #define ADVANCED_LISTBOX_OPTIONS 1 #define ADVANCED_PAGE_X 200 @@ -40,7 +40,7 @@ /* label */ FIXEDTEXT_HEIGHT + RELATED_CONTROLS + \ /* check boxes */ ( ADVANCED_CHECKBOX_OPTIONS * ( CHECKBOX_HEIGHT + RELATED_CONTROLS ) ) + \ /* list boxes */ ( ADVANCED_LISTBOX_OPTIONS * ( LISTBOX_HEIGHT + RELATED_CONTROLS ) ) + \ - /* bottom space */ START_Y - RELATED_CONTROLS + /* bottom space */ START_Y #define STR_GENERATED_VALUE 1 @@ -64,6 +64,7 @@ #define CB_CHECK_REQUIRED 13 #define CB_IGNORECURRENCY 14 #define CB_ESCAPE_DATETIME 15 +#define CB_PRIMARY_KEY_SUPPORT 16 #define ET_AUTOINCREMENTVALUE 1 #define ET_RETRIEVE_AUTO 2 diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 78a572d7fb0f..8145db32c4e2 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -74,6 +74,7 @@ namespace dbaui CheckBox* m_pCheckRequiredFields; CheckBox* m_pIgnoreCurrency; CheckBox* m_pEscapeDateTime; + CheckBox* m_pPrimaryKeySupport; FixedText* m_pBooleanComparisonModeLabel; ListBox* m_pBooleanComparisonMode; @@ -83,8 +84,7 @@ namespace dbaui BooleanSettingDescs m_aBooleanSettings; - AdvancedSettingsSupport - m_aSupported; + bool m_bHasBooleanComparisonMode; public: virtual BOOL FillItemSet ( SfxItemSet& _rCoreAttrs ); diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src index acb5fbb81656..dc06146402d7 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.src +++ b/dbaccess/source/ui/dlg/advancedsettings.src @@ -206,7 +206,18 @@ Size = MAP_APPFONT ( ADVANCED_PAGE_X -12 , CHECKBOX_HEIGHT ) ; \ TabStop = TRUE ; \ HelpId = HID_DSADMIN_ESCAPE_DATETIME; \ - Text [ en-US ] = "Use ODBC conformant date/time literals"; \ + Text [ en-US ] = "Use ODBC conformant date/time literals"; \ + }; + + +#define AUTO_PRIMARY_KEY_SUPPORT(AUTO_Y) \ + CheckBox CB_PRIMARY_KEY_SUPPORT \ + { \ + Pos = MAP_APPFONT ( 6 , AUTO_Y ) ; \ + Size = MAP_APPFONT ( ADVANCED_PAGE_X - 12 , CHECKBOX_HEIGHT ) ; \ + TabStop = TRUE ; \ + HelpId = HID_DSADMIN_PRIMARY_KEY_SUPPORT; \ + Text [ en-US ] = "Supports primary keys"; \ }; @@ -321,8 +332,9 @@ TabPage PAGE_ADVANCED_SETTINGS_SPECIAL AUTO_DOSLINEENDS( 11*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 10*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_CHECKREQUIRED( 12*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 11*CHECKBOX_HEIGHT + RELATED_CONTROLS ) AUTO_IGNORECURRENCY( 13*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 12*CHECKBOX_HEIGHT + RELATED_CONTROLS ) - AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) - AUTO_BOOLEANCOMPARISON( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 13*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) + AUTO_ESCAPE_DATETIME( 14*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS ) + AUTO_PRIMARY_KEY_SUPPORT( 15*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 15*CHECKBOX_HEIGHT + RELATED_CONTROLS ) + AUTO_BOOLEANCOMPARISON( 16*RELATED_CONTROLS + FIXEDTEXT_HEIGHT + 14*CHECKBOX_HEIGHT + RELATED_CONTROLS + ( LISTBOX_HEIGHT - CHECKBOX_HEIGHT ) / 2 ) }; //------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/datasourceui.cxx b/dbaccess/source/ui/dlg/datasourceui.cxx deleted file mode 100644 index f0a56e8dec83..000000000000 --- a/dbaccess/source/ui/dlg/datasourceui.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: datasourceui.cxx,v $ - * $Revision: 1.5.68.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "datasourceui.hxx" -#include "dsmeta.hxx" -#include "dsitems.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace dbaui -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - /** === end UNO using === **/ - - //==================================================================== - //= DataSourceUI - //==================================================================== - //-------------------------------------------------------------------- - DataSourceUI::DataSourceUI( const DataSourceMetaData& _rDSMeta ) - :m_aDSMeta( _rDSMeta ) - { - } - - //-------------------------------------------------------------------- - DataSourceUI::~DataSourceUI() - { - } - - //-------------------------------------------------------------------- - bool DataSourceUI::hasSetting( const USHORT _nItemId ) const - { - const AdvancedSettingsSupport& rAdvancedSupport( m_aDSMeta.getAdvancedSettingsSupport() ); - - switch ( _nItemId ) - { - case DSID_SQL92CHECK: return rAdvancedSupport.bUseSQL92NamingConstraints; - case DSID_APPEND_TABLE_ALIAS: return rAdvancedSupport.bAppendTableAliasInSelect; - case DSID_AS_BEFORE_CORRNAME: return rAdvancedSupport.bUseKeywordAsBeforeAlias; - case DSID_ENABLEOUTERJOIN: return rAdvancedSupport.bUseBracketedOuterJoinSyntax; - case DSID_IGNOREDRIVER_PRIV: return rAdvancedSupport.bIgnoreDriverPrivileges; - case DSID_PARAMETERNAMESUBST: return rAdvancedSupport.bParameterNameSubstitution; - case DSID_SUPPRESSVERSIONCL: return rAdvancedSupport.bDisplayVersionColumns; - case DSID_CATALOG: return rAdvancedSupport.bUseCatalogInSelect; - case DSID_SCHEMA: return rAdvancedSupport.bUseSchemaInSelect; - case DSID_INDEXAPPENDIX: return rAdvancedSupport.bUseIndexDirectionKeyword; - case DSID_DOSLINEENDS: return rAdvancedSupport.bUseDOSLineEnds; - case DSID_BOOLEANCOMPARISON: return rAdvancedSupport.bBooleanComparisonMode; - case DSID_CHECK_REQUIRED_FIELDS:return rAdvancedSupport.bFormsCheckRequiredFields; - case DSID_AUTORETRIEVEENABLED: return rAdvancedSupport.bGeneratedValues; - case DSID_AUTOINCREMENTVALUE: return rAdvancedSupport.bGeneratedValues; - case DSID_AUTORETRIEVEVALUE: return rAdvancedSupport.bGeneratedValues; - case DSID_IGNORECURRENCY: return rAdvancedSupport.bIgnoreCurrency; - case DSID_ESCAPE_DATETIME: return rAdvancedSupport.bEscapeDateTime; - } - - OSL_ENSURE( false, "DataSourceUI::hasSetting: this item id is currently not supported!" ); - // Support for *all* items is a medium-term goal only. - return false; - } - -//........................................................................ -} // namespace dbaui -//........................................................................ diff --git a/dbaccess/source/ui/dlg/datasourceui.hxx b/dbaccess/source/ui/dlg/datasourceui.hxx deleted file mode 100644 index 4ea63439c0d5..000000000000 --- a/dbaccess/source/ui/dlg/datasourceui.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: datasourceui.hxx,v $ - * $Revision: 1.3.68.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef DBACCESS_DATASOURCEUI_HXX -#define DBACCESS_DATASOURCEUI_HXX - -#include "dsntypes.hxx" -#include "dsmeta.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include <boost/shared_ptr.hpp> - -//........................................................................ -namespace dbaui -{ -//........................................................................ - - //==================================================================== - //= DataSourceUI - //==================================================================== - /** encapsulates information about available UI features of a data source type - */ - class DataSourceUI - { - public: - DataSourceUI( const DataSourceMetaData& _rDSMeta ); - ~DataSourceUI(); - - /** returns whether the data source's UI contains the specified setting - - Note that at the moment, not all items are supported by this method. In particular, use - it for the following only - <ul><li>All items which refer to advanced settings (see AdvancedSettingsSupport)</li> - </ul> - - A complete support of *all* items is a medium-term goal. - - @param _nItemId - the UI's item ID for the setting in question. See dsitems.hxx. - */ - bool hasSetting( const USHORT _nItemId ) const; - - private: - DataSourceMetaData m_aDSMeta; - }; - -//........................................................................ -} // namespace dbaui -//........................................................................ - -#endif // DBACCESS_DATASOURCEUI_HXX diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 048635edd07f..286236be75c6 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -31,58 +31,26 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#include "dsnItem.hxx" -#ifndef _DBAUI_DBADMIN_HXX_ -#include "dbadmin.hxx" -#endif -#ifndef _DBAUI_DBADMIN_HRC_ +#include "ConnectionPage.hxx" +#include "DbAdminImpl.hxx" +#include "DriverSettings.hxx" +#include "adminpages.hxx" #include "dbadmin.hrc" -#endif -#ifndef _DBU_DLG_HRC_ +#include "dbadmin.hxx" #include "dbu_dlg.hrc" -#endif -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ -#include "dsitems.hxx" -#endif -#ifndef _SFXSTRITEM_HXX -#include <svl/stritem.hxx> -#endif -#ifndef _SFXENUMITEM_HXX -#include <svl/eitem.hxx> -#endif -#ifndef _SFXINTITEM_HXX -#include <svl/intitem.hxx> -#endif -#ifndef _SV_MSGBOX_HXX -#include <vcl/msgbox.hxx> -#endif -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #include "dbustrings.hrc" -#endif -#ifndef _DBAUI_ADMINPAGES_HXX_ -#include "adminpages.hxx" -#endif -#ifndef _DBAUI_LOCALRESACCESS_HXX_ +#include "dsitems.hxx" +#include "dsnItem.hxx" #include "localresaccess.hxx" -#endif -#ifndef _DBAUI_STRINGLISTITEM_HXX_ -#include "stringlistitem.hxx" -#endif -#ifndef _DBAUI_PROPERTYSETITEM_HXX_ +#include "optionalboolitem.hxx" #include "propertysetitem.hxx" -#endif -#ifndef _UNOTOOLS_CONFIGNODE_HXX_ +#include "stringlistitem.hxx" + +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> #include <unotools/confignode.hxx> -#endif -#ifndef DBAUI_CONNECTIONPAGE_HXX -#include "ConnectionPage.hxx" -#endif -#ifndef DBAUI_DRIVERSETTINGS_HXX -#include "DriverSettings.hxx" -#endif -#ifndef _DBAUI_DBADMINIMPL_HXX_ -#include "DbAdminImpl.hxx" -#endif +#include <vcl/msgbox.hxx> //......................................................................... namespace dbaui @@ -439,8 +407,9 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp *pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, sal_True); *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, sal_False); *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, String()); - *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); // must be the same as in ModelImpl.cxx + *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, sal_True); *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, String()); + *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ); // create the pool static SfxItemInfo __READONLY_DATA aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = @@ -500,7 +469,8 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0}, {0,0}, {0,0}, - {0,0}, /* for Escape DateTime*/ + {0,0}, + {0,0}, {0,0}, {0,0} }; diff --git a/dbaccess/source/ui/dlg/dsitems.hxx b/dbaccess/source/ui/dlg/dsitems.hxx deleted file mode 100644 index a0d95aca810b..000000000000 --- a/dbaccess/source/ui/dlg/dsitems.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: dsitems.hxx,v $ - * $Revision: 1.26 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DBAUI_DATASOURCEITEMS_HXX_ -#define _DBAUI_DATASOURCEITEMS_HXX_ - -//======================================================================== -//= item ids for the data source administration dialog - -#define DSID_NAME 1 // name of a data source, SfxStringItem -#define DSID_ORIGINALNAME 2 // orginal name, internal, SfxStringItem -#define DSID_CONNECTURL 3 // connection URL, SfxStringItem -#define DSID_TABLEFILTER 4 // table filter, OStringListItem -#define DSID_TYPECOLLECTION 5 // collection of data source types, ODsnTypeCollection -#define DSID_INVALID_SELECTION 6 // is the selection (thus the set data) invalid?, SfxBoolItem -#define DSID_READONLY 7 // is the selection (thus the set data) readonly?, SfxBoolItem -#define DSID_USER 8 // the user name used for logon, SfxStringItem -#define DSID_PASSWORD 9 // the password used for logon, SfxStringItem -#define DSID_ADDITIONALOPTIONS 10 // additional options used for connecting, SfxStringItem -#define DSID_CHARSET 11 // character set to use, SfxStringItem by now -#define DSID_PASSWORDREQUIRED 12 // is the password required to connect?, SfxBoolItem -#define DSID_SHOWDELETEDROWS 13 // show deleted rows?, SfxBoolItem -#define DSID_ALLOWLONGTABLENAMES 14 // allow tables names longer than 8.3?, SfxBoolItem -#define DSID_JDBCDRIVERCLASS 15 // JDBC driver class, SfxStringItem -#define DSID_FIELDDELIMITER 16 // field delimiter, SfxUInt16Item -#define DSID_TEXTDELIMITER 17 // text delimiter, SfxUInt16Item -#define DSID_DECIMALDELIMITER 18 // decimal delimiter, SfxUInt16Item -#define DSID_THOUSANDSDELIMITER 19 // thousands delimiter, SfxUInt16Item -#define DSID_TEXTFILEEXTENSION 20 // extension for text files, SfxStringItem -#define DSID_TEXTFILEHEADER 21 // the text file contains a header?, SfxBoolItem -#define DSID_PARAMETERNAMESUBST 22 -#define DSID_CONN_PORTNUMBER 23 -#define DSID_SUPPRESSVERSIONCL 24 // meta data: sal_True if the data source described by the set is to-be-deleted -#define DSID_DATASOURCE_UNO 25 // meta data: OPropertySetItem, the data source the set represents -#define DSID_CONN_SHUTSERVICE 26 -#define DSID_CONN_DATAINC 27 -#define DSID_CONN_CACHESIZE 28 -#define DSID_CONN_CTRLUSER 29 -#define DSID_CONN_CTRLPWD 30 -#define DSID_USECATALOG 31 // should the driver use the catalog name when the database is filebased -#define DSID_CONN_HOSTNAME 32 -#define DSID_CONN_LDAP_BASEDN 33 -#define DSID_CONN_LDAP_PORTNUMBER 34 -#define DSID_CONN_LDAP_ROWCOUNT 35 -#define DSID_SQL92CHECK 36 -#define DSID_AUTOINCREMENTVALUE 37 -#define DSID_AUTORETRIEVEVALUE 38 -#define DSID_AUTORETRIEVEENABLED 39 -#define DSID_APPEND_TABLE_ALIAS 40 -#define DSID_MYSQL_PORTNUMBER 41 -#define DSID_IGNOREDRIVER_PRIV 42 -#define DSID_BOOLEANCOMPARISON 43 -#define DSID_ORACLE_PORTNUMBER 44 -#define DSID_ENABLEOUTERJOIN 45 -#define DSID_CATALOG 46 -#define DSID_SCHEMA 47 -#define DSID_INDEXAPPENDIX 48 -#define DSID_CONN_LDAP_USESSL 49 -#define DSID_DOCUMENT_URL 50 -#define DSID_DOSLINEENDS 51 -#define DSID_DATABASENAME 52 -#define DSID_AS_BEFORE_CORRNAME 53 -#define DSID_CHECK_REQUIRED_FIELDS 54 -#define DSID_IGNORECURRENCY 55 -#define DSID_CONN_SOCKET 56 -#define DSID_ESCAPE_DATETIME 57 -#define DSID_NAMED_PIPE 58 - // don't forget to adjust DSID_LAST_ITEM_ID below! - - -//======================================================================== -//= item range. Adjust this if you introduce new items above - -#define DSID_FIRST_ITEM_ID DSID_NAME -#define DSID_LAST_ITEM_ID DSID_NAMED_PIPE - -#endif // _DBAUI_DATASOURCEITEMS_HXX_ - diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk index ca2098778f06..2ec59f3d7840 100644 --- a/dbaccess/source/ui/dlg/makefile.mk +++ b/dbaccess/source/ui/dlg/makefile.mk @@ -124,13 +124,13 @@ EXCEPTIONSFILES= \ $(SLO)$/DriverSettings.obj \ $(SLO)$/odbcconfig.obj \ $(SLO)$/advancedsettings.obj \ - $(SLO)$/datasourceui.obj \ $(SLO)$/textconnectionsettings.obj SLOFILES= \ $(EXCEPTIONSFILES) \ $(SLO)$/dlgsize.obj \ - $(SLO)$/dlgattr.obj + $(SLO)$/dlgattr.obj \ + $(SLO)$/optionalboolitem.obj .IF "$(WINDOWS_VISTA_PSDK)"!="" && "$(PROF_EDITION)"=="" DISABLE_ADO=TRUE diff --git a/dbaccess/source/ui/dlg/optionalboolitem.cxx b/dbaccess/source/ui/dlg/optionalboolitem.cxx new file mode 100644 index 000000000000..9964e393061c --- /dev/null +++ b/dbaccess/source/ui/dlg/optionalboolitem.cxx @@ -0,0 +1,75 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_dbaccess.hxx" + +#include "optionalboolitem.hxx" + +//........................................................................ +namespace dbaui +{ +//........................................................................ + + //==================================================================== + //= OptionalBoolItem + //==================================================================== + TYPEINIT1( OptionalBoolItem, SfxPoolItem ); + //-------------------------------------------------------------------- + OptionalBoolItem::OptionalBoolItem( sal_Int16 _nWhich ) + :SfxPoolItem( _nWhich ) + ,m_aValue() + { + } + + //-------------------------------------------------------------------- + OptionalBoolItem::OptionalBoolItem( const OptionalBoolItem& _rSource ) + :SfxPoolItem( _rSource ) + ,m_aValue( _rSource.m_aValue ) + { + } + + //-------------------------------------------------------------------- + int OptionalBoolItem::operator==( const SfxPoolItem& _rItem ) const + { + const OptionalBoolItem* pCompare = PTR_CAST( OptionalBoolItem, &_rItem ); + if ( !pCompare ) + return 0; + + if ( m_aValue == pCompare->m_aValue ) + return 1; + + return 0; + } + + //-------------------------------------------------------------------- + SfxPoolItem* OptionalBoolItem::Clone( SfxItemPool* /*_pPool*/ ) const + { + return new OptionalBoolItem( *this ); + } + +//........................................................................ +} // namespace dbaui +//........................................................................ diff --git a/dbaccess/source/ui/dlg/optionalboolitem.hxx b/dbaccess/source/ui/dlg/optionalboolitem.hxx new file mode 100644 index 000000000000..4bc2054630eb --- /dev/null +++ b/dbaccess/source/ui/dlg/optionalboolitem.hxx @@ -0,0 +1,66 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef DBACCESS_OPTIONALBOOLITEM_HXX +#define DBACCESS_OPTIONALBOOLITEM_HXX + +#include <svl/poolitem.hxx> + +#include <boost/optional.hpp> + +//........................................................................ +namespace dbaui +{ +//........................................................................ + + //==================================================================== + //= OptionalBoolItem + //==================================================================== + class OptionalBoolItem : public SfxPoolItem + { + ::boost::optional< bool > m_aValue; + + public: + TYPEINFO(); + OptionalBoolItem( sal_Int16 nWhich ); + OptionalBoolItem( const OptionalBoolItem& _rSource ); + + virtual int operator==( const SfxPoolItem& _rItem ) const; + virtual SfxPoolItem* Clone( SfxItemPool* _pPool = NULL ) const; + + bool HasValue() const { return !!m_aValue; } + void ClearValue() { m_aValue.reset(); } + bool GetValue() const { return *m_aValue; } + void SetValue( const bool _bValue ) { m_aValue.reset( _bValue ); } + + const ::boost::optional< bool >& + GetFullValue() const { return m_aValue; } + }; + +//........................................................................ +} // namespace dbaui +//........................................................................ + +#endif // DBACCESS_OPTIONALBOOLITEM_HXX |