2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-05-10 11:17:59 +00:00
|
|
|
|
|
|
|
#ifndef _DBAUI_DATASOURCECONNECTOR_HXX_
|
|
|
|
#define _DBAUI_DATASOURCECONNECTOR_HXX_
|
|
|
|
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
2012-12-06 14:15:55 +02:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2001-05-10 11:17:59 +00:00
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2004-08-02 14:56:46 +00:00
|
|
|
#include <com/sun/star/sdbc/XDataSource.hpp>
|
2001-05-10 11:17:59 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
namespace dbtools
|
|
|
|
{
|
|
|
|
class SQLExceptionInfo;
|
|
|
|
}
|
|
|
|
|
2001-05-10 11:17:59 +00:00
|
|
|
class Window;
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// ODatasourceConnector
|
2001-05-10 11:17:59 +00:00
|
|
|
class ODatasourceConnector
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
Window* m_pErrorMessageParent;
|
2012-12-06 14:15:55 +02:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
|
|
|
|
m_xContext;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sContextInformation;
|
2001-05-10 11:17:59 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ODatasourceConnector(
|
2012-12-06 14:15:55 +02:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
|
2001-08-15 05:48:59 +00:00
|
|
|
Window* _pMessageParent
|
|
|
|
);
|
|
|
|
ODatasourceConnector(
|
2012-12-06 14:15:55 +02:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
|
2001-08-15 05:48:59 +00:00
|
|
|
Window* _pMessageParent,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rContextInformation
|
2001-08-15 05:48:59 +00:00
|
|
|
);
|
2001-05-10 11:17:59 +00:00
|
|
|
|
|
|
|
/// returns <TRUE/> if the object is able to create data source connections
|
2012-12-06 14:15:55 +02:00
|
|
|
sal_Bool isValid() const { return m_xContext.is(); }
|
2001-05-10 11:17:59 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
/** creates a connection to the data source, displays the possible error to the user, or returns it
|
|
|
|
*/
|
2001-05-10 11:17:59 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
|
2008-12-01 12:31:27 +00:00
|
|
|
connect(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rDataSourceName,
|
2008-12-01 12:31:27 +00:00
|
|
|
::dbtools::SQLExceptionInfo* _pErrorInfo
|
|
|
|
) const;
|
2001-08-15 05:48:59 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
/** creates a connection to the data source, displays the possible error to the user, or returns it
|
|
|
|
*/
|
2004-08-02 14:56:46 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
|
2008-12-01 12:31:27 +00:00
|
|
|
connect(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource,
|
|
|
|
::dbtools::SQLExceptionInfo* _pErrorInfo
|
|
|
|
) const;
|
2001-05-10 11:17:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
|
|
|
#endif // _DBAUI_DATASOURCECONNECTOR_HXX_
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|