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

Generated by: LCOV version 1.10