LCOV - code coverage report
Current view: top level - dbaccess/source/core/inc - definitioncolumn.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 7 100.0 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.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             : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
      21             : 
      22             : #include "apitools.hxx"
      23             : #include "column.hxx"
      24             : #include "columnsettings.hxx"
      25             : 
      26             : #include <com/sun/star/sdbc/DataType.hpp>
      27             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      28             : #include <com/sun/star/container/XChild.hpp>
      29             : 
      30             : #include <comphelper/IdPropArrayHelper.hxx>
      31             : #include <comphelper/uno3.hxx>
      32             : #include <cppuhelper/implbase1.hxx>
      33             : 
      34             : namespace dbaccess
      35             : {
      36             : 
      37             :     typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild;
      38             :     // OTableColumnDescriptor
      39             :     /**
      40             :      *  provides the properties for description. A descriptor could be used to create a new table column.
      41             :      */
      42        1281 :     class OTableColumnDescriptor : public OColumn
      43             :                                   ,public OColumnSettings
      44             :                                   ,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
      45             :                                   ,public TXChild
      46             :     {
      47             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   m_xParent;
      48             :         const bool                                                              m_bActAsDescriptor;
      49             : 
      50             :     protected:
      51             :     //  <properties>
      52             :         OUString           m_aTypeName;
      53             :         OUString           m_aDescription;
      54             :         OUString           m_aDefaultValue;
      55             :         OUString           m_aAutoIncrementValue;
      56             :         sal_Int32               m_nType;
      57             :         sal_Int32               m_nPrecision;
      58             :         sal_Int32               m_nScale;
      59             :         sal_Int32               m_nIsNullable;
      60             :         bool                m_bAutoIncrement;
      61             :         bool                m_bRowVersion;
      62             :         bool                m_bCurrency;
      63             :     //  </properties>
      64             : 
      65             :     public:
      66         642 :         OTableColumnDescriptor( const bool _bActAsDescriptor )
      67         642 :             :OColumn( !_bActAsDescriptor )
      68             :             ,m_bActAsDescriptor( _bActAsDescriptor )
      69             :             ,m_nType( ::com::sun::star::sdbc::DataType::SQLNULL )
      70             :             ,m_nPrecision( 0 )
      71             :             ,m_nScale( 0 )
      72             :             ,m_nIsNullable( ::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN )
      73             :             ,m_bAutoIncrement( false )
      74             :             ,m_bRowVersion( false )
      75         642 :             ,m_bCurrency( false )
      76             :         {
      77         642 :             impl_registerProperties();
      78         642 :         }
      79             : 
      80             :         DECLARE_XINTERFACE( )
      81             : 
      82             :         // com::sun::star::lang::XTypeProvider
      83             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             : 
      85             :         // ::com::sun::star::lang::XServiceInfo
      86             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      87             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      88             : 
      89             :         // ::com::sun::star::container::XChild
      90             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :         virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :         // ::comphelper::OPropertyArrayUsageHelper
      94             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
      95             : 
      96             :         // ::cppu::OPropertySetHelper
      97             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
      98             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
      99             : 
     100             :     private:
     101             :         void    impl_registerProperties();
     102             :     };
     103             : 
     104             :     // OTableColumn
     105             :     class OTableColumn;
     106             :     typedef ::comphelper::OPropertyArrayUsageHelper < OTableColumn >    OTableColumn_PBase;
     107             :     /** describes a column of a table
     108             :      */
     109             :     class OTableColumn  :public OTableColumnDescriptor
     110             :                         ,public OTableColumn_PBase
     111             :     {
     112             :     protected:
     113             :         virtual ~OTableColumn();
     114             : 
     115             :     public:
     116             :         OTableColumn(const OUString& _rName);
     117             : 
     118             :         // XTypeProvider
     119             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             :         // XServiceInfo
     122             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             : 
     124             :         // OPropertyArrayUsageHelper
     125             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     126             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
     127             :     };
     128             : 
     129             :     // OQueryColumn
     130             :     class OQueryColumn;
     131             :     typedef ::comphelper::OPropertyArrayUsageHelper< OQueryColumn > OQueryColumn_PBase;
     132             :     /** a column of a Query, with additional information obtained from parsing the query statement
     133             :     */
     134             :     class OQueryColumn  :public OTableColumnDescriptor
     135             :                         ,public OQueryColumn_PBase
     136             :     {
     137             :         // <properties>
     138             :         OUString m_sCatalogName;
     139             :         OUString m_sSchemaName;
     140             :         OUString m_sTableName;
     141             :         OUString m_sRealName;
     142             :         OUString m_sLabel;
     143             :         // </properties>
     144             : 
     145             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_xOriginalTableColumn;
     146             : 
     147             :     protected:
     148             :         virtual ~OQueryColumn();
     149             : 
     150             :     public:
     151             :         OQueryColumn(
     152             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn,
     153             :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     154             :             const OUString &i_sLabel
     155             :         );
     156             : 
     157             :         // XTypeProvider
     158             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             : 
     160             :         // XServiceInfo
     161             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     162             : 
     163             :         // *Property*
     164             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     165             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
     166             :         virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
     167             : 
     168             :     private:
     169             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     170             :                 impl_determineOriginalTableColumn(
     171             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
     172             :                 );
     173             : 
     174             :         using ::cppu::OPropertySetHelper::getFastPropertyValue;
     175             :     };
     176             : 
     177             :     // OColumnWrapper
     178             :     /**
     179             :      *  describes all properties for a columns of a table. Only the view parts are provided
     180             :      *  directly, all the other parts are derived from a driver implementation
     181             :      */
     182             :     class OColumnWrapper    :public OColumn
     183             :     {
     184             :     protected:
     185             :         // definition which is provided by a driver!
     186             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     187             :                                 m_xAggregate;
     188             : 
     189             :         sal_Int32               m_nColTypeID;
     190             : 
     191             :     protected:
     192             :         OColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rCol, const bool _bNameIsReadOnly );
     193             :         virtual ~OColumnWrapper();
     194             : 
     195             :     public:
     196             :         virtual void SAL_CALL getFastPropertyValue(
     197             :                                 ::com::sun::star::uno::Any& rValue,
     198             :                                 sal_Int32 nHandle
     199             :                                  ) const SAL_OVERRIDE;
     200             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(
     201             :                                 ::com::sun::star::uno::Any & rConvertedValue,
     202             :                                 ::com::sun::star::uno::Any & rOldValue,
     203             :                                 sal_Int32 nHandle,
     204             :                                 const ::com::sun::star::uno::Any& rValue )
     205             :                                     throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
     206             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     207             :                                     sal_Int32 nHandle,
     208             :                                     const ::com::sun::star::uno::Any& rValue
     209             :                                                      )
     210             :                                                      throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     211             : 
     212             :         sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
     213             : 
     214             :     protected:
     215             :         OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const;
     216             : 
     217             :     protected:
     218             :         using OColumn::getFastPropertyValue;
     219             :     };
     220             : 
     221             :     // OTableColumnDescriptorWrapper
     222             :     /**
     223             :      *  provides the properties for description. A descriptor could be used to create a new table column.
     224             :      */
     225         838 :     class OTableColumnDescriptorWrapper :public OColumnWrapper
     226             :                                         ,public OColumnSettings
     227             :                                         ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
     228             :     {
     229             :         const bool  m_bPureWrap;
     230             :         const bool  m_bIsDescriptor;
     231             : 
     232             :     public:
     233             :         OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
     234             :             const bool _bPureWrap, const bool _bIsDescriptor );
     235             : 
     236             :     // com::sun::star::lang::XTypeProvider
     237             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     238             : 
     239             :     // ::com::sun::star::lang::XServiceInfo
     240             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     241             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     242             : 
     243             :     // OIdPropertyArrayUsageHelper
     244             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const SAL_OVERRIDE;
     245             : 
     246             :     // cppu::OPropertySetHelper
     247             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     248             :         virtual void SAL_CALL getFastPropertyValue(
     249             :                                     ::com::sun::star::uno::Any& rValue,
     250             :                                     sal_Int32 nHandle
     251             :                                          ) const SAL_OVERRIDE;
     252             :         virtual sal_Bool SAL_CALL convertFastPropertyValue(
     253             :                                 ::com::sun::star::uno::Any & rConvertedValue,
     254             :                                 ::com::sun::star::uno::Any & rOldValue,
     255             :                                 sal_Int32 nHandle,
     256             :                                 const ::com::sun::star::uno::Any& rValue )
     257             :                                     throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
     258             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     259             :                                     sal_Int32 nHandle,
     260             :                                     const ::com::sun::star::uno::Any& rValue
     261             :                                                      )
     262             :                                                      throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     263             : 
     264             :     protected:
     265             :         using OColumnWrapper::getFastPropertyValue;
     266             :     };
     267             : 
     268             :     // OTableColumnWrapper
     269             :     /**
     270             :      *  describes all properties for a columns of a table. Only the view parts are provided
     271             :      *  directly, all the other parts are derived from a driver implementation
     272             :      */
     273             :     class OTableColumnWrapper   :public OTableColumnDescriptorWrapper
     274             :                                 ,public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
     275             :     {
     276             :     protected:
     277             :         virtual ~OTableColumnWrapper();
     278             : 
     279             :     public:
     280             :         OTableColumnWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,
     281             :                              const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion,
     282             :                              const bool _bPureWrap );
     283             : 
     284             :     // ::com::sun::star::lang::XTypeProvider
     285             :         virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     286             : 
     287             :     // ::com::sun::star::lang::XServiceInfo
     288             :         virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     289             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     290             : 
     291             :     // OIdPropertyArrayUsageHelper
     292             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     293             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const SAL_OVERRIDE;
     294             :     };
     295             : }
     296             : #endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
     297             : 
     298             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11