LCOV - code coverage report
Current view: top level - dbaccess/source/ui/uno - dbinteraction.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 9 0.0 %
Date: 2014-04-14 Functions: 0 8 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_UI_UNO_DBINTERACTION_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
      22             : 
      23             : #include <cppuhelper/implbase2.hxx>
      24             : 
      25             : #include "moduledbu.hxx"
      26             : #include "apitools.hxx"
      27             : 
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/task/XInteractionHandler2.hpp>
      30             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      31             : #include <com/sun/star/ucb/AuthenticationRequest.hpp>
      32             : #include <com/sun/star/sdb/ParametersRequest.hpp>
      33             : #include <com/sun/star/sdb/DocumentSaveRequest.hpp>
      34             : 
      35             : namespace com { namespace sun { namespace star { namespace uno {
      36             :     class XComponentContext;
      37             : } } } }
      38             : 
      39             : namespace dbtools
      40             : {
      41             :     class SQLExceptionInfo;
      42             : }
      43             : 
      44             : namespace dbaui
      45             : {
      46             : 
      47             :     // BasicInteractionHandler
      48             :     typedef ::cppu::WeakImplHelper2 <   ::com::sun::star::lang::XServiceInfo
      49             :                                     ,   ::com::sun::star::task::XInteractionHandler2
      50             :                                     >   BasicInteractionHandler_Base;
      51             :     /** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for
      52             :         database related interaction requests.
      53             :         <p/>
      54             :         Supported interaction requests by now (specified by an exception: The appropriate exception
      55             :         has to be returned by the getRequest method of the object implementing the
      56             :         <type scope="com.sun.star.task">XInteractionRequest</type> interface.
      57             :             <ul>
      58             :                 <li><b><type scope="com.sun.star.sdbc">SQLException</type></b>: requests to display a
      59             :                     standard error dialog for the (maybe chained) exception given</li>
      60             :             </ul>
      61             :     */
      62           0 :     class BasicInteractionHandler
      63             :                 :public BasicInteractionHandler_Base
      64             :     {
      65             :         const OModuleClient m_aModuleClient;
      66             :         const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
      67             :                             m_xContext;
      68             :         const bool          m_bFallbackToGeneric;
      69             : 
      70             :     public:
      71             :         BasicInteractionHandler(
      72             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
      73             :             const bool i_bFallbackToGeneric
      74             :         );
      75             : 
      76             :         // XInitialization
      77             :         void SAL_CALL initialize( com::sun::star::uno::Sequence< com::sun::star::uno::Any > const & /*rArguments*/) throw (com::sun::star::uno::Exception) {}
      78             : 
      79             :         // XInteractionHandler2
      80             :         virtual sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : 
      82             :         // XInteractionHandler
      83             :         virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      84             : 
      85             :     protected:
      86             :         sal_Bool
      87             :                 impl_handle_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_Request );
      88             : 
      89             :         /// handle SQLExceptions (and derived classes)
      90             :         void    implHandle(
      91             :                     const ::dbtools::SQLExceptionInfo& _rSqlInfo,
      92             :                     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
      93             : 
      94             :         /// handle parameter requests
      95             :         void    implHandle(
      96             :                     const ::com::sun::star::sdb::ParametersRequest& _rParamRequest,
      97             :                     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
      98             : 
      99             :         /// handle document save requests
     100             :         void    implHandle(
     101             :                     const ::com::sun::star::sdb::DocumentSaveRequest& _rParamRequest,
     102             :                     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
     103             : 
     104             :         /// handles requests which are not SDB-specific
     105             :         bool    implHandleUnknown(
     106             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& _rxRequest );
     107             : 
     108             :         /// known continuation types
     109             :         enum Continuation
     110             :         {
     111             :             APPROVE,
     112             :             DISAPPROVE,
     113             :             RETRY,
     114             :             ABORT,
     115             :             SUPPLY_PARAMETERS,
     116             :             SUPPLY_DOCUMENTSAVE
     117             :         };
     118             :         /** check if a given continuation sequence contains a given continuation type<p/>
     119             :             @return     the index within <arg>_rContinuations</arg> of the first occurrence of a continuation
     120             :                         of the requested type, -1 of no such continuation exists
     121             :         */
     122             :         sal_Int32 getContinuation(
     123             :             Continuation _eCont,
     124             :             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
     125             :     };
     126             : 
     127             :     // SQLExceptionInteractionHandler
     128           0 :     class SQLExceptionInteractionHandler : public BasicInteractionHandler
     129             :     {
     130             :     public:
     131           0 :         SQLExceptionInteractionHandler(
     132             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
     133             :             )
     134           0 :             :BasicInteractionHandler( rxContext, false )
     135             :         {
     136           0 :         }
     137             : 
     138             :         // XServiceInfo
     139             :         DECLARE_SERVICE_INFO_STATIC();
     140             :     };
     141             : 
     142             :     // SQLExceptionInteractionHandler
     143             :     /** an implementation for the legacy css.sdb.InteractionHandler
     144             : 
     145             :         css.sdb.InteractionHandler is deprecated, as it does not only handle database related interactions,
     146             :         but also delegates all kind of unknown requests to a css.task.InteractionHandler.
     147             : 
     148             :         In today's architecture, there's only one central css.task.InteractionHandler, which is to be used
     149             :         for all requests. Depending on configuration information, it decides which handler implementation
     150             :         to delegate a request to.
     151             : 
     152             :         SQLExceptionInteractionHandler is the delegatee which handles only database related interactions.
     153             :         LegacyInteractionHandler is the version which first checks for a database related interaction, and
     154             :         forwards everything else to the css.task.InteractionHandler.
     155             :     */
     156           0 :     class LegacyInteractionHandler : public BasicInteractionHandler
     157             :     {
     158             :     public:
     159           0 :         LegacyInteractionHandler(
     160             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
     161             :             )
     162           0 :             :BasicInteractionHandler( rxContext, true )
     163             :         {
     164           0 :         }
     165             : 
     166             :         // XServiceInfo
     167             :         DECLARE_SERVICE_INFO_STATIC();
     168             :     };
     169             : 
     170             : }   // namespace dbaui
     171             : 
     172             : #endif // INCLUDED_DBACCESS_SOURCE_UI_UNO_DBINTERACTION_HXX
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10