LCOV - code coverage report
Current view: top level - ucb/source/ucp/gio - gio_provider.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 38 0.0 %
Date: 2014-04-14 Functions: 0 17 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 <ucbhelper/contentidentifier.hxx>
      21             : #include <ucbhelper/contenthelper.hxx>
      22             : #include <com/sun/star/ucb/ContentCreationException.hpp>
      23             : #include "gio_provider.hxx"
      24             : #include "gio_content.hxx"
      25             : 
      26             : #include <stdio.h>
      27             : 
      28             : using namespace com::sun::star;
      29             : 
      30             : namespace gio
      31             : {
      32             : uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
      33           0 : ContentProvider::queryContent(
      34             :             const uno::Reference<
      35             :                     com::sun::star::ucb::XContentIdentifier >& Identifier )
      36             :     throw( com::sun::star::ucb::IllegalIdentifierException,
      37             :            uno::RuntimeException, std::exception )
      38             : {
      39             : #if OSL_DEBUG_LEVEL > 1
      40             :     fprintf(stderr, "QueryContent: '%s'",
      41             :        OUStringToOString
      42             :        (Identifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
      43             : #endif
      44             : 
      45           0 :     osl::MutexGuard aGuard( m_aMutex );
      46             : 
      47             :     // Check, if a content with given id already exists...
      48           0 :     uno::Reference< ucb::XContent > xContent = queryExistingContent( Identifier ).get();
      49           0 :     if ( xContent.is() )
      50           0 :         return xContent;
      51             : 
      52             :     try
      53             :     {
      54           0 :         xContent = new ::gio::Content(m_xContext, this, Identifier);
      55             :     }
      56           0 :     catch ( com::sun::star::ucb::ContentCreationException const & )
      57             :     {
      58           0 :         throw com::sun::star::ucb::IllegalIdentifierException();
      59             :     }
      60             : 
      61           0 :     if ( !xContent->getIdentifier().is() )
      62           0 :         throw com::sun::star::ucb::IllegalIdentifierException();
      63             : 
      64           0 :     return xContent;
      65             : }
      66             : 
      67           0 : ContentProvider::ContentProvider(
      68             :     const uno::Reference< uno::XComponentContext >& rxContext )
      69           0 : : ::ucbhelper::ContentProviderImplHelper( rxContext )
      70             : {
      71           0 : }
      72             : 
      73           0 : ContentProvider::~ContentProvider()
      74             : {
      75           0 : }
      76             : 
      77             : // XInterface
      78           0 : void SAL_CALL ContentProvider::acquire()
      79             :     throw()
      80             : {
      81           0 :     OWeakObject::acquire();
      82           0 : }
      83             : 
      84           0 : void SAL_CALL ContentProvider::release()
      85             :     throw()
      86             : {
      87           0 :     OWeakObject::release();
      88           0 : }
      89             : 
      90           0 : css::uno::Any SAL_CALL ContentProvider::queryInterface( const css::uno::Type & rType )
      91             :     throw( css::uno::RuntimeException, std::exception )
      92             : {
      93             :     css::uno::Any aRet = cppu::queryInterface( rType,
      94             :                                                (static_cast< lang::XTypeProvider* >(this)),
      95             :                                                (static_cast< lang::XServiceInfo* >(this)),
      96             :                                                (static_cast< css::ucb::XContentProvider* >(this))
      97           0 :                                                );
      98           0 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
      99             : }
     100             : 
     101           0 : XTYPEPROVIDER_IMPL_3( ContentProvider,
     102             :                       lang::XTypeProvider,
     103             :                       lang::XServiceInfo,
     104             :                       com::sun::star::ucb::XContentProvider );
     105             : 
     106           0 : XSERVICEINFO_IMPL_1_CTX( ContentProvider,
     107             :                      OUString( "com.sun.star.comp.GIOContentProvider" ),
     108             :                      OUString( "com.sun.star.ucb.GIOContentProvider" ) );
     109             : 
     110           0 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
     111             : 
     112             : }
     113             : 
     114           0 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpgio1_component_getFactory( const sal_Char *pImplName,
     115             :     void *pServiceManager, void * )
     116             : {
     117           0 :     void * pRet = 0;
     118             : 
     119             :     uno::Reference< lang::XMultiServiceFactory > xSMgr
     120           0 :         (reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
     121           0 :     uno::Reference< lang::XSingleServiceFactory > xFactory;
     122             : #if !GLIB_CHECK_VERSION(2,36,0)
     123             :     g_type_init();
     124             : #endif
     125           0 :     if ( ::gio::ContentProvider::getImplementationName_Static().equalsAscii( pImplName ) )
     126           0 :         xFactory = ::gio::ContentProvider::createServiceFactory( xSMgr );
     127             : 
     128           0 :     if ( xFactory.is() )
     129             :     {
     130           0 :         xFactory->acquire();
     131           0 :         pRet = xFactory.get();
     132             :     }
     133             : 
     134           0 :     return pRet;
     135             : }
     136             : 
     137             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10