LCOV - code coverage report
Current view: top level - dbaccess/source/inc - dsntypes.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef _DBACCESS_DSNTYPES_HXX_
      21                 :            : #define _DBACCESS_DSNTYPES_HXX_
      22                 :            : 
      23                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24                 :            : 
      25                 :            : #include <comphelper/stl_types.hxx>
      26                 :            : #include "dbadllapi.hxx"
      27                 :            : #include <tools/string.hxx>
      28                 :            : #include <connectivity/DriversConfig.hxx>
      29                 :            : 
      30                 :            : //.........................................................................
      31                 :            : namespace dbaccess
      32                 :            : {
      33                 :            : //.........................................................................
      34                 :            : 
      35                 :            : //=========================================================================
      36                 :            : //= DATASOURCE_TYPE
      37                 :            : //=========================================================================
      38                 :            : /// known datasource types
      39                 :            : enum DATASOURCE_TYPE
      40                 :            : {
      41                 :            :     DST_MSACCESS            =  1,
      42                 :            :     DST_MYSQL_ODBC          =  2,
      43                 :            :     DST_MYSQL_JDBC          =  3,
      44                 :            :     DST_ORACLE_JDBC         =  4,
      45                 :            :     //5 was DST_ADABAS
      46                 :            :     DST_CALC                =  6,
      47                 :            :     DST_DBASE               =  7,
      48                 :            :     DST_FLAT                =  8,
      49                 :            :     DST_JDBC                =  9,
      50                 :            :     DST_ODBC                = 10,
      51                 :            :     DST_ADO                 = 11,
      52                 :            :     DST_MOZILLA             = 12,
      53                 :            :      DST_THUNDERBIRD         = 13,
      54                 :            :     DST_LDAP                = 14,
      55                 :            :     DST_OUTLOOK             = 15,
      56                 :            :     DST_OUTLOOKEXP          = 16,
      57                 :            :     DST_EVOLUTION           = 17,
      58                 :            :     DST_EVOLUTION_GROUPWISE = 18,
      59                 :            :     DST_EVOLUTION_LDAP      = 19,
      60                 :            :      DST_KAB                 = 20,
      61                 :            :      DST_MACAB               = 21,
      62                 :            :     DST_MSACCESS_2007       = 22,
      63                 :            :      DST_EMBEDDED_HSQLDB    = 23,
      64                 :            :     DST_MYSQL_NATIVE        = 24,
      65                 :            :     DST_MYSQL_NATIVE_DIRECT = 25,
      66                 :            : 
      67                 :            :     DST_USERDEFINE1,    /// first user defined driver
      68                 :            :     DST_USERDEFINE2,
      69                 :            :     DST_USERDEFINE3,
      70                 :            :     DST_USERDEFINE4,
      71                 :            :     DST_USERDEFINE5,
      72                 :            :     DST_USERDEFINE6,
      73                 :            :     DST_USERDEFINE7,
      74                 :            :     DST_USERDEFINE8,
      75                 :            :     DST_USERDEFINE9,
      76                 :            :     DST_USERDEFINE10,
      77                 :            : 
      78                 :            : 
      79                 :            :     DST_UNKNOWN         /// unrecognized type
      80                 :            : };
      81                 :            : 
      82                 :            : #define PAGE_DBSETUPWIZARD_INTRO                     0
      83                 :            : #define PAGE_DBSETUPWIZARD_DBASE                     1
      84                 :            : #define PAGE_DBSETUPWIZARD_TEXT                      2
      85                 :            : #define PAGE_DBSETUPWIZARD_MSACCESS                  3
      86                 :            : #define PAGE_DBSETUPWIZARD_LDAP                      4
      87                 :            : //5 was PAGE_DBSETUPWIZARD_ADABAS
      88                 :            : #define PAGE_DBSETUPWIZARD_MYSQL_INTRO               6
      89                 :            : #define PAGE_DBSETUPWIZARD_MYSQL_JDBC                7
      90                 :            : #define PAGE_DBSETUPWIZARD_MYSQL_ODBC                8
      91                 :            : #define PAGE_DBSETUPWIZARD_ORACLE                    9
      92                 :            : #define PAGE_DBSETUPWIZARD_JDBC                      10
      93                 :            : #define PAGE_DBSETUPWIZARD_ADO                       11
      94                 :            : #define PAGE_DBSETUPWIZARD_ODBC                      12
      95                 :            : #define PAGE_DBSETUPWIZARD_SPREADSHEET               13
      96                 :            : #define PAGE_DBSETUPWIZARD_AUTHENTIFICATION          14
      97                 :            : #define PAGE_DBSETUPWIZARD_MOZILLA                   15
      98                 :            : #define PAGE_DBSETUPWIZARD_FINAL                     16
      99                 :            : #define PAGE_DBSETUPWIZARD_USERDEFINED               17
     100                 :            : #define PAGE_DBSETUPWIZARD_MYSQL_NATIVE              18
     101                 :            : 
     102                 :            : 
     103                 :            : //=========================================================================
     104                 :            : //= ODsnTypeCollection
     105                 :            : //=========================================================================
     106                 :            : class OOO_DLLPUBLIC_DBA ODsnTypeCollection
     107                 :            : {
     108                 :            : protected:
     109                 :            :     DECLARE_STL_VECTOR(String, StringVector);
     110                 :            : 
     111                 :            :     StringVector    m_aDsnTypesDisplayNames;    /// user readable names for the datasource types
     112                 :            :     StringVector    m_aDsnPrefixes;             /// DSN prefixes which determine the type of a datasource
     113                 :            :     ::connectivity::DriversConfig m_aDriverConfig;
     114                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
     115                 :            : 
     116                 :            : #if OSL_DEBUG_LEVEL > 0
     117                 :            :     sal_Int32       m_nLivingIterators;         /// just for debugging reasons, counts the living iterators
     118                 :            : #endif
     119                 :            : 
     120                 :            : public:
     121                 :            :     class TypeIterator;
     122                 :            :     friend class ODsnTypeCollection::TypeIterator;
     123                 :            : 
     124                 :            :     ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory);
     125                 :            :     ~ODsnTypeCollection();
     126                 :            : 
     127                 :            :     /// get the datasource type display name from a DSN string
     128                 :            :     String getTypeDisplayName(const ::rtl::OUString& _sURL) const;
     129                 :            : 
     130                 :            :     /// on a given string, cut the type prefix and return the result
     131                 :            :     String cutPrefix(const ::rtl::OUString& _sURL) const;
     132                 :            : 
     133                 :            :     /// on a given string, return the type prefix
     134                 :            :     String getPrefix(const ::rtl::OUString& _sURL) const;
     135                 :            : 
     136                 :            :     /// determines whether there is a driver for the given URL prefix/pattern
     137                 :            :     bool    hasDriver( const sal_Char* _pAsciiPattern ) const;
     138                 :            : 
     139                 :            :     /// on a given string, return the Java Driver Class
     140                 :            :     String getJavaDriverClass(const ::rtl::OUString& _sURL) const;
     141                 :            : 
     142                 :            :     /// returns the media type of a file based database
     143                 :            :     String getMediaType(const ::rtl::OUString& _sURL) const;
     144                 :            : 
     145                 :            :     /// returns the dsn prefix for a given media type
     146                 :            :     String getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension = ::rtl::OUString() );
     147                 :            : 
     148                 :            :     void extractHostNamePort(const ::rtl::OUString& _rDsn,String& _sDatabaseName,String& _rHostname,sal_Int32& _nPortNumber) const;
     149                 :            : 
     150                 :            :     /// check if the given data source allows creation of tables
     151                 :            :     sal_Bool supportsTableCreation(const ::rtl::OUString& _sURL) const;
     152                 :            : 
     153                 :            :     /// check if the given data source allows to show column description.
     154                 :            :     sal_Bool supportsColumnDescription(const ::rtl::OUString& _sURL) const;
     155                 :            : 
     156                 :            :     // check if a Browse button may be shown to insert connection url
     157                 :            :     sal_Bool supportsBrowsing(const ::rtl::OUString& _sURL) const;
     158                 :            : 
     159                 :            :     /// check if the given data source tyoe is based on the file system - i.e. the URL is a prefix plus a file URL
     160                 :            :     sal_Bool isFileSystemBased(const ::rtl::OUString& _sURL) const;
     161                 :            : 
     162                 :            :     bool isConnectionUrlRequired(const ::rtl::OUString& _sURL) const;
     163                 :            : 
     164                 :            :     /// checks if the given data source type embeds its data into the database document
     165                 :            :     bool isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const;
     166                 :            : 
     167                 :            :     ::rtl::OUString getEmbeddedDatabase() const;
     168                 :            : 
     169                 :            :     // returns true when the properties dialog can be shown, otherwise false.
     170                 :            :     bool isShowPropertiesEnabled( const ::rtl::OUString& _sURL ) const;
     171                 :            : 
     172                 :            :     /** returns default settings for newly created databases of the given type.
     173                 :            :     */
     174                 :            :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
     175                 :            :             getDefaultDBSettings( const ::rtl::OUString& _sURL ) const;
     176                 :            : 
     177                 :            :     /// get access to the first element of the types collection
     178                 :            :     TypeIterator    begin() const;
     179                 :            :     /// get access to the (last + 1st) element of the types collection
     180                 :            :     TypeIterator    end() const;
     181                 :            : 
     182                 :            :     void fillPageIds(const ::rtl::OUString& _sURL,::std::vector<sal_Int16>& _rOutPathIds) const;
     183                 :            : 
     184                 :            :     DATASOURCE_TYPE determineType(const String& _rDsn) const;
     185                 :            : 
     186                 :            :     bool needsJVM(const String& _rDsn) const;
     187                 :            : 
     188                 :            :     sal_Int32 getIndexOf(const ::rtl::OUString& _sURL) const;
     189                 :            :     sal_Int32 size() const;
     190                 :            :     ::rtl::OUString getType(const ::rtl::OUString& _sURL) const;
     191                 :            : };
     192                 :            : 
     193                 :            : //-------------------------------------------------------------------------
     194                 :            : //- ODsnTypeCollection::TypeIterator
     195                 :            : //-------------------------------------------------------------------------
     196                 :            : class OOO_DLLPUBLIC_DBA ODsnTypeCollection::TypeIterator
     197                 :            : {
     198                 :            :     friend class ODsnTypeCollection;
     199                 :            : 
     200                 :            :     friend bool OOO_DLLPUBLIC_DBA operator==(const TypeIterator& lhs, const TypeIterator& rhs);
     201                 :          0 :     friend bool OOO_DLLPUBLIC_DBA operator!=(const TypeIterator& lhs, const TypeIterator& rhs) { return !(lhs == rhs); }
     202                 :            : 
     203                 :            : protected:
     204                 :            :     const ODsnTypeCollection*   m_pContainer;
     205                 :            :     sal_Int32                   m_nPosition;
     206                 :            : 
     207                 :            : public:
     208                 :            :     TypeIterator(const TypeIterator& _rSource);
     209                 :            :     ~TypeIterator();
     210                 :            : 
     211                 :            :     ::rtl::OUString getURLPrefix() const;
     212                 :            :     String          getDisplayName() const;
     213                 :            : 
     214                 :            :     /// prefix increment
     215                 :            :     const TypeIterator& operator++();
     216                 :            :     /// postfix increment
     217                 :            :     const TypeIterator  operator++(int) { TypeIterator hold(*this); ++*this; return hold; }
     218                 :            : 
     219                 :            :     /// prefix decrement
     220                 :            :     const TypeIterator& operator--();
     221                 :            :     /// postfix decrement
     222                 :            :     const TypeIterator  operator--(int) { TypeIterator hold(*this); --*this; return hold; }
     223                 :            : 
     224                 :            : protected:
     225                 :            :     TypeIterator(const ODsnTypeCollection* _pContainer, sal_Int32 _nInitialPos = 0);
     226                 :            : };
     227                 :            : 
     228                 :            : //.........................................................................
     229                 :            : }   // namespace dbaccess
     230                 :            : //.........................................................................
     231                 :            : 
     232                 :            : #endif // _DBACCESS_DSNTYPES_HXX_
     233                 :            : 
     234                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10