LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/uui/source - iahndl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 6 33.3 %
Date: 2013-07-09 Functions: 1 6 16.7 %
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 UUI_IAHNDL_HXX
      21             : #define UUI_IAHNDL_HXX
      22             : 
      23             : #include <vector>
      24             : 
      25             : #include "osl/mutex.hxx"
      26             : #include "rtl/ustring.hxx"
      27             : 
      28             : #include "com/sun/star/uno/Reference.hxx"
      29             : #include "com/sun/star/uno/Sequence.hxx"
      30             : #include "com/sun/star/uno/XComponentContext.hpp"
      31             : 
      32             : #include "com/sun/star/beans/Optional.hpp"
      33             : #include "com/sun/star/task/InteractionClassification.hpp"
      34             : 
      35             : #include "tools/solar.h" // sal_uInt16
      36             : #include "tools/errcode.hxx" // ErrCode
      37             : #include "tools/rc.hxx" // Resource
      38             : #include "tools/wintypes.hxx" // WinBits
      39             : 
      40             : namespace com { namespace sun { namespace star {
      41             :     namespace awt {
      42             :         class XWindow;
      43             :     }
      44             :     namespace embed {
      45             :         class XStorage;
      46             :     }
      47             :     namespace lang {
      48             :         class XMultiServiceFactory;
      49             :     }
      50             :     namespace security {
      51             :         struct DocumentSignatureInformation;
      52             :     }
      53             :     namespace task {
      54             :         class FutureDocumentVersionProductUpdateRequest;
      55             :         class XInteractionContinuation;
      56             :         class XInteractionHandler2;
      57             :         class XInteractionRequest;
      58             :     }
      59             :     namespace ucb {
      60             :         class NameClashResolveRequest;
      61             :     }
      62             : } } }
      63             : 
      64             : #include <boost/unordered_map.hpp>
      65             : 
      66             : class Window;
      67             : 
      68             : //============================================================================
      69           0 : struct InteractionHandlerData
      70             : {
      71             :     /** The UNO service name to use to instanciate the content provider.
      72             :      */
      73             :     OUString ServiceName;
      74             : 
      75           0 :     InteractionHandlerData() {};
      76             :     InteractionHandlerData(const OUString & rService)
      77             :     : ServiceName( rService ){}
      78             : };
      79             : 
      80             : typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
      81             : 
      82             : typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > Continuations;
      83             : 
      84             : typedef ::boost::unordered_map< OUString, OUString, OUStringHash >    StringHashMap;
      85             : 
      86             : //============================================================================
      87             : class UUIInteractionHelper
      88             : {
      89             : private:
      90             :     mutable osl::Mutex                                                                      m_aPropertyMutex;
      91             :             ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >      m_xContext;
      92             :             ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow >                m_xWindowParam;
      93             :             const OUString                                                                  m_aContextParam;
      94             :             StringHashMap                                                                   m_aTypedCustomHandlers;
      95             :     UUIInteractionHelper(UUIInteractionHelper &); // not implemented
      96             :     void operator =(UUIInteractionHelper); // not implemented
      97             : 
      98             : public:
      99             :     UUIInteractionHelper(
     100             :         com::sun::star::uno::Reference<
     101             :             com::sun::star::uno::XComponentContext > const & rxContext,
     102             :         com::sun::star::uno::Reference<
     103             :             com::sun::star::awt::XWindow > const & rxWindow,
     104             :         const OUString & rContextParam)
     105             :         SAL_THROW(());
     106             :     UUIInteractionHelper(
     107             :         com::sun::star::uno::Reference<
     108             :             com::sun::star::uno::XComponentContext > const & rxContext)
     109             :         SAL_THROW(());
     110             : 
     111             :     ~UUIInteractionHelper() SAL_THROW(());
     112             : 
     113             :     bool
     114             :     handleRequest(
     115             :         com::sun::star::uno::Reference<
     116             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     117             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     118             : 
     119             :     com::sun::star::beans::Optional< OUString >
     120             :     getStringFromRequest(
     121             :         com::sun::star::uno::Reference<
     122             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     123             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     124             : 
     125             :     // Helper.
     126             :     static OUString
     127             :     replaceMessageWithArguments(
     128             :         OUString aMessage,
     129             :             std::vector< OUString > const & rArguments );
     130             : 
     131             :     ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
     132         425 :     getORB() const
     133         425 :     { return m_xContext; }
     134             : private:
     135             :     bool
     136             :     handleRequest_impl(
     137             :         com::sun::star::uno::Reference<
     138             :             com::sun::star::task::XInteractionRequest > const & rRequest,
     139             :         bool bObtainErrorStringOnly,
     140             :         bool & bHasErrorString,
     141             :         OUString & rErrorString)
     142             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     143             : 
     144             :     static long
     145             :     handlerequest(void* pHandleData, void* pInteractionHandler);
     146             : 
     147             :     com::sun::star::beans::Optional< OUString >
     148             :     getStringFromRequest_impl(
     149             :         com::sun::star::uno::Reference<
     150             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     151             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     152             : 
     153             :     static long
     154             :     getstringfromrequest(void* pHandleData, void* pInteractionHandler);
     155             : 
     156             :     Window *
     157             :     getParentProperty()
     158             :         SAL_THROW(());
     159             : 
     160             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
     161             :     getParentXWindow() const
     162             :         SAL_THROW(());
     163             : 
     164             :     OUString
     165             :     getContextProperty()
     166             :         SAL_THROW(());
     167             : 
     168             :     com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler2 >
     169             :     getInteractionHandler()
     170             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     171             : 
     172             :     bool    handleTypedHandlerImplementations(
     173             :                 ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const &  rRequest
     174             :             );
     175             : 
     176             :     bool
     177             :     tryOtherInteractionHandler(
     178             :         com::sun::star::uno::Reference<
     179             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     180             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     181             : 
     182             :     void
     183             :     getInteractionHandlerList(InteractionHandlerDataList &rdataList)
     184             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     185             : 
     186             :     static bool
     187             :     isInformationalErrorMessageRequest(
     188             :         com::sun::star::uno::Sequence<
     189             :             com::sun::star::uno::Reference<
     190             :                 com::sun::star::task::XInteractionContinuation > > const &
     191             :             rContinuations);
     192             : 
     193             :     //=====================================================================
     194             : 
     195             :     bool
     196             :     handleInteractiveIOException(
     197             :         com::sun::star::uno::Reference<
     198             :             com::sun::star::task::XInteractionRequest > const & rRequest,
     199             :         bool bObtainErrorStringOnly,
     200             :         bool & bHasErrorString,
     201             :         OUString & rErrorString)
     202             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     203             : 
     204             :     bool
     205             :     handleAuthenticationRequest(
     206             :         com::sun::star::uno::Reference<
     207             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     208             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     209             : 
     210             :     bool
     211             :     handleCertificateValidationRequest(
     212             :         com::sun::star::uno::Reference<
     213             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     214             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     215             : 
     216             :     void
     217             :     handleNameClashResolveRequest(
     218             :         com::sun::star::ucb::NameClashResolveRequest const & rRequest,
     219             :         com::sun::star::uno::Sequence<
     220             :             com::sun::star::uno::Reference<
     221             :                 com::sun::star::task::XInteractionContinuation > > const &
     222             :                     rContinuations)
     223             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     224             : 
     225             :     bool
     226             :     handleMasterPasswordRequest(
     227             :         com::sun::star::uno::Reference<
     228             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     229             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     230             : 
     231             :     bool
     232             :     handlePasswordRequest(
     233             :         com::sun::star::uno::Reference<
     234             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     235             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     236             : 
     237             :     bool
     238             :     handleNoSuchFilterRequest(
     239             :         com::sun::star::uno::Reference<
     240             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     241             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     242             : 
     243             :     bool
     244             :     handleAmbigousFilterRequest(
     245             :         com::sun::star::uno::Reference<
     246             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     247             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     248             : 
     249             :     bool
     250             :     handleFilterOptionsRequest(
     251             :         com::sun::star::uno::Reference<
     252             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     253             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     254             : 
     255             :     void
     256             :     handleErrorHandlerRequest(
     257             :         com::sun::star::task::InteractionClassification eClassification,
     258             :         ErrCode nErrorCode,
     259             :         std::vector< OUString > const & rArguments,
     260             :         com::sun::star::uno::Sequence<
     261             :             com::sun::star::uno::Reference<
     262             :                 com::sun::star::task::XInteractionContinuation > > const &
     263             :                     rContinuations,
     264             :         bool bObtainErrorStringOnly,
     265             :         bool & bHasErrorString,
     266             :         OUString & rErrorString)
     267             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     268             : 
     269             :     void
     270             :     handleGenericErrorRequest(
     271             :         sal_Int32 nErrorCode,
     272             :         com::sun::star::uno::Sequence<
     273             :             com::sun::star::uno::Reference<
     274             :                 com::sun::star::task::XInteractionContinuation > > const &
     275             :                     rContinuations,
     276             :         bool bObtainErrorStringOnly,
     277             :         bool & bHasErrorString,
     278             :         OUString & rErrorString)
     279             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     280             : 
     281             :     void
     282             :     handleMacroConfirmRequest(
     283             :         const OUString& aDocumentURL,
     284             :         const ::com::sun::star::uno::Reference<
     285             :             ::com::sun::star::embed::XStorage >& xZipStorage,
     286             :         const OUString& aDocumentVersion,
     287             :         const ::com::sun::star::uno::Sequence<
     288             :             ::com::sun::star::security::DocumentSignatureInformation >
     289             :                 aSignInfo,
     290             :         com::sun::star::uno::Sequence<
     291             :             com::sun::star::uno::Reference<
     292             :                 com::sun::star::task::XInteractionContinuation > > const &
     293             :                     rContinuations)
     294             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     295             : 
     296             :     void
     297             :     handleFutureDocumentVersionUpdateRequest(
     298             :         const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest&
     299             :             _rRequest,
     300             :         com::sun::star::uno::Sequence<
     301             :             com::sun::star::uno::Reference<
     302             :                 com::sun::star::task::XInteractionContinuation > > const &
     303             :                     rContinuations)
     304             :         SAL_THROW((com::sun::star::uno::RuntimeException));
     305             : 
     306             :     void
     307             :     handleBrokenPackageRequest(
     308             :         std::vector< OUString > const & rArguments,
     309             :         ::com::sun::star::uno::Sequence<
     310             :             ::com::sun::star::uno::Reference<
     311             :                 ::com::sun::star::task::XInteractionContinuation > > const &
     312             :                     rContinuations,
     313             :         bool bObtainErrorStringOnly,
     314             :         bool & bHasErrorString,
     315             :         OUString & rErrorString)
     316             :         SAL_THROW((::com::sun::star::uno::RuntimeException));
     317             : 
     318             :     bool handleLockedDocumentRequest(
     319             :         com::sun::star::uno::Reference<
     320             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     321             :         SAL_THROW((::com::sun::star::uno::RuntimeException));
     322             : 
     323             :     bool handleChangedByOthersRequest(
     324             :         com::sun::star::uno::Reference<
     325             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     326             :         SAL_THROW((::com::sun::star::uno::RuntimeException));
     327             : 
     328             :     bool handleLockFileIgnoreRequest(
     329             :         com::sun::star::uno::Reference<
     330             :             com::sun::star::task::XInteractionRequest > const & rRequest)
     331             :         SAL_THROW((::com::sun::star::uno::RuntimeException));
     332             : 
     333             :     bool    handleCustomRequest(
     334             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_rRequest,
     335             :                 const OUString& i_rServiceName
     336             :             ) const;
     337             : };
     338             : 
     339             : class ErrorResource: private Resource
     340             : {
     341             : public:
     342           0 :     inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
     343             : 
     344           0 :     inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
     345             : 
     346             :     bool getString(ErrCode nErrorCode, OUString &rString) const
     347             :         SAL_THROW(());
     348             : };
     349             : 
     350             : #endif // UUI_IAHNDL_HXX
     351             : 
     352             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10