sc: copy cache values when clone color conditional format
[LibreOffice.git] / connectivity / source / inc / mysql / YDriver.hxx
blob7bdb499718fd4bb6fe11501aefcb482b50410527
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 .
19 #pragma once
21 #include <sal/config.h>
23 #include <map>
25 #include <com/sun/star/sdbc/XDriver.hpp>
26 #include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <cppuhelper/compbase.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 #include <connectivity/CommonTools.hxx>
34 namespace connectivity
38 class OMetaConnection;
40 namespace mysql
42 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XDriver
43 , css::sdbcx::XDataDefinitionSupplier
44 , css::lang::XServiceInfo
45 > ODriverDelegator_BASE;
47 typedef std::pair< css::uno::WeakReferenceHelper,OMetaConnection*> TWeakConnectionPair;
48 typedef std::pair< css::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair;
49 typedef std::vector< TWeakPair > TWeakPairVector;
50 typedef std::map< OUString, css::uno::Reference< css::sdbc::XDriver > > TJDBCDrivers;
52 /** delegates all calls to the original driver and extend the existing one with the SDBCX layer.
55 class ODriverDelegator : public ::cppu::BaseMutex
56 ,public ODriverDelegator_BASE
58 TJDBCDrivers m_aJdbcDrivers; // all jdbc drivers
59 TWeakPairVector m_aConnections; // vector containing a list
60 // of all the Connection objects
61 // for this Driver
62 css::uno::Reference< css::sdbc::XDriver > m_xODBCDriver;
63 css::uno::Reference< css::sdbc::XDriver > m_xNativeDriver;
64 css::uno::Reference< css::uno::XComponentContext > m_xContext;
66 /** load the driver we want to delegate.
67 The <member>m_xODBCDriver</member> or <member>m_xDBCDriver</member> may be <NULL/> if the driver could not be loaded.
68 @param url
69 The URL.
70 @param info
71 The property info contains which driver we have to delegate.
72 @return
73 The driver which was currently selected.
75 css::uno::Reference< css::sdbc::XDriver > loadDriver( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info );
77 public:
78 /** creates a new delegator for a mysql driver
80 ODriverDelegator(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
82 // XServiceInfo
83 DECLARE_SERVICE_INFO();
85 // XDriver
86 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
87 virtual sal_Bool SAL_CALL acceptsURL( const OUString& url ) override;
88 virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
89 virtual sal_Int32 SAL_CALL getMajorVersion( ) override;
90 virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
92 // XDataDefinitionSupplier
93 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const css::uno::Reference< css::sdbc::XConnection >& connection ) override;
94 virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const css::uno::Sequence< css::beans::PropertyValue >& info ) override;
95 protected:
96 /// dtor
97 virtual ~ODriverDelegator() override;
98 // OComponentHelper
99 virtual void SAL_CALL disposing() override;
104 } // namespace connectivity
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */