diff options
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/charsets.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dbumiscres.src | 205 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dsmeta.cxx | 164 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dsntypes.cxx | 732 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/linkeddocuments.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/makefile.mk | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/singledoccontroller.cxx | 20 |
8 files changed, 106 insertions, 1055 deletions
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index e689f7b26431..3e026d4e5116 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: UITools.cxx,v $ - * $Revision: 1.81 $ + * $Revision: 1.81.24.1 $ * * This file is part of OpenOffice.org. * @@ -1627,30 +1627,6 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType return pTypeInfo; } // ----------------------------------------------------------------------------- -::rtl::OUString getUserDefinedDriverNodeName() -{ - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/UserDefinedDriverSettings")); - return s_sNodeName; -} -// ----------------------------------------------------------------------------- -::rtl::OUString getDriverTypeDisplayNodeName() -{ - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverTypeDisplayName")); - return s_sNodeName; -} -// ----------------------------------------------------------------------------- -::rtl::OUString getDriverDsnPrefixNodeName() -{ - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverDsnPrefix")); - return s_sNodeName; -} -// ----------------------------------------------------------------------------- -::rtl::OUString getDriverExtensionNodeName() -{ - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("Extension")); - return s_sNodeName; -} -// ----------------------------------------------------------------------------- sal_Int32 askForUserAction(Window* _pParent,USHORT _nTitle,USHORT _nText,sal_Bool _bAll,const ::rtl::OUString& _sName) { vos::OGuard aGuard( Application::GetSolarMutex() ); diff --git a/dbaccess/source/ui/misc/charsets.cxx b/dbaccess/source/ui/misc/charsets.cxx index c062736de285..cfed1e3d1ddd 100644 --- a/dbaccess/source/ui/misc/charsets.cxx +++ b/dbaccess/source/ui/misc/charsets.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: charsets.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.68.1 $ * * This file is part of OpenOffice.org. * @@ -37,9 +37,6 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#ifndef _DBU_MISCRES_HRC_ -#include "dbumiscres.hrc" -#endif #ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" #endif diff --git a/dbaccess/source/ui/misc/dbumiscres.src b/dbaccess/source/ui/misc/dbumiscres.src index ca0551abc0df..f58b0b8b23ba 100644 --- a/dbaccess/source/ui/misc/dbumiscres.src +++ b/dbaccess/source/ui/misc/dbumiscres.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbumiscres.src,v $ - * $Revision: 1.80 $ + * $Revision: 1.80.68.1 $ * * This file is part of OpenOffice.org. * @@ -31,210 +31,7 @@ #ifndef _DBU_MISC_HRC_ #include "dbu_misc.hrc" #endif -#ifndef _DBU_MISCRES_HRC_ -#include "dbumiscres.hrc" -#endif -//------------------------------------------------------------------------- -Resource RSC_DATASOURCE_TYPES -{ - String STR_MYSQL_ODBC - { - Text ="sdbc:mysql:odbc:"; - }; - String STR_MYSQL_JDBC - { - Text ="sdbc:mysql:jdbc:"; - }; - String STR_ADABAS - { - Text ="sdbc:adabas:"; - }; - String STR_ORACLE_JDBC - { - Text ="jdbc:oracle:thin:"; - }; - String STR_JDBC - { - Text ="jdbc:"; - }; - String STR_ODBC - { - Text ="sdbc:odbc:"; - }; - String STR_DBASE - { - Text ="sdbc:dbase:"; - }; - String STR_MSACCESS - { - Text ="sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="; - }; - String STR_MSACCESS2007 - { - Text ="sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="; - }; - String STR_ADO - { - Text ="sdbc:ado:"; - }; - String STR_FLAT - { - Text ="sdbc:flat:"; - }; - String STR_CALC - { - Text ="sdbc:calc:"; - }; - String STR_MOZILLA - { - Text ="sdbc:address:mozilla:"; - }; - String STR_LDAP - { - Text ="sdbc:address:ldap:"; - }; - String STR_OUTLOOK - { - Text ="sdbc:address:outlook"; - }; - String STR_OUTLOOKEXP - { - Text ="sdbc:address:outlookexp"; - }; - String STR_EVOLUTION - { - Text ="sdbc:address:evolution:local"; - }; - String STR_EVOLUTION_GROUPWISE - { - Text ="sdbc:address:evolution:groupwise"; - }; - String STR_EVOLUTION_LDAP - { - Text ="sdbc:address:evolution:ldap"; - }; - String STR_KAB - { - Text ="sdbc:address:kab"; - }; - String STR_EMBEDDED_HSQLDB - { - Text = "sdbc:embedded:hsqldb"; - }; - String STR_MACAB - { - Text ="sdbc:address:macab"; - }; - String STR_THUNDERBIRD - { - Text ="sdbc:address:thunderbird:"; - }; - String STR_MYSQL_NATIVE - { - Text ="sdbc:mysqlc:"; - }; -}; -Resource RSC_DATASOURCE_TYPE_UINAMES -{ - String STR_MYSQL_ODBC - { - Text[ en-US ] = "MySQL (ODBC)"; - }; - String STR_MYSQL_JDBC - { - Text[ en-US ] = "MySQL (JDBC)"; - }; - String STR_ADABAS - { - Text[ en-US ] = "Adabas D"; - }; - String STR_ORACLE_JDBC - { - Text[ en-US ] = "Oracle JDBC"; - }; - - String STR_JDBC - { - Text[ en-US ] = "JDBC"; - }; - String STR_ODBC - { - Text[ en-US ] = "ODBC"; - }; - String STR_DBASE - { - Text[ en-US ] = "dBASE"; - }; - String STR_MSACCESS - { - Text[ en-US ] = "Microsoft Access"; - }; - String STR_MSACCESS2007 - { - Text[ en-US ] = "Microsoft Access 2007"; - }; - String STR_ADO - { - Text[ en-US ] = "ADO"; - }; - String STR_FLAT - { - Text[ en-US ] = "Text"; - }; - String STR_CALC - { - Text[ en-US ] = "Spreadsheet"; - }; - String STR_MOZILLA - { - Text[ en-US ] = "Mozilla Address Book"; - }; - String STR_LDAP - { - Text[ en-US ] = "LDAP Address Book"; - }; - String STR_OUTLOOK - { - Text[ en-US ] = "Microsoft Outlook Address Book"; - }; - String STR_OUTLOOKEXP - { - Text[ en-US ] = "Microsoft Windows Address Book"; - }; - String STR_EVOLUTION - { - Text[ en-US ] = "Evolution Local"; - }; - String STR_EVOLUTION_GROUPWISE - { - Text[ en-US ] = "Groupwise"; - }; - String STR_EVOLUTION_LDAP - { - Text[ en-US ] = "Evolution LDAP"; - }; - String STR_KAB - { - Text[ en-US ] = "KDE Address Book"; - }; - String STR_MACAB - { - Text[ en-US ] = "Mac OS X Address Book"; - }; - String STR_EMBEDDED_HSQLDB - { - Text[ en-US ] = "HSQL database engine"; - }; - String STR_THUNDERBIRD - { - Text[ en-US ] = "Thunderbird Address Book"; - }; - String STR_MYSQL_NATIVE - { - Text[ en-US ] = "MySQL (Native)"; - }; -}; Resource RSC_CHARSETS { diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 98e7ef3afe33..10f955e4a7d2 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dsmeta.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.8.2 $ * * This file is part of OpenOffice.org. * @@ -47,7 +47,7 @@ namespace dbaui { // strange ctor, but makes instantiating this class more readable (see below) InitAdvanced( short _Generated, short _SQL, short _Append, short _As, short _Outer, short _Priv, short _Param, - short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur ) + short _Version, short _Catalog, short _Schema, short _Index, short _DOS, short _Required, short _Bool,short _IgnoreCur,short _AutoPKey ) :AdvancedSettingsSupport() { bGeneratedValues = ( _Generated != 0 ); @@ -65,6 +65,7 @@ namespace dbaui bBooleanComparisonMode = ( _Bool != 0 ); bFormsCheckRequiredFields = ( _Required != 0 ); bIgnoreCurrency = ( _IgnoreCur != 0 ); + bAutoIncrementIsPrimaryKey = ( _AutoPKey != 0 ); } enum Special { All, None }; @@ -87,6 +88,7 @@ namespace dbaui bBooleanComparisonMode = ( _eType == All ); bFormsCheckRequiredFields = ( _eType == All ); bIgnoreCurrency = false; // Oracle special + bAutoIncrementIsPrimaryKey = false; // hsqldb special } }; @@ -110,95 +112,95 @@ namespace dbaui //= global tables //==================================================================== //-------------------------------------------------------------------- - static const AdvancedSettingsSupport& getAdvancedSettingsSupport( DATASOURCE_TYPE _eType ) + static const AdvancedSettingsSupport& getAdvancedSettingsSupport( ::dbaccess::DATASOURCE_TYPE _eType ) { - typedef ::std::map< DATASOURCE_TYPE, AdvancedSettingsSupport > AdvancedSupport; + typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, AdvancedSettingsSupport > AdvancedSupport; static AdvancedSupport s_aSupport; if ( s_aSupport.empty() ) { - s_aSupport[ DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_CALC ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ); - s_aSupport[ DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - s_aSupport[ DST_JDBC ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_ODBC ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0 ); - s_aSupport[ DST_MOZILLA ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_THUNDERBIRD ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_LDAP ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_OUTLOOK ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_OUTLOOKEXP ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_EVOLUTION ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_EVOLUTION_GROUPWISE ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_EVOLUTION_LDAP ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_KAB ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_MACAB ] = InitAdvanced( InitAdvanced::None ); - s_aSupport[ DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 ); - s_aSupport[ DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 ); - s_aSupport[ DST_USERDEFINE1 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE2 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE3 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE4 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE5 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE6 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE7 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE8 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE9 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_USERDEFINE10 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_CALC ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_DBASE ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_FLAT ] = InitAdvanced( 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); + s_aSupport[ ::dbaccess::DST_JDBC ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_ODBC ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_ADO ] = InitAdvanced( 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_MOZILLA ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_LDAP ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_OUTLOOK ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_EVOLUTION ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_KAB ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_MACAB ] = InitAdvanced( InitAdvanced::None ); + s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 ); + s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = InitAdvanced( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1 ); + s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = InitAdvanced( InitAdvanced::All ); + s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = InitAdvanced( InitAdvanced::All ); - s_aSupport[ DST_ORACLE_JDBC ].bIgnoreCurrency = true; + s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ].bIgnoreCurrency = true; } return s_aSupport[ _eType ]; } //-------------------------------------------------------------------- - static AuthenticationMode getAuthenticationMode( DATASOURCE_TYPE _eType ) + static AuthenticationMode getAuthenticationMode( ::dbaccess::DATASOURCE_TYPE _eType ) { - typedef ::std::map< DATASOURCE_TYPE, FeatureSupport > Supported; + typedef ::std::map< ::dbaccess::DATASOURCE_TYPE, FeatureSupport > Supported; static Supported s_aSupport; if ( s_aSupport.empty() ) { - s_aSupport[ DST_MSACCESS ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_MYSQL_NATIVE ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_MYSQL_ODBC ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_MYSQL_JDBC ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_ORACLE_JDBC ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_ADABAS ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_CALC ] = FeatureSupport( AuthPwd ); - s_aSupport[ DST_DBASE ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_FLAT ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_JDBC ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_ODBC ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_ADO ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_MOZILLA ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_THUNDERBIRD ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_LDAP ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_OUTLOOK ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_OUTLOOKEXP ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_EVOLUTION ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_EVOLUTION_GROUPWISE ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_EVOLUTION_LDAP ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_KAB ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_MACAB ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_MSACCESS_2007 ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_EMBEDDED_HSQLDB ] = FeatureSupport( AuthNone ); - s_aSupport[ DST_USERDEFINE1 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE2 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE3 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE4 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE5 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE6 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE7 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE8 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE9 ] = FeatureSupport( AuthUserPwd ); - s_aSupport[ DST_USERDEFINE10 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_MSACCESS ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_ADABAS ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_CALC ] = FeatureSupport( AuthPwd ); + s_aSupport[ ::dbaccess::DST_DBASE ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_FLAT ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_JDBC ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_ODBC ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_ADO ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_MOZILLA ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_THUNDERBIRD ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_LDAP ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_OUTLOOK ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_OUTLOOKEXP ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_EVOLUTION ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_EVOLUTION_GROUPWISE ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_EVOLUTION_LDAP ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_KAB ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_MACAB ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_MSACCESS_2007 ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_EMBEDDED_HSQLDB ] = FeatureSupport( AuthNone ); + s_aSupport[ ::dbaccess::DST_USERDEFINE1 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE2 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE3 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE4 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE5 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE6 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE7 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE8 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE9 ] = FeatureSupport( AuthUserPwd ); + s_aSupport[ ::dbaccess::DST_USERDEFINE10 ] = FeatureSupport( AuthUserPwd ); } return s_aSupport[ _eType ].eAuthentication; } @@ -209,16 +211,16 @@ namespace dbaui class DataSourceMetaData_Impl { public: - DataSourceMetaData_Impl( DATASOURCE_TYPE _eType ); + DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType ); - inline DATASOURCE_TYPE getType() const { return m_eType; } + inline ::dbaccess::DATASOURCE_TYPE getType() const { return m_eType; } private: - DATASOURCE_TYPE m_eType; + ::dbaccess::DATASOURCE_TYPE m_eType; }; //-------------------------------------------------------------------- - DataSourceMetaData_Impl::DataSourceMetaData_Impl( DATASOURCE_TYPE _eType ) + DataSourceMetaData_Impl::DataSourceMetaData_Impl( ::dbaccess::DATASOURCE_TYPE _eType ) :m_eType( _eType ) { } @@ -227,7 +229,7 @@ namespace dbaui //= DataSourceMetaData //==================================================================== //-------------------------------------------------------------------- - DataSourceMetaData::DataSourceMetaData( DATASOURCE_TYPE _eType ) + DataSourceMetaData::DataSourceMetaData( ::dbaccess::DATASOURCE_TYPE _eType ) :m_pImpl( new DataSourceMetaData_Impl( _eType ) ) { } @@ -250,7 +252,7 @@ namespace dbaui } //-------------------------------------------------------------------- - AuthenticationMode DataSourceMetaData::getAuthentication( DATASOURCE_TYPE _eType ) + AuthenticationMode DataSourceMetaData::getAuthentication( ::dbaccess::DATASOURCE_TYPE _eType ) { return getAuthenticationMode( _eType ); } diff --git a/dbaccess/source/ui/misc/dsntypes.cxx b/dbaccess/source/ui/misc/dsntypes.cxx index 45aad375b52f..e69de29bb2d1 100644 --- a/dbaccess/source/ui/misc/dsntypes.cxx +++ b/dbaccess/source/ui/misc/dsntypes.cxx @@ -1,732 +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: dsntypes.cxx,v $ - * $Revision: 1.41 $ - * - * 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" -#ifndef _DBAUI_DSNTYPES_HXX_ -#include "dsntypes.hxx" -#endif -#ifndef _DBU_MISC_HRC_ -#include "dbu_misc.hrc" -#endif -#ifndef _DBU_MISCRES_HRC_ -#include "dbumiscres.hrc" -#endif -#ifndef _UNOTOOLS_CONFIGNODE_HXX_ -#include <unotools/confignode.hxx> -#endif -#ifndef DBAUI_TOOLS_HXX -#include "UITools.hxx" -#endif -#ifndef _TOOLS_RC_HXX -#include <tools/rc.hxx> -#endif -// --- needed because of the solar mutex -#ifndef _VOS_MUTEX_HXX_ -#include <vos/mutex.hxx> -#endif -#ifndef _SV_SVAPP_HXX -#include <vcl/svapp.hxx> -#endif -#ifndef _OSL_FILE_HXX_ -#include <osl/file.hxx> -#endif -// --- -#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC -#include "dbustrings.hrc" -#endif -#ifndef _DBAUI_MODULE_DBU_HXX_ -#include "moduledbu.hxx" -#endif -#include <comphelper/documentconstants.hxx> -//......................................................................... -namespace dbaui -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::sdbc; - - namespace - { - void lcl_extractHostAndPort(const String& _sUrl,String& _sHostname,sal_Int32& _nPortNumber) - { - if ( _sUrl.GetTokenCount(':') >= 2 ) - { - _sHostname = _sUrl.GetToken(0,':'); - _nPortNumber = _sUrl.GetToken(1,':').ToInt32(); - } - } - class ODataSourceTypeStringListResource : public Resource - { - ::std::vector<String> m_aStrings; - public: - ODataSourceTypeStringListResource(USHORT _nResId ) : Resource(ModuleRes(_nResId)) - { - m_aStrings.reserve(STR_END); - for (int i = STR_MYSQL_ODBC; i < STR_END ; ++i) - { - m_aStrings.push_back(String(ModuleRes(sal::static_int_cast<USHORT>(i)))); - } - - } - ~ODataSourceTypeStringListResource() - { - FreeResource(); - } - /** fill the vector with our readed strings - @param _rToFill - Vector to fill. - */ - inline void fill( ::std::vector<String>& _rToFill ) - { - _rToFill = m_aStrings; - } - - - /** returns the String with a given resource id - @param _nResId - The resource id. It will not be checked if this id exists. - - @return String - The string. - */ - String getString(USHORT _nResId) - { - return String(ModuleRes(_nResId)); - } - }; - } -//========================================================================= -//= ODsnTypeCollection -//========================================================================= -DBG_NAME(ODsnTypeCollection) -//------------------------------------------------------------------------- -ODsnTypeCollection::ODsnTypeCollection() -#ifdef DBG_UTIL -:m_nLivingIterators(0) -#endif -{ - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - DBG_CTOR(ODsnTypeCollection,NULL); - ODataSourceTypeStringListResource aTypes(RSC_DATASOURCE_TYPES); - aTypes.fill(m_aDsnPrefixes); - - ODataSourceTypeStringListResource aDisplayNames(RSC_DATASOURCE_TYPE_UINAMES); - aDisplayNames.fill(m_aDsnTypesDisplayNames); - - - DBG_ASSERT(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(), - "ODsnTypeCollection::ODsnTypeCollection : invalid resources !"); - String sCurrentType; - - for (StringVector::iterator aIter = m_aDsnPrefixes.begin();aIter != m_aDsnPrefixes.end();++aIter) - { - m_aDsnTypes.push_back(implDetermineType(*aIter)); - } -} - -//------------------------------------------------------------------------- -ODsnTypeCollection::~ODsnTypeCollection() -{ - DBG_DTOR(ODsnTypeCollection,NULL); - DBG_ASSERT(0 == m_nLivingIterators, "ODsnTypeCollection::~ODsnTypeCollection : there are still living iterator objects!"); -} -// ----------------------------------------------------------------------------- -void ODsnTypeCollection::initUserDriverTypes(const Reference< XMultiServiceFactory >& _rxORB) -{ - // read the user driver out of the configuration - // the config node where all pooling relevant info are stored under - ::utl::OConfigurationTreeRoot aUserDefinedDriverRoot = ::utl::OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, ::dbaui::getUserDefinedDriverNodeName(), -1, ::utl::OConfigurationTreeRoot::CM_READONLY); - - if ( aUserDefinedDriverRoot.isValid() ) - { - Sequence< ::rtl::OUString > aDriverKeys = aUserDefinedDriverRoot.getNodeNames(); - const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray(); - const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (sal_Int32 i=0;pDriverKeys != pDriverKeysEnd && i <= DST_USERDEFINE10; ++pDriverKeys) - { - ::utl::OConfigurationNode aThisDriverSettings = aUserDefinedDriverRoot.openNode(*pDriverKeys); - if ( aThisDriverSettings.isValid() ) - { - // read the needed information - ::rtl::OUString sDsnPrefix,sDsnTypeDisplayName,sExtension; - aThisDriverSettings.getNodeValue(getDriverTypeDisplayNodeName()) >>= sDsnTypeDisplayName; - aThisDriverSettings.getNodeValue(getDriverDsnPrefixNodeName()) >>= sDsnPrefix; - aThisDriverSettings.getNodeValue(getDriverExtensionNodeName()) >>= sExtension; - - m_aDsnTypesDisplayNames.push_back(sDsnTypeDisplayName); - m_aDsnPrefixes.push_back(sDsnPrefix); - m_aDsnTypes.push_back(static_cast<DATASOURCE_TYPE>(DST_USERDEFINE1 + i++)); - m_aUserExtensions.push_back(sExtension); - } - } - } -} - -//------------------------------------------------------------------------- -DATASOURCE_TYPE ODsnTypeCollection::getType(const String& _rDsn) const -{ - DATASOURCE_TYPE eType = DST_UNKNOWN; - // look for user defined driver types - StringVector::const_iterator aIter = m_aDsnPrefixes.begin(); - StringVector::const_iterator aEnd = m_aDsnPrefixes.end(); - for (; aIter != aEnd; ++aIter) - { - if ( _rDsn.Len() >= aIter->Len() && aIter->EqualsIgnoreCaseAscii(_rDsn,0, aIter->Len()) ) - { - size_t nPos = (aIter - m_aDsnPrefixes.begin()); - if ( nPos < m_aDsnTypes.size() ) - { - eType = m_aDsnTypes[nPos]; - break; - } - } - } - return eType; -} - -//------------------------------------------------------------------------- -String ODsnTypeCollection::getTypeDisplayName(DATASOURCE_TYPE _eType) const -{ - String sDisplayName; - - sal_Int32 nIndex = implDetermineTypeIndex(_eType); - if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnTypesDisplayNames.size())) - sDisplayName = m_aDsnTypesDisplayNames[nIndex]; - - return sDisplayName; -} - -//------------------------------------------------------------------------- -String ODsnTypeCollection::getDatasourcePrefix(DATASOURCE_TYPE _eType) const -{ - String sPrefix; - sal_Int32 nIndex = implDetermineTypeIndex(_eType); - if ((nIndex >= 0) && (nIndex < (sal_Int32)m_aDsnPrefixes.size())) - sPrefix = m_aDsnPrefixes[nIndex]; - - return sPrefix; -} - -//------------------------------------------------------------------------- -String ODsnTypeCollection::cutPrefix(const String& _rDsn) const -{ - DATASOURCE_TYPE eType = getType(_rDsn); - String sPrefix = getDatasourcePrefix(eType); - return _rDsn.Copy(sPrefix.Len()); -} -// ----------------------------------------------------------------------------- -String ODsnTypeCollection::getMediaType(DATASOURCE_TYPE _eType) const -{ - String sRet; - switch (_eType) - { - case DST_DBASE: - sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/dbase")); - break; - case DST_FLAT: - sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("text/csv")); - break; - case DST_CALC: - sRet = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET; - break; - case DST_MSACCESS: - case DST_MSACCESS_2007: - sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("application/msaccess")); - break; - default: - break; - } - return sRet; -} -// ----------------------------------------------------------------------------- -String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const String& _sMediaType,const String& _sExtension) -{ - ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("sdbc:")); - if ( _sMediaType.EqualsIgnoreCaseAscii( "text/csv" ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("flat:")); - } - else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/dbase" ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbase:")); - } - else if ( _sMediaType.EqualsIgnoreCaseAscii( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) - { - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("calc:")); - } - else if ( _sMediaType.EqualsIgnoreCaseAscii( "application/msaccess" ) ) - { - if ( _sExtension.EqualsIgnoreCaseAscii( "mdb" ) ) - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=")); - else - sURL += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")); - } - return sURL; -} -// ----------------------------------------------------------------------------- -void ODsnTypeCollection::extractHostNamePort(const String& _rDsn,String& _sDatabaseName,String& _rsHostname,sal_Int32& _nPortNumber) const -{ - DATASOURCE_TYPE eType = getType(_rDsn); - String sUrl = cutPrefix(_rDsn); - switch( eType ) - { - case DST_ORACLE_JDBC: - lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber); - if ( !_rsHostname.Len() && sUrl.GetTokenCount(':') == 2 ) - { - _nPortNumber = -1; - _rsHostname = sUrl.GetToken(0,':'); - } - if ( _rsHostname.Len() ) - _rsHostname = _rsHostname.GetToken(_rsHostname.GetTokenCount('@') - 1,'@'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':'); - break; - case DST_LDAP: - lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber); - break; - case DST_ADABAS: - if ( sUrl.GetTokenCount(':') == 2 ) - _rsHostname = sUrl.GetToken(0,':'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount(':') - 1,':'); - break; - case DST_MYSQL_NATIVE: - case DST_MYSQL_JDBC: - { - lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber); - - if ( _nPortNumber == -1 && !_rsHostname.Len() && sUrl.GetTokenCount('/') == 2 ) - _rsHostname = sUrl.GetToken(0,'/'); - _sDatabaseName = sUrl.GetToken(sUrl.GetTokenCount('/') - 1,'/'); - } - break; - case DST_MSACCESS: - case DST_MSACCESS_2007: - { - ::rtl::OUString sNewFileName; - if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None ) - { - _sDatabaseName = sNewFileName; - } - } - break; - default: - break; - } -} - -//------------------------------------------------------------------------- -sal_Bool ODsnTypeCollection::isFileSystemBased(DATASOURCE_TYPE _eType) const -{ - switch (_eType) - { - case DST_DBASE: - case DST_FLAT: - case DST_CALC: - case DST_MSACCESS: - case DST_MSACCESS_2007: - return sal_True; - - case DST_USERDEFINE1: - case DST_USERDEFINE2: - case DST_USERDEFINE3: - case DST_USERDEFINE4: - case DST_USERDEFINE5: - case DST_USERDEFINE6: - case DST_USERDEFINE7: - case DST_USERDEFINE8: - case DST_USERDEFINE9: - case DST_USERDEFINE10: - { - StringVector::size_type nPos = static_cast<sal_Int16>(_eType-DST_USERDEFINE1); - return nPos < m_aUserExtensions.size() && m_aUserExtensions[nPos].Len() != 0; - } - default: - return sal_False; - } -} - - -sal_Bool ODsnTypeCollection::supportsTableCreation(DATASOURCE_TYPE _eType) -{ - BOOL bSupportsTableCreation; - switch( _eType ) - { - case DST_MOZILLA: - case DST_OUTLOOK: - case DST_OUTLOOKEXP: - case DST_FLAT: - case DST_EVOLUTION: - case DST_EVOLUTION_GROUPWISE: - case DST_EVOLUTION_LDAP: - case DST_KAB: - case DST_THUNDERBIRD: - case DST_CALC: - bSupportsTableCreation = FALSE; - break; - case DST_DBASE: - case DST_ADABAS: - case DST_ADO: - case DST_MSACCESS: - case DST_MSACCESS_2007: - case DST_MYSQL_ODBC: - case DST_ODBC: - case DST_MYSQL_JDBC: - case DST_MYSQL_NATIVE: - case DST_ORACLE_JDBC: - case DST_LDAP: - case DST_JDBC: - default: - bSupportsTableCreation = TRUE; - break; - } - return bSupportsTableCreation; -} -// ----------------------------------------------------------------------------- -sal_Bool ODsnTypeCollection::supportsBrowsing(DATASOURCE_TYPE _eType) -{ - sal_Bool bEnableBrowseButton = sal_False; - switch( _eType ) - { - case DST_DBASE: - case DST_FLAT: - case DST_CALC: - case DST_ADABAS: - case DST_ADO: - case DST_MSACCESS: - case DST_MSACCESS_2007: - case DST_MYSQL_ODBC: - case DST_ODBC: - case DST_MOZILLA: - case DST_THUNDERBIRD: - bEnableBrowseButton = TRUE; - break; - case DST_MYSQL_NATIVE: - case DST_MYSQL_JDBC: - case DST_ORACLE_JDBC: - case DST_LDAP: - case DST_OUTLOOK: - case DST_OUTLOOKEXP: - case DST_JDBC: - case DST_EVOLUTION: - case DST_EVOLUTION_GROUPWISE: - case DST_EVOLUTION_LDAP: - case DST_KAB: - bEnableBrowseButton = FALSE; - break; - default: - bEnableBrowseButton = getTypeExtension(_eType).Len() != 0; - break; - } - return bEnableBrowseButton; -} - - -//------------------------------------------------------------------------- -DATASOURCE_TYPE ODsnTypeCollection::implDetermineType(const String& _rDsn) const -{ - sal_uInt16 nSeparator = _rDsn.Search((sal_Unicode)':'); - if (STRING_NOTFOUND == nSeparator) - { - // there should be at least one such separator - DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the colon !"); - return DST_UNKNOWN; - } - // find first : - sal_uInt16 nOracleSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1); - if ( nOracleSeparator != STRING_NOTFOUND ) - { - nOracleSeparator = _rDsn.Search((sal_Unicode)':', nOracleSeparator + 1); - if (nOracleSeparator != STRING_NOTFOUND && _rDsn.EqualsIgnoreCaseAscii("jdbc:oracle:thin", 0, nOracleSeparator)) - return DST_ORACLE_JDBC; - } - - if (_rDsn.EqualsIgnoreCaseAscii("jdbc", 0, nSeparator)) - return DST_JDBC; - - // find second : - nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1); - if (STRING_NOTFOUND == nSeparator) - { - // at the moment only jdbc is allowed to have just one separator - DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the second colon !"); - return DST_UNKNOWN; - } - - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:adabas", 0, nSeparator)) - return DST_ADABAS; - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:odbc", 0, nSeparator)) - return DST_ODBC; - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:dbase", 0, nSeparator)) - return DST_DBASE; - - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:ado:", 0, nSeparator)) - { - nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1); - if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access",0, nSeparator) ) - { - nSeparator = _rDsn.Search((sal_Unicode)';', nSeparator + 1); - if (STRING_NOTFOUND != nSeparator && _rDsn.EqualsIgnoreCaseAscii("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0",0, nSeparator) ) - return DST_MSACCESS_2007; - - return DST_MSACCESS; - } - return DST_ADO; - } - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:flat:", 0, nSeparator)) - return DST_FLAT; - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:calc:", 0, nSeparator)) - return DST_CALC; - if ( ( 11 <= nSeparator) && _rDsn.EqualsIgnoreCaseAscii("sdbc:mysqlc:", 0, nSeparator)) - return DST_MYSQL_NATIVE; - - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:embedded:hsqldb", 0, _rDsn.Len())) - return DST_EMBEDDED_HSQLDB; - - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:address:", 0, nSeparator)) - { - ++nSeparator; - if (_rDsn.EqualsIgnoreCaseAscii("mozilla:", nSeparator,_rDsn.Len() - nSeparator)) - return DST_MOZILLA; - if (_rDsn.EqualsIgnoreCaseAscii("thunderbird:", nSeparator,_rDsn.Len() - nSeparator)) - return DST_THUNDERBIRD; - if (_rDsn.EqualsIgnoreCaseAscii("ldap:", nSeparator,_rDsn.Len() - nSeparator)) - return DST_LDAP; - if (_rDsn.EqualsIgnoreCaseAscii("outlook", nSeparator,_rDsn.Len() - nSeparator)) - return DST_OUTLOOK; - if (_rDsn.EqualsIgnoreCaseAscii("outlookexp", nSeparator,_rDsn.Len() - nSeparator)) - return DST_OUTLOOKEXP; - if (_rDsn.EqualsIgnoreCaseAscii("evolution:ldap", nSeparator,_rDsn.Len() - nSeparator)) - return DST_EVOLUTION_LDAP; - if (_rDsn.EqualsIgnoreCaseAscii("evolution:groupwise", nSeparator,_rDsn.Len() - nSeparator)) - return DST_EVOLUTION_GROUPWISE; - if (_rDsn.EqualsIgnoreCaseAscii("evolution:local", nSeparator,_rDsn.Len() - nSeparator)) - return DST_EVOLUTION; - if (_rDsn.EqualsIgnoreCaseAscii("kab", nSeparator,_rDsn.Len() - nSeparator)) - return DST_KAB; - if (_rDsn.EqualsIgnoreCaseAscii("macab", nSeparator,_rDsn.Len() - nSeparator)) - return DST_MACAB; - } - - // find third : - nSeparator = _rDsn.Search((sal_Unicode)':', nSeparator + 1); - if (STRING_NOTFOUND == nSeparator) - { - DBG_ERROR("ODsnTypeCollection::implDetermineType : missing the third colon !"); - return DST_UNKNOWN; - } - - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:odbc", 0, nSeparator)) - return DST_MYSQL_ODBC; - if (_rDsn.EqualsIgnoreCaseAscii("sdbc:mysql:jdbc", 0, nSeparator)) - return DST_MYSQL_JDBC; - - DBG_ERROR("ODsnTypeCollection::implDetermineType : unrecognized data source type !"); - return DST_UNKNOWN; -} -// ----------------------------------------------------------------------------- -sal_Int32 ODsnTypeCollection::implDetermineTypeIndex(DATASOURCE_TYPE _eType) const -{ - DBG_ASSERT( - (m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size()) - && (m_aDsnTypesDisplayNames.size() == m_aDsnTypes.size()), - "ODsnTypeCollection::implDetermineTypeIndex : inconsistent structures !"); - - // the type of the datasource described by the DSN string - if (DST_UNKNOWN == _eType) - { - return -1; - } - - // search this type in our arrays - sal_Int32 nIndex = 0; - ConstTypeVectorIterator aSearch = m_aDsnTypes.begin(); - - for (; aSearch != m_aDsnTypes.end(); ++nIndex, ++aSearch) - if (*aSearch == _eType) - return nIndex; - - DBG_ERROR("ODsnTypeCollection::implDetermineTypeIndex : recognized the DSN schema, but did not find the type!"); - return -1; -} -// ----------------------------------------------------------------------------- -Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( DATASOURCE_TYPE _eType ) const -{ - Sequence< PropertyValue > aSettings; - - switch ( _eType ) - { - case DST_EMBEDDED_HSQLDB: - aSettings.realloc( 3 ); - - aSettings[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoIncrementCreation" ) ); - aSettings[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IDENTITY" ) ); - - aSettings[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoRetrievingStatement" ) ); - aSettings[1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CALL IDENTITY()" ) ); - - aSettings[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutoRetrievingEnabled" ) ); - aSettings[2].Value <<= (sal_Bool)sal_True; - break; - - default: - DBG_ERROR( "ODsnTypeCollection::getDefaultDBSettings: type is unsupported by this method!" ); - break; - } - - return aSettings; -} - -// ----------------------------------------------------------------------------- -String ODsnTypeCollection::getTypeExtension(DATASOURCE_TYPE _eType) const -{ - StringVector::size_type nPos = static_cast<sal_uInt16>(_eType-DST_USERDEFINE1); - return nPos < m_aUserExtensions.size() ? m_aUserExtensions[nPos] : String(); -} -//------------------------------------------------------------------------- -ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const -{ - return TypeIterator(this, 0); -} - -//------------------------------------------------------------------------- -ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const -{ - return TypeIterator(this, m_aDsnTypes.size()); -} - -//========================================================================= -//= ODsnTypeCollection::TypeIterator -//========================================================================= -//------------------------------------------------------------------------- -ODsnTypeCollection::TypeIterator::TypeIterator(const ODsnTypeCollection* _pContainer, sal_Int32 _nInitialPos) - :m_pContainer(_pContainer) - ,m_nPosition(_nInitialPos) -{ - DBG_ASSERT(m_pContainer, "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!"); -#ifdef DBG_UTIL - ++const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators; -#endif -} - -//------------------------------------------------------------------------- -ODsnTypeCollection::TypeIterator::TypeIterator(const TypeIterator& _rSource) - :m_pContainer(_rSource.m_pContainer) - ,m_nPosition(_rSource.m_nPosition) -{ -#ifdef DBG_UTIL - ++const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators; -#endif -} - -//------------------------------------------------------------------------- -ODsnTypeCollection::TypeIterator::~TypeIterator() -{ -#ifdef DBG_UTIL - --const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators; -#endif -} - -//------------------------------------------------------------------------- -DATASOURCE_TYPE ODsnTypeCollection::TypeIterator::getType() const -{ - DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::getType : invalid position!"); - return m_pContainer->m_aDsnTypes[m_nPosition]; -} - -//------------------------------------------------------------------------- -String ODsnTypeCollection::TypeIterator::getDisplayName() const -{ - DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypesDisplayNames.size(), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!"); - return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition]; -} - -//------------------------------------------------------------------------- -const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator++() -{ - DBG_ASSERT(m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size(), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!"); - if (m_nPosition < (sal_Int32)m_pContainer->m_aDsnTypes.size()) - ++m_nPosition; - return *this; -} - -//------------------------------------------------------------------------- -const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator--() -{ - DBG_ASSERT(m_nPosition >= 0, "ODsnTypeCollection::TypeIterator::operator-- : invalid position!"); - if (m_nPosition >= 0) - --m_nPosition; - return *this; -} - -//------------------------------------------------------------------------- -bool operator==(const ODsnTypeCollection::TypeIterator& lhs, const ODsnTypeCollection::TypeIterator& rhs) -{ - return (lhs.m_pContainer == rhs.m_pContainer) && (lhs.m_nPosition == rhs.m_nPosition); -} - -//========================================================================= -//= DbuTypeCollectionItem -//========================================================================= -TYPEINIT1(DbuTypeCollectionItem, SfxPoolItem); -//------------------------------------------------------------------------- -DbuTypeCollectionItem::DbuTypeCollectionItem(sal_Int16 _nWhich, ODsnTypeCollection* _pCollection) - :SfxPoolItem(_nWhich) - ,m_pCollection(_pCollection) -{ -} - -//------------------------------------------------------------------------- -DbuTypeCollectionItem::DbuTypeCollectionItem(const DbuTypeCollectionItem& _rSource) - :SfxPoolItem(_rSource) - ,m_pCollection(_rSource.getCollection()) -{ -} - -//------------------------------------------------------------------------- -int DbuTypeCollectionItem::operator==(const SfxPoolItem& _rItem) const -{ - DbuTypeCollectionItem* pCompare = PTR_CAST(DbuTypeCollectionItem, &_rItem); - return pCompare && (pCompare->getCollection() == getCollection()); -} - -//------------------------------------------------------------------------- -SfxPoolItem* DbuTypeCollectionItem::Clone(SfxItemPool* /*_pPool*/) const -{ - return new DbuTypeCollectionItem(*this); -} -//......................................................................... -} // namespace dbaui -//......................................................................... - diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index c91ffb0df93a..e84927a15690 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: linkeddocuments.cxx,v $ - * $Revision: 1.32 $ + * $Revision: 1.31.24.2 $ * * This file is part of OpenOffice.org. * @@ -123,10 +123,6 @@ #ifndef _EHDL_HXX #include <svtools/ehdl.hxx> #endif -// ----------------- -#ifndef _DBU_MISCRES_HRC_ -#include "dbumiscres.hrc" -#endif #ifndef _SVX_DATACCESSDESCRIPTOR_HXX_ #include <svx/dataaccessdescriptor.hxx> #endif diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk index 5cb04804274b..e5db6954ea4d 100644 --- a/dbaccess/source/ui/misc/makefile.mk +++ b/dbaccess/source/ui/misc/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.35 $ +# $Revision: 1.35.68.1 $ # # This file is part of OpenOffice.org. # @@ -80,7 +80,6 @@ SLOFILES= \ $(SLO)$/ToolBoxHelper.obj \ $(SLO)$/stringlistitem.obj \ $(SLO)$/charsets.obj \ - $(SLO)$/dsntypes.obj \ $(SLO)$/defaultobjectnamecheck.obj \ $(SLO)$/dsmeta.obj \ $(SLO)$/controllerframe.obj \ diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index 4275339c159a..2ef890cd8713 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: singledoccontroller.cxx,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.24.2 $ * * This file is part of OpenOffice.org. * @@ -155,13 +155,15 @@ namespace dbaui sal_Bool m_bSuspended; // is true when the controller was already suspended sal_Bool m_bEditable; // is the control readonly or not sal_Bool m_bModified; // is the data modified + bool m_bNotAttached; OSingleDocumentControllerImpl() :m_aDocScriptSupport() - ,m_nDocStartNumber(1) + ,m_nDocStartNumber(0) ,m_bSuspended( sal_False ) ,m_bEditable(sal_True) ,m_bModified(sal_False) + ,m_bNotAttached(true) { } @@ -288,6 +290,14 @@ namespace dbaui } OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: unable to obtain the data source object!" ); + if ( m_pImpl->m_bNotAttached ) + { + Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY ); + m_pImpl->m_nDocStartNumber = 1; + if ( xUntitledProvider.is() ) + m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) ); + } + // determine the availability of script support in our document. Our own XScriptInvocationContext // interface depends on this m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() ); @@ -471,9 +481,15 @@ namespace dbaui // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OSingleDocumentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException ) { + if ( !_rxModel.is() ) + return sal_False; if ( !OSingleDocumentController_Base::attachModel( _rxModel ) ) return sal_False; + m_pImpl->m_bNotAttached = false; + if ( m_pImpl->m_nDocStartNumber == 1 ) + releaseNumberForComponent(); + Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY ); m_pImpl->m_nDocStartNumber = 1; if ( xUntitledProvider.is() ) |