LCOV - code coverage report
Current view: top level - dbaccess/source/core/inc - definitioncolumn.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-08-25 Functions: 4 5 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 18 50.0 %

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

Generated by: LCOV version 1.10