LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/interaction - quietinteraction.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 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             : #ifndef __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
      21             : #define __FRAMEWORK_INTERACTION_QUIETINTERACTION_HXX_
      22             : 
      23             : #include <threadhelp/threadhelpbase.hxx>
      24             : #include <macros/xinterface.hxx>
      25             : #include <macros/xtypeprovider.hxx>
      26             : #include <general.h>
      27             : 
      28             : #include <com/sun/star/task/XInteractionHandler.hpp>
      29             : #include <com/sun/star/task/XInteractionRequest.hpp>
      30             : 
      31             : #include <cppuhelper/weak.hxx>
      32             : 
      33             : namespace framework{
      34             : 
      35             : /**
      36             :     @short      handle interactions non visible
      37             :     @descr      Sometimes it's neccessary to use a non visible interaction handler.
      38             :                 He can't do anything, which a visible one can handle.
      39             :                 But it can be used to intercept problems e.g. during loading of documents.
      40             : 
      41             :                 In current implementation we solve conflicts for following situations only:
      42             :                     - AmbigousFilterRequest
      43             :                     - InteractiveIOException
      44             :                     - InteractiveAugmentedIOException
      45             :                 All other requests will be aborted.
      46             : 
      47             :     @by         Andreas Schlüns
      48             :  */
      49           0 : class QuietInteraction : public  css::lang::XTypeProvider
      50             :                        , public  css::task::XInteractionHandler
      51             :                        , private ThreadHelpBase
      52             :                        , public  ::cppu::OWeakObject
      53             : {
      54             :     //_____________________________________
      55             :     // member
      56             :     private:
      57             : 
      58             :         /// in case an unknown interaction was aborted - we save it for our external user!
      59             :         css::uno::Any m_aRequest;
      60             : 
      61             :     //_____________________________________
      62             :     // uno interface
      63             :     public:
      64             : 
      65             :         // XInterface, XTypeProvider
      66             :         FWK_DECLARE_XINTERFACE
      67             :         FWK_DECLARE_XTYPEPROVIDER
      68             : 
      69             :         //_________________________________
      70             :         /**
      71             :             @interface  XInteractionHandler
      72             :             @short      called from outside to handle a problem
      73             :             @descr      The only interaction we can handle here is to
      74             :                         decide which of two ambigous filters should be realy used.
      75             :                         We use the user selected one every time.
      76             :                         All other request will be aborted and can break the code,
      77             :                         which use this interaction handler.
      78             : 
      79             :                         But you can use another method of this class to check for
      80             :                         some special interactions too: IO Exceptions
      81             :                         May a ComponentLoader needs that to throw suitable exception
      82             :                         on his own interface.
      83             : 
      84             :             @threadsafe yes
      85             :         */
      86             :         virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException );
      87             : 
      88             :     //_____________________________________
      89             :     // c++ interface
      90             :     public:
      91             : 
      92             :         //_________________________________
      93             :         /**
      94             :             @short      ctor to guarantee right initialized instances of this class
      95             :             @descr      -
      96             : 
      97             :             @threadsafe not neccessary
      98             :         */
      99             :         QuietInteraction();
     100             : 
     101             :         //_________________________________
     102             :         /**
     103             :             @short      return the handled interaction request
     104             :             @descr      We saved any getted interaction request internaly.
     105             :                         May the outside user of this class is interessted
     106             :                         on that. Especialy we gotted an unknown interaction
     107             :                         and aborted it hard.
     108             : 
     109             :             @return     [com.sun.star.uno.Any]
     110             :                             the packed interaction request
     111             :                             Can be empty if no interaction was used!
     112             : 
     113             :             @threadsafe yes
     114             :         */
     115             :         css::uno::Any getRequest() const;
     116             : 
     117             :         //_________________________________
     118             :         /**
     119             :             @short      returns information if interaction was used
     120             :             @descr      It can be usefully to know the reason for a failed operation.
     121             : 
     122             :             @return     [boolean]
     123             :                             <TRUE/> for used interaction
     124             :                             <FALSE/> otherwhise
     125             : 
     126             :             @threadsafe yes
     127             :         */
     128             :         sal_Bool wasUsed() const;
     129             : };
     130             : 
     131             : } // namespace framework
     132             : 
     133             : #endif // #ifndef __FRAMEWORK_INTERACTION_STILLINTERACTION_HXX_
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10