LCOV - code coverage report
Current view: top level - dbaccess/source/core/inc - TableDeco.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.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_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
      22             : 
      23             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      24             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      25             : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      26             : #include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
      27             : #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
      28             : #include <com/sun/star/sdbcx/XRename.hpp>
      29             : #include <com/sun/star/sdbcx/XAlterTable.hpp>
      30             : #include <com/sun/star/lang/XServiceInfo.hpp>
      31             : #include <com/sun/star/sdbc/XRow.hpp>
      32             : #include <com/sun/star/sdbc/XConnection.hpp>
      33             : #include <cppuhelper/compbase9.hxx>
      34             : #include <cppuhelper/implbase5.hxx>
      35             : #include "apitools.hxx"
      36             : #include "datasettings.hxx"
      37             : #include "column.hxx"
      38             : 
      39             : #include <connectivity/CommonTools.hxx>
      40             : #include <connectivity/sdbcx/IRefreshable.hxx>
      41             : #include <comphelper/IdPropArrayHelper.hxx>
      42             : 
      43             : namespace dbaccess
      44             : {
      45             :     typedef ::cppu::WeakComponentImplHelper9<   ::com::sun::star::sdbcx::XColumnsSupplier,
      46             :                                                 ::com::sun::star::sdbcx::XKeysSupplier,
      47             :                                                 ::com::sun::star::container::XNamed,
      48             :                                                 ::com::sun::star::lang::XServiceInfo,
      49             :                                                 ::com::sun::star::sdbcx::XDataDescriptorFactory,
      50             :                                                 ::com::sun::star::sdbcx::XIndexesSupplier,
      51             :                                                 ::com::sun::star::sdbcx::XRename,
      52             :                                                 ::com::sun::star::lang::XUnoTunnel,
      53             :                                                 ::com::sun::star::sdbcx::XAlterTable> OTableDescriptor_BASE;
      54             :     // OTables
      55             :     class ODBTableDecorator;
      56             :     typedef ::comphelper::OIdPropertyArrayUsageHelper< ODBTableDecorator >  ODBTableDecorator_PROP;
      57             : 
      58             :     class ODBTableDecorator :public comphelper::OBaseMutex
      59             :                             ,public OTableDescriptor_BASE
      60             :                             ,public ODataSettings //ODataSettings_Base
      61             :                             ,public IColumnFactory
      62             :                             ,public ::connectivity::sdbcx::IRefreshableColumns
      63             :                             ,public ODBTableDecorator_PROP
      64             :     {
      65             :         void fillPrivileges() const;
      66             :     protected:
      67             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xColumnMediator;
      68             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier >       m_xTable;
      69             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >        m_xColumnDefinitions;
      70             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >             m_xConnection;
      71             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >       m_xMetaData;
      72             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  m_xNumberFormats;
      73             : 
      74             :     // <properties>
      75             :         mutable sal_Int32                                                                   m_nPrivileges;
      76             :     // </properties>
      77             :         ::connectivity::sdbcx::OCollection*                                                 m_pColumns;
      78             : 
      79             :         // IColumnFactory
      80             :         virtual OColumn*    createColumn(const OUString& _rName) const SAL_OVERRIDE;
      81             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor() SAL_OVERRIDE;
      82             :         virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor ) SAL_OVERRIDE;
      83             :         virtual void columnDropped(const OUString& _sName) SAL_OVERRIDE;
      84             : 
      85             :         virtual void refreshColumns() SAL_OVERRIDE;
      86             : 
      87             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId) const SAL_OVERRIDE;
      88             :         virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
      89             : 
      90             :         // OPropertySetHelper
      91             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(
      92             :                             ::com::sun::star::uno::Any & rConvertedValue,
      93             :                             ::com::sun::star::uno::Any & rOldValue,
      94             :                             sal_Int32 nHandle,
      95             :                             const ::com::sun::star::uno::Any& rValue )
      96             :                                 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
      97             :         virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const SAL_OVERRIDE;
      98             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
      99             :                                 sal_Int32 nHandle,
     100             :                                 const ::com::sun::star::uno::Any& rValue
     101             :                                                  )
     102             : 
     103             :                                          throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     104             : 
     105             :         virtual ~ODBTableDecorator();
     106             :     public:
     107             :         /** constructs a wrapper supporting the com.sun.star.sdb.Table service.
     108             : 
     109             :             @param _rxConn
     110             :                 the connection the table belongs to. Must not be <NULL/>
     111             :             @param _rxTable
     112             :                 the table from the driver can be <NULL/>
     113             :         */
     114             :         ODBTableDecorator(
     115             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
     116             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier >& _rxTable,
     117             :             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _rxNumberFormats,
     118             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumnDefinitions
     119             :         )   throw(::com::sun::star::sdbc::SQLException);
     120             : 
     121             :         // ODescriptor
     122             :         virtual void construct();
     123             : 
     124             :         //XInterface
     125             :         virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             :         virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     127             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     128             :         //XTypeProvider
     129             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131             : 
     132             :     // OComponentHelper
     133             :         virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
     134             : 
     135             :     // ::com::sun::star::lang::XServiceInfo
     136             :         DECLARE_SERVICE_INFO();
     137             :         // XPropertySet
     138             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     139             :     // ::com::sun::star::sdbcx::XRename,
     140             :         virtual void SAL_CALL rename( const OUString& _rNewName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     141             : 
     142             :     // ::com::sun::star::sdbcx::XAlterTable,
     143             :         virtual void SAL_CALL alterColumnByName( const OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDescriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :         virtual void SAL_CALL alterColumnByIndex( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDescriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     145             : 
     146             :         // XNamed
     147             :         virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :         virtual void SAL_CALL setName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             :         // com::sun::star::lang::XUnoTunnel
     150             :         virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :         static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
     152             : 
     153           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const { return m_xMetaData; }
     154             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const { return m_xMetaData.is() ? m_xMetaData->getConnection() : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>(); }
     155             : 
     156             :         // XColumnsSupplier
     157             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             :         // XKeysSupplier
     159             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :         // XIndexesSupplier
     161             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     162             :         // XDataDescriptorFactory
     163             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             :     protected:
     166             :         using ODataSettings::getFastPropertyValue;
     167             :     };
     168             : }
     169             : #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10