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 <com/sun/star/sdbc/XDriver.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
25 #include <cppuhelper/compbase.hxx>
26 #include <connectivity/CommonTools.hxx>
27 #include <file/filedllapi.hxx>
28 
29 namespace connectivity::file
30     {
31         typedef ::cppu::WeakComponentImplHelper<   css::sdbc::XDriver,
32                                                    css::lang::XServiceInfo,
33                                                    css::sdbcx::XDataDefinitionSupplier> ODriver_BASE;
34 
35         class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileDriver : public ODriver_BASE
36         {
37         protected:
38             ::osl::Mutex                                        m_aMutex;
39 
40             connectivity::OWeakRefArray                         m_xConnections; //  vector containing a list
41                                                                                 //  of all the Connection objects
42                                                                                 //  for this Driver
43             css::uno::Reference< css::uno::XComponentContext > m_xContext;
44         public:
45             OFileDriver(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
46 
47             // OComponentHelper
48             virtual void SAL_CALL disposing() override;
49 
50             // XServiceInfo
51             virtual OUString SAL_CALL getImplementationName(  ) override;
52             virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
53             virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
54 
55             // XDriver
56             virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
57             virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
58             virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
59             virtual sal_Int32 SAL_CALL getMajorVersion(  ) override;
60             virtual sal_Int32 SAL_CALL getMinorVersion(  ) override;
61 
62             // XDataDefinitionSupplier
63             virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override;
64             virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
65 
getComponentContext() const66             const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const { return m_xContext; }
67         };
68 
69 }
70 
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
73