fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / gvfs / gvfs_provider.cxx
blobb6372234da98cd5d4f3d0c35a3755adc03fba0e6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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"
27 using namespace com::sun::star;
28 using namespace gvfs;
33 // ContentProvider Implementation.
38 ContentProvider::ContentProvider(
39 const uno::Reference< uno::XComponentContext >& rxContext )
40 : ::ucbhelper::ContentProviderImplHelper( rxContext )
43 // sdafas
45 // virtual
46 ContentProvider::~ContentProvider()
52 // XInterface methods.
53 void SAL_CALL ContentProvider::acquire()
54 throw()
56 OWeakObject::acquire();
59 void SAL_CALL ContentProvider::release()
60 throw()
62 OWeakObject::release();
65 css::uno::Any SAL_CALL ContentProvider::queryInterface( const css::uno::Type & rType )
66 throw( css::uno::RuntimeException, std::exception )
68 css::uno::Any aRet = cppu::queryInterface( rType,
69 (static_cast< lang::XTypeProvider* >(this)),
70 (static_cast< lang::XServiceInfo* >(this)),
71 (static_cast< css::ucb::XContentProvider* >(this))
73 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
76 // XTypeProvider methods.
80 XTYPEPROVIDER_IMPL_3( ContentProvider,
81 lang::XTypeProvider,
82 lang::XServiceInfo,
83 com::sun::star::ucb::XContentProvider );
87 // XServiceInfo methods.
91 XSERVICEINFO_IMPL_1_CTX( ContentProvider,
92 OUString( "com.sun.star.comp.GnomeVFSContentProvider" ),
93 OUString( "com.sun.star.ucb.GnomeVFSContentProvider" ) );
96 // Service factory implementation.
100 ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
104 // XContentProvider methods.
108 uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
109 ContentProvider::queryContent(
110 const uno::Reference<
111 com::sun::star::ucb::XContentIdentifier >& Identifier )
112 throw( com::sun::star::ucb::IllegalIdentifierException,
113 uno::RuntimeException )
115 #if OSL_DEBUG_LEVEL > 1
116 g_warning ("QueryContent: '%s'",
117 OUStringToOString (Identifier->getContentIdentifier(),
118 RTL_TEXTENCODING_UTF8).getStr() );
119 #endif
121 osl::MutexGuard aGuard( m_aMutex );
123 // Check, if a content with given id already exists...
124 uno::Reference< com::sun::star::ucb::XContent > xContent
125 = queryExistingContent( Identifier ).get();
126 if ( xContent.is() )
127 return xContent;
131 xContent = new ::gvfs::Content( m_xContext, this, Identifier );
132 registerNewContent( xContent );
134 catch ( com::sun::star::ucb::ContentCreationException const & )
136 throw com::sun::star::ucb::IllegalIdentifierException();
139 if ( !xContent->getIdentifier().is() )
140 throw com::sun::star::ucb::IllegalIdentifierException();
142 return xContent;
146 //============================ shlib entry points =============================================
148 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL ucpgvfs1_component_getFactory( const sal_Char *pImplName,
149 void *pServiceManager,
150 void */*pRegistryKey*/ )
152 void * pRet = 0;
155 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
156 if (!gnome_vfs_initialized ())
157 gnome_vfs_init ();
158 SAL_WNODEPRECATED_DECLARATIONS_PUSH
159 if (!auth_queue)
160 auth_queue = g_private_new( auth_queue_destroy );
161 SAL_WNODEPRECATED_DECLARATIONS_POP
164 uno::Reference< lang::XMultiServiceFactory > xSMgr
165 (reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
166 uno::Reference< lang::XSingleServiceFactory > xFactory;
168 if ( ::gvfs::ContentProvider::getImplementationName_Static().equalsAscii( pImplName ) )
169 xFactory = ::gvfs::ContentProvider::createServiceFactory( xSMgr );
171 if ( xFactory.is() ) {
172 xFactory->acquire();
173 pRet = xFactory.get();
176 return pRet;
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */