LCOV - code coverage report
Current view: top level - libreoffice/ucbhelper/source/provider - cancelcommandexecution.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 28 50.0 %
Date: 2012-12-27 Functions: 2 2 100.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             : 
      21             : /**************************************************************************
      22             :                                 TODO
      23             :  **************************************************************************
      24             : 
      25             :  *************************************************************************/
      26             : #include <osl/diagnose.h>
      27             : #include <cppuhelper/exc_hlp.hxx>
      28             : #include <com/sun/star/ucb/CommandFailedException.hpp>
      29             : #include <com/sun/star/ucb/XCommandEnvironment.hpp>
      30             : #include <ucbhelper/interactionrequest.hxx>
      31             : #include <ucbhelper/cancelcommandexecution.hxx>
      32             : #include <ucbhelper/simpleioerrorrequest.hxx>
      33             : 
      34             : using namespace com::sun::star;
      35             : 
      36             : namespace ucbhelper
      37             : {
      38             : 
      39             : //=========================================================================
      40          57 : void cancelCommandExecution( const uno::Any & rException,
      41             :                              const uno::Reference<
      42             :                                         ucb::XCommandEnvironment > & xEnv )
      43             :     throw( uno::Exception )
      44             : {
      45          57 :     if ( xEnv.is() )
      46             :     {
      47             :         uno::Reference<
      48           0 :             task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
      49           0 :         if ( xIH.is() )
      50             :         {
      51             :             rtl::Reference< ucbhelper::InteractionRequest > xRequest
      52           0 :                 = new ucbhelper::InteractionRequest( rException );
      53             : 
      54             :             uno::Sequence< uno::Reference< task::XInteractionContinuation > >
      55           0 :                 aContinuations( 1 );
      56           0 :             aContinuations[ 0 ]
      57           0 :                 = new ucbhelper::InteractionAbort( xRequest.get() );
      58             : 
      59           0 :             xRequest->setContinuations( aContinuations );
      60             : 
      61           0 :             xIH->handle( xRequest.get() );
      62             : 
      63             :             rtl::Reference< ucbhelper::InteractionContinuation > xSelection
      64           0 :                 = xRequest->getSelection();
      65             : 
      66           0 :             if ( xSelection.is() )
      67             :                 throw ucb::CommandFailedException(
      68             :                                     rtl::OUString(),
      69             :                                     uno::Reference< uno::XInterface >(),
      70           0 :                                     rException );
      71           0 :         }
      72             :     }
      73             : 
      74          57 :     cppu::throwException( rException );
      75             : 
      76             :     OSL_FAIL( "Return from cppu::throwException call!!!" );
      77           0 :     throw uno::RuntimeException();
      78             : }
      79             : 
      80             : 
      81             : //=========================================================================
      82        1613 : void cancelCommandExecution( const ucb::IOErrorCode eError,
      83             :                              const uno::Sequence< uno::Any > & rArgs,
      84             :                              const uno::Reference<
      85             :                                 ucb::XCommandEnvironment > & xEnv,
      86             :                              const rtl::OUString & rMessage,
      87             :                              const uno::Reference<
      88             :                                     ucb::XCommandProcessor > & xContext )
      89             :     throw( uno::Exception )
      90             : {
      91             :     rtl::Reference< ucbhelper::SimpleIOErrorRequest > xRequest
      92             :         = new ucbhelper::SimpleIOErrorRequest(
      93        1613 :                                     eError, rArgs, rMessage, xContext );
      94        1613 :     if ( xEnv.is() )
      95             :     {
      96             :         uno::Reference<
      97         387 :             task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
      98         387 :         if ( xIH.is() )
      99             :         {
     100          28 :             xIH->handle( xRequest.get() );
     101             : 
     102             :             rtl::Reference< ucbhelper::InteractionContinuation > xSelection
     103          28 :                 = xRequest->getSelection();
     104             : 
     105          28 :             if ( xSelection.is() )
     106             :                 throw ucb::CommandFailedException( rtl::OUString(),
     107             :                                                    xContext,
     108          10 :                                                    xRequest->getRequest() );
     109         387 :         }
     110             :     }
     111             : 
     112        3206 :     cppu::throwException( xRequest->getRequest() );
     113             : 
     114             :     OSL_FAIL( "Return from cppu::throwException call!!!" );
     115           0 :     throw uno::RuntimeException();
     116             : }
     117             : 
     118             : }
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10