LCOV - code coverage report
Current view: top level - connectivity/source/inc/hsqldb - HConnection.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 7 100.0 %
Date: 2014-11-03 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
      21             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
      22             : 
      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>
      31             : 
      32             : namespace connectivity
      33             : {
      34             :     namespace hsqldb
      35             :     {
      36           4 :         class SAL_NO_VTABLE IMethodGuardAccess
      37             :         {
      38             :         public:
      39             :             virtual ::osl::Mutex&   getMutex() const = 0;
      40             :             virtual void            checkDisposed() const = 0;
      41             : 
      42             :         protected:
      43           2 :             ~IMethodGuardAccess() {}
      44             :         };
      45             : 
      46             : 
      47             :         //= OHsqlConnection - wraps all methods to the real connection from the driver
      48             :         //= but when disposed it doesn't dispose the real connection
      49             : 
      50             :         typedef ::cppu::WeakComponentImplHelper2<   ::com::sun::star::util::XFlushable
      51             :                                                 ,   ::com::sun::star::sdb::application::XTableUIProvider
      52             :                                                 >   OHsqlConnection_BASE;
      53             : 
      54             :         class OHsqlConnection   :public ::comphelper::OBaseMutex
      55             :                                 ,public OHsqlConnection_BASE
      56             :                                 ,public OConnectionWrapper
      57             :                                 ,public IMethodGuardAccess
      58             :         {
      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;
      65             : 
      66             :         protected:
      67             :             virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
      68             :             virtual ~OHsqlConnection();
      69             : 
      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
      75             :             );
      76             : 
      77             :             // XServiceInfo
      78             :             DECLARE_SERVICE_INFO();
      79             :             DECLARE_XTYPEPROVIDER()
      80             :             DECLARE_XINTERFACE( )
      81             : 
      82             :             // IMethodGuardAccess
      83             :             virtual ::osl::Mutex&   getMutex() const SAL_OVERRIDE;
      84             :             virtual void            checkDisposed() const SAL_OVERRIDE;
      85             : 
      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;
      90             : 
      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;
      94             : 
      95             :         private:
      96             : 
      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.
     106             :             */
     107             :             ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     108             :                     impl_getTableContainer_throw();
     109             : 
     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.
     117             :             */
     118             :             void    impl_checkExistingTable_throw( const OUString& _rTableName );
     119             : 
     120             :             /** checks whether the given table name refers to a HSQL TEXT TABLE
     121             :             */
     122             :             bool    impl_isTextTable_nothrow( const OUString& _rTableName );
     123             : 
     124             :             /** retrieves the icon for HSQL TEXT TABLEs
     125             :             */
     126             :             ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
     127             :                 impl_getTextTableIcon_nothrow();
     128             :         };
     129             : 
     130             : 
     131             :         //= OHsqlConnection
     132             : 
     133           4 :         class MethodGuard : public ::osl::MutexGuard
     134             :         {
     135             :         private:
     136             :             typedef ::osl::MutexGuard   BaseGuard;
     137             : 
     138             :         public:
     139           4 :             MethodGuard( const IMethodGuardAccess& _rComponent )
     140           4 :                 :BaseGuard( _rComponent.getMutex() )
     141             :             {
     142           4 :                 _rComponent.checkDisposed();
     143           4 :             }
     144             :         };
     145             :     }
     146             : }
     147             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_HSQLDB_HCONNECTION_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10