LCOV - code coverage report
Current view: top level - uui/source - iahndl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 628 0.8 %
Date: 2012-08-25 Functions: 2 30 6.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 1273 0.3 %

           Branch data     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 <memory>
      21                 :            : 
      22                 :            : #include "com/sun/star/awt/XWindow.hpp"
      23                 :            : #include "com/sun/star/beans/PropertyValue.hpp"
      24                 :            : #include "com/sun/star/configuration/backend/MergeRecoveryRequest.hpp"
      25                 :            : #include "com/sun/star/configuration/backend/StratumCreationException.hpp"
      26                 :            : #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
      27                 :            : #include "com/sun/star/document/BrokenPackageRequest.hpp"
      28                 :            : #include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp"
      29                 :            : #include "com/sun/star/java/WrongJavaVersionException.hpp"
      30                 :            : #include "com/sun/star/lang/XInitialization.hpp"
      31                 :            : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
      32                 :            : #include "com/sun/star/script/ModuleSizeExceededRequest.hpp"
      33                 :            : #include "com/sun/star/sync2/BadPartnershipException.hpp"
      34                 :            : #include "com/sun/star/task/ErrorCodeIOException.hpp"
      35                 :            : #include "com/sun/star/task/ErrorCodeRequest.hpp"
      36                 :            : #include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
      37                 :            : #include "com/sun/star/task/XInteractionAbort.hpp"
      38                 :            : #include "com/sun/star/task/XInteractionApprove.hpp"
      39                 :            : #include "com/sun/star/task/XInteractionAskLater.hpp"
      40                 :            : #include "com/sun/star/task/XInteractionDisapprove.hpp"
      41                 :            : #include "com/sun/star/task/XInteractionHandler2.hpp"
      42                 :            : #include "com/sun/star/task/XInteractionRequest.hpp"
      43                 :            : #include "com/sun/star/task/XInteractionRetry.hpp"
      44                 :            : #include "com/sun/star/ucb/InteractiveAppException.hpp"
      45                 :            : #include "com/sun/star/ucb/InteractiveCHAOSException.hpp"
      46                 :            : #include "com/sun/star/ucb/InteractiveLockingLockedException.hpp"
      47                 :            : #include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp"
      48                 :            : #include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp"
      49                 :            : #include "com/sun/star/ucb/InteractiveNetworkConnectException.hpp"
      50                 :            : #include "com/sun/star/ucb/InteractiveNetworkOffLineException.hpp"
      51                 :            : #include "com/sun/star/ucb/InteractiveNetworkReadException.hpp"
      52                 :            : #include "com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp"
      53                 :            : #include "com/sun/star/ucb/InteractiveNetworkWriteException.hpp"
      54                 :            : #include "com/sun/star/ucb/InteractiveWrongMediumException.hpp"
      55                 :            : #include "com/sun/star/ucb/NameClashException.hpp"
      56                 :            : #include "com/sun/star/ucb/NameClashResolveRequest.hpp"
      57                 :            : #include "com/sun/star/ucb/UnsupportedNameClashException.hpp"
      58                 :            : #include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp"
      59                 :            : #include "com/sun/star/ucb/XInteractionSupplyName.hpp"
      60                 :            : #include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp"
      61                 :            : #include "com/sun/star/loader/CannotActivateFactoryException.hpp"
      62                 :            : 
      63                 :            : #include "osl/conditn.hxx"
      64                 :            : #include "tools/rcid.h" // RSC_STRING
      65                 :            : #include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
      66                 :            : #include "osl/mutex.hxx"
      67                 :            : #include "tools/diagnose_ex.h"
      68                 :            : #include "comphelper/documentconstants.hxx" // ODFVER_012_TEXT
      69                 :            : #include "svtools/sfxecode.hxx" // ERRCODE_SFX_*
      70                 :            : #include "vcl/msgbox.hxx"
      71                 :            : #include "vcl/svapp.hxx"
      72                 :            : #include "unotools/configmgr.hxx"
      73                 :            : #include "toolkit/helper/vclunohelper.hxx"
      74                 :            : #include "comphelper/namedvaluecollection.hxx"
      75                 :            : #include "typelib/typedescription.hxx"
      76                 :            : #include "unotools/confignode.hxx"
      77                 :            : 
      78                 :            : #include "ids.hrc"
      79                 :            : 
      80                 :            : #include "getcontinuations.hxx"
      81                 :            : #include "secmacrowarnings.hxx"
      82                 :            : #include "newerverwarn.hxx"
      83                 :            : 
      84                 :            : #include "iahndl.hxx"
      85                 :            : #include "nameclashdlg.hxx"
      86                 :            : 
      87                 :            : #include <boost/scoped_ptr.hpp>
      88                 :            : 
      89                 :            : /** === begin UNO using === **/
      90                 :            : using ::com::sun::star::uno::Sequence;
      91                 :            : using ::com::sun::star::uno::UNO_QUERY;
      92                 :            : using ::com::sun::star::uno::Reference;
      93                 :            : using ::com::sun::star::task::XInteractionContinuation;
      94                 :            : using ::com::sun::star::task::XInteractionAbort;
      95                 :            : using ::com::sun::star::task::XInteractionApprove;
      96                 :            : using ::com::sun::star::task::XInteractionAskLater;
      97                 :            : using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest;
      98                 :            : using ::com::sun::star::uno::XInterface;
      99                 :            : using ::com::sun::star::lang::XInitialization;
     100                 :            : using ::com::sun::star::uno::UNO_QUERY_THROW;
     101                 :            : using ::com::sun::star::task::XInteractionHandler2;
     102                 :            : using ::com::sun::star::uno::Exception;
     103                 :            : using ::com::sun::star::uno::Any;
     104                 :            : using ::com::sun::star::task::XInteractionRequest;
     105                 :            : using ::com::sun::star::lang::XMultiServiceFactory;
     106                 :            : /** === end UNO using === **/
     107                 :            : 
     108                 :            : using namespace ::com::sun::star;
     109                 :            : 
     110                 :            : namespace {
     111                 :            : 
     112                 :          0 : class HandleData : public osl::Condition
     113                 :            : {
     114                 :            : public:
     115                 :          0 :     HandleData(
     116                 :            :         uno::Reference< task::XInteractionRequest > const & rRequest)
     117                 :            :         : osl::Condition(),
     118                 :            :           m_rRequest(rRequest),
     119                 :          0 :           bHandled( false )
     120                 :            :     {
     121                 :          0 :     }
     122                 :            :     uno::Reference< task::XInteractionRequest > m_rRequest;
     123                 :            :     bool                                        bHandled;
     124                 :            :     beans::Optional< rtl::OUString >            m_aResult;
     125                 :            : };
     126                 :            : 
     127                 :            : } /* namespace */
     128                 :            : 
     129                 :          0 : UUIInteractionHelper::UUIInteractionHelper(
     130                 :            :     uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
     131                 :            :     uno::Sequence< uno::Any > const & rArguments)
     132                 :            :     SAL_THROW(()):
     133                 :            :         m_xServiceFactory(rServiceFactory),
     134 [ #  # ][ #  # ]:          0 :         m_aProperties(rArguments)
     135                 :            : {
     136                 :          0 : }
     137                 :            : 
     138                 :        421 : UUIInteractionHelper::UUIInteractionHelper(
     139                 :            :     uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory)
     140                 :            :     SAL_THROW(()):
     141 [ +  - ][ +  - ]:        421 :         m_xServiceFactory(rServiceFactory)
     142                 :            : {
     143                 :        421 : }
     144                 :            : 
     145 [ +  - ][ +  - ]:        421 : UUIInteractionHelper::~UUIInteractionHelper()
     146                 :            : {
     147                 :        421 : }
     148                 :            : 
     149                 :            : long
     150                 :          0 : UUIInteractionHelper::handlerequest(
     151                 :            :     void* pHandleData, void* pInteractionHelper)
     152                 :            : {
     153                 :            :     HandleData* pHND
     154                 :          0 :         = static_cast< HandleData * >(pHandleData);
     155                 :            :     UUIInteractionHelper* pUUI
     156                 :          0 :         = static_cast< UUIInteractionHelper * >(pInteractionHelper);
     157                 :          0 :     bool bDummy = false;
     158                 :          0 :     rtl::OUString aDummy;
     159                 :            :     pHND->bHandled
     160         [ #  # ]:          0 :         = pUUI->handleRequest_impl(pHND->m_rRequest, false, bDummy, aDummy);
     161         [ #  # ]:          0 :     pHND->set();
     162                 :          0 :     return 0;
     163                 :            : }
     164                 :            : 
     165                 :            : bool
     166                 :          0 : UUIInteractionHelper::handleRequest(
     167                 :            :     uno::Reference< task::XInteractionRequest > const & rRequest)
     168                 :            :     SAL_THROW((uno::RuntimeException))
     169                 :            : {
     170                 :          0 :     Application* pApp = 0;
     171 [ #  # ][ #  # ]:          0 :     if(
                 [ #  # ]
     172                 :            :         // be aware,it is the same type
     173                 :            :         static_cast< oslThreadIdentifier >(
     174                 :          0 :             Application::GetMainThreadIdentifier())
     175                 :          0 :         != osl_getThreadIdentifier(NULL)
     176                 :            :         &&
     177                 :            :         (pApp = GetpApp())
     178                 :            :         != 0
     179                 :            :     ) {
     180                 :            :         // we are not in the main thread, let it handle that stuff
     181         [ #  # ]:          0 :         HandleData aHD(rRequest);
     182         [ #  # ]:          0 :         Link aLink(&aHD,handlerequest);
     183         [ #  # ]:          0 :         pApp->PostUserEvent(aLink,this);
     184         [ #  # ]:          0 :         sal_uLong locks = Application::ReleaseSolarMutex();
     185         [ #  # ]:          0 :         aHD.wait();
     186         [ #  # ]:          0 :         Application::AcquireSolarMutex(locks);
     187         [ #  # ]:          0 :         return aHD.bHandled;
     188                 :            :     }
     189                 :            :     else
     190                 :            :     {
     191                 :          0 :         bool bDummy = false;
     192                 :          0 :         rtl::OUString aDummy;
     193         [ #  # ]:          0 :         return handleRequest_impl(rRequest, false, bDummy, aDummy);
     194                 :            :     }
     195                 :            : }
     196                 :            : 
     197                 :            : long
     198                 :          0 : UUIInteractionHelper::getstringfromrequest(
     199                 :            :     void* pHandleData,void* pInteractionHelper)
     200                 :            : {
     201                 :          0 :     HandleData* pHND = (HandleData*) pHandleData;
     202                 :          0 :     UUIInteractionHelper* pUUI = (UUIInteractionHelper*) pInteractionHelper;
     203                 :          0 :     pHND->m_aResult = pUUI->getStringFromRequest_impl(pHND->m_rRequest);
     204                 :          0 :     pHND->set();
     205                 :          0 :     return 0;
     206                 :            : }
     207                 :            : 
     208                 :            : beans::Optional< rtl::OUString >
     209                 :          0 : UUIInteractionHelper::getStringFromRequest_impl(
     210                 :            :     uno::Reference< task::XInteractionRequest > const & rRequest)
     211                 :            :     SAL_THROW((uno::RuntimeException))
     212                 :            : {
     213                 :          0 :     bool bSuccess = false;
     214                 :          0 :     rtl::OUString aMessage;
     215         [ #  # ]:          0 :     handleRequest_impl(rRequest, true, bSuccess, aMessage);
     216                 :            : 
     217                 :            :     OSL_ENSURE(bSuccess ||
     218                 :            :                !isInformationalErrorMessageRequest(
     219                 :            :                    rRequest->getContinuations()),
     220                 :            :                "Interaction request is a candidate for a string representation."
     221                 :            :                "Please implement!");
     222                 :            : 
     223                 :          0 :     return beans::Optional< rtl::OUString >(bSuccess, aMessage);
     224                 :            : }
     225                 :            : 
     226                 :            : beans::Optional< rtl::OUString >
     227                 :          0 : UUIInteractionHelper::getStringFromRequest(
     228                 :            :     uno::Reference< task::XInteractionRequest > const & rRequest)
     229                 :            :     SAL_THROW((uno::RuntimeException))
     230                 :            : {
     231                 :          0 :     Application* pApp = 0;
     232 [ #  # ][ #  # ]:          0 :     if(
                 [ #  # ]
     233                 :            :         // be aware,it is the same type
     234                 :            :         static_cast< oslThreadIdentifier >(
     235                 :          0 :             Application::GetMainThreadIdentifier())
     236                 :          0 :         != osl_getThreadIdentifier(NULL)
     237                 :            :         &&
     238                 :            :         (pApp = GetpApp())
     239                 :            :         != 0
     240                 :            :     ) {
     241                 :            :         // we are not in the main thread, let it handle that stuff
     242         [ #  # ]:          0 :         HandleData aHD(rRequest);
     243         [ #  # ]:          0 :         Link aLink(&aHD,getstringfromrequest);
     244         [ #  # ]:          0 :         pApp->PostUserEvent(aLink,this);
     245         [ #  # ]:          0 :         sal_uLong locks = Application::ReleaseSolarMutex();
     246         [ #  # ]:          0 :         aHD.wait();
     247         [ #  # ]:          0 :         Application::AcquireSolarMutex(locks);
     248         [ #  # ]:          0 :         return aHD.m_aResult;
     249                 :            :     }
     250                 :            :     else
     251                 :          0 :         return getStringFromRequest_impl(rRequest);
     252                 :            : }
     253                 :            : 
     254                 :            : ::rtl::OUString
     255                 :          0 : UUIInteractionHelper::replaceMessageWithArguments(
     256                 :            :     ::rtl::OUString aMessage,
     257                 :            :     std::vector< rtl::OUString > const & rArguments )
     258                 :            : {
     259                 :          0 :     for (sal_Int32 i = 0;;)
     260                 :            :     {
     261                 :          0 :         i = aMessage.indexOf("$(ARG", i);
     262         [ #  # ]:          0 :         if (i == -1)
     263                 :          0 :             break;
     264   [ #  #  #  # ]:          0 :         if (aMessage.getLength() - i >= RTL_CONSTASCII_LENGTH("$(ARGx)")
                 [ #  # ]
     265                 :          0 :             && aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARGx")] == ')')
     266                 :            :         {
     267                 :            :             sal_Unicode c
     268                 :          0 :                 = aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARG")];
     269 [ #  # ][ #  # ]:          0 :             if (c >= '1' && c <= '2')
     270                 :            :             {
     271                 :            :                 std::vector< rtl::OUString >::size_type nIndex
     272                 :            :                     = static_cast< std::vector< rtl::OUString >::size_type >(
     273                 :          0 :                         c - '1');
     274         [ #  # ]:          0 :                 if (nIndex < rArguments.size())
     275                 :            :                 {
     276                 :            :                     aMessage
     277                 :            :                         = aMessage.replaceAt(i,
     278                 :            :                                              RTL_CONSTASCII_LENGTH("$(ARGx)"),
     279                 :          0 :                                              rArguments[nIndex]);
     280                 :          0 :                     i += rArguments[nIndex].getLength();
     281                 :          0 :                     continue;
     282                 :            :                 }
     283                 :            :             }
     284                 :            :         }
     285                 :          0 :         ++i;
     286                 :            :     }
     287                 :            : 
     288                 :          0 :     return aMessage;
     289                 :            : }
     290                 :            : 
     291                 :            : bool
     292                 :          0 : UUIInteractionHelper::isInformationalErrorMessageRequest(
     293                 :            :     uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
     294                 :            :         rContinuations)
     295                 :            : {
     296                 :            :     // Only requests with a single continuation (user has no choice, request
     297                 :            :     // is just informational)
     298         [ #  # ]:          0 :     if (rContinuations.getLength() != 1 )
     299                 :          0 :         return false;
     300                 :            : 
     301                 :            :     // user can only abort or approve, all other continuations are not
     302                 :            :     // considered to be informational.
     303                 :            :     uno::Reference< task::XInteractionApprove > xApprove(
     304         [ #  # ]:          0 :         rContinuations[0], uno::UNO_QUERY);
     305         [ #  # ]:          0 :     if (xApprove.is())
     306                 :          0 :         return true;
     307                 :            : 
     308                 :            :     uno::Reference< task::XInteractionAbort > xAbort(
     309         [ #  # ]:          0 :         rContinuations[0], uno::UNO_QUERY);
     310         [ #  # ]:          0 :     if (xAbort.is())
     311                 :          0 :         return true;
     312                 :            : 
     313                 :          0 :     return false;
     314                 :            : }
     315                 :            : 
     316                 :            : bool
     317                 :          0 : UUIInteractionHelper::tryOtherInteractionHandler(
     318                 :            :     uno::Reference< task::XInteractionRequest > const & rRequest)
     319                 :            :     SAL_THROW((uno::RuntimeException))
     320                 :            : {
     321         [ #  # ]:          0 :     InteractionHandlerDataList dataList;
     322         [ #  # ]:          0 :     getInteractionHandlerList(dataList);
     323                 :            : 
     324         [ #  # ]:          0 :     InteractionHandlerDataList::const_iterator aEnd(dataList.end());
     325 [ #  # ][ #  # ]:          0 :     for (InteractionHandlerDataList::const_iterator aIt(dataList.begin());
                 [ #  # ]
     326                 :            :          aIt != aEnd;
     327                 :            :          ++aIt)
     328                 :            :     {
     329 [ #  # ][ #  # ]:          0 :         if ( handleCustomRequest( rRequest, aIt->ServiceName ) )
     330                 :          0 :             return true;
     331                 :            :     }
     332                 :          0 :     return false;
     333                 :            : }
     334                 :            : 
     335                 :            : namespace
     336                 :            : {
     337                 :            :     // .................................................................................................................
     338                 :          0 :     static bool lcl_matchesRequest( const Any& i_rRequest, const ::rtl::OUString& i_rTypeName, const ::rtl::OUString& i_rPropagation )
     339                 :            :     {
     340                 :          0 :         const ::com::sun::star::uno::TypeDescription aTypeDesc( i_rTypeName );
     341                 :          0 :         const typelib_TypeDescription* pTypeDesc = aTypeDesc.get();
     342 [ #  # ][ #  # ]:          0 :         if ( !pTypeDesc || !pTypeDesc->pWeakRef )
     343                 :            :         {
     344                 :            : #if OSL_DEBUG_LEVEL > 0
     345                 :            :             ::rtl::OStringBuffer aMessage;
     346                 :            :             aMessage.append( "no type found for '" );
     347                 :            :             aMessage.append( ::rtl::OUStringToOString( i_rTypeName, RTL_TEXTENCODING_UTF8 ) );
     348                 :            :             aMessage.append( "'" );
     349                 :            :             OSL_FAIL( aMessage.makeStringAndClear().getStr() );
     350                 :            : #endif
     351                 :          0 :             return false;
     352                 :            :         }
     353                 :          0 :         const ::com::sun::star::uno::Type aType( pTypeDesc->pWeakRef );
     354                 :            : 
     355                 :          0 :         const bool bExactMatch = ( i_rPropagation.compareToAscii( "named-only" ) == 0 );
     356         [ #  # ]:          0 :         if ( bExactMatch )
     357                 :          0 :             return i_rRequest.getValueType().equals( aType );
     358                 :            : 
     359                 :          0 :         return i_rRequest.isExtractableTo( aType );
     360                 :            :     }
     361                 :            : }
     362                 :            : 
     363                 :            : // ---------------------------------------------------------------------------------------------------------------------
     364                 :          0 : bool UUIInteractionHelper::handleCustomRequest( const Reference< XInteractionRequest >& i_rRequest, const ::rtl::OUString& i_rServiceName ) const
     365                 :            : {
     366                 :            :     try
     367                 :            :     {
     368 [ #  # ][ #  # ]:          0 :         Reference< XInteractionHandler2 > xHandler( m_xServiceFactory->createInstance( i_rServiceName ), UNO_QUERY_THROW );
                 [ #  # ]
     369                 :            : 
     370         [ #  # ]:          0 :         Reference< XInitialization > xHandlerInit( xHandler, UNO_QUERY );
     371         [ #  # ]:          0 :         if ( xHandlerInit.is() )
     372                 :            :         {
     373         [ #  # ]:          0 :             ::comphelper::NamedValueCollection aInitArgs;
     374 [ #  # ][ #  # ]:          0 :             aInitArgs.put( "Parent", getParentXWindow() );
     375 [ #  # ][ #  # ]:          0 :             xHandlerInit->initialize( aInitArgs.getWrappedPropertyValues() );
         [ #  # ][ #  # ]
                 [ #  # ]
     376                 :            :         }
     377                 :            : 
     378 [ #  # ][ #  # ]:          0 :         if ( xHandler->handleInteractionRequest( i_rRequest ) )
                 [ #  # ]
     379 [ #  # ][ #  # ]:          0 :             return true;
                 [ #  # ]
     380                 :            :     }
     381                 :          0 :     catch( const Exception& )
     382                 :            :     {
     383                 :            :         DBG_UNHANDLED_EXCEPTION();
     384                 :            :     }
     385                 :          0 :     return false;
     386                 :            : }
     387                 :            : 
     388                 :            : // ---------------------------------------------------------------------------------------------------------------------
     389                 :          0 : bool UUIInteractionHelper::handleTypedHandlerImplementations( Reference< XInteractionRequest > const & rRequest )
     390                 :            : {
     391                 :            :     // the request
     392 [ #  # ][ #  # ]:          0 :     const Any aRequest( rRequest->getRequest() );
     393                 :            : 
     394         [ #  # ]:          0 :     const StringHashMap::const_iterator aCacheHitTest = m_aTypedCustomHandlers.find( aRequest.getValueTypeName() );
     395 [ #  # ][ #  # ]:          0 :     if ( aCacheHitTest != m_aTypedCustomHandlers.end() )
     396 [ #  # ][ #  # ]:          0 :         return handleCustomRequest( rRequest, aCacheHitTest->second );
     397                 :            : 
     398                 :            :     // the base registration node for "typed" interaction handlers
     399                 :            :     const ::utl::OConfigurationTreeRoot aConfigRoot( ::utl::OConfigurationTreeRoot::createWithServiceFactory(
     400                 :            :         m_xServiceFactory,
     401                 :            :         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Interaction/InteractionHandlers" ) ),
     402                 :            :         -1,
     403                 :            :         ::utl::OConfigurationTreeRoot::CM_READONLY
     404 [ #  # ][ #  # ]:          0 :     ) );
     405                 :            : 
     406                 :            :     // loop through all registered implementations
     407                 :          0 :     const Sequence< ::rtl::OUString > aRegisteredHandlers( aConfigRoot.getNodeNames() );
     408                 :          0 :     const ::rtl::OUString* pHandlerName = aRegisteredHandlers.getConstArray();
     409                 :          0 :     const ::rtl::OUString* pHandlersEnd = aRegisteredHandlers.getConstArray() + aRegisteredHandlers.getLength();
     410         [ #  # ]:          0 :     for ( ; pHandlerName != pHandlersEnd; ++pHandlerName )
     411                 :            :     {
     412                 :          0 :         const ::utl::OConfigurationNode aHandlerNode( aConfigRoot.openNode( *pHandlerName ) );
     413         [ #  # ]:          0 :         const ::utl::OConfigurationNode aTypesNode( aHandlerNode.openNode( "HandledRequestTypes" ) );
     414                 :            : 
     415                 :            :         // loop through all the types which the current handler is registered for
     416                 :          0 :         const Sequence< ::rtl::OUString > aHandledTypes( aTypesNode.getNodeNames() );
     417                 :          0 :         const ::rtl::OUString* pType = aHandledTypes.getConstArray();
     418                 :          0 :         const ::rtl::OUString* pTypesEnd = aHandledTypes.getConstArray() + aHandledTypes.getLength();
     419         [ #  # ]:          0 :         for ( ; pType != pTypesEnd; ++pType )
     420                 :            :         {
     421                 :            :             // the UNO type is the node name
     422                 :          0 :             ::utl::OConfigurationNode aType( aTypesNode.openNode( *pType ) );
     423                 :            :             // and there's a child denoting how the responsibility propagates
     424                 :          0 :             ::rtl::OUString sPropagation;
     425                 :          0 :             OSL_VERIFY( aType.getNodeValue( "Propagation" ) >>= sPropagation );
     426         [ #  # ]:          0 :             if ( lcl_matchesRequest( aRequest, *pType, sPropagation ) )
     427                 :            :             {
     428                 :            :                 // retrieve the service/implementation name of the handler
     429                 :          0 :                 ::rtl::OUString sServiceName;
     430                 :          0 :                 OSL_VERIFY( aHandlerNode.getNodeValue( "ServiceName" ) >>= sServiceName );
     431                 :            :                 // cache the information who feels responsible for requests of this type
     432         [ #  # ]:          0 :                 m_aTypedCustomHandlers[ aRequest.getValueTypeName() ] = sServiceName;
     433                 :            :                 // actually handle the request
     434         [ #  # ]:          0 :                 return handleCustomRequest( rRequest, sServiceName );
     435                 :            :             }
     436 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     437 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     438                 :            : 
     439 [ #  # ][ #  # ]:          0 :     return false;
     440                 :            : }
     441                 :            : 
     442                 :            : bool
     443                 :          0 : UUIInteractionHelper::handleRequest_impl(
     444                 :            :     uno::Reference< task::XInteractionRequest > const & rRequest,
     445                 :            :     bool bObtainErrorStringOnly,
     446                 :            :     bool & bHasErrorString,
     447                 :            :     rtl::OUString & rErrorString)
     448                 :            :     SAL_THROW((uno::RuntimeException))
     449                 :            : {
     450                 :            :     try
     451                 :            :     {
     452         [ #  # ]:          0 :         if (!rRequest.is())
     453                 :          0 :             return false;
     454                 :            : 
     455 [ #  # ][ #  # ]:          0 :         uno::Any aAnyRequest(rRequest->getRequest());
     456                 :            : 
     457         [ #  # ]:          0 :         script::ModuleSizeExceededRequest aModSizeException;
     458 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aModSizeException )
     459                 :            :         {
     460                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_IO_MODULESIZEEXCEEDED;
     461         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     462                 :            :             uno::Sequence< rtl::OUString > sModules
     463         [ #  # ]:          0 :                 = aModSizeException.Names;
     464         [ #  # ]:          0 :             if ( sModules.getLength() )
     465                 :            :             {
     466                 :          0 :                 rtl::OUString aName;
     467         [ #  # ]:          0 :                 for ( sal_Int32 index=0; index< sModules.getLength(); ++index )
     468                 :            :                 {
     469         [ #  # ]:          0 :                     if ( index )
     470         [ #  # ]:          0 :                         aName = aName + rtl::OUString( ',' ) + sModules[index];
     471                 :            :                     else
     472         [ #  # ]:          0 :                         aName = sModules[index]; // 1st name
     473                 :            :                 }
     474         [ #  # ]:          0 :                 aArguments.push_back( aName );
     475                 :            :             }
     476                 :            :             handleErrorHandlerRequest( task::InteractionClassification_WARNING,
     477                 :            :                                        nErrorCode,
     478                 :            :                                        aArguments,
     479         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     480                 :            :                                        bObtainErrorStringOnly,
     481                 :            :                                        bHasErrorString,
     482 [ #  # ][ #  # ]:          0 :                                        rErrorString);
                 [ #  # ]
     483         [ #  # ]:          0 :             return true;
     484                 :            :         }
     485                 :            : 
     486         [ #  # ]:          0 :         ucb::NameClashException aNCException;
     487 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aNCException)
     488                 :            :         {
     489                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS;
     490         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     491                 :            : 
     492         [ #  # ]:          0 :             if( !aNCException.Name.isEmpty() )
     493                 :            :             {
     494                 :          0 :                 nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS;
     495         [ #  # ]:          0 :                 aArguments.push_back( aNCException.Name );
     496                 :            :             }
     497                 :            : 
     498                 :            :             handleErrorHandlerRequest( aNCException.Classification,
     499                 :            :                                        nErrorCode,
     500                 :            :                                        aArguments,
     501         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     502                 :            :                                        bObtainErrorStringOnly,
     503                 :            :                                        bHasErrorString,
     504 [ #  # ][ #  # ]:          0 :                                        rErrorString);
                 [ #  # ]
     505                 :          0 :             return true;
     506                 :            :         }
     507                 :            : 
     508         [ #  # ]:          0 :         ucb::UnsupportedNameClashException aUORequest;
     509 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aUORequest)
     510                 :            :         {
     511                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE;
     512         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     513                 :            : 
     514                 :          0 :             uno::Reference< task::XInteractionApprove > xApprove;
     515                 :          0 :             uno::Reference< task::XInteractionDisapprove > xDisapprove;
     516                 :            :             getContinuations(
     517 [ #  # ][ #  # ]:          0 :                 rRequest->getContinuations(), &xApprove, &xDisapprove);
         [ #  # ][ #  # ]
     518                 :            : 
     519 [ #  # ][ #  # ]:          0 :             if ( xApprove.is() && xDisapprove.is() )
                 [ #  # ]
     520                 :            :             {
     521                 :            :                 handleErrorHandlerRequest( task::InteractionClassification_QUERY,
     522                 :            :                                            nErrorCode,
     523                 :            :                                            aArguments,
     524         [ #  # ]:          0 :                                            rRequest->getContinuations(),
     525                 :            :                                            bObtainErrorStringOnly,
     526                 :            :                                            bHasErrorString,
     527 [ #  # ][ #  # ]:          0 :                                            rErrorString);
                 [ #  # ]
     528                 :            :             }
     529                 :          0 :             return true;
     530                 :            :         }
     531                 :            : 
     532 [ #  # ][ #  # ]:          0 :         if ( handleInteractiveIOException( rRequest,
     533                 :            :                                            bObtainErrorStringOnly,
     534                 :            :                                            bHasErrorString,
     535                 :          0 :                                            rErrorString ) )
     536                 :          0 :             return true;
     537                 :            : 
     538         [ #  # ]:          0 :         ucb::InteractiveAppException aAppException;
     539 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aAppException)
     540                 :            :         {
     541         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     542                 :            :             handleErrorHandlerRequest( aAppException.Classification,
     543                 :            :                                        aAppException.Code,
     544                 :            :                                        aArguments,
     545         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     546                 :            :                                        bObtainErrorStringOnly,
     547                 :            :                                        bHasErrorString,
     548 [ #  # ][ #  # ]:          0 :                                        rErrorString);
                 [ #  # ]
     549                 :          0 :             return true;
     550                 :            :         }
     551                 :            : 
     552         [ #  # ]:          0 :         ucb::InteractiveNetworkException aNetworkException;
     553 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aNetworkException)
     554                 :            :         {
     555                 :            :             ErrCode nErrorCode;
     556         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     557         [ #  # ]:          0 :             ucb::InteractiveNetworkOffLineException aOffLineException;
     558         [ #  # ]:          0 :             ucb::InteractiveNetworkResolveNameException aResolveNameException;
     559         [ #  # ]:          0 :             ucb::InteractiveNetworkConnectException aConnectException;
     560         [ #  # ]:          0 :             ucb::InteractiveNetworkReadException aReadException;
     561         [ #  # ]:          0 :             ucb::InteractiveNetworkWriteException aWriteException;
     562 [ #  # ][ #  # ]:          0 :             if (aAnyRequest >>= aOffLineException)
     563                 :          0 :                 nErrorCode = ERRCODE_INET_OFFLINE;
     564 [ #  # ][ #  # ]:          0 :             else if (aAnyRequest >>= aResolveNameException)
     565                 :            :             {
     566                 :          0 :                 nErrorCode = ERRCODE_INET_NAME_RESOLVE;
     567         [ #  # ]:          0 :                 aArguments.push_back(aResolveNameException.Server);
     568                 :            :             }
     569 [ #  # ][ #  # ]:          0 :             else if (aAnyRequest >>= aConnectException)
     570                 :            :             {
     571                 :          0 :                 nErrorCode = ERRCODE_INET_CONNECT;
     572         [ #  # ]:          0 :                 aArguments.push_back(aConnectException.Server);
     573                 :            :             }
     574 [ #  # ][ #  # ]:          0 :             else if (aAnyRequest >>= aReadException)
     575                 :            :             {
     576                 :          0 :                 nErrorCode = ERRCODE_INET_READ;
     577         [ #  # ]:          0 :                 aArguments.push_back(aReadException.Diagnostic);
     578                 :            :             }
     579 [ #  # ][ #  # ]:          0 :             else if (aAnyRequest >>= aWriteException)
     580                 :            :             {
     581                 :          0 :                 nErrorCode = ERRCODE_INET_WRITE;
     582         [ #  # ]:          0 :                 aArguments.push_back(aWriteException.Diagnostic);
     583                 :            :             }
     584                 :            :             else
     585                 :          0 :                 nErrorCode = ERRCODE_INET_GENERAL;
     586                 :            : 
     587                 :            :             handleErrorHandlerRequest(aNetworkException.Classification,
     588                 :            :                                       nErrorCode,
     589                 :            :                                       aArguments,
     590         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     591                 :            :                                       bObtainErrorStringOnly,
     592                 :            :                                       bHasErrorString,
     593 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     594 [ #  # ][ #  # ]:          0 :             return true;
         [ #  # ][ #  # ]
                 [ #  # ]
     595                 :            :         }
     596                 :            : 
     597         [ #  # ]:          0 :         ucb::InteractiveCHAOSException aChaosException;
     598 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aChaosException)
     599                 :            :         {
     600         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     601                 :            :             sal_Int32 nCount
     602                 :          0 :                 = std::min< sal_Int32 >(aChaosException.Arguments.getLength(),
     603         [ #  # ]:          0 :                                         2);
     604                 :            :             aArguments.
     605                 :            :                 reserve(static_cast< std::vector< rtl::OUString >::size_type >(
     606         [ #  # ]:          0 :                     nCount));
     607         [ #  # ]:          0 :             for (sal_Int32 i = 0; i < nCount; ++i)
     608 [ #  # ][ #  # ]:          0 :                 aArguments.push_back(aChaosException.Arguments[i]);
     609                 :            :             handleErrorHandlerRequest(aChaosException.Classification,
     610                 :            :                                       aChaosException.ID,
     611                 :            :                                       aArguments,
     612         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     613                 :            :                                       bObtainErrorStringOnly,
     614                 :            :                                       bHasErrorString,
     615 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     616                 :          0 :             return true;
     617                 :            :         }
     618                 :            : 
     619         [ #  # ]:          0 :         ucb::InteractiveWrongMediumException aWrongMediumException;
     620 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aWrongMediumException)
     621                 :            :         {
     622                 :          0 :             sal_Int32 nMedium = 0;
     623                 :          0 :             aWrongMediumException.Medium >>= nMedium;
     624         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     625         [ #  # ]:          0 :             aArguments.push_back(rtl::OUString::valueOf(nMedium + 1));
     626                 :            :             handleErrorHandlerRequest(aWrongMediumException.Classification,
     627                 :            :                                       ERRCODE_UUI_WRONGMEDIUM,
     628                 :            :                                       aArguments,
     629         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     630                 :            :                                       bObtainErrorStringOnly,
     631                 :            :                                       bHasErrorString,
     632 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     633                 :          0 :             return true;
     634                 :            :         }
     635                 :            : 
     636         [ #  # ]:          0 :         java::WrongJavaVersionException aWrongJavaVersionException;
     637 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aWrongJavaVersionException)
     638                 :            :         {
     639                 :            :             ErrCode nErrorCode;
     640         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     641         [ #  # ]:          0 :             if (aWrongJavaVersionException.DetectedVersion.isEmpty())
     642         [ #  # ]:          0 :                 if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty())
     643                 :          0 :                     nErrorCode = ERRCODE_UUI_WRONGJAVA;
     644                 :            :                 else
     645                 :            :                 {
     646                 :          0 :                     nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN;
     647         [ #  # ]:          0 :                     aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion);
     648                 :            :                 }
     649         [ #  # ]:          0 :             else if (aWrongJavaVersionException.LowestSupportedVersion.isEmpty())
     650                 :            :             {
     651                 :          0 :                 nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION;
     652         [ #  # ]:          0 :                 aArguments.push_back(aWrongJavaVersionException.DetectedVersion);
     653                 :            :             }
     654                 :            :             else
     655                 :            :             {
     656                 :          0 :                 nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN;
     657         [ #  # ]:          0 :                 aArguments.reserve(2);
     658         [ #  # ]:          0 :                 aArguments.push_back(aWrongJavaVersionException.DetectedVersion);
     659         [ #  # ]:          0 :                 aArguments.push_back(aWrongJavaVersionException.LowestSupportedVersion);
     660                 :            :             }
     661                 :            :             handleErrorHandlerRequest(task::InteractionClassification_ERROR,
     662                 :            :                                       nErrorCode,
     663                 :            :                                       aArguments,
     664         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     665                 :            :                                       bObtainErrorStringOnly,
     666                 :            :                                       bHasErrorString,
     667 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     668                 :          0 :             return true;
     669                 :            :         }
     670                 :            : 
     671         [ #  # ]:          0 :         sync2::BadPartnershipException aBadPartnershipException;
     672 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aBadPartnershipException)
     673                 :            :         {
     674                 :            :             ErrCode nErrorCode;
     675         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     676         [ #  # ]:          0 :             if (aBadPartnershipException.Partnership.getLength() == 0)
     677                 :          0 :                 nErrorCode = ERRCODE_UUI_BADPARTNERSHIP;
     678                 :            :             else
     679                 :            :             {
     680                 :          0 :                 nErrorCode = ERRCODE_UUI_BADPARTNERSHIP_NAME;
     681         [ #  # ]:          0 :                 aArguments.push_back(aBadPartnershipException.Partnership);
     682                 :            :             }
     683                 :            :             handleErrorHandlerRequest(task::InteractionClassification_ERROR,
     684                 :            :                                       nErrorCode,
     685                 :            :                                       aArguments,
     686         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     687                 :            :                                       bObtainErrorStringOnly,
     688                 :            :                                       bHasErrorString,
     689 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     690                 :          0 :             return true;
     691                 :            :         }
     692                 :            : 
     693         [ #  # ]:          0 :         configuration::backend::MergeRecoveryRequest aMergeRecoveryRequest;
     694 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aMergeRecoveryRequest)
     695                 :            :         {
     696                 :            :             ErrCode nErrorCode = aMergeRecoveryRequest.IsRemovalRequest
     697                 :            :                 ? ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE
     698         [ #  # ]:          0 :                 : ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE;
     699                 :            : 
     700         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     701         [ #  # ]:          0 :             aArguments.push_back(aMergeRecoveryRequest.ErrorLayerId);
     702                 :            : 
     703                 :            :             handleErrorHandlerRequest(task::InteractionClassification_ERROR,
     704                 :            :                                       nErrorCode,
     705                 :            :                                       aArguments,
     706         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     707                 :            :                                       bObtainErrorStringOnly,
     708                 :            :                                       bHasErrorString,
     709 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     710                 :          0 :             return true;
     711                 :            :         }
     712                 :            : 
     713                 :            :         configuration::backend::StratumCreationException
     714         [ #  # ]:          0 :             aStratumCreationException;
     715                 :            : 
     716 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aStratumCreationException)
     717                 :            :         {
     718                 :          0 :             const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING;
     719                 :            : 
     720                 :          0 :             rtl::OUString aStratum = aStratumCreationException.StratumData;
     721         [ #  # ]:          0 :             if (aStratum.isEmpty())
     722                 :          0 :                 aStratum = aStratumCreationException.StratumService;
     723                 :            : 
     724         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     725         [ #  # ]:          0 :             aArguments.push_back(aStratum);
     726                 :            : 
     727                 :            :             handleErrorHandlerRequest(task::InteractionClassification_ERROR,
     728                 :            :                                       nErrorCode,
     729                 :            :                                       aArguments,
     730         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     731                 :            :                                       bObtainErrorStringOnly,
     732                 :            :                                       bHasErrorString,
     733 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     734                 :          0 :             return true;
     735                 :            :         }
     736                 :            : 
     737         [ #  # ]:          0 :         xforms::InvalidDataOnSubmitException aInvalidDataOnSubmitException;
     738 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aInvalidDataOnSubmitException)
     739                 :            :         {
     740                 :            :             const ErrCode nErrorCode =
     741                 :          0 :                 ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA;
     742                 :            : 
     743         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     744                 :            : 
     745                 :            :             handleErrorHandlerRequest(task::InteractionClassification_QUERY,
     746                 :            :                                       nErrorCode,
     747                 :            :                                       aArguments,
     748         [ #  # ]:          0 :                                       rRequest->getContinuations(),
     749                 :            :                                       bObtainErrorStringOnly,
     750                 :            :                                       bHasErrorString,
     751 [ #  # ][ #  # ]:          0 :                                       rErrorString);
                 [ #  # ]
     752                 :          0 :             return true;
     753                 :            :         }
     754                 :            : 
     755         [ #  # ]:          0 :         ucb::InteractiveLockingLockedException aLLException;
     756 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aLLException)
     757                 :            :         {
     758                 :            :             ErrCode nErrorCode = aLLException.SelfOwned
     759         [ #  # ]:          0 :                 ? ERRCODE_UUI_LOCKING_LOCKED_SELF : ERRCODE_UUI_LOCKING_LOCKED;
     760         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     761         [ #  # ]:          0 :             aArguments.push_back( aLLException.Url );
     762                 :            : 
     763                 :            :             handleErrorHandlerRequest( aLLException.Classification,
     764                 :            :                                        nErrorCode,
     765                 :            :                                        aArguments,
     766         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     767                 :            :                                        bObtainErrorStringOnly,
     768                 :            :                                        bHasErrorString,
     769 [ #  # ][ #  # ]:          0 :                                        rErrorString );
                 [ #  # ]
     770                 :          0 :             return true;
     771                 :            :         }
     772                 :            : 
     773         [ #  # ]:          0 :         ucb::InteractiveLockingNotLockedException aLNLException;
     774 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aLNLException)
     775                 :            :         {
     776                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_LOCKING_NOT_LOCKED;
     777         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     778         [ #  # ]:          0 :             aArguments.push_back( aLNLException.Url );
     779                 :            : 
     780                 :            :             handleErrorHandlerRequest( aLNLException.Classification,
     781                 :            :                                        nErrorCode,
     782                 :            :                                        aArguments,
     783         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     784                 :            :                                        bObtainErrorStringOnly,
     785                 :            :                                        bHasErrorString,
     786 [ #  # ][ #  # ]:          0 :                                        rErrorString );
                 [ #  # ]
     787                 :          0 :             return true;
     788                 :            :         }
     789                 :            : 
     790         [ #  # ]:          0 :         ucb::InteractiveLockingLockExpiredException aLLEException;
     791 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aLLEException)
     792                 :            :         {
     793                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_LOCKING_LOCK_EXPIRED;
     794         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     795         [ #  # ]:          0 :             aArguments.push_back( aLLEException.Url );
     796                 :            : 
     797                 :            :             handleErrorHandlerRequest( aLLEException.Classification,
     798                 :            :                                        nErrorCode,
     799                 :            :                                        aArguments,
     800         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     801                 :            :                                        bObtainErrorStringOnly,
     802                 :            :                                        bHasErrorString,
     803 [ #  # ][ #  # ]:          0 :                                        rErrorString );
                 [ #  # ]
     804                 :          0 :             return true;
     805                 :            :         }
     806                 :            : 
     807         [ #  # ]:          0 :         document::BrokenPackageRequest aBrokenPackageRequest;
     808 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aBrokenPackageRequest)
     809                 :            :         {
     810         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     811                 :            : 
     812         [ #  # ]:          0 :             if( !aBrokenPackageRequest.aName.isEmpty() )
     813         [ #  # ]:          0 :                 aArguments.push_back( aBrokenPackageRequest.aName );
     814                 :            : 
     815                 :            :             handleBrokenPackageRequest( aArguments,
     816         [ #  # ]:          0 :                                         rRequest->getContinuations(),
     817                 :            :                                         bObtainErrorStringOnly,
     818                 :            :                                         bHasErrorString,
     819 [ #  # ][ #  # ]:          0 :                                         rErrorString );
                 [ #  # ]
     820                 :          0 :             return true;
     821                 :            :         }
     822                 :            : 
     823         [ #  # ]:          0 :         task::ErrorCodeRequest aErrorCodeRequest;
     824 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aErrorCodeRequest)
     825                 :            :         {
     826                 :            :             handleGenericErrorRequest( aErrorCodeRequest.ErrCode,
     827         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     828                 :            :                                        bObtainErrorStringOnly,
     829                 :            :                                        bHasErrorString,
     830 [ #  # ][ #  # ]:          0 :                                        rErrorString);
                 [ #  # ]
     831                 :          0 :             return true;
     832                 :            :         }
     833                 :            : 
     834         [ #  # ]:          0 :         task::ErrorCodeIOException aErrorCodeIOException;
     835 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aErrorCodeIOException)
     836                 :            :         {
     837                 :            :             handleGenericErrorRequest( aErrorCodeIOException.ErrCode,
     838         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     839                 :            :                                        bObtainErrorStringOnly,
     840                 :            :                                        bHasErrorString,
     841 [ #  # ][ #  # ]:          0 :                                        rErrorString);
                 [ #  # ]
     842                 :          0 :             return true;
     843                 :            :         }
     844                 :            : 
     845         [ #  # ]:          0 :         loader::CannotActivateFactoryException aCannotActivateFactoryException;
     846 [ #  # ][ #  # ]:          0 :         if (aAnyRequest >>= aCannotActivateFactoryException)
     847                 :            :         {
     848                 :          0 :             ErrCode nErrorCode = ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY;
     849         [ #  # ]:          0 :             std::vector< rtl::OUString > aArguments;
     850         [ #  # ]:          0 :             aArguments.push_back( aCannotActivateFactoryException.Message );
     851                 :            : 
     852                 :            :             handleErrorHandlerRequest( task::InteractionClassification_ERROR,
     853                 :            :                                        nErrorCode,
     854                 :            :                                        aArguments,
     855         [ #  # ]:          0 :                                        rRequest->getContinuations(),
     856                 :            :                                        bObtainErrorStringOnly,
     857                 :            :                                        bHasErrorString,
     858 [ #  # ][ #  # ]:          0 :                                        rErrorString );
                 [ #  # ]
     859                 :          0 :             return true;
     860                 :            :         }
     861                 :            : 
     862                 :            : 
     863                 :            :         ///////////////////////////////////////////////////////////////////
     864                 :            :         // Handle requests which do not have a plain string representation.
     865                 :            :         ///////////////////////////////////////////////////////////////////
     866         [ #  # ]:          0 :         if (!bObtainErrorStringOnly)
     867                 :            :         {
     868 [ #  # ][ #  # ]:          0 :             if ( handleAuthenticationRequest( rRequest ) )
     869                 :          0 :                 return true;
     870                 :            : 
     871 [ #  # ][ #  # ]:          0 :             if ( handleCertificateValidationRequest( rRequest ) )
     872                 :          0 :                 return true;
     873                 :            : 
     874         [ #  # ]:          0 :             ucb::NameClashResolveRequest aNameClashResolveRequest;
     875 [ #  # ][ #  # ]:          0 :             if (aAnyRequest >>= aNameClashResolveRequest)
     876                 :            :             {
     877                 :            :                 handleNameClashResolveRequest(aNameClashResolveRequest,
     878 [ #  # ][ #  # ]:          0 :                                               rRequest->getContinuations());
         [ #  # ][ #  # ]
     879                 :          0 :                 return true;
     880                 :            :             }
     881                 :            : 
     882 [ #  # ][ #  # ]:          0 :             if ( handleMasterPasswordRequest( rRequest ) )
     883                 :          0 :                 return true;
     884                 :            : 
     885 [ #  # ][ #  # ]:          0 :             if ( handlePasswordRequest( rRequest ) )
     886                 :          0 :                 return true;
     887                 :            : 
     888 [ #  # ][ #  # ]:          0 :             if ( handleNoSuchFilterRequest( rRequest ) )
     889                 :          0 :                 return true;
     890                 :            : 
     891 [ #  # ][ #  # ]:          0 :             if ( handleAmbigousFilterRequest( rRequest ) )
     892                 :          0 :                 return true;
     893                 :            : 
     894 [ #  # ][ #  # ]:          0 :             if ( handleFilterOptionsRequest( rRequest ) )
     895                 :          0 :                 return true;
     896                 :            : 
     897 [ #  # ][ #  # ]:          0 :             if ( handleLockedDocumentRequest( rRequest ) )
     898                 :          0 :                 return true;
     899                 :            : 
     900 [ #  # ][ #  # ]:          0 :             if ( handleChangedByOthersRequest( rRequest ) )
     901                 :          0 :                 return true;
     902                 :            : 
     903 [ #  # ][ #  # ]:          0 :             if ( handleLockFileIgnoreRequest( rRequest ) )
     904                 :          0 :                 return true;
     905                 :            : 
     906         [ #  # ]:          0 :             task::DocumentMacroConfirmationRequest aMacroConfirmRequest;
     907 [ #  # ][ #  # ]:          0 :             if (aAnyRequest >>= aMacroConfirmRequest)
     908                 :            :             {
     909                 :            :                 handleMacroConfirmRequest(
     910                 :            :                     aMacroConfirmRequest.DocumentURL,
     911                 :            :                     aMacroConfirmRequest.DocumentStorage,
     912                 :          0 :                     !aMacroConfirmRequest.DocumentVersion.isEmpty() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT,
     913                 :            :                     aMacroConfirmRequest.DocumentSignatureInformation,
     914 [ #  # ][ #  # ]:          0 :                     rRequest->getContinuations());
           [ #  #  #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     915                 :          0 :                 return true;
     916                 :            :             }
     917                 :            : 
     918                 :            :             task::FutureDocumentVersionProductUpdateRequest
     919         [ #  # ]:          0 :                 aProductUpdateRequest;
     920 [ #  # ][ #  # ]:          0 :             if (aAnyRequest >>= aProductUpdateRequest)
     921                 :            :             {
     922                 :            :                 handleFutureDocumentVersionUpdateRequest(
     923                 :            :                     aProductUpdateRequest,
     924 [ #  # ][ #  # ]:          0 :                     rRequest->getContinuations());
         [ #  # ][ #  # ]
     925                 :          0 :                 return true;
     926                 :            :             }
     927                 :            : 
     928                 :            :             ///////////////////////////////////////////////////////////////
     929                 :            :             // Last chance: interaction handlers registered in the configuration
     930                 :            :             ///////////////////////////////////////////////////////////////
     931                 :            : 
     932                 :            :             // typed InteractionHandlers (ooo.Interactions)
     933 [ #  # ][ #  # ]:          0 :             if ( handleTypedHandlerImplementations( rRequest ) )
     934                 :          0 :                 return true;
     935                 :            : 
     936                 :            :             // legacy configuration (ooo.ucb.InteractionHandlers)
     937 [ #  # ][ #  # ]:          0 :             if (tryOtherInteractionHandler( rRequest ))
     938 [ #  # ][ #  # ]:          0 :                 return true;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     939                 :            :         }
     940                 :            : 
     941                 :            :         // Not handled.
     942 [ #  # ][ #  # ]:          0 :         return false;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     943                 :            :     }
     944                 :          0 :     catch (std::bad_alloc const &)
     945                 :            :     {
     946                 :            :         throw uno::RuntimeException(
     947                 :            :             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
     948   [ #  #  #  # ]:          0 :             uno::Reference< uno::XInterface >());
     949                 :            :     }
     950   [ #  #  #  # ]:          0 :     catch( const uno::RuntimeException& )
     951                 :            :     {
     952                 :          0 :         throw;  // allowed to leave here
     953                 :            :     }
     954                 :          0 :     catch( const uno::Exception& )
     955                 :            :     {
     956                 :            :         DBG_UNHANDLED_EXCEPTION();
     957                 :            :     }
     958                 :          0 :     return false;
     959                 :            : }
     960                 :            : 
     961                 :            : void
     962                 :          0 : UUIInteractionHelper::getInteractionHandlerList(
     963                 :            :     InteractionHandlerDataList &rdataList)
     964                 :            :     SAL_THROW((uno::RuntimeException))
     965                 :            : {
     966                 :            :     try
     967                 :            :     {
     968                 :            :         uno::Reference< lang::XMultiServiceFactory > xConfigProv(
     969         [ #  # ]:          0 :             m_xServiceFactory->createInstance(
     970                 :            :                 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
     971                 :          0 :                     "com.sun.star.configuration.ConfigurationProvider" )) ),
     972 [ #  # ][ #  # ]:          0 :             uno::UNO_QUERY );
                 [ #  # ]
     973                 :            : 
     974         [ #  # ]:          0 :         if ( !xConfigProv.is() )
     975                 :            :             throw uno::RuntimeException(
     976                 :            :                 rtl::OUString(
     977                 :            :                     RTL_CONSTASCII_USTRINGPARAM(
     978                 :            :                         "unable to instanciate config provider service")),
     979 [ #  # ][ #  # ]:          0 :                 uno::Reference< uno::XInterface >());
     980                 :            : 
     981                 :          0 :         rtl::OUStringBuffer aFullPath;
     982                 :            :         aFullPath.appendAscii(
     983         [ #  # ]:          0 :             "/org.openoffice.ucb.InteractionHandler/InteractionHandlers" );
     984                 :            : 
     985         [ #  # ]:          0 :         uno::Sequence< uno::Any > aArguments( 1 );
     986                 :          0 :         beans::PropertyValue      aProperty;
     987                 :            :         aProperty.Name
     988         [ #  # ]:          0 :             = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
     989 [ #  # ][ #  # ]:          0 :         aProperty.Value <<= aFullPath.makeStringAndClear();
     990 [ #  # ][ #  # ]:          0 :         aArguments[ 0 ] <<= aProperty;
     991                 :            : 
     992                 :            :         uno::Reference< uno::XInterface > xInterface(
     993         [ #  # ]:          0 :                 xConfigProv->createInstanceWithArguments(
     994                 :            :                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
     995                 :            :                         "com.sun.star.configuration.ConfigurationAccess" ) ),
     996 [ #  # ][ #  # ]:          0 :                     aArguments ) );
     997                 :            : 
     998         [ #  # ]:          0 :         if ( !xInterface.is() )
     999                 :            :             throw uno::RuntimeException(
    1000                 :            :                 rtl::OUString(
    1001                 :            :                     RTL_CONSTASCII_USTRINGPARAM(
    1002                 :            :                         "unable to instanciate config access")),
    1003 [ #  # ][ #  # ]:          0 :                 uno::Reference< uno::XInterface >());
    1004                 :            : 
    1005                 :            :         uno::Reference< container::XNameAccess > xNameAccess(
    1006         [ #  # ]:          0 :             xInterface, uno::UNO_QUERY );
    1007         [ #  # ]:          0 :         if ( !xNameAccess.is() )
    1008                 :            :             throw uno::RuntimeException(
    1009                 :            :                 rtl::OUString(
    1010                 :            :                     RTL_CONSTASCII_USTRINGPARAM(
    1011                 :            :                         "config access does not implement XNameAccess")),
    1012 [ #  # ][ #  # ]:          0 :                 uno::Reference< uno::XInterface >());
    1013                 :            : 
    1014 [ #  # ][ #  # ]:          0 :         uno::Sequence< rtl::OUString > aElems = xNameAccess->getElementNames();
    1015                 :          0 :         const rtl::OUString* pElems = aElems.getConstArray();
    1016                 :          0 :         sal_Int32 nCount = aElems.getLength();
    1017                 :            : 
    1018         [ #  # ]:          0 :         if ( nCount > 0 )
    1019                 :            :         {
    1020                 :            :             uno::Reference< container::XHierarchicalNameAccess >
    1021         [ #  # ]:          0 :                                 xHierNameAccess( xInterface, uno::UNO_QUERY );
    1022                 :            : 
    1023         [ #  # ]:          0 :             if ( !xHierNameAccess.is() )
    1024                 :            :             throw uno::RuntimeException(
    1025                 :            :                 rtl::OUString(
    1026                 :            :                     RTL_CONSTASCII_USTRINGPARAM(
    1027                 :            :                         "config access does not implement XHierarchicalNameAccess")),
    1028 [ #  # ][ #  # ]:          0 :                 uno::Reference< uno::XInterface >());
    1029                 :            : 
    1030                 :            :             // Iterate over children.
    1031         [ #  # ]:          0 :             for ( sal_Int32 n = 0; n < nCount; ++n )
    1032                 :            :             {
    1033                 :          0 :                 rtl::OUStringBuffer aElemBuffer;
    1034         [ #  # ]:          0 :                 aElemBuffer.appendAscii( "['" );
    1035         [ #  # ]:          0 :                 aElemBuffer.append( pElems[ n ] );
    1036                 :            : 
    1037                 :            :                 try
    1038                 :            :                 {
    1039                 :          0 :                     InteractionHandlerData aInfo;
    1040                 :            : 
    1041                 :            :                     // Obtain service name.
    1042         [ #  # ]:          0 :                     rtl::OUStringBuffer aKeyBuffer = aElemBuffer;
    1043         [ #  # ]:          0 :                     aKeyBuffer.appendAscii( "']/ServiceName" );
    1044                 :            : 
    1045                 :          0 :                     rtl::OUString aValue;
    1046   [ #  #  #  # ]:          0 :                     if ( !( xHierNameAccess->getByHierarchicalName(
    1047 [ #  # ][ #  # ]:          0 :                                 aKeyBuffer.makeStringAndClear() ) >>= aValue ) )
    1048                 :            :                     {
    1049                 :            :                         OSL_FAIL( "GetInteractionHandlerList - "
    1050                 :            :                                     "Error getting item value!" );
    1051                 :          0 :                         continue;
    1052                 :            :                     }
    1053                 :            : 
    1054                 :          0 :                     aInfo.ServiceName = aValue;
    1055                 :            : 
    1056                 :            :                     // Append info to list.
    1057 [ #  # ][ #  # ]:          0 :                     rdataList.push_back( aInfo );
         [ #  # ][ #  # ]
                 [ #  # ]
    1058                 :            :                 }
    1059         [ #  # ]:          0 :                 catch ( container::NoSuchElementException& )
    1060                 :            :                 {
    1061                 :            :                     // getByHierarchicalName
    1062                 :            : 
    1063                 :            :                     OSL_FAIL( "GetInteractionHandlerList - "
    1064                 :            :                                 "caught NoSuchElementException!" );
    1065                 :            :                 }
    1066         [ #  # ]:          0 :             }
    1067 [ #  # ][ #  # ]:          0 :         }
    1068                 :            :     }
    1069      [ #  #  # ]:          0 :     catch ( uno::RuntimeException const & )
    1070                 :            :     {
    1071                 :          0 :         throw;
    1072                 :            :     }
    1073                 :          0 :     catch ( uno::Exception const & )
    1074                 :            :     {
    1075                 :            :         OSL_FAIL( "GetInteractionHandlerList - Caught Exception!" );
    1076                 :            :     }
    1077                 :          0 : }
    1078                 :            : 
    1079                 :            : Window *
    1080                 :          0 : UUIInteractionHelper::getParentProperty()
    1081                 :            :     SAL_THROW(())
    1082                 :            : {
    1083         [ #  # ]:          0 :     uno::Reference< awt::XWindow > xWindow = getParentXWindow();
    1084         [ #  # ]:          0 :     if ( xWindow.is() )
    1085         [ #  # ]:          0 :         return VCLUnoHelper::GetWindow(xWindow);
    1086                 :            : 
    1087                 :          0 :     return 0;
    1088                 :            : }
    1089                 :            : 
    1090                 :            : uno::Reference< awt::XWindow>
    1091                 :          0 : UUIInteractionHelper::getParentXWindow() const
    1092                 :            :     SAL_THROW(())
    1093                 :            : {
    1094         [ #  # ]:          0 :     osl::MutexGuard aGuard(m_aPropertyMutex);
    1095         [ #  # ]:          0 :     ::comphelper::NamedValueCollection aProperties( m_aProperties );
    1096 [ #  # ][ #  # ]:          0 :     if ( aProperties.has( "Parent" ) )
    1097                 :            :     {
    1098                 :          0 :         uno::Reference< awt::XWindow > xWindow;
    1099 [ #  # ][ #  # ]:          0 :         OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow );
    1100                 :          0 :         return xWindow;
    1101                 :            :     }
    1102 [ #  # ][ #  # ]:          0 :     return 0;
                 [ #  # ]
    1103                 :            : }
    1104                 :            : 
    1105                 :            : rtl::OUString
    1106                 :          0 : UUIInteractionHelper::getContextProperty()
    1107                 :            :     SAL_THROW(())
    1108                 :            : {
    1109         [ #  # ]:          0 :     osl::MutexGuard aGuard(m_aPropertyMutex);
    1110         [ #  # ]:          0 :     for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
    1111                 :            :     {
    1112                 :          0 :         beans::PropertyValue aProperty;
    1113 [ #  # ][ #  # ]:          0 :         if ((m_aProperties[i] >>= aProperty) && aProperty.Name == "Context" )
         [ #  # ][ #  # ]
                 [ #  # ]
    1114                 :            :         {
    1115                 :          0 :             rtl::OUString aContext;
    1116                 :          0 :             aProperty.Value >>= aContext;
    1117                 :          0 :             return aContext;
    1118                 :            :         }
    1119         [ #  # ]:          0 :     }
    1120         [ #  # ]:          0 :     return rtl::OUString();
    1121                 :            : }
    1122                 :            : 
    1123                 :            : uno::Reference< task::XInteractionHandler >
    1124                 :          0 : UUIInteractionHelper::getInteractionHandler()
    1125                 :            :     SAL_THROW((uno::RuntimeException))
    1126                 :            : {
    1127                 :          0 :     uno::Reference< task::XInteractionHandler > xIH;
    1128                 :            :     try
    1129                 :            :     {
    1130         [ #  # ]:          0 :         xIH.set(m_xServiceFactory->createInstanceWithArguments(
    1131                 :            :                     rtl::OUString(
    1132                 :            :                         RTL_CONSTASCII_USTRINGPARAM(
    1133                 :            :                             "com.sun.star.task.InteractionHandler")),
    1134                 :          0 :                     m_aProperties),
    1135 [ #  # ][ #  # ]:          0 :                 uno::UNO_QUERY);
         [ #  # ][ #  # ]
    1136                 :            :     }
    1137         [ #  # ]:          0 :     catch (uno::Exception const &)
    1138                 :            :     {}
    1139                 :            : 
    1140         [ #  # ]:          0 :     if (!xIH.is())
    1141                 :            :         throw uno::RuntimeException(
    1142                 :            :             rtl::OUString(
    1143                 :            :                 RTL_CONSTASCII_USTRINGPARAM(
    1144                 :            :                     "unable to instanciate Interaction Handler service")),
    1145 [ #  # ][ #  # ]:          0 :             uno::Reference< uno::XInterface >());
    1146                 :          0 :     return xIH;
    1147                 :            : }
    1148                 :            : 
    1149                 :            : namespace {
    1150                 :            : 
    1151                 :            : sal_uInt16
    1152                 :          0 : executeMessageBox(
    1153                 :            :     Window * pParent,
    1154                 :            :     rtl::OUString const & rTitle,
    1155                 :            :     rtl::OUString const & rMessage,
    1156                 :            :     WinBits nButtonMask )
    1157                 :            :     SAL_THROW((uno::RuntimeException))
    1158                 :            : {
    1159         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1160                 :            : 
    1161 [ #  # ][ #  # ]:          0 :     MessBox xBox( pParent, nButtonMask, rTitle, rMessage );
         [ #  # ][ #  # ]
                 [ #  # ]
    1162                 :            : 
    1163         [ #  # ]:          0 :     sal_uInt16 aResult = xBox.Execute();
    1164   [ #  #  #  #  :          0 :     switch( aResult )
                   #  # ]
    1165                 :            :     {
    1166                 :            :     case BUTTONID_OK:
    1167                 :          0 :         aResult = ERRCODE_BUTTON_OK;
    1168                 :          0 :         break;
    1169                 :            :     case BUTTONID_CANCEL:
    1170                 :          0 :         aResult = ERRCODE_BUTTON_CANCEL;
    1171                 :          0 :         break;
    1172                 :            :     case BUTTONID_YES:
    1173                 :          0 :         aResult = ERRCODE_BUTTON_YES;
    1174                 :          0 :         break;
    1175                 :            :     case BUTTONID_NO:
    1176                 :          0 :         aResult = ERRCODE_BUTTON_NO;
    1177                 :          0 :         break;
    1178                 :            :     case BUTTONID_RETRY:
    1179                 :          0 :         aResult = ERRCODE_BUTTON_RETRY;
    1180                 :          0 :         break;
    1181                 :            :     }
    1182                 :            : 
    1183 [ #  # ][ #  # ]:          0 :     return aResult;
    1184                 :            : }
    1185                 :            : 
    1186                 :          0 : NameClashResolveDialogResult executeSimpleNameClashResolveDialog( Window *pParent,
    1187                 :            :                                                                   rtl::OUString const & rTargetFolderURL,
    1188                 :            :                                                                   rtl::OUString const & rClashingName,
    1189                 :            :                                                                   rtl::OUString & rProposedNewName,
    1190                 :            :                                                                   bool bAllowOverwrite )
    1191                 :            : {
    1192         [ #  # ]:          0 :     boost::scoped_ptr< ResMgr > xManager( ResMgr::CreateResMgr( "uui" ) );
    1193         [ #  # ]:          0 :     if ( !xManager.get() )
    1194                 :          0 :         return ABORT;
    1195                 :            : 
    1196                 :            :     NameClashDialog aDialog( pParent, xManager.get(), rTargetFolderURL,
    1197         [ #  # ]:          0 :                              rClashingName, rProposedNewName, bAllowOverwrite );
    1198                 :            : 
    1199         [ #  # ]:          0 :     NameClashResolveDialogResult eResult = (NameClashResolveDialogResult) aDialog.Execute();
    1200                 :          0 :     rProposedNewName = aDialog.getNewName();
    1201 [ #  # ][ #  # ]:          0 :     return eResult;
    1202                 :            : }
    1203                 :            : 
    1204                 :            : } // namespace
    1205                 :            : 
    1206                 :            : void
    1207                 :          0 : UUIInteractionHelper::handleNameClashResolveRequest(
    1208                 :            :     ucb::NameClashResolveRequest const & rRequest,
    1209                 :            :     uno::Sequence< uno::Reference<
    1210                 :            :         task::XInteractionContinuation > > const & rContinuations)
    1211                 :            :   SAL_THROW((uno::RuntimeException))
    1212                 :            : {
    1213                 :            :     OSL_ENSURE(!rRequest.TargetFolderURL.isEmpty(),
    1214                 :            :         "NameClashResolveRequest must not contain empty TargetFolderURL" );
    1215                 :            : 
    1216                 :            :     OSL_ENSURE(!rRequest.ClashingName.isEmpty(),
    1217                 :            :         "NameClashResolveRequest must not contain empty ClashingName" );
    1218                 :            : 
    1219                 :          0 :     uno::Reference< task::XInteractionAbort > xAbort;
    1220                 :          0 :     uno::Reference< ucb::XInteractionSupplyName > xSupplyName;
    1221                 :          0 :     uno::Reference< ucb::XInteractionReplaceExistingData > xReplaceExistingData;
    1222                 :            :     getContinuations(
    1223         [ #  # ]:          0 :         rContinuations, &xAbort, &xSupplyName, &xReplaceExistingData);
    1224                 :            : 
    1225                 :            :     OSL_ENSURE( xAbort.is(),
    1226                 :            :         "NameClashResolveRequest must contain Abort continuation" );
    1227                 :            : 
    1228                 :            :     OSL_ENSURE( xSupplyName.is(),
    1229                 :            :         "NameClashResolveRequest must contain SupplyName continuation" );
    1230                 :            : 
    1231                 :          0 :     NameClashResolveDialogResult eResult = ABORT;
    1232                 :          0 :     rtl::OUString aProposedNewName( rRequest.ProposedNewName );
    1233                 :            : 
    1234                 :            :     eResult = executeSimpleNameClashResolveDialog( getParentProperty(),
    1235                 :            :                     rRequest.TargetFolderURL,
    1236                 :            :                     rRequest.ClashingName,
    1237                 :            :                     aProposedNewName,
    1238 [ #  # ][ #  # ]:          0 :                     xReplaceExistingData.is() );
    1239                 :            : 
    1240   [ #  #  #  # ]:          0 :     switch ( eResult )
    1241                 :            :     {
    1242                 :            :     case ABORT:
    1243 [ #  # ][ #  # ]:          0 :         xAbort->select();
    1244                 :          0 :         break;
    1245                 :            : 
    1246                 :            :     case RENAME:
    1247 [ #  # ][ #  # ]:          0 :         xSupplyName->setName( aProposedNewName );
    1248 [ #  # ][ #  # ]:          0 :         xSupplyName->select();
    1249                 :          0 :         break;
    1250                 :            : 
    1251                 :            :     case OVERWRITE:
    1252                 :            :         OSL_ENSURE(
    1253                 :            :             xReplaceExistingData.is(),
    1254                 :            :             "Invalid NameClashResolveDialogResult: OVERWRITE - "
    1255                 :            :             "No ReplaceExistingData continuation available!" );
    1256 [ #  # ][ #  # ]:          0 :         xReplaceExistingData->select();
    1257                 :          0 :         break;
    1258                 :          0 :     }
    1259                 :          0 : }
    1260                 :            : 
    1261                 :            : void
    1262                 :          0 : UUIInteractionHelper::handleGenericErrorRequest(
    1263                 :            :     sal_Int32 nErrorCode,
    1264                 :            :     uno::Sequence< uno::Reference<
    1265                 :            :         task::XInteractionContinuation > > const & rContinuations,
    1266                 :            :     bool bObtainErrorStringOnly,
    1267                 :            :     bool & bHasErrorString,
    1268                 :            :     rtl::OUString & rErrorString)
    1269                 :            :     SAL_THROW((uno::RuntimeException))
    1270                 :            : {
    1271         [ #  # ]:          0 :     if (bObtainErrorStringOnly)
    1272                 :            :     {
    1273                 :          0 :         bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
    1274         [ #  # ]:          0 :         if (bHasErrorString)
    1275                 :            :         {
    1276         [ #  # ]:          0 :             String aErrorString;
    1277         [ #  # ]:          0 :             ErrorHandler::GetErrorString(nErrorCode, aErrorString);
    1278 [ #  # ][ #  # ]:          0 :             rErrorString = aErrorString;
    1279                 :            :         }
    1280                 :            :     }
    1281                 :            :     else
    1282                 :            :     {
    1283                 :          0 :         uno::Reference< task::XInteractionAbort > xAbort;
    1284                 :          0 :         uno::Reference< task::XInteractionApprove > xApprove;
    1285         [ #  # ]:          0 :         getContinuations(rContinuations, &xApprove, &xAbort);
    1286                 :            : 
    1287                 :            :         // Note: It's important to convert the transported long to the
    1288                 :            :         // required  unsigned long value. Otherwhise using as flag field
    1289                 :            :         // can fail ...
    1290                 :          0 :         ErrCode  nError   = static_cast< ErrCode >(nErrorCode);
    1291                 :          0 :         sal_Bool bWarning = !ERRCODE_TOERROR(nError);
    1292                 :            : 
    1293 [ #  # ][ #  # ]:          0 :         if ( nError == ERRCODE_SFX_BROKENSIGNATURE
    1294                 :            :              || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
    1295                 :            :         {
    1296                 :            :             // the security warning box needs a special title
    1297         [ #  # ]:          0 :             String aErrorString;
    1298         [ #  # ]:          0 :             ErrorHandler::GetErrorString( nErrorCode, aErrorString );
    1299                 :            : 
    1300                 :            :             boost::scoped_ptr< ResMgr > xManager(
    1301         [ #  # ]:          0 :                 ResMgr::CreateResMgr( "uui" ) );
    1302         [ #  # ]:          0 :             rtl::OUString aTitle( utl::ConfigManager::getProductName() );
    1303                 :            : 
    1304                 :            :             ::rtl::OUString aErrTitle
    1305                 :            :                   = ResId( nError == ERRCODE_SFX_BROKENSIGNATURE
    1306                 :            :                                        ? STR_WARNING_BROKENSIGNATURE_TITLE
    1307                 :            :                                        : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
    1308 [ #  # ][ #  # ]:          0 :                                    *xManager.get() ).toString();
    1309                 :            : 
    1310 [ #  # ][ #  # ]:          0 :             if ( !aTitle.isEmpty() && !aErrTitle.isEmpty() )
                 [ #  # ]
    1311         [ #  # ]:          0 :                 aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
    1312                 :          0 :             aTitle += aErrTitle;
    1313                 :            : 
    1314                 :            :             executeMessageBox(
    1315 [ #  # ][ #  # ]:          0 :                 getParentProperty(), aTitle, aErrorString, WB_OK );
         [ #  # ][ #  # ]
                 [ #  # ]
    1316                 :            :         }
    1317                 :            :         else
    1318         [ #  # ]:          0 :             ErrorHandler::HandleError(nErrorCode);
    1319                 :            : 
    1320 [ #  # ][ #  # ]:          0 :         if (xApprove.is() && bWarning)
                 [ #  # ]
    1321 [ #  # ][ #  # ]:          0 :             xApprove->select();
    1322         [ #  # ]:          0 :         else if (xAbort.is())
    1323 [ #  # ][ #  # ]:          0 :             xAbort->select();
    1324                 :            :     }
    1325                 :          0 : }
    1326                 :            : 
    1327                 :            : void
    1328                 :          0 : UUIInteractionHelper::handleMacroConfirmRequest(
    1329                 :            :     const ::rtl::OUString& aDocumentURL,
    1330                 :            :     const uno::Reference< embed::XStorage >& xZipStorage,
    1331                 :            :     const ::rtl::OUString& aDocumentVersion,
    1332                 :            :     const uno::Sequence< security::DocumentSignatureInformation > aSignInfo,
    1333                 :            :     uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
    1334                 :            :         rContinuations )
    1335                 :            :     SAL_THROW((uno::RuntimeException))
    1336                 :            : {
    1337                 :          0 :     uno::Reference< task::XInteractionAbort > xAbort;
    1338                 :          0 :     uno::Reference< task::XInteractionApprove > xApprove;
    1339         [ #  # ]:          0 :     getContinuations( rContinuations, &xApprove, &xAbort );
    1340                 :            : 
    1341                 :          0 :     bool bApprove = false;
    1342                 :            : 
    1343         [ #  # ]:          0 :     boost::scoped_ptr< ResMgr > pResMgr( ResMgr::CreateResMgr( "uui" ) );
    1344         [ #  # ]:          0 :     if ( pResMgr.get() )
    1345                 :            :     {
    1346                 :          0 :         bool bShowSignatures = aSignInfo.getLength() > 0;
    1347                 :            :         MacroWarning aWarning(
    1348 [ #  # ][ #  # ]:          0 :             getParentProperty(), bShowSignatures, *pResMgr.get() );
    1349                 :            : 
    1350 [ #  # ][ #  # ]:          0 :         aWarning.SetDocumentURL( aDocumentURL );
                 [ #  # ]
    1351         [ #  # ]:          0 :         if ( aSignInfo.getLength() > 1 )
    1352                 :            :         {
    1353         [ #  # ]:          0 :             aWarning.SetStorage( xZipStorage, aDocumentVersion, aSignInfo );
    1354                 :            :         }
    1355         [ #  # ]:          0 :         else if ( aSignInfo.getLength() == 1 )
    1356                 :            :         {
    1357         [ #  # ]:          0 :             aWarning.SetCertificate( aSignInfo[ 0 ].Signer );
    1358                 :            :         }
    1359                 :            : 
    1360 [ #  # ][ #  # ]:          0 :         bApprove = aWarning.Execute() == RET_OK;
    1361                 :            :     }
    1362                 :            : 
    1363 [ #  # ][ #  # ]:          0 :     if ( bApprove && xApprove.is() )
                 [ #  # ]
    1364 [ #  # ][ #  # ]:          0 :         xApprove->select();
    1365         [ #  # ]:          0 :     else if ( xAbort.is() )
    1366 [ #  # ][ #  # ]:          0 :         xAbort->select();
                 [ #  # ]
    1367                 :          0 : }
    1368                 :            : 
    1369                 :            : void
    1370                 :          0 : UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest(
    1371                 :            :     const task::FutureDocumentVersionProductUpdateRequest& _rRequest,
    1372                 :            :     uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
    1373                 :            :         rContinuations )
    1374                 :            :     SAL_THROW((uno::RuntimeException))
    1375                 :            : {
    1376                 :          0 :     uno::Reference< task::XInteractionAbort > xAbort;
    1377                 :          0 :     uno::Reference< task::XInteractionApprove > xApprove;
    1378                 :          0 :     uno::Reference< task::XInteractionAskLater > xAskLater;
    1379         [ #  # ]:          0 :     getContinuations( rContinuations, &xApprove, &xAbort, &xAskLater );
    1380                 :            : 
    1381                 :          0 :     short nResult = RET_CANCEL;
    1382                 :            : 
    1383                 :            :     static bool s_bDeferredToNextSession = false;
    1384                 :            :     // TODO: this static variable is somewhat hacky. Formerly (before the dialog was moved from SFX2 to the
    1385                 :            :     // interaction handler implementation), this was stored in SFX_APP()'s impl structure, in member
    1386                 :            :     // bODFVersionWarningLater. Of course, we do not have access to it here.
    1387                 :            :     //
    1388                 :            :     // A proper solution which I would envision would be:
    1389                 :            :     // - There's a central implementation (this one here) of css.task.InteractionHandler
    1390                 :            :     // - There's a configuration which maps UNO names to service names
    1391                 :            :     // - If the handler is confronted with a request, it tries to find the name of the UNO structure describing
    1392                 :            :     //   the request in the said configuration.
    1393                 :            :     //   - If an entry is found, then
    1394                 :            :     //     - the respective service is instantiated
    1395                 :            :     //     - the component is queried for css.task.XInteractionHandler, and the request is delegated
    1396                 :            :     //   - if no entry is found, then the request is silenced (with calling the AbortContinuation, if possible)
    1397                 :            :     // This way, the FutureDocumentVersionProductUpdateRequest could be handled in SFX (or any other
    1398                 :            :     // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession
    1399                 :            :     // flag.
    1400                 :            :     //
    1401                 :            :     // Note: The above pattern has been implemented in CWS autorecovery. Now the remaining task is to move the
    1402                 :            :     // handling of this interaction to SFX, again.
    1403                 :            : 
    1404         [ #  # ]:          0 :     if ( !s_bDeferredToNextSession )
    1405                 :            :     {
    1406         [ #  # ]:          0 :         boost::scoped_ptr< ResMgr > pResMgr( ResMgr::CreateResMgr( "uui" ) );
    1407         [ #  # ]:          0 :         if ( pResMgr.get() )
    1408                 :            :         {
    1409                 :            :             ::uui::NewerVersionWarningDialog aDialog(
    1410                 :            :                 getParentProperty(),
    1411                 :            :                 _rRequest.DocumentODFVersion,
    1412 [ #  # ][ #  # ]:          0 :                 *pResMgr.get() );
    1413 [ #  # ][ #  # ]:          0 :             nResult = aDialog.Execute();
    1414         [ #  # ]:          0 :         }
    1415                 :            :     }
    1416                 :            : 
    1417   [ #  #  #  # ]:          0 :     switch ( nResult )
    1418                 :            :     {
    1419                 :            :     case RET_OK:
    1420         [ #  # ]:          0 :         if ( xApprove.is() )
    1421 [ #  # ][ #  # ]:          0 :             xApprove->select();
    1422                 :          0 :         break;
    1423                 :            :     case RET_CANCEL:
    1424         [ #  # ]:          0 :         if ( xAbort.is() )
    1425 [ #  # ][ #  # ]:          0 :             xAbort->select();
    1426                 :          0 :         break;
    1427                 :            :     case RET_ASK_LATER:
    1428         [ #  # ]:          0 :         if ( xAskLater.is() )
    1429 [ #  # ][ #  # ]:          0 :             xAskLater->select();
    1430                 :          0 :         s_bDeferredToNextSession = true;
    1431                 :          0 :         break;
    1432                 :            :     default:
    1433                 :            :         OSL_FAIL( "UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest: "
    1434                 :            :                     "unexpected dialog return value!" );
    1435                 :          0 :         break;
    1436                 :          0 :     }
    1437                 :          0 : }
    1438                 :            : 
    1439                 :            : void
    1440                 :          0 : UUIInteractionHelper::handleBrokenPackageRequest(
    1441                 :            :     std::vector< rtl::OUString > const & rArguments,
    1442                 :            :     uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
    1443                 :            :         rContinuations,
    1444                 :            :     bool bObtainErrorStringOnly,
    1445                 :            :     bool & bHasErrorString,
    1446                 :            :     rtl::OUString & rErrorString)
    1447                 :            :     SAL_THROW((uno::RuntimeException))
    1448                 :            : {
    1449         [ #  # ]:          0 :     if (bObtainErrorStringOnly)
    1450                 :            :     {
    1451         [ #  # ]:          0 :         bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
    1452         [ #  # ]:          0 :         if (!bHasErrorString)
    1453                 :            :             return;
    1454                 :            :     }
    1455                 :            : 
    1456                 :          0 :     uno::Reference< task::XInteractionApprove > xApprove;
    1457                 :          0 :     uno::Reference< task::XInteractionDisapprove > xDisapprove;
    1458                 :          0 :     uno::Reference< task::XInteractionAbort > xAbort;
    1459         [ #  # ]:          0 :     getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
    1460                 :            : 
    1461                 :            :     ErrCode nErrorCode;
    1462 [ #  # ][ #  # ]:          0 :     if( xApprove.is() && xDisapprove.is() )
                 [ #  # ]
    1463                 :            :     {
    1464                 :          0 :         nErrorCode = ERRCODE_UUI_IO_BROKENPACKAGE;
    1465                 :            :     }
    1466         [ #  # ]:          0 :     else if ( xAbort.is() )
    1467                 :            :     {
    1468                 :          0 :         nErrorCode = ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR;
    1469                 :            :     }
    1470                 :            :     else
    1471                 :            :         return;
    1472                 :            : 
    1473                 :          0 :     ::rtl::OUString aMessage;
    1474                 :            :     {
    1475         [ #  # ]:          0 :         SolarMutexGuard aGuard;
    1476         [ #  # ]:          0 :         boost::scoped_ptr< ResMgr > xManager(ResMgr::CreateResMgr("uui"));
    1477         [ #  # ]:          0 :         if (!xManager.get())
    1478                 :            :             return;
    1479                 :            : 
    1480                 :          0 :         ResId aResId( RID_UUI_ERRHDL, *xManager.get() );
    1481 [ #  # ][ #  # ]:          0 :         if ( !ErrorResource(aResId).getString(nErrorCode, aMessage) )
         [ #  # ][ #  # ]
    1482 [ #  # ][ #  # ]:          0 :             return;
         [ #  # ][ #  # ]
    1483                 :            :     }
    1484                 :            : 
    1485         [ #  # ]:          0 :     aMessage = replaceMessageWithArguments( aMessage, rArguments );
    1486                 :            : 
    1487         [ #  # ]:          0 :     if (bObtainErrorStringOnly)
    1488                 :            :     {
    1489                 :          0 :         rErrorString = aMessage;
    1490                 :            :         return;
    1491                 :            :     }
    1492                 :            : 
    1493                 :            :     WinBits nButtonMask;
    1494 [ #  # ][ #  # ]:          0 :     if( xApprove.is() && xDisapprove.is() )
                 [ #  # ]
    1495                 :            :     {
    1496                 :          0 :         nButtonMask = WB_YES_NO | WB_DEF_YES;
    1497                 :            :     }
    1498         [ #  # ]:          0 :     else if ( xAbort.is() )
    1499                 :            :     {
    1500                 :          0 :         nButtonMask = WB_OK;
    1501                 :            :     }
    1502                 :            :     else
    1503                 :            :         return;
    1504                 :            : 
    1505                 :            :     rtl::OUString title(
    1506                 :            :         utl::ConfigManager::getProductName() +
    1507                 :            :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) +
    1508 [ #  # ][ #  # ]:          0 :         utl::ConfigManager::getProductVersion() );
                 [ #  # ]
    1509                 :            : 
    1510   [ #  #  #  # ]:          0 :     switch (
    1511 [ #  # ][ #  # ]:          0 :         executeMessageBox( getParentProperty(), title, aMessage, nButtonMask ) )
    1512                 :            :     {
    1513                 :            :     case ERRCODE_BUTTON_OK:
    1514                 :            :         OSL_ENSURE( xAbort.is(), "unexpected situation" );
    1515         [ #  # ]:          0 :         if (xAbort.is())
    1516 [ #  # ][ #  # ]:          0 :             xAbort->select();
    1517                 :          0 :         break;
    1518                 :            : 
    1519                 :            :     case ERRCODE_BUTTON_NO:
    1520                 :            :         OSL_ENSURE(xDisapprove.is(), "unexpected situation");
    1521         [ #  # ]:          0 :         if (xDisapprove.is())
    1522 [ #  # ][ #  # ]:          0 :             xDisapprove->select();
    1523                 :          0 :         break;
    1524                 :            : 
    1525                 :            :     case ERRCODE_BUTTON_YES:
    1526                 :            :         OSL_ENSURE(xApprove.is(), "unexpected situation");
    1527         [ #  # ]:          0 :         if (xApprove.is())
    1528 [ #  # ][ #  # ]:          0 :             xApprove->select();
    1529                 :          0 :         break;
    1530 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
    1531                 :            : }
    1532                 :            : 
    1533                 :            : //=========================================================================
    1534                 :            : // ErrorResource Implementation
    1535                 :            : //=========================================================================
    1536                 :            : 
    1537                 :            : bool
    1538                 :          0 : ErrorResource::getString(ErrCode nErrorCode, rtl::OUString &rString)
    1539                 :            :     const SAL_THROW(())
    1540                 :            : {
    1541                 :            :     ResId aResId(static_cast< sal_uInt16 >(nErrorCode & ERRCODE_RES_MASK),
    1542                 :          0 :                  *m_pResMgr);
    1543                 :          0 :     aResId.SetRT(RSC_STRING);
    1544 [ #  # ][ #  # ]:          0 :     if (!IsAvailableRes(aResId))
    1545                 :          0 :         return false;
    1546                 :          0 :     aResId.SetAutoRelease(false);
    1547         [ #  # ]:          0 :     rString = aResId.toString();
    1548         [ #  # ]:          0 :     m_pResMgr->PopContext();
    1549                 :          0 :     return true;
    1550                 :            : }
    1551                 :            : 
    1552                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10