LCOV - code coverage report
Current view: top level - dbaccess/source/core/dataaccess - ComponentDefinition.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 11 0.0 %
Date: 2014-04-14 Functions: 0 9 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_DATAACCESS_COMPONENTDEFINITION_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
      22             : 
      23             : #include "commandbase.hxx"
      24             : #include <comphelper/propertycontainer.hxx>
      25             : #include <com/sun/star/sdbcx/XRename.hpp>
      26             : #include <cppuhelper/implbase1.hxx>
      27             : #include <comphelper/proparrhlp.hxx>
      28             : #include "datasettings.hxx"
      29             : #include <com/sun/star/container/XNameAccess.hpp>
      30             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      31             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      32             : #include <com/sun/star/uno/XComponentContext.hpp>
      33             : #include "ContentHelper.hxx"
      34             : #include "apitools.hxx"
      35             : #include <column.hxx>
      36             : #include <comphelper/implementationreference.hxx>
      37             : 
      38             : #include <memory>
      39             : namespace dbaccess
      40             : {
      41             : 
      42             :     typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XColumnsSupplier > OComponentDefinition_BASE;
      43             : 
      44             :     class OComponentDefinition_Impl : public OContentHelper_Impl
      45             :                                      ,public ODataSettings_Base
      46             :     {
      47             :     public:
      48             :         typedef ::std::map  <   OUString
      49             :                             ,   ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
      50             :                             >   Columns;
      51             :     typedef Columns::iterator           iterator;
      52             :     typedef Columns::const_iterator     const_iterator;
      53             : 
      54             :     private:
      55             :         Columns             m_aColumns;
      56             : 
      57             :     public:
      58             :         OUString     m_sSchemaName;
      59             :         OUString     m_sCatalogName;
      60             : 
      61             :     public:
      62             :         OComponentDefinition_Impl();
      63             :         virtual ~OComponentDefinition_Impl();
      64             : 
      65           0 :         inline size_t size() const { return m_aColumns.size(); }
      66             : 
      67           0 :         inline const_iterator begin() const   { return m_aColumns.begin(); }
      68           0 :         inline const_iterator end() const     { return m_aColumns.end(); }
      69             : 
      70           0 :         inline const_iterator find( const OUString& _rName ) const { return m_aColumns.find( _rName ); }
      71             : 
      72           0 :         inline void erase( const OUString& _rName ) { m_aColumns.erase( _rName ); }
      73             : 
      74           0 :         inline void insert( const OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
      75             :         {
      76             :             OSL_PRECOND( m_aColumns.find( _rName ) == m_aColumns.end(), "OComponentDefinition_Impl::insert: there's already an element with this name!" );
      77           0 :             m_aColumns.insert( Columns::value_type( _rName, _rxColumn ) );
      78           0 :         }
      79             :     };
      80             : 
      81             : class OColumnPropertyListener;
      82             : // OComponentDefinition - a database "document" which describes a query
      83             : class OComponentDefinition  :public OContentHelper
      84             :                             ,public ODataSettings
      85             :                             ,public IColumnFactory
      86             :                             ,public OComponentDefinition_BASE
      87             :                             ,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition >
      88             : {
      89             :     OComponentDefinition();
      90             : 
      91             : protected:
      92             :     ::std::auto_ptr< OColumns >     m_pColumns;
      93             :     ::comphelper::ImplementationReference< OColumnPropertyListener,::com::sun::star::beans::XPropertyChangeListener>
      94             :                                     m_xColumnPropertyListener;
      95             :     sal_Bool                        m_bTable;
      96             : 
      97             :     virtual ~OComponentDefinition();
      98             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      99             : 
     100             : protected:
     101             :     OComponentDefinition(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
     102             :         ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&   _xParentContainer
     103             :         ,const TContentPtr& _pImpl
     104             :         ,sal_Bool _bTable = sal_True);
     105             : 
     106           0 :     const   OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl.get() ); }
     107           0 :             OComponentDefinition_Impl& getDefinition()       { return dynamic_cast<       OComponentDefinition_Impl& >( *m_pImpl.get() ); }
     108             : public:
     109             : 
     110             :     OComponentDefinition(
     111             :              const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer
     112             :             ,const OUString& _rElementName
     113             :             ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
     114             :             ,const TContentPtr& _pImpl
     115             :             ,sal_Bool _bTable = sal_True
     116             :         );
     117             : 
     118             :     virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
     119             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
     121             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             : // ::com::sun::star::uno::XInterface
     124             :     DECLARE_XINTERFACE( )
     125             : 
     126             :     // ::com::sun::star::lang::XServiceInfo
     127             :     virtual OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             : 
     130             :     static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
     131             :     static OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
     132             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     133             :         Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
     134             : 
     135             :     // XInitialization
     136             :     virtual void SAL_CALL initialize( com::sun::star::uno::Sequence< com::sun::star::uno::Any > const & rArguments) throw (com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     137             : 
     138             :     // ::com::sun::star::beans::XPropertySet
     139             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             : 
     141             :     // XColumnsSupplier
     142             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     143             : 
     144             :     // OPropertySetHelper
     145             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     146             : 
     147             :     // IColumnFactory
     148             :     virtual OColumn*    createColumn(const OUString& _rName) const SAL_OVERRIDE;
     149             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor() SAL_OVERRIDE;
     150             :     virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor ) SAL_OVERRIDE;
     151             :     virtual void columnDropped(const OUString& _sName) SAL_OVERRIDE;
     152           0 :     virtual void notifyDataSourceModified() SAL_OVERRIDE { OContentHelper::notifyDataSourceModified(); }
     153             : 
     154             : protected:
     155             : // OPropertyArrayUsageHelper
     156             :     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
     157             : 
     158             :     virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     159             :                                     sal_Int32 nHandle,
     160             :                                     const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     161             : 
     162             :     // OContentHelper overridables
     163             :     virtual OUString determineContentType() const SAL_OVERRIDE;
     164             : 
     165             : private:
     166             :     void registerProperties();
     167             : };
     168             : 
     169             : }   // namespace dbaccess
     170             : 
     171             : #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10