LCOV - code coverage report
Current view: top level - comphelper/source/misc - synchronousdispatch.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 17 0.0 %
Date: 2014-11-03 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      22             : #include <com/sun/star/frame/XSynchronousDispatch.hpp>
      23             : #include <com/sun/star/lang/XComponent.hpp>
      24             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      25             : #include <com/sun/star/util/URLTransformer.hpp>
      26             : 
      27             : #include <comphelper/synchronousdispatch.hxx>
      28             : #include <comphelper/processfactory.hxx>
      29             : 
      30             : 
      31             : 
      32             : namespace comphelper
      33             : {
      34             : 
      35             : 
      36             : using namespace ::com::sun::star;
      37             : 
      38             : 
      39             : //= SynchronousDispatch
      40             : 
      41             : 
      42           0 : uno::Reference< lang::XComponent > SynchronousDispatch::dispatch(
      43             :         const uno::Reference< uno::XInterface > &xStartPoint,
      44             :         const OUString &sURL,
      45             :         const OUString &sTarget,
      46             :         const sal_Int32 nFlags,
      47             :         const uno::Sequence< beans::PropertyValue > &lArguments )
      48             : {
      49           0 :     util::URL aURL;
      50           0 :     aURL.Complete = sURL;
      51           0 :     uno::Reference < util::XURLTransformer > xTrans = util::URLTransformer::create( ::comphelper::getProcessComponentContext() );
      52           0 :     xTrans->parseStrict( aURL );
      53             : 
      54           0 :     uno::Reference < frame::XDispatch > xDispatcher;
      55           0 :     uno::Reference < frame::XDispatchProvider > xProvider( xStartPoint, uno::UNO_QUERY );
      56             : 
      57           0 :     if ( xProvider.is() )
      58           0 :         xDispatcher = xProvider->queryDispatch( aURL, sTarget, nFlags );
      59             : 
      60           0 :     uno::Reference < lang::XComponent > aComponent;
      61             : 
      62           0 :     if ( xDispatcher.is() )
      63             :     {
      64             :         try
      65             :         {
      66           0 :             uno::Any aRet;
      67           0 :             uno::Reference < frame::XSynchronousDispatch > xSyncDisp( xDispatcher, uno::UNO_QUERY_THROW );
      68             : 
      69           0 :             aRet = xSyncDisp->dispatchWithReturnValue( aURL, lArguments );
      70             : 
      71           0 :             aRet >>= aComponent;
      72             :         }
      73           0 :         catch ( uno::Exception& )
      74             :         {
      75             :             SAL_WARN("comphelper","SynchronousDispatch::dispatch() Error while dispatching!");
      76             :         }
      77             :     }
      78             : 
      79           0 :     return aComponent;
      80             : }
      81             : 
      82             : 
      83             : }   // namespace comphelper
      84             : 
      85             : 
      86             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10