LCOV - code coverage report
Current view: top level - libreoffice/ucb/source/ucp/gvfs - gvfs_provider.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 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             : 
      21             : #include <comphelper/processfactory.hxx>
      22             : #include <ucbhelper/contentidentifier.hxx>
      23             : #include <libgnomevfs/gnome-vfs-init.h>
      24             : #include "gvfs_provider.hxx"
      25             : #include "gvfs_content.hxx"
      26             : 
      27             : using namespace com::sun::star;
      28             : using namespace gvfs;
      29             : 
      30             : //=========================================================================
      31             : //=========================================================================
      32             : //
      33             : // ContentProvider Implementation.
      34             : //
      35             : //=========================================================================
      36             : //=========================================================================
      37             : 
      38           0 : ContentProvider::ContentProvider(
      39             :     const uno::Reference< uno::XComponentContext >& rxContext )
      40           0 : : ::ucbhelper::ContentProviderImplHelper( rxContext )
      41             : {
      42           0 : }
      43             : // sdafas
      44             : //=========================================================================
      45             : // virtual
      46           0 : ContentProvider::~ContentProvider()
      47             : {
      48           0 : }
      49             : 
      50             : //=========================================================================
      51             : //
      52             : // XInterface methods.
      53             : //
      54             : //=========================================================================
      55             : 
      56           0 : XINTERFACE_IMPL_3( ContentProvider,
      57             :                    lang::XTypeProvider,
      58             :                    lang::XServiceInfo,
      59             :                    com::sun::star::ucb::XContentProvider );
      60             : 
      61             : //=========================================================================
      62             : //
      63             : // XTypeProvider methods.
      64             : //
      65             : //=========================================================================
      66             : 
      67           0 : XTYPEPROVIDER_IMPL_3( ContentProvider,
      68             :                       lang::XTypeProvider,
      69             :                       lang::XServiceInfo,
      70             :                       com::sun::star::ucb::XContentProvider );
      71             : 
      72             : //=========================================================================
      73             : //
      74             : // XServiceInfo methods.
      75             : //
      76             : //=========================================================================
      77             : 
      78           0 : XSERVICEINFO_IMPL_1_CTX( ContentProvider,
      79             :                      rtl::OUString( "com.sun.star.comp.GnomeVFSContentProvider" ),
      80           0 :                      rtl::OUString( "com.sun.star.ucb.GnomeVFSContentProvider" ) );
      81             : //=========================================================================
      82             : //
      83             : // Service factory implementation.
      84             : //
      85             : //=========================================================================
      86             : 
      87           0 : ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
      88             : 
      89             : //=========================================================================
      90             : //
      91             : // XContentProvider methods.
      92             : //
      93             : //=========================================================================
      94             : 
      95             : uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
      96           0 : ContentProvider::queryContent(
      97             :             const uno::Reference<
      98             :                     com::sun::star::ucb::XContentIdentifier >& Identifier )
      99             :     throw( com::sun::star::ucb::IllegalIdentifierException,
     100             :            uno::RuntimeException )
     101             : {
     102             : #if OSL_DEBUG_LEVEL > 1
     103             :     g_warning ("QueryContent: '%s'",
     104             :                rtl::OUStringToOString (Identifier->getContentIdentifier(),
     105             :                                        RTL_TEXTENCODING_UTF8).getStr() );
     106             : #endif
     107             : 
     108           0 :     osl::MutexGuard aGuard( m_aMutex );
     109             : 
     110             :     // Check, if a content with given id already exists...
     111             :     uno::Reference< com::sun::star::ucb::XContent > xContent
     112           0 :         = queryExistingContent( Identifier ).get();
     113           0 :     if ( xContent.is() )
     114             :         return xContent;
     115             : 
     116             :     try
     117             :     {
     118           0 :         xContent = new ::gvfs::Content( m_xContext, this, Identifier );
     119           0 :         registerNewContent( xContent );
     120             :     }
     121           0 :     catch ( com::sun::star::ucb::ContentCreationException const & )
     122             :     {
     123           0 :         throw com::sun::star::ucb::IllegalIdentifierException();
     124             :     }
     125             : 
     126           0 :     if ( !xContent->getIdentifier().is() )
     127           0 :         throw com::sun::star::ucb::IllegalIdentifierException();
     128             : 
     129           0 :     return xContent;
     130             : }
     131             : 
     132             : 
     133             : //============================ shlib entry points =============================================
     134             : 
     135           0 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpgvfs1_component_getFactory( const sal_Char *pImplName,
     136             :               void           *pServiceManager,
     137             :               void           */*pRegistryKey*/ )
     138             : {
     139           0 :     void * pRet = 0;
     140             : 
     141             :     {
     142           0 :         osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     143           0 :         if (!gnome_vfs_initialized ())
     144           0 :             gnome_vfs_init ();
     145           0 :         if (!auth_queue)
     146           0 :             auth_queue = g_private_new( auth_queue_destroy );
     147             :     }
     148             : 
     149             :     uno::Reference< lang::XMultiServiceFactory > xSMgr
     150           0 :         (reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
     151           0 :     uno::Reference< lang::XSingleServiceFactory > xFactory;
     152             : 
     153           0 :     if ( !::gvfs::ContentProvider::getImplementationName_Static().compareToAscii( pImplName ) )
     154           0 :         xFactory = ::gvfs::ContentProvider::createServiceFactory( xSMgr );
     155             : 
     156           0 :     if ( xFactory.is() ) {
     157           0 :         xFactory->acquire();
     158           0 :         pRet = xFactory.get();
     159             :     }
     160             : 
     161           0 :     return pRet;
     162             : }
     163             : 
     164             : 
     165             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10