diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /dbaccess/source/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dbaccess/source/inc')
-rw-r--r-- | dbaccess/source/inc/OAuthenticationContinuation.hxx | 70 | ||||
-rw-r--r-- | dbaccess/source/inc/apitools.hxx | 234 | ||||
-rw-r--r-- | dbaccess/source/inc/dbu_reghelper.hxx | 39 | ||||
-rw-r--r-- | dbaccess/source/inc/dsntypes.hxx | 220 | ||||
-rw-r--r-- | dbaccess/source/inc/flt_reghelper.hxx | 39 | ||||
-rw-r--r-- | dbaccess/source/inc/registrationhelper.hxx | 112 | ||||
-rw-r--r-- | dbaccess/source/inc/stringconstants.hxx | 174 |
7 files changed, 888 insertions, 0 deletions
diff --git a/dbaccess/source/inc/OAuthenticationContinuation.hxx b/dbaccess/source/inc/OAuthenticationContinuation.hxx new file mode 100644 index 000000000..ce933b31b --- /dev/null +++ b/dbaccess/source/inc/OAuthenticationContinuation.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX +#define INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX + +#include <dbadllapi.hxx> + +#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> +#include <com/sun/star/ucb/RememberAuthentication.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <rtl/ustring.hxx> +#include <comphelper/interaction.hxx> + +namespace dbaccess +{ + +class OOO_DLLPUBLIC_DBA OAuthenticationContinuation : + public comphelper::OInteraction< css::ucb::XInteractionSupplyAuthentication > +{ + bool m_bRemberPassword : 1; // remember the password for this session ? + + bool m_bCanSetUserName; + OUString m_sUser; // the user + OUString m_sPassword; // the user's password + +public: + OAuthenticationContinuation(); + + sal_Bool SAL_CALL canSetRealm( ) override; + void SAL_CALL setRealm( const OUString& Realm ) override; + sal_Bool SAL_CALL canSetUserName( ) override; + void SAL_CALL setUserName( const OUString& UserName ) override; + sal_Bool SAL_CALL canSetPassword( ) override; + void SAL_CALL setPassword( const OUString& Password ) override; + css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL getRememberPasswordModes( css::ucb::RememberAuthentication& Default ) override; + void SAL_CALL setRememberPassword( css::ucb::RememberAuthentication Remember ) override; + sal_Bool SAL_CALL canSetAccount( ) override; + void SAL_CALL setAccount( const OUString& Account ) override; + css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL getRememberAccountModes( css::ucb::RememberAuthentication& Default ) override; + void SAL_CALL setRememberAccount( css::ucb::RememberAuthentication Remember ) override; + + void setCanChangeUserName( bool bVal ) { m_bCanSetUserName = bVal; } + const OUString& getUser() const { return m_sUser; } + const OUString& getPassword() const { return m_sPassword; } + bool getRememberPassword() const { return m_bRemberPassword; } +}; + +} // namespace dbaccess + +#endif // INCLUDED_DBACCESS_SOURCE_INC_OAUTHENTICATIONCONTINUATION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx new file mode 100644 index 000000000..725cebd0b --- /dev/null +++ b/dbaccess/source/inc/apitools.hxx @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX +#define INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX + +#include <sal/config.h> + +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <cppuhelper/component.hxx> +#include <osl/mutex.hxx> +#include <osl/diagnose.h> +#include <comphelper/sequence.hxx> +#include <strings.hxx> + +// OSubComponent - a component which holds a hard ref to its parent +// and is been hold itself (by the parent) with a weak ref +class OSubComponent : public ::cppu::OComponentHelper +{ +protected: + // the parent must support the tunnel implementation + css::uno::Reference< css::uno::XInterface > m_xParent; + virtual ~OSubComponent() override; + +public: + OSubComponent(::osl::Mutex& _rMutex, + const css::uno::Reference< css::uno::XInterface >& _xParent); + +// css::lang::XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + +// css::uno::XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + virtual void SAL_CALL release() throw() override; + + operator css::uno::Reference< css::uno::XInterface > () const + { return static_cast<css::uno::XWeak *>(const_cast<OSubComponent *>(this)); } + +}; + +// helper for implementing the XServiceInfo interface + +// (internal - not to be used outside - usually) +#define IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ + OUString SAL_CALL classname::getImplementationName( ) \ + { \ + return implasciiname; \ + } \ + +#define IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname) \ + OUString SAL_CALL classname::getImplementationName( ) \ + { \ + return getImplementationName_Static(); \ + } \ + OUString classname::getImplementationName_Static( ) \ + { \ + return implasciiname; \ + } \ + +#define IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ + sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) \ + { \ + const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames()); \ + for (const OUString& s : aSupported) \ + if (s == _rServiceName) \ + return true; \ + \ + return false; \ + } \ + +#define IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(classname, serviceasciiname) \ + css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \ + { \ + return getSupportedServiceNames_Static(); \ + } \ + css::uno::Sequence< OUString > classname::getSupportedServiceNames_Static( ) \ + { \ + return { serviceasciiname }; \ + } \ + +#define IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1, serviceasciiname2) \ + css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \ + { \ + return getSupportedServiceNames_Static(); \ + } \ + css::uno::Sequence< OUString > classname::getSupportedServiceNames_Static( ) \ + { \ + return { serviceasciiname1, serviceasciiname2 }; \ + } \ + +#define IMPLEMENT_SERVICE_INFO1(classname, implasciiname, serviceasciiname) \ + IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ + IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ + css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \ + { \ + return { serviceasciiname }; \ + } \ + + +#define IMPLEMENT_SERVICE_INFO2(classname, implasciiname, serviceasciiname1, serviceasciiname2) \ + IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ + IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ + css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \ + { \ + return { serviceasciiname1, serviceasciiname2 }; \ + } + + +#define IMPLEMENT_SERVICE_INFO2_STATIC(classname, implasciiname, serviceasciiname1, serviceasciiname2) \ + IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(classname, implasciiname) \ + IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ + IMPLEMENT_SERVICE_INFO_GETSUPPORTED2_STATIC(classname, serviceasciiname1,serviceasciiname2) \ + css::uno::Reference< css::uno::XInterface > \ + classname::Create(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxORB) \ + { \ + return static_cast< XServiceInfo* >(new classname(_rxORB)); \ + } + + +#define IMPLEMENT_SERVICE_INFO3(classname, implasciiname, serviceasciiname1, serviceasciiname2, serviceasciiname3) \ + IMPLEMENT_SERVICE_INFO_IMPLNAME(classname, implasciiname) \ + IMPLEMENT_SERVICE_INFO_SUPPORTS(classname) \ + css::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) \ + { \ + return { serviceasciiname1, serviceasciiname2, serviceasciiname3 }; \ + } \ + + +// XTypeProvider helpers + +#define IMPLEMENT_GETTYPES2( classname, baseclass1, baseclass2 ) \ + css::uno::Sequence< css::uno::Type > classname::getTypes() \ + { \ + return ::comphelper::concatSequences( \ + baseclass1::getTypes( ), \ + baseclass2::getTypes( ) \ + ); \ + } + +#define IMPLEMENT_GETTYPES3( classname, baseclass1, baseclass2, baseclass3 ) \ + css::uno::Sequence< css::uno::Type > classname::getTypes() \ + { \ + return ::comphelper::concatSequences( \ + baseclass1::getTypes( ), \ + baseclass2::getTypes( ), \ + baseclass3::getTypes( ) \ + ); \ + } + +// helper for declaring/implementing classes based on the OPropertyContainer and an OPropertyArrayUsageHelper +#define DECLARE_PROPERTYCONTAINER_DEFAULTS( ) \ + virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; \ + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; \ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override + +#define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname , baseclass1) \ + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL classname::getPropertySetInfo() \ + { \ + Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); \ + return xInfo; \ + } \ + ::cppu::IPropertyArrayHelper& classname::getInfoHelper() \ + { \ + return *baseclass1::getArrayHelper(); \ + } \ + ::cppu::IPropertyArrayHelper* classname::createArrayHelper( ) const \ + { \ + css::uno::Sequence< css::beans::Property > aProps; \ + describeProperties(aProps); \ + return new ::cppu::OPropertyArrayHelper(aProps); \ + } +#define IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( classname ) \ + IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2( classname, classname ) + +// helper for implementing the createArrayHelper +#define BEGIN_PROPERTY_SEQUENCE(count) \ + css::uno::Sequence< css::beans::Property> aDescriptor(count); \ + css::beans::Property* pDesc = aDescriptor.getArray(); \ + sal_Int32 nPos = 0; \ + +#define BEGIN_PROPERTY_HELPER(count) \ + BEGIN_PROPERTY_SEQUENCE(count) + +#define DECL_PROP_IMPL(varname, cpputype) \ + pDesc[nPos++] = css::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cpputype, + +#define DECL_PROP0(varname, type) \ + DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) 0) + +#define DECL_PROP0_BOOL(varname) \ + DECL_PROP_IMPL(varname, cppu::UnoType<bool>::get()) 0) + +#define DECL_PROP1(varname, type, attrib1) \ + DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1) + +#define DECL_PROP1_BOOL(varname, attrib1) \ + DECL_PROP_IMPL(varname, cppu::UnoType<bool>::get()) css::beans::PropertyAttribute::attrib1) + +#define DECL_PROP2_IFACE(varname, iface, attrib1, attrib2) \ + DECL_PROP_IMPL(varname, cppu::UnoType<iface>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2) + +#define DECL_PROP2(varname, type, attrib1, attrib2) \ + DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2) + +#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \ + DECL_PROP_IMPL(varname, cppu::UnoType<type>::get()) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2 | css::beans::PropertyAttribute::attrib3) + +#define END_PROPERTY_SEQUENCE() \ + OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?"); \ + +#define END_PROPERTY_HELPER() \ + END_PROPERTY_SEQUENCE() \ + return new ::cppu::OPropertyArrayHelper(aDescriptor); + +#endif // INCLUDED_DBACCESS_SOURCE_INC_APITOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/dbu_reghelper.hxx b/dbaccess/source/inc/dbu_reghelper.hxx new file mode 100644 index 000000000..1e105b25d --- /dev/null +++ b/dbaccess/source/inc/dbu_reghelper.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_DBU_REGHELPER_HXX +#define INCLUDED_DBACCESS_SOURCE_INC_DBU_REGHELPER_HXX + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <rtl/ustring.hxx> +#include <cppuhelper/factory.hxx> + +namespace dbaui +{ + + #define REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ + #include "registrationhelper.hxx" + #undef REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ + +} + +#endif // INCLUDED_DBACCESS_SOURCE_INC_DBU_REGHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx new file mode 100644 index 000000000..334b297b0 --- /dev/null +++ b/dbaccess/source/inc/dsntypes.hxx @@ -0,0 +1,220 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX +#define INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX + +#include <sal/config.h> + +#include <vector> + +#include <dbadllapi.hxx> +#include <connectivity/DriversConfig.hxx> + +namespace dbaccess +{ + +// DATASOURCE_TYPE +/// known datasource types +enum DATASOURCE_TYPE +{ + DST_MSACCESS = 1, + DST_MYSQL_ODBC = 2, + DST_MYSQL_JDBC = 3, + DST_ORACLE_JDBC = 4, + //5 was DST_ADABAS + DST_CALC = 6, + DST_DBASE = 7, + DST_FLAT = 8, + DST_JDBC = 9, + DST_ODBC = 10, + DST_ADO = 11, + DST_MOZILLA = 12, + DST_THUNDERBIRD = 13, + DST_LDAP = 14, + DST_OUTLOOK = 15, + DST_OUTLOOKEXP = 16, + DST_EVOLUTION = 17, + DST_EVOLUTION_GROUPWISE = 18, + DST_EVOLUTION_LDAP = 19, + DST_KAB = 20, + DST_MACAB = 21, + DST_MSACCESS_2007 = 22, + DST_EMBEDDED_HSQLDB = 23, + DST_MYSQL_NATIVE = 24, + DST_MYSQL_NATIVE_DIRECT = 25, + DST_FIREBIRD = 26, + DST_EMBEDDED_FIREBIRD = 27, + DST_POSTGRES = 28, + DST_WRITER = 29, + + DST_USERDEFINE1, /// first user defined driver + DST_USERDEFINE2, + DST_USERDEFINE3, + DST_USERDEFINE4, + DST_USERDEFINE5, + DST_USERDEFINE6, + DST_USERDEFINE7, + DST_USERDEFINE8, + DST_USERDEFINE9, + DST_USERDEFINE10, + + DST_UNKNOWN /// unrecognized type +}; + +#define PAGE_DBSETUPWIZARD_INTRO 0 +#define PAGE_DBSETUPWIZARD_DBASE 1 +#define PAGE_DBSETUPWIZARD_TEXT 2 +#define PAGE_DBSETUPWIZARD_MSACCESS 3 +#define PAGE_DBSETUPWIZARD_LDAP 4 +//5 was PAGE_DBSETUPWIZARD_ADABAS +#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6 +#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7 +#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8 +#define PAGE_DBSETUPWIZARD_ORACLE 9 +#define PAGE_DBSETUPWIZARD_JDBC 10 +#define PAGE_DBSETUPWIZARD_ADO 11 +#define PAGE_DBSETUPWIZARD_ODBC 12 +#define PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET 13 +#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14 +#define PAGE_DBSETUPWIZARD_FINAL 16 +#define PAGE_DBSETUPWIZARD_USERDEFINED 17 +#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18 + +// ODsnTypeCollection +class OOO_DLLPUBLIC_DBA ODsnTypeCollection final +{ + + std::vector<OUString> m_aDsnTypesDisplayNames; /// user readable names for the datasource types + std::vector<OUString> m_aDsnPrefixes; /// DSN prefixes which determine the type of a datasource + ::connectivity::DriversConfig m_aDriverConfig; + +#if OSL_DEBUG_LEVEL > 0 + sal_Int32 m_nLivingIterators; /// just for debugging reasons, counts the living iterators +#endif + +public: + class TypeIterator; + friend class ODsnTypeCollection::TypeIterator; + + ODsnTypeCollection(const css::uno::Reference< css::uno::XComponentContext >& _xContext); + ~ODsnTypeCollection(); + + /// get the datasource type display name from a DSN string + OUString getTypeDisplayName(const OUString& _sURL) const; + + /// on a given string, cut the type prefix and return the result + OUString cutPrefix(const OUString& _sURL) const; + + /// on a given string, return the type prefix + OUString getPrefix(const OUString& _sURL) const; + + /// determines whether there is a driver for the given URL prefix/pattern + bool hasDriver( const char* _pAsciiPattern ) const; + + /// on a given string, return the Java Driver Class + OUString getJavaDriverClass(const OUString& _sURL) const; + + /// returns the media type of a file based database + OUString getMediaType(const OUString& _sURL) const; + + /// returns the dsn prefix for a given media type + OUString getDatasourcePrefixFromMediaType(const OUString& _sMediaType, const OUString& _sExtension ); + + void extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rHostname,sal_Int32& _nPortNumber) const; + + /// check if the given data source allows creation of tables + bool supportsTableCreation(const OUString& _sURL) const; + + /// check if the given data source allows to show column description. + bool supportsColumnDescription(const OUString& _sURL) const; + + // check if a Browse button may be shown to insert connection url + bool supportsBrowsing(const OUString& _sURL) const; + + // check if a Create New Database button may be shown to insert connection url + bool supportsDBCreation(const OUString& _sURL) const; + + /// check if the given data source type is based on the file system - i.e. the URL is a prefix plus a file URL + bool isFileSystemBased(const OUString& _sURL) const; + + bool isConnectionUrlRequired(const OUString& _sURL) const; + + /// checks if the given data source type embeds its data into the database document + static bool isEmbeddedDatabase( const OUString& _sURL ); + + static OUString getEmbeddedDatabase(); + + // returns true when the properties dialog can be shown, otherwise false. + static bool isShowPropertiesEnabled( const OUString& _sURL ); + + /** returns default settings for newly created databases of the given type. + */ + css::uno::Sequence< css::beans::PropertyValue> + getDefaultDBSettings( const OUString& _sURL ) const; + + /// get access to the first element of the types collection + inline TypeIterator begin() const; + /// get access to the (last + 1st) element of the types collection + inline TypeIterator end() const; + + void fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const; + + DATASOURCE_TYPE determineType(const OUString& _rDsn) const; + + sal_Int32 getIndexOf(const OUString& _sURL) const; + sal_Int32 size() const; + OUString getType(const OUString& _sURL) const; +}; + +//- ODsnTypeCollection::TypeIterator +class OOO_DLLPUBLIC_DBA ODsnTypeCollection::TypeIterator +{ + friend class ODsnTypeCollection; + + friend bool OOO_DLLPUBLIC_DBA operator==(const TypeIterator& lhs, const TypeIterator& rhs); + friend bool OOO_DLLPUBLIC_DBA operator!=(const TypeIterator& lhs, const TypeIterator& rhs) { return !(lhs == rhs); } + +protected: + const ODsnTypeCollection* m_pContainer; + sal_Int32 m_nPosition; + +public: + TypeIterator(const TypeIterator& _rSource); + ~TypeIterator(); + + OUString const & getURLPrefix() const; + OUString const & getDisplayName() const; + + /// prefix increment + const TypeIterator& operator++(); + +protected: + TypeIterator(const ODsnTypeCollection* _pContainer, sal_Int32 _nInitialPos); +}; + + +inline ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const { return ODsnTypeCollection::TypeIterator(this, 0);} +inline ODsnTypeCollection::TypeIterator ODsnTypeCollection::end() const { return ODsnTypeCollection::TypeIterator(this, m_aDsnTypesDisplayNames.size());} + +} // namespace dbaccess + +#endif // INCLUDED_DBACCESS_SOURCE_INC_DSNTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/flt_reghelper.hxx b/dbaccess/source/inc/flt_reghelper.hxx new file mode 100644 index 000000000..df43de320 --- /dev/null +++ b/dbaccess/source/inc/flt_reghelper.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_FLT_REGHELPER_HXX +#define INCLUDED_DBACCESS_SOURCE_INC_FLT_REGHELPER_HXX + +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <rtl/ustring.hxx> +#include <cppuhelper/factory.hxx> + +namespace dbaxml +{ + + #define REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ + #include "registrationhelper.hxx" + #undef REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ + +} + +#endif // INCLUDED_DBACCESS_SOURCE_INC_FLT_REGHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/registrationhelper.hxx b/dbaccess/source/inc/registrationhelper.hxx new file mode 100644 index 000000000..a90781887 --- /dev/null +++ b/dbaccess/source/inc/registrationhelper.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef REGISTRATIONHELPER_INCLUDED_INDIRECTLY_ +#error "don't include this file directly! use dbu_reghelper.hxx instead!" +#endif + +typedef css::uno::Reference< css::lang::XSingleServiceFactory > (*FactoryInstantiation) + ( + const css::uno::Reference< css::lang::XMultiServiceFactory >& _rServiceManager, + const OUString & _rComponentName, + ::cppu::ComponentInstantiation _pCreateFunction, + const css::uno::Sequence< OUString > & _rServiceNames, + rtl_ModuleCount* + ); + +class OModuleRegistration +{ + static css::uno::Sequence< OUString >* + s_pImplementationNames; + static css::uno::Sequence< css::uno::Sequence< OUString > >* + s_pSupportedServices; + static css::uno::Sequence< sal_Int64 >* + s_pCreationFunctionPointers; + static css::uno::Sequence< sal_Int64 >* + s_pFactoryFunctionPointers; + + // no direct instantiation, only static members/methods + OModuleRegistration() = delete; + +public: + /** register a component implementing a service with the given data. + @param _rImplementationName the implementation name of the component + @param _rServiceNames the services the component supports + @param _pCreateFunction a function for creating an instance of the component + @param _pFactoryFunction a function for creating a factory for that component + @see revokeComponent + */ + static void registerComponent( + const OUString& _rImplementationName, + const css::uno::Sequence< OUString >& _rServiceNames, + ::cppu::ComponentInstantiation _pCreateFunction, + FactoryInstantiation _pFactoryFunction); + + /** revoke the registration for the specified component + @param _rImplementationName the implementation name of the component + */ + static void revokeComponent( + const OUString& _rImplementationName); + + /** creates a Factory for the component with the given implementation name. Usually used from within component_getFactory. + @param _rxServiceManager a pointer to an XMultiServiceFactory interface as got in component_getFactory + @param _pImplementationName the implementation name of the component + @return the XInterface access to a factory for the component + */ + static css::uno::Reference< css::uno::XInterface > getComponentFactory( + const OUString& _rImplementationName, + const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxServiceManager + ); +}; + +template <class TYPE> +class OMultiInstanceAutoRegistration +{ +public: + /** assumed that the template argument has the three methods<BR> + <code>static OUString getImplementationName_Static()</code><BR> + <code>static css::uno::Sequence< OUString > getSupportedServiceNames_Static()</code><BR> + and<BR> + <code>static css::uno::Reference< css::uno::XInterface > + Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&)</code><BR> + the instantiation of this object will automatically register the class via <code>OModuleRegistration::registerComponent</code>. + The factory creation function used is <code>::cppu::createSingleFactory</code>.<BR> + */ + OMultiInstanceAutoRegistration(); + ~OMultiInstanceAutoRegistration(); +}; + +template <class TYPE> +OMultiInstanceAutoRegistration<TYPE>::OMultiInstanceAutoRegistration() +{ + OModuleRegistration::registerComponent( + TYPE::getImplementationName_Static(), + TYPE::getSupportedServiceNames_Static(), + TYPE::Create, + ::cppu::createSingleFactory + ); +} + +template <class TYPE> +OMultiInstanceAutoRegistration<TYPE>::~OMultiInstanceAutoRegistration() +{ + OModuleRegistration::revokeComponent(TYPE::getImplementationName_Static()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/inc/stringconstants.hxx b/dbaccess/source/inc/stringconstants.hxx new file mode 100644 index 000000000..9b7e732fe --- /dev/null +++ b/dbaccess/source/inc/stringconstants.hxx @@ -0,0 +1,174 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_DBACCESS_SOURCE_INC_STRINGCONSTANTS_HRC +#define INCLUDED_DBACCESS_SOURCE_INC_STRINGCONSTANTS_HRC + +// property ids + +#define PROPERTY_ID_TITLE 1 +#define PROPERTY_ID_URL 2 +#define PROPERTY_ID_INFO 4 +#define PROPERTY_ID_ISPASSWORDREQUIRED 5 +#define PROPERTY_ID_TABLEFILTER 6 +#define PROPERTY_ID_NAME 7 +#define PROPERTY_ID_SCHEMANAME 8 +#define PROPERTY_ID_CATALOGNAME 9 +#define PROPERTY_ID_PRIVILEGES 10 +#define PROPERTY_ID_ESCAPE_PROCESSING 11 +#define PROPERTY_ID_COMMAND 12 +#define PROPERTY_ID_TYPE 13 +#define PROPERTY_ID_TYPENAME 14 +#define PROPERTY_ID_PRECISION 15 +#define PROPERTY_ID_SCALE 16 +#define PROPERTY_ID_ISNULLABLE 17 +#define PROPERTY_ID_ISAUTOINCREMENT 18 +#define PROPERTY_ID_ISROWVERSION 19 +#define PROPERTY_ID_DESCRIPTION 20 +#define PROPERTY_ID_DEFAULTVALUE 21 +#define PROPERTY_ID_NUMBERFORMAT 22 +#define PROPERTY_ID_QUERYTIMEOUT 23 +#define PROPERTY_ID_MAXFIELDSIZE 24 +#define PROPERTY_ID_MAXROWS 25 +#define PROPERTY_ID_CURSORNAME 26 +#define PROPERTY_ID_RESULTSETCONCURRENCY 27 +#define PROPERTY_ID_RESULTSETTYPE 28 +#define PROPERTY_ID_FETCHDIRECTION 29 +#define PROPERTY_ID_FETCHSIZE 30 +#define PROPERTY_ID_USEBOOKMARKS 31 +#define PROPERTY_ID_ISSEARCHABLE 32 +#define PROPERTY_ID_ISCURRENCY 33 +#define PROPERTY_ID_ISSIGNED 34 +#define PROPERTY_ID_DISPLAYSIZE 35 +#define PROPERTY_ID_LABEL 36 +#define PROPERTY_ID_ISREADONLY 37 +#define PROPERTY_ID_ISWRITABLE 38 +#define PROPERTY_ID_ISDEFINITELYWRITABLE 39 +#define PROPERTY_ID_VALUE 40 +#define PROPERTY_ID_TABLENAME 41 +#define PROPERTY_ID_ISCASESENSITIVE 42 +#define PROPERTY_ID_SERVICENAME 43 +#define PROPERTY_ID_ISBOOKMARKABLE 44 +#define PROPERTY_ID_CANUPDATEINSERTEDROWS 45 +#define PROPERTY_ID_ISSET 46 +#define PROPERTY_ID_ISOUTPARAMETER 47 +#define PROPERTY_ID_NUMBERFORMATSSUPPLIER 48 +#define PROPERTY_ID_ISCALCULATED 49 +#define PROPERTY_ID_DATASOURCENAME 50 +#define PROPERTY_ID_TRANSACTIONISOLATION 51 +#define PROPERTY_ID_TYPEMAP 52 +#define PROPERTY_ID_USER 53 +#define PROPERTY_ID_PASSWORD 54 +#define PROPERTY_ID_COMMAND_TYPE 55 +#define PROPERTY_ID_ACTIVECOMMAND 56 +#define PROPERTY_ID_ACTIVE_CONNECTION 57 +#define PROPERTY_ID_FILTER 58 +#define PROPERTY_ID_APPLYFILTER 59 +#define PROPERTY_ID_ORDER 60 +#define PROPERTY_ID_ISMODIFIED 61 +#define PROPERTY_ID_ISNEW 62 +#define PROPERTY_ID_ROWCOUNT 63 +#define PROPERTY_ID_ISROWCOUNTFINAL 64 +#define PROPERTY_ID_HELPFILENAME 65 +#define PROPERTY_ID_REALNAME 66 +#define PROPERTY_ID_HIDDEN 67 +#define PROPERTY_ID_ALIGN 68 +#define PROPERTY_ID_WIDTH 69 +#define PROPERTY_ID_TABLETYPEFILTER 70 +#define PROPERTY_ID_DATABASE_LOCATION 71 +#define PROPERTY_ID_FONT 72 +#define PROPERTY_ID_ROW_HEIGHT 73 +#define PROPERTY_ID_TEXTCOLOR 74 +#define PROPERTY_ID_UPDATE_TABLENAME 75 +#define PROPERTY_ID_UPDATE_SCHEMANAME 76 +#define PROPERTY_ID_UPDATE_CATALOGNAME 77 +#define PROPERTY_ID_CONTROLMODEL 78 +#define PROPERTY_ID_RELATIVEPOSITION 79 +#define PROPERTY_ID_ISASCENDING 80 +#define PROPERTY_ID_RELATEDCOLUMN 81 +#define PROPERTY_ID_ISUNIQUE 82 +#define PROPERTY_ID_ISPRIMARYKEYINDEX 83 +#define PROPERTY_ID_IGNORERESULT 84 +#define PROPERTY_ID_DELETERULE 85 +#define PROPERTY_ID_UPDATERULE 86 +#define PROPERTY_ID_REFERENCEDTABLE 87 +#define PROPERTY_ID_REFERENCEDCOLUMN 88 +#define PROPERTY_ID_PARENTWINDOW 89 +#define PROPERTY_ID_SQLEXCEPTION 90 +#define PROPERTY_ID_ISHIDDEN 91 +#define PROPERTY_ID_SUPPRESSVERSIONCL 92 +#define PROPERTY_ID_LAYOUTINFORMATION 93 +#define PROPERTY_ID_TEXTLINECOLOR 94 +#define PROPERTY_ID_TEXTEMPHASIS 95 +#define PROPERTY_ID_TEXTRELIEF 96 +#define PROPERTY_ID_HELPTEXT 97 +#define PROPERTY_ID_CONTROLDEFAULT 98 +#define PROPERTY_ID_AUTOINCREMENTCREATION 99 +#define PROPERTY_ID_SPECIAL_OPTIONS 100 +#define PROPERTY_ID_FONTCHARWIDTH 101 +#define PROPERTY_ID_FONTCHARSET 102 +#define PROPERTY_ID_FONTFAMILY 103 +#define PROPERTY_ID_FONTHEIGHT 104 +#define PROPERTY_ID_FONTKERNING 105 +#define PROPERTY_ID_FONTNAME 106 +#define PROPERTY_ID_FONTORIENTATION 107 +#define PROPERTY_ID_FONTPITCH 108 +#define PROPERTY_ID_FONTSLANT 109 +#define PROPERTY_ID_FONTSTRIKEOUT 110 +#define PROPERTY_ID_FONTSTYLENAME 111 +#define PROPERTY_ID_FONTUNDERLINE 112 +#define PROPERTY_ID_FONTWEIGHT 113 +#define PROPERTY_ID_FONTWIDTH 114 +#define PROPERTY_ID_FONTWORDLINEMODE 115 +#define PROPERTY_ID_FONTTYPE 116 +#define PROPERTY_ID_PERSISTENT_NAME 117 +#define PROPERTY_ID_ORIGINAL 118 +#define PROPERTY_ID_TABSTOP 119 +#define PROPERTY_ID_DEFAULTCONTROL 120 +#define PROPERTY_ID_ENABLED 121 +#define PROPERTY_ID_BORDER 122 +#define PROPERTY_ID_COLUMN 123 +#define PROPERTY_ID_AS_TEMPLATE 124 +#define PROPERTY_ID_IS_FORM 125 +#define PROPERTY_ID_HAVING_CLAUSE 126 +#define PROPERTY_ID_GROUP_BY 127 +#define PROPERTY_ID_EDIT_WIDTH 128 +#define PROPERTY_ID_SETTINGS 129 +#define PROPERTY_ID_CONNECTION_RESOURCE 130 +#define PROPERTY_ID_RESULT_SET 131 +#define PROPERTY_ID_SELECTION 132 +#define PROPERTY_ID_BOOKMARK_SELECTION 133 +#define PROPERTY_ID_COLUMN_NAME 134 +#define PROPERTY_ID_CONNECTION_INFO 135 +#define PROPERTY_ID_HEADER_LINE 136 +#define PROPERTY_ID_FIELD_DELIMITER 137 +#define PROPERTY_ID_STRING_DELIMITER 138 +#define PROPERTY_ID_DECIMAL_DELIMITER 139 +#define PROPERTY_ID_THOUSAND_DELIMITER 140 +#define PROPERTY_ID_ENCODING 141 +#define PROPERTY_ID_HELP_URL 142 +#define PROPERTY_ID_PERSISTENT_PATH 143 +#define PROPERTY_ID_CURRENT_QUERY_DESIGN 144 +#define PROPERTY_ID_SINGLESELECTQUERYCOMPOSER 145 +#define PROPERTY_ID_PROPCHANGE_NOTIFY 146 +#define PROPERTY_ID_AUTOGROW 147 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |