xref: /aoo42x/main/ucb/source/cacher/cacheserv.cxx (revision 421ed02e)
12f86921cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32f86921cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42f86921cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52f86921cSAndrew Rist  * distributed with this work for additional information
62f86921cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72f86921cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
82f86921cSAndrew Rist  * "License"); you may not use this file except in compliance
92f86921cSAndrew Rist  * with the License.  You may obtain a copy of the License at
102f86921cSAndrew Rist  *
112f86921cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
122f86921cSAndrew Rist  *
132f86921cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
142f86921cSAndrew Rist  * software distributed under the License is distributed on an
152f86921cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162f86921cSAndrew Rist  * KIND, either express or implied.  See the License for the
172f86921cSAndrew Rist  * specific language governing permissions and limitations
182f86921cSAndrew Rist  * under the License.
192f86921cSAndrew Rist  *
202f86921cSAndrew Rist  *************************************************************/
212f86921cSAndrew Rist 
222f86921cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*421ed02eSdamjan #include "precompiled_cacher.hxx"
26cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
29cdf0e10cSrcweir #include <cachedcontentresultset.hxx>
30cdf0e10cSrcweir #include <cachedcontentresultsetstub.hxx>
31cdf0e10cSrcweir #include <cacheddynamicresultset.hxx>
32cdf0e10cSrcweir #include <cacheddynamicresultsetstub.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir using namespace rtl;
35cdf0e10cSrcweir using namespace com::sun::star::uno;
36cdf0e10cSrcweir using namespace com::sun::star::lang;
37cdf0e10cSrcweir using namespace com::sun::star::registry;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //=========================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)40*421ed02eSdamjan extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
41cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //=========================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)47*421ed02eSdamjan extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
48cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	void * pRet = 0;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	Reference< XMultiServiceFactory > xSMgr(
53cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
54cdf0e10cSrcweir 	Reference< XSingleServiceFactory > xFactory;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
57cdf0e10cSrcweir 	// CachedContentResultSetFactory.
58cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	if ( CachedContentResultSetFactory::getImplementationName_Static().
61cdf0e10cSrcweir 				compareToAscii( pImplName ) == 0 )
62cdf0e10cSrcweir 	{
63cdf0e10cSrcweir 		xFactory = CachedContentResultSetFactory::createServiceFactory( xSMgr );
64cdf0e10cSrcweir 	}
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
67cdf0e10cSrcweir 	// CachedContentResultSetStubFactory.
68cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	else if ( CachedContentResultSetStubFactory::getImplementationName_Static().
71cdf0e10cSrcweir 				compareToAscii( pImplName ) == 0 )
72cdf0e10cSrcweir 	{
73cdf0e10cSrcweir 		xFactory = CachedContentResultSetStubFactory::createServiceFactory( xSMgr );
74cdf0e10cSrcweir 	}
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
77cdf0e10cSrcweir 	// CachedDynamicResultSetFactory.
78cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	else if ( CachedDynamicResultSetFactory::getImplementationName_Static().
81cdf0e10cSrcweir 				compareToAscii( pImplName ) == 0 )
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 		xFactory = CachedDynamicResultSetFactory::createServiceFactory( xSMgr );
84cdf0e10cSrcweir 	}
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
87cdf0e10cSrcweir 	// CachedDynamicResultSetStubFactory.
88cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	else if ( CachedDynamicResultSetStubFactory::getImplementationName_Static().
91cdf0e10cSrcweir 				compareToAscii( pImplName ) == 0 )
92cdf0e10cSrcweir 	{
93cdf0e10cSrcweir 		xFactory = CachedDynamicResultSetStubFactory::createServiceFactory( xSMgr );
94cdf0e10cSrcweir 	}
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	if ( xFactory.is() )
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir 		xFactory->acquire();
101cdf0e10cSrcweir 		pRet = xFactory.get();
102cdf0e10cSrcweir 	}
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	return pRet;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107