LibreOffice Module dbaccess (master) 1
dsntypes.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25#include <vector>
26
27#include <dbadllapi.hxx>
29
30namespace dbaccess
31{
32
33// DATASOURCE_TYPE
36{
41 //5 was DST_ADABAS
47 DST_ADO = 11,
56 DST_KAB = 20,
67
68
79
81};
82
83#define PAGE_DBSETUPWIZARD_INTRO 0
84#define PAGE_DBSETUPWIZARD_DBASE 1
85#define PAGE_DBSETUPWIZARD_TEXT 2
86#define PAGE_DBSETUPWIZARD_MSACCESS 3
87#define PAGE_DBSETUPWIZARD_LDAP 4
88//5 was PAGE_DBSETUPWIZARD_ADABAS
89#define PAGE_DBSETUPWIZARD_MYSQL_INTRO 6
90#define PAGE_DBSETUPWIZARD_MYSQL_JDBC 7
91#define PAGE_DBSETUPWIZARD_MYSQL_ODBC 8
92#define PAGE_DBSETUPWIZARD_ORACLE 9
93#define PAGE_DBSETUPWIZARD_JDBC 10
94#define PAGE_DBSETUPWIZARD_ADO 11
95#define PAGE_DBSETUPWIZARD_ODBC 12
96#define PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET 13
97#define PAGE_DBSETUPWIZARD_AUTHENTIFICATION 14
98#define PAGE_DBSETUPWIZARD_FINAL 16
99#define PAGE_DBSETUPWIZARD_USERDEFINED 17
100#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE 18
101#define PAGE_DBSETUPWIZARD_POSTGRES 19
102
103// ODsnTypeCollection
105{
106
107 std::vector<OUString> m_aDsnTypesDisplayNames;
108 std::vector<OUString> m_aDsnPrefixes;
110
111#if OSL_DEBUG_LEVEL > 0
113#endif
114
115public:
116 class TypeIterator;
118
119 ODsnTypeCollection(const css::uno::Reference< css::uno::XComponentContext >& _xContext);
121
123 OUString getTypeDisplayName(std::u16string_view _sURL) const;
124
126 OUString cutPrefix(std::u16string_view _sURL) const;
127
129 OUString getPrefix(std::u16string_view _sURL) const;
130
132 bool hasDriver( const char* _pAsciiPattern ) const;
133
135 OUString getJavaDriverClass(std::u16string_view _sURL) const;
136
138 OUString getMediaType(std::u16string_view _sURL) const;
139
141 OUString getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType, std::u16string_view _sExtension );
142
143 void extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rHostname,sal_Int32& _nPortNumber) const;
144
146 bool supportsTableCreation(std::u16string_view _sURL) const;
147
149 bool supportsColumnDescription(std::u16string_view _sURL) const;
150
151 // check if a Browse button may be shown to insert connection url
152 bool supportsBrowsing(std::u16string_view _sURL) const;
153
154 // check if a Create New Database button may be shown to insert connection url
155 bool supportsDBCreation(std::u16string_view _sURL) const;
156
158 bool isFileSystemBased(std::u16string_view _sURL) const;
159
160 bool isConnectionUrlRequired(std::u16string_view _sURL) const;
161
163 static bool isEmbeddedDatabase( std::u16string_view _sURL );
164
165 static OUString getEmbeddedDatabase();
166
167 // returns true when the properties dialog can be shown, otherwise false.
168 static bool isShowPropertiesEnabled( const OUString& _sURL );
169
172 css::uno::Sequence< css::beans::PropertyValue>
173 getDefaultDBSettings( std::u16string_view _sURL ) const;
174
176 inline TypeIterator begin() const;
178 inline TypeIterator end() const;
179
180 void fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const;
181
182 DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const;
183
184 sal_Int32 getIndexOf(std::u16string_view _sURL) const;
185 sal_Int32 size() const;
186 OUString getType(std::u16string_view _sURL) const;
187};
188
189//- ODsnTypeCollection::TypeIterator
190class OOO_DLLPUBLIC_DBA ODsnTypeCollection::TypeIterator
191{
192 friend class ODsnTypeCollection;
193
194 friend bool OOO_DLLPUBLIC_DBA operator==(const TypeIterator& lhs, const TypeIterator& rhs);
195 friend bool OOO_DLLPUBLIC_DBA operator!=(const TypeIterator& lhs, const TypeIterator& rhs) { return !(lhs == rhs); }
196
197protected:
199 sal_Int32 m_nPosition;
200
201public:
202 TypeIterator(const TypeIterator& _rSource);
204
205 OUString const & getURLPrefix() const;
206 OUString const & getDisplayName() const;
207
209 const TypeIterator& operator++();
210
211protected:
212 TypeIterator(const ODsnTypeCollection* _pContainer, sal_Int32 _nInitialPos);
213};
214
215
218
219} // namespace dbaccess
220
221/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< OUString > m_aDsnTypesDisplayNames
Definition: dsntypes.hxx:107
TypeIterator end() const
get access to the (last + 1st) element of the types collection
Definition: dsntypes.hxx:217
const ODsnTypeCollection * m_pContainer
Definition: dsntypes.hxx:198
friend bool OOO_DLLPUBLIC_DBA operator==(const TypeIterator &lhs, const TypeIterator &rhs)
friend bool OOO_DLLPUBLIC_DBA operator!=(const TypeIterator &lhs, const TypeIterator &rhs)
Definition: dsntypes.hxx:195
OUString const & getDisplayName() const
::connectivity::DriversConfig m_aDriverConfig
DSN prefixes which determine the type of a datasource.
Definition: dsntypes.hxx:109
TypeIterator begin() const
get access to the first element of the types collection
Definition: dsntypes.hxx:216
OUString const & getURLPrefix() const
TypeIterator(const ODsnTypeCollection *_pContainer, sal_Int32 _nInitialPos)
std::vector< OUString > m_aDsnPrefixes
user readable names for the datasource types
Definition: dsntypes.hxx:108
const TypeIterator & operator++()
prefix increment
TypeIterator(const TypeIterator &_rSource)
#define OOO_DLLPUBLIC_DBA
Definition: dbadllapi.hxx:29
size
DATASOURCE_TYPE
known datasource types
Definition: dsntypes.hxx:36
@ DST_USERDEFINE1
for all embedded addons driver
Definition: dsntypes.hxx:69
@ DST_MSACCESS_2007
Definition: dsntypes.hxx:58
@ DST_MYSQL_JDBC
Definition: dsntypes.hxx:39
@ DST_CALC
Definition: dsntypes.hxx:42
@ DST_USERDEFINE3
Definition: dsntypes.hxx:71
@ DST_WRITER
Definition: dsntypes.hxx:65
@ DST_MOZILLA
Definition: dsntypes.hxx:48
@ DST_EVOLUTION
Definition: dsntypes.hxx:53
@ DST_EMBEDDED_UNKNOWN
Definition: dsntypes.hxx:66
@ DST_MSACCESS
Definition: dsntypes.hxx:37
@ DST_MYSQL_ODBC
Definition: dsntypes.hxx:38
@ DST_USERDEFINE9
Definition: dsntypes.hxx:77
@ DST_USERDEFINE7
Definition: dsntypes.hxx:75
@ DST_JDBC
Definition: dsntypes.hxx:45
@ DST_ODBC
Definition: dsntypes.hxx:46
@ DST_MYSQL_NATIVE
Definition: dsntypes.hxx:60
@ DST_USERDEFINE6
Definition: dsntypes.hxx:74
@ DST_LDAP
Definition: dsntypes.hxx:50
@ DST_USERDEFINE2
first user defined driver
Definition: dsntypes.hxx:70
@ DST_DBASE
Definition: dsntypes.hxx:43
@ DST_FLAT
Definition: dsntypes.hxx:44
@ DST_OUTLOOKEXP
Definition: dsntypes.hxx:52
@ DST_ORACLE_JDBC
Definition: dsntypes.hxx:40
@ DST_POSTGRES
Definition: dsntypes.hxx:64
@ DST_USERDEFINE10
Definition: dsntypes.hxx:78
@ DST_EMBEDDED_FIREBIRD
Definition: dsntypes.hxx:63
@ DST_EVOLUTION_GROUPWISE
Definition: dsntypes.hxx:54
@ DST_UNKNOWN
unrecognized type
Definition: dsntypes.hxx:80
@ DST_OUTLOOK
Definition: dsntypes.hxx:51
@ DST_FIREBIRD
Definition: dsntypes.hxx:62
@ DST_EVOLUTION_LDAP
Definition: dsntypes.hxx:55
@ DST_THUNDERBIRD
Definition: dsntypes.hxx:49
@ DST_USERDEFINE8
Definition: dsntypes.hxx:76
@ DST_EMBEDDED_HSQLDB
Definition: dsntypes.hxx:59
@ DST_USERDEFINE4
Definition: dsntypes.hxx:72
@ DST_USERDEFINE5
Definition: dsntypes.hxx:73
@ DST_MYSQL_NATIVE_DIRECT
Definition: dsntypes.hxx:61
@ DST_MACAB
Definition: dsntypes.hxx:57
enumrange< T >::Iterator begin(enumrange< T >)
end
bool getType(BSTR name, Type &type)