LCOV - code coverage report
Current view: top level - libreoffice/extensions/source/propctrlr - pcrcomponentcontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 20 0.0 %
Date: 2012-12-17 Functions: 0 4 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             : #include "pcrcomponentcontext.hxx"
      21             : 
      22             : #include <com/sun/star/lang/NullPointerException.hpp>
      23             : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
      24             : #include <com/sun/star/beans/XPropertySet.hpp>
      25             : 
      26             : //........................................................................
      27             : namespace pcr
      28             : {
      29             : //........................................................................
      30             : 
      31             :     /** === begin UNO using === **/
      32             :     using ::com::sun::star::uno::Reference;
      33             :     using ::com::sun::star::uno::XComponentContext;
      34             :     using ::com::sun::star::lang::NullPointerException;
      35             :     using ::com::sun::star::lang::ServiceNotRegisteredException;
      36             :     using ::com::sun::star::uno::Exception;
      37             :     using ::com::sun::star::uno::Any;
      38             :     using ::com::sun::star::uno::XInterface;
      39             :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      40             :     using ::com::sun::star::lang::XMultiServiceFactory;
      41             :     using ::com::sun::star::beans::XPropertySet;
      42             :     using ::com::sun::star::uno::UNO_QUERY;
      43             :     using ::com::sun::star::uno::RuntimeException;
      44             :     /** === end UNO using === **/
      45             : 
      46             :     //====================================================================
      47             :     //= ComponentContext
      48             :     //====================================================================
      49             :     //--------------------------------------------------------------------
      50           0 :     ComponentContext::ComponentContext( const Reference< XComponentContext >& _rxContext )
      51           0 :         :m_xContext( _rxContext )
      52             :     {
      53           0 :         if ( m_xContext.is() )
      54           0 :             m_xORB = m_xContext->getServiceManager();
      55           0 :         if ( !m_xORB.is() )
      56           0 :             throw NullPointerException();
      57           0 :     }
      58             : 
      59             :     //------------------------------------------------------------------------
      60           0 :     Any ComponentContext::getContextValueByName( const ::rtl::OUString& _rName ) const
      61             :     {
      62           0 :         Any aReturn;
      63             :         try
      64             :         {
      65           0 :             aReturn = m_xContext->getValueByName( _rName );
      66             :         }
      67           0 :         catch( const Exception& )
      68             :         {
      69             :             OSL_FAIL( "PropertyHandler::getContextValueByName: caught an exception!" );
      70             :         }
      71           0 :         return aReturn;
      72             :     }
      73             : 
      74             :     //------------------------------------------------------------------------
      75           0 :     Reference< XInterface > ComponentContext::createComponent( const ::rtl::OUString& _rServiceName ) const
      76             :     {
      77             :         Reference< XInterface > xComponent(
      78           0 :             m_xORB->createInstanceWithContext( _rServiceName, m_xContext )
      79           0 :         );
      80           0 :         if ( !xComponent.is() )
      81           0 :             throw ServiceNotRegisteredException( _rServiceName, NULL );
      82           0 :         return xComponent;
      83             :     }
      84             : 
      85             :     //------------------------------------------------------------------------
      86           0 :     Reference< XMultiServiceFactory > ComponentContext::getLegacyServiceFactory() const
      87             :     {
      88           0 :         return Reference< XMultiServiceFactory >( m_xORB, UNO_QUERY_THROW );
      89             :     }
      90             : 
      91             : //........................................................................
      92             : } // namespace pcr
      93             : //........................................................................
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10