Breeze: Add Save All & Save a Copy icons
[LibreOffice.git] / include / connectivity / ConnectionWrapper.hxx
blobb621cd041b5110af4ee7264e38b2162ce4ebaaf2
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_CONNECTIVITY_CONNECTIONWRAPPER_HXX
21 #define INCLUDED_CONNECTIVITY_CONNECTIONWRAPPER_HXX
23 #include <cppuhelper/implbase2.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <connectivity/CommonTools.hxx>
27 #include <connectivity/dbtoolsdllapi.hxx>
29 namespace com::sun::star::beans { struct PropertyValue; }
30 namespace com::sun::star::sdbc { class XConnection; }
31 namespace com::sun::star::uno { class XComponentContext; }
33 namespace connectivity
37 //= OConnectionWrapper - wraps all methods to the real connection from the driver
38 //= but when disposed it doesn't dispose the real connection
40 typedef ::cppu::ImplHelper2< css::lang::XServiceInfo,
41 css::lang::XUnoTunnel
42 > OConnection_BASE;
44 class OOO_DLLPUBLIC_DBTOOLS OConnectionWrapper : public OConnection_BASE
46 protected:
47 css::uno::Reference< css::uno::XAggregation > m_xProxyConnection;
48 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
49 css::uno::Reference< css::lang::XTypeProvider > m_xTypeProvider;
50 css::uno::Reference< css::lang::XUnoTunnel > m_xUnoTunnel;
51 css::uno::Reference< css::lang::XServiceInfo > m_xServiceInfo;
53 virtual ~OConnectionWrapper();
54 void setDelegation(css::uno::Reference< css::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
55 void setDelegation(const css::uno::Reference< css::sdbc::XConnection >& _xConnection
56 ,const css::uno::Reference< css::uno::XComponentContext>& _rxContext
57 ,oslInterlockedCount& _rRefCount);
58 // must be called from derived classes
59 void disposing();
60 public:
61 OConnectionWrapper( );
63 // XServiceInfo
64 DECLARE_SERVICE_INFO();
65 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& _rType ) override;
66 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
68 // css::lang::XUnoTunnel
69 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
70 static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
71 /** method to create unique ids
72 @param _rURL
73 The URL.
74 @param _rInfo
75 The info property of the datasource. It will be resorted if needed.
76 @param _pBuffer
77 Here we store the digest. Must not NULL.
78 @param _rUserName
79 The user name.
80 @param _rPassword
81 The password.
83 static void createUniqueId( const OUString& _rURL
84 ,css::uno::Sequence< css::beans::PropertyValue >& _rInfo
85 ,sal_uInt8* _pBuffer
86 ,const OUString& _rUserName = OUString()
87 ,const OUString& _rPassword = OUString());
90 #endif // INCLUDED_CONNECTIVITY_CONNECTIONWRAPPER_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */