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

Generated by: LCOV version 1.11