LCOV - code coverage report
Current view: top level - libreoffice/ucbhelper/source/provider - simpleinteractionrequest.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 49 0.0 %
Date: 2012-12-27 Functions: 0 2 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             : #include <ucbhelper/simpleinteractionrequest.hxx>
      21             : 
      22             : using namespace com::sun::star;
      23             : using namespace ucbhelper;
      24             : 
      25             : //=========================================================================
      26           0 : SimpleInteractionRequest::SimpleInteractionRequest(
      27             :                                     const uno::Any & rRequest,
      28             :                                     const sal_Int32 nContinuations )
      29           0 : : InteractionRequest( rRequest )
      30             : {
      31             :     // Set continuations.
      32             :     OSL_ENSURE( nContinuations != CONTINUATION_UNKNOWN,
      33             :                 "SimpleInteractionRequest - No continuation!" );
      34             : 
      35           0 :     sal_Int32 nLength = 0;
      36             : 
      37           0 :     uno::Reference< task::XInteractionContinuation > xAbort;
      38           0 :     uno::Reference< task::XInteractionContinuation > xRetry;
      39           0 :     uno::Reference< task::XInteractionContinuation > xApprove;
      40           0 :     uno::Reference< task::XInteractionContinuation > xDisapprove;
      41             : 
      42           0 :     if ( nContinuations & CONTINUATION_ABORT )
      43             :     {
      44           0 :         ++nLength;
      45           0 :         xAbort = new InteractionAbort( this );
      46             :     }
      47             : 
      48           0 :     if ( nContinuations & CONTINUATION_RETRY )
      49             :     {
      50           0 :         ++nLength;
      51           0 :         xRetry = new InteractionRetry( this );
      52             :     }
      53             : 
      54           0 :     if ( nContinuations & CONTINUATION_APPROVE )
      55             :     {
      56           0 :         ++nLength;
      57           0 :         xApprove = new InteractionApprove( this );
      58             :     }
      59             : 
      60           0 :     if (  nContinuations & CONTINUATION_DISAPPROVE )
      61             :     {
      62           0 :         ++nLength;
      63           0 :         xDisapprove = new InteractionDisapprove( this );
      64             :     }
      65             : 
      66             :     OSL_ENSURE( nLength > 0,
      67             :                 "SimpleInteractionRequest - No continuation!" );
      68             : 
      69             :     uno::Sequence< uno::Reference< task::XInteractionContinuation > >
      70           0 :         aContinuations( nLength );
      71             : 
      72           0 :     nLength = 0;
      73             : 
      74           0 :     if ( xAbort.is() )
      75           0 :         aContinuations[ nLength++ ] = xAbort;
      76             : 
      77           0 :     if ( xRetry.is() )
      78           0 :         aContinuations[ nLength++ ] = xRetry;
      79             : 
      80           0 :     if ( xApprove.is() )
      81           0 :         aContinuations[ nLength++ ] = xApprove;
      82             : 
      83           0 :     if ( xDisapprove.is() )
      84           0 :         aContinuations[ nLength++ ] = xDisapprove;
      85             : 
      86           0 :     setContinuations( aContinuations );
      87           0 : }
      88             : 
      89             : //=========================================================================
      90           0 : sal_Int32 SimpleInteractionRequest::getResponse() const
      91             : {
      92           0 :     rtl::Reference< InteractionContinuation > xSelection = getSelection();
      93           0 :     if ( xSelection.is() )
      94             :     {
      95           0 :         InteractionContinuation * pSelection = xSelection.get();
      96             : 
      97             :         uno::Reference< task::XInteractionAbort > xAbort(
      98           0 :                                         pSelection, uno::UNO_QUERY );
      99           0 :         if ( xAbort.is() )
     100           0 :             return CONTINUATION_ABORT;
     101             : 
     102             :         uno::Reference< task::XInteractionRetry > xRetry(
     103           0 :                                         pSelection, uno::UNO_QUERY );
     104           0 :         if ( xRetry.is() )
     105           0 :             return CONTINUATION_RETRY;
     106             : 
     107             :         uno::Reference< task::XInteractionApprove > xApprove(
     108           0 :                                         pSelection, uno::UNO_QUERY );
     109           0 :         if ( xApprove.is() )
     110           0 :             return CONTINUATION_APPROVE;
     111             : 
     112             :         uno::Reference< task::XInteractionDisapprove > xDisapprove(
     113           0 :                                         pSelection, uno::UNO_QUERY );
     114           0 :         if ( xDisapprove.is() )
     115           0 :             return CONTINUATION_DISAPPROVE;
     116             : 
     117           0 :         OSL_FAIL( "SimpleInteractionRequest::getResponse - Unknown continuation!" );
     118             :     }
     119           0 :     return CONTINUATION_UNKNOWN;
     120             : }
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10