tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / core / dataaccess / SharedConnection.hxx
blobe4467c44d060a53fb74d85b31850586c6705873a
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 <connectivity/ConnectionWrapper.hxx>
22 #include <connectivity/CommonTools.hxx>
23 #include <cppuhelper/compbase.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 #include <com/sun/star/sdbc/SQLException.hpp>
26 #include <com/sun/star/sdbc/XConnection.hpp>
27 #include <comphelper/sequence.hxx>
29 namespace dbaccess
31 // OSharedConnection: This class implements a simple forwarding of connection calls.
32 // All methods will be forwarded with exception of the set methods, which are not allowed
33 // to be called on shared connections. Instances of this class will be created when the
34 // datasource is asked for not isolated connection.
35 typedef ::cppu::ImplInheritanceHelper<connectivity::OConnectionWrapper,
36 css::sdbc::XConnection
37 > OSharedConnection_BASE;
39 class OSharedConnection : public OSharedConnection_BASE
41 protected:
42 virtual ~OSharedConnection() override;
43 public:
44 explicit OSharedConnection(css::uno::Reference< css::uno::XAggregation >& _rxProxyConnection);
46 // XCloseable
47 virtual void SAL_CALL close( ) override
50 ::osl::MutexGuard aGuard( m_aMutex );
51 ::connectivity::checkDisposed(rBHelper.bDisposed);
53 dispose();
56 // XConnection
57 virtual void SAL_CALL setAutoCommit( sal_Bool /*autoCommit*/ ) override
59 throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
61 virtual void SAL_CALL setReadOnly( sal_Bool /*readOnly*/ ) override
63 throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
65 virtual void SAL_CALL setCatalog( const OUString& /*catalog*/ ) override
67 throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
69 virtual void SAL_CALL setTransactionIsolation( sal_Int32 /*level*/ ) override
71 throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
73 virtual void SAL_CALL setTypeMap( const css::uno::Reference< css::container::XNameAccess >& /*typeMap*/ ) override
75 throw css::sdbc::SQLException(u"This call is not allowed when sharing connections."_ustr,*this,u"S10000"_ustr,0,css::uno::Any());
77 // XConnection
78 virtual css::uno::Reference< css::sdbc::XStatement > SAL_CALL createStatement( ) override;
79 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) override;
80 virtual css::uno::Reference< css::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) override;
81 virtual OUString SAL_CALL nativeSQL( const OUString& sql ) override;
82 virtual sal_Bool SAL_CALL getAutoCommit( ) override;
83 virtual void SAL_CALL commit( ) override;
84 virtual void SAL_CALL rollback( ) override;
85 virtual sal_Bool SAL_CALL isClosed( ) override;
86 virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) override;
87 virtual sal_Bool SAL_CALL isReadOnly( ) override;
88 virtual OUString SAL_CALL getCatalog( ) override;
89 virtual sal_Int32 SAL_CALL getTransactionIsolation( ) override;
90 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTypeMap( ) override;
93 } // namespace dbaccess
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */