bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / hsqldb / HConnection.hxx
blob3fbe63c6b65792a39905dc2642f112d037a931f6
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_SOURCE_INC_HSQLDB_HCONNECTION_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
23 #include <connectivity/ConnectionWrapper.hxx>
24 #include <com/sun/star/util/XFlushable.hpp>
25 #include <com/sun/star/sdbc/XDriver.hpp>
26 #include <com/sun/star/sdb/application/XTableUIProvider.hpp>
27 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
28 #include <cppuhelper/compbase2.hxx>
29 #include <comphelper/uno3.hxx>
30 #include <cppuhelper/interfacecontainer.hxx>
32 namespace connectivity
34 namespace hsqldb
36 class SAL_NO_VTABLE IMethodGuardAccess
38 public:
39 virtual ::osl::Mutex& getMutex() const = 0;
40 virtual void checkDisposed() const = 0;
42 protected:
43 ~IMethodGuardAccess() {}
47 // OHsqlConnection - wraps all methods to the real connection from the driver
48 // but when disposed it doesn't dispose the real connection
50 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::util::XFlushable
51 , ::com::sun::star::sdb::application::XTableUIProvider
52 > OHsqlConnection_BASE;
54 class OHsqlConnection :public ::comphelper::OBaseMutex
55 ,public OHsqlConnection_BASE
56 ,public OConnectionWrapper
57 ,public IMethodGuardAccess
59 private:
60 ::cppu::OInterfaceContainerHelper m_aFlushListeners;
61 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver;
62 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
63 bool m_bIni;
64 bool m_bReadOnly;
66 protected:
67 virtual void SAL_CALL disposing() SAL_OVERRIDE;
68 virtual ~OHsqlConnection();
70 public:
71 OHsqlConnection(
72 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >& _rxDriver,
73 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
74 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
77 // XServiceInfo
78 DECLARE_SERVICE_INFO();
79 DECLARE_XTYPEPROVIDER()
80 DECLARE_XINTERFACE( )
82 // IMethodGuardAccess
83 virtual ::osl::Mutex& getMutex() const SAL_OVERRIDE;
84 virtual void checkDisposed() const SAL_OVERRIDE;
86 // XFlushable
87 virtual void SAL_CALL flush( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 virtual void SAL_CALL addFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 virtual void SAL_CALL removeFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 // XTableUIProvider
92 virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getTableIcon( const OUString& TableName, ::sal_Int32 ColorMode ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getTableEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& DocumentUI, const OUString& TableName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 private:
97 /** retrieves our table container
98 @return
99 our table container. Guaranteed to not be <NULL/>.
100 @throws ::com::sun::star::lang::WrappedTargetException
101 if a non-RuntimeException is caught during obtaining the container.
102 @throws ::com::sun::star::uno::RuntimeException
103 if a serious error occurs
104 @precond
105 We're not disposed.
107 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
108 impl_getTableContainer_throw();
110 /** checks whether the given table name denotes an existing table
111 @param _rTableName
112 the fully name of the table to check for existence
113 @throws ::com::sun::star::lang::IllegalArgumentException
114 if the name does not denote an existing table
115 @precond
116 We're not disposed.
118 void impl_checkExistingTable_throw( const OUString& _rTableName );
120 /** checks whether the given table name refers to a HSQL TEXT TABLE
122 bool impl_isTextTable_nothrow( const OUString& _rTableName );
124 /** retrieves the icon for HSQL TEXT TABLEs
126 ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
127 impl_getTextTableIcon_nothrow();
131 // OHsqlConnection
133 class MethodGuard : public ::osl::MutexGuard
135 private:
136 typedef ::osl::MutexGuard BaseGuard;
138 public:
139 MethodGuard( const IMethodGuardAccess& _rComponent )
140 :BaseGuard( _rComponent.getMutex() )
142 _rComponent.checkDisposed();
147 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */