LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/core/api - querydescriptor.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 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 _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
      21             : #define _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
      22             : 
      23             : #include <cppuhelper/implbase3.hxx>
      24             : #include <comphelper/proparrhlp.hxx>
      25             : #include <osl/mutex.hxx>
      26             : 
      27             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XUnoTunnel.hpp>
      30             : 
      31             : #include "apitools.hxx"
      32             : #include "column.hxx"
      33             : #include "datasettings.hxx"
      34             : #include "commandbase.hxx"
      35             : #include <comphelper/broadcasthelper.hxx>
      36             : #include <comphelper/uno3.hxx>
      37             : 
      38             : //........................................................................
      39             : namespace dbaccess
      40             : {
      41             : //........................................................................
      42             : 
      43             : //==========================================================================
      44             : //= OQueryDescriptor_Base - a query descriptor (as the name suggests :)
      45             : //==========================================================================
      46             : typedef ::cppu::ImplHelper3<
      47             :         ::com::sun::star::sdbcx::XColumnsSupplier,
      48             :         ::com::sun::star::lang::XUnoTunnel,
      49             :         ::com::sun::star::lang::XServiceInfo >  OQueryDescriptor_BASE;
      50             : 
      51             : class OQueryDescriptor_Base
      52             :         :public OQueryDescriptor_BASE
      53             :         ,public OCommandBase
      54             :         ,public IColumnFactory
      55             :         ,public ::connectivity::sdbcx::IRefreshableColumns
      56             : {
      57             : private:
      58             :     sal_Bool        m_bColumnsOutOfDate : 1;    // the columns have to be rebuild on the next getColumns ?
      59             :     ::osl::Mutex&   m_rMutex;
      60             : 
      61             : protected:
      62             :     OColumns*       m_pColumns;                 // our column descriptions
      63             :     ::rtl::OUString m_sElementName;
      64             :     virtual ~OQueryDescriptor_Base();
      65             : 
      66             :     void        setColumnsOutOfDate( sal_Bool _bOutOfDate = sal_True );
      67           0 :     sal_Bool    isColumnsOutOfDate() const { return m_bColumnsOutOfDate; }
      68             : 
      69             :     sal_Int32   getColumnCount() const { return m_pColumns ? m_pColumns->getCount() : 0; }
      70             :     void        clearColumns( );
      71             : 
      72             :     void        implAppendColumn( const ::rtl::OUString& _rName, OColumn* _pColumn );
      73             : 
      74             : public:
      75             :     OQueryDescriptor_Base(::osl::Mutex& _rMutex,::cppu::OWeakObject& _rMySelf);
      76             :     /** constructs the object with a UNO QueryDescriptor. If you use this ctor, the resulting object
      77             :         won't have any column informations (the column container will be empty)
      78             :     */
      79             :     OQueryDescriptor_Base(const OQueryDescriptor_Base& _rSource,::cppu::OWeakObject& _rMySelf);
      80             : 
      81             : // ::com::sun::star::sdbcx::XColumnsSupplier
      82             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns(  ) throw(::com::sun::star::uno::RuntimeException);
      83             : 
      84             : // ::com::sun::star::lang::XUnoTunnel
      85             :     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
      86             :     DECLARE_IMPLEMENTATION_ID( );
      87             : 
      88             : // ::com::sun::star::lang::XServiceInfo
      89             :     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
      90             :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
      91             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
      92             : 
      93             : protected:
      94             : 
      95             : // IColumnFactory
      96             :     virtual OColumn*    createColumn(const ::rtl::OUString& _rName) const;
      97             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor();
      98             :     virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor );
      99             :     virtual void columnDropped(const ::rtl::OUString& _sName);
     100             : 
     101             :     /** rebuild our columns set
     102             : 
     103             :         clearColumns has already been called before, do <em>NOT</em> call it, again
     104             :     */
     105             :     virtual void rebuildColumns( );
     106             : 
     107             :     virtual void disposeColumns();
     108             : 
     109             :     // IRefreshableColumns overridables
     110             :     virtual void refreshColumns();
     111             : };
     112             : 
     113             : class OQueryDescriptor : public comphelper::OMutexAndBroadcastHelper
     114             :                         ,public ::cppu::OWeakObject
     115             :                         ,public OQueryDescriptor_Base
     116             :                         ,public ::comphelper::OPropertyArrayUsageHelper< OQueryDescriptor_Base >
     117             :                         ,public ODataSettings
     118             : {
     119             :     OQueryDescriptor(const OQueryDescriptor&);
     120             :     void operator =(const OQueryDescriptor&);
     121             :     // helper
     122             :     void registerProperties();
     123             : protected:
     124             :     // OPropertyArrayUsageHelper
     125             :     virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
     126             : 
     127             :     // OPropertySetHelper
     128             :     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
     129             : 
     130             :     virtual ~OQueryDescriptor();
     131             : public:
     132             :     OQueryDescriptor();
     133             :     OQueryDescriptor(const OQueryDescriptor_Base& _rSource);
     134             : 
     135             :     // com::sun::star::lang::XTypeProvider
     136             :     DECLARE_TYPEPROVIDER( );
     137             : 
     138             : // ::com::sun::star::uno::XInterface
     139             :     DECLARE_XINTERFACE( )
     140             : 
     141             :     // ::com::sun::star::beans::XPropertySet
     142             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
     143             : 
     144             : };
     145             : //........................................................................
     146             : }   // namespace dbaccess
     147             : //........................................................................
     148             : 
     149             : #endif // _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
     150             : 
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10