LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/comphelper - interaction.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 13 61.5 %
Date: 2012-12-17 Functions: 10 48 20.8 %
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 _COMPHELPER_INTERACTION_HXX_
      21             : #define _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             :         sal_Bool    m_bSelected : 1;    /// indicates if the select event occurred
      47             : 
      48             :     protected:
      49          64 :         OInteractionSelect() : m_bSelected(sal_False) { }
      50             : 
      51             :     public:
      52             :         /// determines whether or not this handler was selected
      53          32 :         sal_Bool    wasSelected() const { return m_bSelected; }
      54             :         /// resets the state to "not selected", so you may reuse the handler
      55             :         void        reset() { m_bSelected = sal_False; }
      56             : 
      57             :     protected:
      58          32 :         void    implSelected() { m_bSelected = sal_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         128 :     class OInteraction
      69             :             :public ::cppu::WeakImplHelper1< INTERACTION >
      70             :             ,public OInteractionSelect
      71             :     {
      72             :     public:
      73          64 :         OInteraction() { }
      74             : 
      75             :     // XInteractionContinuation
      76             :         virtual void SAL_CALL select(  ) throw(::com::sun::star::uno::RuntimeException);
      77             :     };
      78             : 
      79             :     //.........................................................................
      80             :     template <class INTERACTION>
      81          32 :     void SAL_CALL OInteraction< INTERACTION >::select(  ) throw(::com::sun::star::uno::RuntimeException)
      82             :     {
      83          32 :         implSelected();
      84          32 :     }
      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 ::rtl::OUString& _rInitialPassword )
     117           0 :             :m_sPassword( _rInitialPassword )
     118             :         {
     119           0 :         }
     120             : 
     121             :         // XInteractionPassword
     122             :         virtual void SAL_CALL setPassword( const ::rtl::OUString& _Password ) throw (::com::sun::star::uno::RuntimeException);
     123             :         virtual ::rtl::OUString SAL_CALL getPassword(  ) throw (::com::sun::star::uno::RuntimeException);
     124             : 
     125             :     private:
     126             :         ::rtl::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 (<type scope="com.sun.star.task">XInteractionRequest</type>)<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);
     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);
     153             :     };
     154             : //.........................................................................
     155             : }   // namespace comphelper
     156             : //.........................................................................
     157             : 
     158             : #endif // _COMPHELPER_INTERACTION_HXX_
     159             : 
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10