Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / datasourceconnector.hxx
blobc5459ecbe15b8c1e48263cf028ec2ace7672bb5d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
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 #include <vcl/vclptr.hxx>
29 namespace dbtools
31 class SQLExceptionInfo;
34 namespace vcl { class Window; }
35 namespace dbaui
38 // ODatasourceConnector
39 class ODatasourceConnector
41 protected:
42 VclPtr<vcl::Window> m_pErrorMessageParent;
43 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
44 m_xContext;
45 OUString m_sContextInformation;
47 public:
48 ODatasourceConnector(
49 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
50 vcl::Window* _pMessageParent
52 ODatasourceConnector(
53 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
54 vcl::Window* _pMessageParent,
55 const OUString& _rContextInformation
58 /// returns <TRUE/> if the object is able to create data source connections
59 bool isValid() const { return m_xContext.is(); }
61 /** creates a connection to the data source, displays the possible error to the user, or returns it
63 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
64 connect(
65 const OUString& _rDataSourceName,
66 ::dbtools::SQLExceptionInfo* _pErrorInfo
67 ) const;
69 /** creates a connection to the data source, displays the possible error to the user, or returns it
71 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
72 connect(
73 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource,
74 ::dbtools::SQLExceptionInfo* _pErrorInfo
75 ) const;
78 } // namespace dbaui
80 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DATASOURCECONNECTOR_HXX
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */