LCOV - code coverage report
Current view: top level - include/comphelper - interaction.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 13 0.0 %
Date: 2014-04-14 Functions: 0 48 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_COMPHELPER_INTERACTION_HXX
      21             : #define INCLUDED_COMPHELPER_INTERACTION_HXX
      22             : 
      23             : #include <comphelper/uno3.hxx>
      24             : #include <cppuhelper/implbase1.hxx>
      25             : #include <com/sun/star/task/XInteractionApprove.hpp>
      26             : #include <com/sun/star/task/XInteractionDisapprove.hpp>
      27             : #include <com/sun/star/task/XInteractionAbort.hpp>
      28             : #include <com/sun/star/task/XInteractionRetry.hpp>
      29             : #include <com/sun/star/task/XInteractionPassword.hpp>
      30             : #include <com/sun/star/task/XInteractionRequest.hpp>
      31             : #include <comphelper/comphelperdllapi.h>
      32             : 
      33             : 
      34             : namespace comphelper
      35             : {
      36             : 
      37             : 
      38             : 
      39             :     //= OInteractionSelect
      40             : 
      41             :     /** base class for concrete XInteractionContinuation implementations.<p/>
      42             :         Instances of the classes maintain a flag indicating if the handler was called.
      43             :     */
      44             :     class OInteractionSelect
      45             :     {
      46             :         bool    m_bSelected : 1;    /// indicates if the select event occurred
      47             : 
      48             :     protected:
      49           0 :         OInteractionSelect() : m_bSelected(false) { }
      50             : 
      51             :     public:
      52             :         /// determines whether or not this handler was selected
      53           0 :         bool    wasSelected() const { return m_bSelected; }
      54             :         /// resets the state to "not selected", so you may reuse the handler
      55             :         void        reset() { m_bSelected = false; }
      56             : 
      57             :     protected:
      58           0 :         void    implSelected() { m_bSelected = true; }
      59             :     };
      60             : 
      61             : 
      62             :     //= OInteraction
      63             : 
      64             :     /** template for instantiating concret interaction handlers<p/>
      65             :         the template argument must eb an interface derived from XInteractionContinuation
      66             :     */
      67             :     template <class INTERACTION>
      68           0 :     class OInteraction
      69             :             :public ::cppu::WeakImplHelper1< INTERACTION >
      70             :             ,public OInteractionSelect
      71             :     {
      72             :     public:
      73           0 :         OInteraction() { }
      74             : 
      75             :     // XInteractionContinuation
      76             :         virtual void SAL_CALL select(  ) throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
      77             :     };
      78             : 
      79             : 
      80             :     template <class INTERACTION>
      81           0 :     void SAL_CALL OInteraction< INTERACTION >::select(  ) throw(::com::sun::star::uno::RuntimeException)
      82             :     {
      83           0 :         implSelected();
      84           0 :     }
      85             : 
      86             : 
      87             :     //= OInteractionApprove
      88             : 
      89             :     typedef OInteraction< ::com::sun::star::task::XInteractionApprove > OInteractionApprove;
      90             : 
      91             : 
      92             :     //= OInteractionDispprove
      93             : 
      94             :     typedef OInteraction< ::com::sun::star::task::XInteractionDisapprove >  OInteractionDisapprove;
      95             : 
      96             : 
      97             :     //= OInteractionAbort
      98             : 
      99             :     typedef OInteraction< ::com::sun::star::task::XInteractionAbort >   OInteractionAbort;
     100             : 
     101             : 
     102             :     //= OInteractionRetry
     103             : 
     104             :     typedef OInteraction< ::com::sun::star::task::XInteractionRetry >   OInteractionRetry;
     105             : 
     106             : 
     107             :     //= OInteractionPassword
     108             : 
     109           0 :     class COMPHELPER_DLLPUBLIC OInteractionPassword : public OInteraction< ::com::sun::star::task::XInteractionPassword >
     110             :     {
     111             :     public:
     112             :         OInteractionPassword()
     113             :         {
     114             :         }
     115             : 
     116           0 :         OInteractionPassword( const OUString& _rInitialPassword )
     117           0 :             :m_sPassword( _rInitialPassword )
     118             :         {
     119           0 :         }
     120             : 
     121             :         // XInteractionPassword
     122             :         virtual void SAL_CALL setPassword( const OUString& _Password ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             :         virtual OUString SAL_CALL getPassword(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             : 
     125             :     private:
     126             :         OUString m_sPassword;
     127             :     };
     128             : 
     129             : 
     130             :     //= OInteractionRequest
     131             : 
     132             :     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::task::XInteractionRequest
     133             :                                     >   OInteractionRequest_Base;
     134             :     /** implements an interaction request (com.sun.star.task::XInteractionRequest)<p/>
     135             :         at run time, you can freely add any interaction continuation objects
     136             :     */
     137           0 :     class COMPHELPER_DLLPUBLIC OInteractionRequest : public OInteractionRequest_Base
     138             :     {
     139             :         ::com::sun::star::uno::Any
     140             :                     m_aRequest;         /// the request we represent
     141             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
     142             :                     m_aContinuations;   /// all registered continuations
     143             : 
     144             :     public:
     145             :         OInteractionRequest(const ::com::sun::star::uno::Any& _rRequestDescription);
     146             : 
     147             :         /// add a new continuation
     148             :         void addContinuation(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >& _rxContinuation);
     149             : 
     150             :     // XInteractionRequest
     151             :         virtual ::com::sun::star::uno::Any SAL_CALL getRequest(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :     };
     154             : 
     155             : }   // namespace comphelper
     156             : 
     157             : 
     158             : #endif // INCLUDED_COMPHELPER_INTERACTION_HXX
     159             : 
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10