1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef DBACCESS_DSMETA_HXX 29 #define DBACCESS_DSMETA_HXX 30 31 #include "dsntypes.hxx" 32 #include "dsitems.hxx" 33 34 /** === begin UNO includes === **/ 35 /** === end UNO includes === **/ 36 37 #include <boost/shared_ptr.hpp> 38 39 //........................................................................ 40 namespace dbaui 41 { 42 //........................................................................ 43 44 //==================================================================== 45 //= AutheticationMode 46 //==================================================================== 47 enum AuthenticationMode 48 { 49 AuthNone, 50 AuthUserPwd, 51 AuthPwd 52 }; 53 54 //==================================================================== 55 //= DataSourceMetaData 56 //==================================================================== 57 class FeatureSet; 58 class DataSourceMetaData_Impl; 59 /** encapsulates meta data for a data source 60 61 On the long run, this class should a) encapsulate *all* meta data which 62 currently is hard coded somewhere in the program logic and b) be initialized 63 from the configuration. 64 65 At the moment, the data a) is still hard coded in the, well, code and b) 66 contains meta data about the advanced settings only. 67 */ 68 class DataSourceMetaData 69 { 70 public: 71 DataSourceMetaData( const ::rtl::OUString& _sURL ); 72 ~DataSourceMetaData(); 73 74 /// returns a struct describing this data source type's support for our known advanced settings 75 const FeatureSet& getFeatureSet() const; 76 77 /// determines whether or not the data source requires authentication 78 static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL ); 79 80 private: 81 ::boost::shared_ptr< DataSourceMetaData_Impl > m_pImpl; 82 }; 83 84 //==================================================================== 85 //= FeatureSet 86 //==================================================================== 87 /** can be used to ask for (UI) support for certain advanced features 88 */ 89 class FeatureSet 90 { 91 public: 92 typedef ::std::set< ItemID >::const_iterator const_iterator; 93 94 public: 95 inline FeatureSet() { } 96 97 inline void put( const ItemID _id ) { m_aContent.insert( _id ); } 98 inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); } 99 100 inline bool supportsAnySpecialSetting() const; 101 inline bool supportsGeneratedValues() const; 102 103 inline const_iterator begin() const { return m_aContent.begin(); } 104 inline const_iterator end() const { return m_aContent.end(); } 105 106 private: 107 ::std::set< ItemID > m_aContent; 108 }; 109 110 //-------------------------------------------------------------------- 111 inline bool FeatureSet::supportsGeneratedValues() const 112 { 113 return has( DSID_AUTORETRIEVEENABLED ); 114 } 115 116 //-------------------------------------------------------------------- 117 inline bool FeatureSet::supportsAnySpecialSetting() const 118 { 119 return has( DSID_SQL92CHECK ) 120 || has( DSID_APPEND_TABLE_ALIAS ) 121 || has( DSID_AS_BEFORE_CORRNAME ) 122 || has( DSID_ENABLEOUTERJOIN ) 123 || has( DSID_IGNOREDRIVER_PRIV ) 124 || has( DSID_PARAMETERNAMESUBST ) 125 || has( DSID_SUPPRESSVERSIONCL ) 126 || has( DSID_CATALOG ) 127 || has( DSID_SCHEMA ) 128 || has( DSID_INDEXAPPENDIX ) 129 || has( DSID_DOSLINEENDS ) 130 || has( DSID_BOOLEANCOMPARISON ) 131 || has( DSID_CHECK_REQUIRED_FIELDS ) 132 || has( DSID_IGNORECURRENCY ) 133 || has( DSID_ESCAPE_DATETIME ) 134 || has( DSID_PRIMARY_KEY_SUPPORT ) 135 || has( DSID_MAX_ROW_SCAN ) 136 || has( DSID_RESPECTRESULTSETTYPE ) 137 ; 138 } 139 140 //........................................................................ 141 } // namespace dbaui 142 //........................................................................ 143 144 #endif // DBACCESS_DSMETA_HXX 145