summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc2
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx23
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx183
-rw-r--r--dbaccess/source/ui/dlg/DriverSettings.cxx1
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx82
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx45
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hrc3
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx1
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src18
-rw-r--r--dbaccess/source/ui/dlg/datasourceui.cxx1
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx66
-rw-r--r--dbaccess/source/ui/dlg/dsitems.hxx3
-rw-r--r--dbaccess/source/ui/dlg/makefile.mk3
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.cxx75
-rw-r--r--dbaccess/source/ui/dlg/optionalboolitem.hxx66
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx31
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx20
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx40
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx15
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx215
21 files changed, 454 insertions, 448 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index 28771fad05b1..4140e049a939 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -441,8 +441,8 @@
#define HID_EXTENSION_NOT_PRESENT_DLG ( HID_DBACCESS_START + 381)
#define HID_DLG_QRY_JOIN_CONTROL ( HID_DBACCESS_START + 382)
#define HID_DSADMIN_IGNORECURRENCY ( HID_DBACCESS_START + 383)
-
#define HID_MACRO_MIGRATION_BACKUP_LOCATION ( HID_DBACCESS_START + 384)
+#define HID_DSADMIN_PRIMARY_KEY_SUPPORT ( HID_DBACCESS_START + 385)
// this one below have hid in number space HID_SBA_START
#define HID_DLG_ADABAS_NEWDB (HID_SBA_START + 0)
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 132ccb289550..b6f688754129 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -426,7 +426,7 @@ void ODatabaseModelImpl::impl_construct_nothrow()
Property aProperty(
::rtl::OUString::createFromAscii( pSettings->AsciiName ),
-1,
- ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ),
+ pSettings->ValueType,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID
);
xSettingsSet->insert( makeAny( aProperty ) );
@@ -1117,8 +1117,9 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "ParameterNameSubstitution", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AddIndexAppendix", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( "ImplicitCatalogRestriction", Any( ) ),
- AsciiPropertyValue( "ImplicitSchemaRestriction", Any( ) ),
+ AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
+ AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
// known SDB level settings
AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ),
@@ -1135,7 +1136,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ),
AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ),
- AsciiPropertyValue( NULL, Any() )
+ AsciiPropertyValue()
};
return aKnownSettings;
}
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index 5a5de5782c52..dd194829bb51 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -104,13 +104,32 @@ struct AsciiPropertyValue
// note: the canonic member order would be AsciiName / DefaultValue, but
// this crashes on unxlngi6.pro, since there's a bug which somehow results in
// getDefaultDataSourceSettings returning corrupted Any instances then.
- ::com::sun::star::uno::Any DefaultValue;
- const sal_Char* AsciiName;
+ ::com::sun::star::uno::Any DefaultValue;
+ const sal_Char* AsciiName;
+ const ::com::sun::star::uno::Type& ValueType;
+
+ AsciiPropertyValue()
+ :DefaultValue( )
+ ,AsciiName( NULL )
+ ,ValueType( ::cppu::UnoType< ::cppu::UnoVoidType >::get() )
+ {
+ }
AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rDefaultValue )
:DefaultValue( _rDefaultValue )
,AsciiName( _pAsciiName )
+ ,ValueType( _rDefaultValue.getValueType() )
+ {
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: NULL values not allowed here, use the other CTOR for this!" );
+ }
+ AsciiPropertyValue( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Type& _rValeType )
+ :DefaultValue()
+ ,AsciiName( _pAsciiName )
+ ,ValueType( _rValeType )
{
+ OSL_ENSURE( ValueType.getTypeClass() != ::com::sun::star::uno::TypeClass_VOID,
+ "AsciiPropertyValue::AsciiPropertyValue: VOID property values not supported!" );
}
};
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 28a9b83fca35..dd7e736240ec 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 <svtools/poolitem.hxx>
-#endif
-#ifndef _SFXITEMPOOL_HXX
-#include <svtools/itempool.hxx>
-#endif
-#ifndef _SFXSTRITEM_HXX
-#include <svtools/stritem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/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 <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/itempool.hxx>
+#include <svtools/logindlg.hxx>
+#include <svtools/poolitem.hxx>
+#include <svtools/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..fda1b37063e7 100644
--- a/dbaccess/source/ui/dlg/DriverSettings.cxx
+++ b/dbaccess/source/ui/dlg/DriverSettings.cxx
@@ -68,6 +68,7 @@ void ODriversSettings::getSupportedIndirectSettings( const ::rtl::OUString& _sUR
DSID_AUTORETRIEVEVALUE,
DSID_BOOLEANCOMPARISON,
DSID_ESCAPE_DATETIME,
+ DSID_PRIMARY_KEY_SUPPORT,
0
};
for ( const USHORT* pGenericKnowSetting = nGenericKnownSettings; *pGenericKnowSetting; ++pGenericKnowSetting )
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index c67d34311147..fd2afb804827 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 <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/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 <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/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 7f0b5ee16515..1f6faa969908 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -38,7 +38,7 @@
#include "DbAdminImpl.hxx"
#include "DriverSettings.hxx"
#include "datasourceui.hxx"
-
+#include "optionalboolitem.hxx"
#include "dbu_resource.hrc"
#include "dbu_dlg.hrc"
#include "dbadmin.hrc"
@@ -98,6 +98,7 @@ namespace dbaui
,m_pCheckRequiredFields( NULL )
,m_pIgnoreCurrency(NULL)
,m_pEscapeDateTime(NULL)
+ ,m_pPrimaryKeySupport(NULL)
,m_pBooleanComparisonModeLabel( NULL )
,m_pBooleanComparisonMode( NULL )
,m_aControlDependencies()
@@ -116,9 +117,14 @@ namespace dbaui
USHORT nItemId = setting->nItemId;
if ( aDSUI.hasSetting( 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 );
}
}
@@ -185,6 +191,7 @@ namespace dbaui
DELETEZ( m_pCheckRequiredFields );
DELETEZ( m_pIgnoreCurrency );
DELETEZ( m_pEscapeDateTime );
+ DELETEZ( m_pPrimaryKeySupport );
DELETEZ( m_pBooleanComparisonModeLabel );
DELETEZ( m_pBooleanComparisonMode );
}
@@ -210,13 +217,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 );
}
}
@@ -270,12 +276,31 @@ 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
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc
index 8bd0063fc4d6..2ecc8f53b839 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 13
+#define ADVANCED_CHECKBOX_OPTIONS 14
#define ADVANCED_LISTBOX_OPTIONS 1
#define ADVANCED_PAGE_X 200
@@ -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..ebe364592836 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;
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
index f0a56e8dec83..129ef3b9702e 100644
--- a/dbaccess/source/ui/dlg/datasourceui.cxx
+++ b/dbaccess/source/ui/dlg/datasourceui.cxx
@@ -87,6 +87,7 @@ namespace dbaui
case DSID_AUTORETRIEVEVALUE: return rAdvancedSupport.bGeneratedValues;
case DSID_IGNORECURRENCY: return rAdvancedSupport.bIgnoreCurrency;
case DSID_ESCAPE_DATETIME: return rAdvancedSupport.bEscapeDateTime;
+ case DSID_PRIMARY_KEY_SUPPORT: return rAdvancedSupport.bPrimaryKeySupport;
}
OSL_ENSURE( false, "DataSourceUI::hasSetting: this item id is currently not supported!" );
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 7aa91ef8ce2c..ccb904994c23 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 <svtools/stritem.hxx>
-#endif
-#ifndef _SFXENUMITEM_HXX
-#include <svtools/eitem.hxx>
-#endif
-#ifndef _SFXINTITEM_HXX
-#include <svtools/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 <svtools/eitem.hxx>
+#include <svtools/intitem.hxx>
+#include <svtools/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
@@ -449,8 +417,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] =
@@ -510,7 +479,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
index a0d95aca810b..557c095da67c 100644
--- a/dbaccess/source/ui/dlg/dsitems.hxx
+++ b/dbaccess/source/ui/dlg/dsitems.hxx
@@ -92,6 +92,7 @@
#define DSID_CONN_SOCKET 56
#define DSID_ESCAPE_DATETIME 57
#define DSID_NAMED_PIPE 58
+#define DSID_PRIMARY_KEY_SUPPORT 59
// don't forget to adjust DSID_LAST_ITEM_ID below!
@@ -99,7 +100,7 @@
//= 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
+#define DSID_LAST_ITEM_ID DSID_PRIMARY_KEY_SUPPORT
#endif // _DBAUI_DATASOURCEITEMS_HXX_
diff --git a/dbaccess/source/ui/dlg/makefile.mk b/dbaccess/source/ui/dlg/makefile.mk
index ca2098778f06..71cc69216dae 100644
--- a/dbaccess/source/ui/dlg/makefile.mk
+++ b/dbaccess/source/ui/dlg/makefile.mk
@@ -130,7 +130,8 @@ EXCEPTIONSFILES= \
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..16f4e03c63aa
--- /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 <svtools/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; }
+ bool SetValue( const bool _bValue ) { m_aValue.reset( _bValue ); }
+
+ const ::boost::optional< bool >&
+ GetFullValue() const { return m_aValue; }
+ };
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
+
+#endif // DBACCESS_OPTIONALBOOLITEM_HXX
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 62ad79e80a67..88f04388545b 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -109,27 +109,29 @@ namespace dbaui
bool bFormsCheckRequiredFields;
bool bIgnoreCurrency;
bool bEscapeDateTime;
+ bool bPrimaryKeySupport;
// Note: If you extend this list, you need to adjust the ctor (of course)
// and (maybe) the implementation of supportsAnySpecialSetting
AdvancedSettingsSupport()
- :bGeneratedValues ( true )
- ,bUseSQL92NamingConstraints ( true )
- ,bAppendTableAliasInSelect ( true )
- ,bUseKeywordAsBeforeAlias ( true )
- ,bUseBracketedOuterJoinSyntax ( true )
- ,bIgnoreDriverPrivileges ( true )
- ,bParameterNameSubstitution ( true )
- ,bDisplayVersionColumns ( true )
- ,bUseCatalogInSelect ( true )
- ,bUseSchemaInSelect ( true )
- ,bUseIndexDirectionKeyword ( true )
- ,bUseDOSLineEnds ( true )
- ,bBooleanComparisonMode ( true )
- ,bFormsCheckRequiredFields ( true )
+ :bGeneratedValues ( false )
+ ,bUseSQL92NamingConstraints ( false )
+ ,bAppendTableAliasInSelect ( false )
+ ,bUseKeywordAsBeforeAlias ( false )
+ ,bUseBracketedOuterJoinSyntax ( false )
+ ,bIgnoreDriverPrivileges ( false )
+ ,bParameterNameSubstitution ( false )
+ ,bDisplayVersionColumns ( false )
+ ,bUseCatalogInSelect ( false )
+ ,bUseSchemaInSelect ( false )
+ ,bUseIndexDirectionKeyword ( false )
+ ,bUseDOSLineEnds ( false )
+ ,bBooleanComparisonMode ( false )
+ ,bFormsCheckRequiredFields ( false )
,bIgnoreCurrency ( false )
,bEscapeDateTime ( false )
+ ,bPrimaryKeySupport ( false )
{
}
@@ -157,6 +159,7 @@ namespace dbaui
|| ( bFormsCheckRequiredFields == true )
|| ( bIgnoreCurrency == true )
|| ( bEscapeDateTime == true )
+ || ( bPrimaryKeySupport == true )
;
}
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 1feb51cf49a9..82fa7b7ec2bf 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -63,6 +63,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
+#include <connectivity/dbmetadata.hxx>
#include <rtl/logfile.hxx>
#include <rtl/ustrbuf.hxx>
@@ -1381,23 +1382,12 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
// -----------------------------------------------------------------------------
bool OCopyTableWizard::supportsPrimaryKey( const Reference< XConnection >& _rxConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::supportsPrimaryKey" );
OSL_PRECOND( _rxConnection.is(), "OCopyTableWizard::supportsPrimaryKey: invalid connection!" );
+ if ( !_rxConnection.is() )
+ return false;
- bool bSupports( false );
- if ( _rxConnection.is() )
- {
- try
- {
- Reference< XDatabaseMetaData > xMetaData( _rxConnection->getMetaData(), UNO_QUERY_THROW );
- bSupports = xMetaData->supportsCoreSQLGrammar();
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return bSupports;
+ ::dbtools::DatabaseMetaData aMetaData( _rxConnection );
+ return aMetaData.supportsPrimaryKeys();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index f758f529f66f..b8d7bd935a4d 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -47,32 +47,6 @@ namespace dbaui
using namespace ::com::sun::star;
/** === end UNO using === **/
- struct InitAdvanced : public AdvancedSettingsSupport
- {
- enum Special { All, AllButIgnoreCurrency, None };
-
- InitAdvanced( Special _eType )
- :AdvancedSettingsSupport()
- {
- bGeneratedValues = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseSQL92NamingConstraints = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bAppendTableAliasInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseKeywordAsBeforeAlias = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseBracketedOuterJoinSyntax = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bIgnoreDriverPrivileges = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bParameterNameSubstitution = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bDisplayVersionColumns = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseCatalogInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseSchemaInSelect = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseIndexDirectionKeyword = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bUseDOSLineEnds = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bBooleanComparisonMode = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bFormsCheckRequiredFields = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- bIgnoreCurrency = ( _eType == All );
- bEscapeDateTime = ( _eType == All ) || ( _eType == AllButIgnoreCurrency );
- }
- };
-
struct FeatureSupport
{
// authentication mode of the data source
@@ -105,7 +79,7 @@ namespace dbaui
const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
for(;pIter != pEnd;++pIter)
{
- InitAdvanced aInit(InitAdvanced::None);
+ AdvancedSettingsSupport aInit;
const uno::Sequence< beans::NamedValue> aProperties = aDriverConfig.getFeatures(*pIter).getNamedValues();
const beans::NamedValue* pPropertiesIter = aProperties.getConstArray();
const beans::NamedValue* pPropertiesEnd = pPropertiesIter + aProperties.getLength();
@@ -175,10 +149,14 @@ namespace dbaui
{
pPropertiesIter->Value >>= aInit.bEscapeDateTime;
}
- } // for (;pPropertiesIter != pPropertiesEnd ; ++pPropertiesIter)
+ else if ( pPropertiesIter->Name.equalsAscii("PrimaryKeySupport") )
+ {
+ pPropertiesIter->Value >>= aInit.bPrimaryKeySupport;
+ }
+ }
s_aSupport.insert(AdvancedSupport::value_type(*pIter,aInit));
}
- } // if ( s_aSupport.empty() )
+ }
OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
return s_aSupport[ _sURL ];
}
@@ -208,8 +186,8 @@ namespace dbaui
aInit = AuthPwd;
}
s_aSupport.insert(Supported::value_type(*pIter,aInit));
- } // for(;pIter != pEnd;++pIter)
- } // if ( s_aSupport.empty() )
+ }
+ }
OSL_ENSURE(s_aSupport.find(_sURL) != s_aSupport.end(),"Illegal URL!");
return s_aSupport[ _sURL ].eAuthentication;
}
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 9694d285c511..347a19ca60ad 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -1534,19 +1534,8 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ )
return sal_False;
OTableController& rController = GetView()->getController();
- try
- {
- Reference<XConnection> xCon = rController.getConnection();
-
- Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>();
- if(!xMetaData.is() || !xMetaData->supportsCoreSQLGrammar())
- return sal_False; // no primary keys allowed
-
- }
- catch(SQLException&)
- {
- OSL_ASSERT(!"supportsCoreSQLGrammar");
- }
+ if ( !rController.getSdbMetaData().supportsPrimaryKeys() )
+ return sal_False;
Reference<XPropertySet> xTable = rController.getTable();
//////////////////////////////////////////////////////////////
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index c447c002a830..98f57b61fbdc 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -30,143 +30,62 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBUI_TABLECONTROLLER_HXX
-#include "TableController.hxx"
-#endif
-#ifndef _DBAU_REGHELPER_HXX_
+#include "FieldDescriptions.hxx"
+#include "TEditControl.hxx"
+#include "TableController.hxx"
+#include "TableDesignView.hxx"
+#include "TableRow.hxx"
+#include "TypeInfo.hxx"
+#include "UITools.hxx"
+#include "browserids.hxx"
#include "dbu_reghelper.hxx"
-#endif
-#ifndef _STRING_HXX
-#include <tools/string.hxx>
-#endif
-#include <tools/diagnose_ex.h>
-#ifndef _SFXSIDS_HRC
-#include <sfx2/sfxsids.hrc>
-#endif
-#ifndef _DBU_TBL_HRC_
#include "dbu_tbl.hrc"
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
-#include "browserids.hxx"
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef DBACCESS_SOURCE_UI_INC_DEFAULTOBJECTNAMECHECK_HXX
#include "defaultobjectnamecheck.hxx"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
-#include <comphelper/extract.hxx>
-#endif
-#ifndef DBAUI_DLGSAVE_HXX
#include "dlgsave.hxx"
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include "dsmeta.hxx"
+#include "indexdialog.hxx"
+#include "sqlmessage.hxx"
+
+/** === begin UNO includes === **/
#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
-#include <com/sun/star/sdbcx/KeyType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
-#include <com/sun/star/sdbcx/XDrop.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
-#include <com/sun/star/sdbcx/XAlterTable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
-#include <com/sun/star/sdbcx/XAppend.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XTitleChangeListener.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
-#endif
-#include <com/sun/star/frame/XTitleChangeListener.hpp>
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#endif
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
-#ifndef _COMPHELPER_STREAMSECTION_HXX_
+/** === end UNO includes === **/
+
+#include <comphelper/extract.hxx>
#include <comphelper/streamsection.hxx>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef DBAUI_TABLEDESIGNVIEW_HXX
-#include "TableDesignView.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
-#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef DBAUI_FIELDDESCRIPTIONS_HXX
-#include "FieldDescriptions.hxx"
-#endif
-#ifndef DBAUI_TABLEROW_HXX
-#include "TableRow.hxx"
-#endif
-#ifndef DBAUI_TYPEINFO_HXX
-#include "TypeInfo.hxx"
-#endif
-#ifndef DBAUI_TABLEEDITORCONTROL_HXX
-#include "TEditControl.hxx"
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
-#include "sqlmessage.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX
+#include <comphelper/types.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <connectivity/dbmetadata.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <tools/diagnose_ex.h>
+#include <tools/string.hxx>
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _DBAUI_INDEXDIALOG_HXX_
-#include "indexdialog.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#include <boost/mem_fn.hpp>
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#include "dsmeta.hxx"
+#include <boost/mem_fn.hpp>
#include <boost/bind.hpp>
+
#include <algorithm>
#include <functional>
@@ -1089,7 +1008,8 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::
{
sal_Bool bOk = sal_True;
sal_Bool bFoundPKey = sal_False;
- Reference< XDatabaseMetaData> xMetaData = getMetaData( );
+ Reference< XDatabaseMetaData > xMetaData = getMetaData( );
+ DatabaseMetaData aMetaData( getConnection() );
::comphelper::UStringMixEqual bCase(xMetaData.is() ? xMetaData->supportsMixedCaseQuotedIdentifiers() : sal_True);
::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_vRowList.begin();
@@ -1115,39 +1035,38 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::
}
}
}
- if(!bFoundPKey)
+ if ( _bNew && !bFoundPKey && aMetaData.supportsPrimaryKeys() )
{
- if(_bNew && xMetaData.is() && xMetaData->supportsCoreSQLGrammar())
- {
- String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
- String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
- OSQLMessageBox aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
+ String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
+ String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
+ OSQLMessageBox aBox(getView(), sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
- INT16 nReturn = aBox.Execute();
-
- if (nReturn == RET_YES)
- {
- ::boost::shared_ptr<OTableRow> pNewRow(new OTableRow());
- TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
+ switch ( aBox.Execute() )
+ {
+ case RET_YES:
+ {
+ ::boost::shared_ptr<OTableRow> pNewRow(new OTableRow());
+ TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
+ if ( !pTypeInfo.get() )
+ break;
- if ( pTypeInfo.get() )
- {
- pNewRow->SetFieldType( pTypeInfo );
- OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
+ pNewRow->SetFieldType( pTypeInfo );
+ OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
- pActFieldDescr->SetAutoIncrement(sal_False); // #95927# pTypeInfo->bAutoIncrement
- pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
+ pActFieldDescr->SetAutoIncrement(sal_False); // #95927# pTypeInfo->bAutoIncrement
+ pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
- pActFieldDescr->SetName( createUniqueName(::rtl::OUString::createFromAscii("ID") ));
- pActFieldDescr->SetPrimaryKey( sal_True );
- m_vRowList.insert(m_vRowList.begin(),pNewRow);
+ pActFieldDescr->SetName( createUniqueName(::rtl::OUString::createFromAscii("ID") ));
+ pActFieldDescr->SetPrimaryKey( sal_True );
+ m_vRowList.insert(m_vRowList.begin(),pNewRow);
- static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->Invalidate();
- static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->RowInserted(0);
- } // if ( pTypeInfo.get() )
- }
- else if (nReturn == RET_CANCEL)
- bOk = sal_False;
+ static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->Invalidate();
+ static_cast<OTableDesignView*>(getView())->GetEditorCtrl()->RowInserted(0);
+ }
+ break;
+ case RET_CANCEL:
+ bOk = sal_False;
+ break;
}
}
return bOk;