LCOV - code coverage report
Current view: top level - dbaccess/source/inc - dsntypes.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 3 0.0 %
Date: 2014-11-03 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10