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