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_UI_INC_DATASOURCECONNECTOR_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
22 :
23 : #include <com/sun/star/container/XNameAccess.hpp>
24 : #include <com/sun/star/uno/XComponentContext.hpp>
25 : #include <com/sun/star/sdbc/XConnection.hpp>
26 : #include <com/sun/star/sdbc/XDataSource.hpp>
27 :
28 : namespace dbtools
29 : {
30 : class SQLExceptionInfo;
31 : }
32 :
33 : namespace vcl { class Window; }
34 : namespace dbaui
35 : {
36 :
37 : // ODatasourceConnector
38 2 : class ODatasourceConnector
39 : {
40 : protected:
41 : vcl::Window* m_pErrorMessageParent;
42 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
43 : m_xContext;
44 : OUString m_sContextInformation;
45 :
46 : public:
47 : ODatasourceConnector(
48 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
49 : vcl::Window* _pMessageParent
50 : );
51 : ODatasourceConnector(
52 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
53 : vcl::Window* _pMessageParent,
54 : const OUString& _rContextInformation
55 : );
56 :
57 : /// returns <TRUE/> if the object is able to create data source connections
58 4 : bool isValid() const { return m_xContext.is(); }
59 :
60 : /** creates a connection to the data source, displays the possible error to the user, or returns it
61 : */
62 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
63 : connect(
64 : const OUString& _rDataSourceName,
65 : ::dbtools::SQLExceptionInfo* _pErrorInfo
66 : ) const;
67 :
68 : /** creates a connection to the data source, displays the possible error to the user, or returns it
69 : */
70 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
71 : connect(
72 : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource,
73 : ::dbtools::SQLExceptionInfo* _pErrorInfo
74 : ) const;
75 : };
76 :
77 : } // namespace dbaui
78 :
79 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|