LCOV - code coverage report
Current view: top level - dbaccess/source/core/inc - querycontainer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 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                 :            : 
      20                 :            : #ifndef _DBA_CORE_QUERYCONTAINER_HXX_
      21                 :            : #define _DBA_CORE_QUERYCONTAINER_HXX_
      22                 :            : 
      23                 :            : #include <cppuhelper/implbase5.hxx>
      24                 :            : #include <comphelper/stl_types.hxx>
      25                 :            : #include <cppuhelper/interfacecontainer.hxx>
      26                 :            : 
      27                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      28                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      29                 :            : #include <com/sun/star/container/XContainerListener.hpp>
      30                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      31                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      32                 :            : #include <com/sun/star/container/XIndexAccess.hpp>
      33                 :            : #include <com/sun/star/container/XContainer.hpp>
      34                 :            : #include <com/sun/star/util/XRefreshable.hpp>
      35                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      36                 :            : #include <com/sun/star/uno/Sequence.hxx>
      37                 :            : #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
      38                 :            : #include <com/sun/star/sdbcx/XAppend.hpp>
      39                 :            : #include <com/sun/star/sdbcx/XDrop.hpp>
      40                 :            : #include <com/sun/star/sdbc/XConnection.hpp>
      41                 :            : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      42                 :            : #include <com/sun/star/container/XContainerApproveListener.hpp>
      43                 :            : 
      44                 :            : #include "definitioncontainer.hxx"
      45                 :            : #include "apitools.hxx"
      46                 :            : 
      47                 :            : namespace dbtools
      48                 :            : {
      49                 :            :     class IWarningsContainer;
      50                 :            : }
      51                 :            : 
      52                 :            : namespace dbaccess
      53                 :            : {
      54                 :            : 
      55                 :            :     typedef ::cppu::ImplHelper5 <   ::com::sun::star::container::XContainerListener
      56                 :            :                                 ,   ::com::sun::star::container::XContainerApproveListener
      57                 :            :                                 ,   ::com::sun::star::sdbcx::XDataDescriptorFactory
      58                 :            :                                 ,   ::com::sun::star::sdbcx::XAppend
      59                 :            :                                 ,   ::com::sun::star::sdbcx::XDrop
      60                 :            :                                 >   OQueryContainer_Base;
      61                 :            : 
      62                 :            :     //==========================================================================
      63                 :            :     //= OQueryContainer
      64                 :            :     //==========================================================================
      65                 :            :     class OContainerListener;
      66                 :            :     class OQueryContainer   : public ODefinitionContainer
      67                 :            :                             , public OQueryContainer_Base
      68                 :            :     {
      69                 :            :     protected:
      70                 :            :         ::dbtools::IWarningsContainer*  m_pWarnings;
      71                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
      72                 :            :                                         m_xCommandDefinitions;
      73                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      74                 :            :                                         m_xConnection;
      75                 :            :         // possible actions on our "aggregate"
      76                 :            :         enum AGGREGATE_ACTION { NONE, INSERTING, FLUSHING };
      77                 :            :         AGGREGATE_ACTION        m_eDoingCurrently;
      78                 :            : 
      79                 :            :         OContainerListener*     m_pCommandsListener;
      80                 :            : 
      81                 :            :         /** a class which automatically resets m_eDoingCurrently in it's destructor
      82                 :            :         */
      83                 :            :         class OAutoActionReset; // just for the following friend declaration
      84                 :            :         friend class OAutoActionReset;
      85                 :            :         class OAutoActionReset
      86                 :            :         {
      87                 :            :             OQueryContainer*        m_pActor;
      88                 :            :         public:
      89                 :          0 :             OAutoActionReset(OQueryContainer* _pActor) : m_pActor(_pActor) { }
      90                 :          0 :             ~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; }
      91                 :            :         };
      92                 :            : 
      93                 :            :         // ODefinitionContainer
      94                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject( const ::rtl::OUString& _rName);
      95                 :            :         virtual sal_Bool checkExistence(const ::rtl::OUString& _rName);
      96                 :            : 
      97                 :            :         // helper
      98                 :            :         virtual void SAL_CALL disposing();
      99                 :            :         virtual ~OQueryContainer();
     100                 :            :     public:
     101                 :            :         /** ctor of the container. The parent has to support the <type scope="com::sun::star::sdbc">XConnection</type>
     102                 :            :             interface.<BR>
     103                 :            : 
     104                 :            :             @param _pWarnings
     105                 :            :                 specifies a warnings container (May be <NULL/>)
     106                 :            : 
     107                 :            :                 Any errors which occur during the lifetime of the query container,
     108                 :            :                 which cannot be reported as exceptionts (for instance in methods where throwing an SQLException is
     109                 :            :                 not allowed) will be appended to this container.</p>
     110                 :            :                 <p>The caller is responsible for ensuring the lifetime of the object pointed to by this parameter.
     111                 :            :         */
     112                 :            :         OQueryContainer(
     113                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxCommandDefinitions,
     114                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
     115                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     116                 :            :             ::dbtools::IWarningsContainer* _pWarnings
     117                 :            :             );
     118                 :            : 
     119                 :            :         DECLARE_XINTERFACE( )
     120                 :            :         DECLARE_XTYPEPROVIDER( )
     121                 :            :         DECLARE_SERVICE_INFO();
     122                 :            : 
     123                 :            :     // ::com::sun::star::container::XContainerListener
     124                 :            :         virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
     125                 :            :         virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
     126                 :            :         virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
     127                 :            : 
     128                 :            :         // XContainerApproveListener
     129                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveInsertElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     130                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveReplaceElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     131                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XVeto > SAL_CALL approveRemoveElement( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     132                 :            : 
     133                 :            :     // ::com::sun::star::lang::XEventListener
     134                 :            :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
     135                 :            : 
     136                 :            :     // ::com::sun::star::sdbcx::XDataDescriptorFactory
     137                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor(  ) throw(::com::sun::star::uno::RuntimeException);
     138                 :            : 
     139                 :            :     // ::com::sun::star::sdbcx::XAppend
     140                 :            :         virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
     141                 :            : 
     142                 :            :     // ::com::sun::star::sdbcx::XDrop
     143                 :            :         virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
     144                 :            :         virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     145                 :            : 
     146                 :            :     // ::com::sun::star::container::XElementAccess
     147                 :            :         virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
     148                 :            :     // ::com::sun::star::container::XIndexAccess
     149                 :            :         virtual sal_Int32 SAL_CALL getCount(  ) throw(::com::sun::star::uno::RuntimeException);
     150                 :            :     // ::com::sun::star::container::XNameAccess
     151                 :            :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException);
     152                 :            : 
     153                 :            :     protected:
     154                 :            :         // OContentHelper overridables
     155                 :            :         virtual ::rtl::OUString determineContentType() const;
     156                 :            : 
     157                 :            :     private:
     158                 :            :         // helper
     159                 :            :         /** create a query object wrapping a CommandDefinition given by name. To retrieve the object, the CommandDescription
     160                 :            :             container will be asked for the given name.<BR>
     161                 :            :             The returned object is acquired once.
     162                 :            :         */
     163                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > implCreateWrapper(const ::rtl::OUString& _rName);
     164                 :            :         /// create a query object wrapping a CommandDefinition. The returned object is acquired once.
     165                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > implCreateWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxCommandDesc);
     166                 :            : 
     167                 :            :     };
     168                 :            : }   // namespace dbaccess
     169                 :            : 
     170                 :            : #endif // _DBA_CORE_QUERYCONTAINER_HXX_
     171                 :            : 
     172                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10