1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_scripting.hxx"
26 #include "basprov.hxx"
27 #include "basscript.hxx"
28 #include "baslibnode.hxx"
29 #include <com/sun/star/frame/XModel.hpp>
30 #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
31 #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
32 #include <com/sun/star/document/XEmbeddedScripts.hpp>
33 
34 #ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
35 #include <cppuhelper/implementationentry.hxx>
36 #endif
37 #include <rtl/uri.hxx>
38 #include <osl/process.h>
39 #include <osl/file.hxx>
40 #include <vos/mutex.hxx>
41 #include <vcl/svapp.hxx>
42 #include <basic/sbx.hxx>
43 #include <basic/basmgr.hxx>
44 #include <basic/basicmanagerrepository.hxx>
45 #include <basic/sbstar.hxx>
46 #include <basic/sbmod.hxx>
47 #include <basic/sbmeth.hxx>
48 #include <sfx2/app.hxx>
49 #include <sfx2/objsh.hxx>
50 
51 #include <com/sun/star/util/XMacroExpander.hpp>
52 #include <com/sun/star/script/XLibraryContainer2.hpp>
53 #include <com/sun/star/uri/XUriReference.hpp>
54 #include <com/sun/star/uri/XUriReferenceFactory.hpp>
55 #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
56 
57 #include <util/util.hxx>
58 #include <util/MiscUtils.hxx>
59 
60 
61 using namespace ::com::sun::star;
62 using namespace ::com::sun::star::lang;
63 using namespace ::com::sun::star::uno;
64 using namespace ::com::sun::star::script;
65 using namespace ::com::sun::star::document;
66 using namespace ::sf_misc;
67 
68 //.........................................................................
69 namespace basprov
70 {
71 //.........................................................................
72 
73     // =============================================================================
74     // component operations
75     // =============================================================================
76 
getImplementationName_BasicProviderImpl()77     static ::rtl::OUString getImplementationName_BasicProviderImpl()
78     {
79         static ::rtl::OUString* pImplName = 0;
80 	    if ( !pImplName )
81 	    {
82             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
83             if ( !pImplName )
84 		    {
85                 static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.ScriptProviderForBasic" ) );
86 			    pImplName = &aImplName;
87 		    }
88 	    }
89 	    return *pImplName;
90     }
91 
92     // -----------------------------------------------------------------------------
93 
getSupportedServiceNames_BasicProviderImpl()94     static Sequence< ::rtl::OUString > getSupportedServiceNames_BasicProviderImpl()
95     {
96         static Sequence< ::rtl::OUString >* pNames = 0;
97 	    if ( !pNames )
98 	    {
99             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
100 		    if ( !pNames )
101 		    {
102                 static Sequence< ::rtl::OUString > aNames(4);
103                 aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.provider.ScriptProviderForBasic" ) );
104                 aNames.getArray()[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.provider.LanguageScriptProvider" ) );
105                 aNames.getArray()[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.provider.ScriptProvider" ) );
106                 aNames.getArray()[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.browse.BrowseNode" ) );
107                 pNames = &aNames;
108 		    }
109 	    }
110 	    return *pNames;
111     }
112 
113     // =============================================================================
114     // BasicProviderImpl
115     // =============================================================================
116 
BasicProviderImpl(const Reference<XComponentContext> & xContext)117     BasicProviderImpl::BasicProviderImpl( const Reference< XComponentContext >& xContext )
118         :m_pAppBasicManager( 0 )
119         ,m_pDocBasicManager( 0 )
120         ,m_xLibContainerApp( 0 )
121         ,m_xLibContainerDoc( 0 )
122         ,m_xContext( xContext )
123         ,m_bIsAppScriptCtx( true )
124         ,m_bIsUserCtx(true)
125     {
126     }
127 
128     // -----------------------------------------------------------------------------
129 
~BasicProviderImpl()130     BasicProviderImpl::~BasicProviderImpl()
131     {
132     }
133 
134     // -----------------------------------------------------------------------------
135 
isLibraryShared(const Reference<script::XLibraryContainer> & rxLibContainer,const::rtl::OUString & rLibName)136     bool BasicProviderImpl::isLibraryShared( const Reference< script::XLibraryContainer >& rxLibContainer, const ::rtl::OUString& rLibName )
137     {
138         bool bIsShared = false;
139 
140         Reference< script::XLibraryContainer2 > xLibContainer( rxLibContainer, UNO_QUERY );
141         if ( xLibContainer.is() && xLibContainer->hasByName( rLibName ) && xLibContainer->isLibraryLink( rLibName ) )
142         {
143             ::rtl::OUString aFileURL;
144             if ( m_xContext.is() )
145             {
146                 Reference< uri::XUriReferenceFactory > xUriFac;
147                 Reference< lang::XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
148                 if ( xSMgr.is() )
149                 {
150                     xUriFac.set( xSMgr->createInstanceWithContext( ::rtl::OUString::createFromAscii(
151                         "com.sun.star.uri.UriReferenceFactory" ), m_xContext ), UNO_QUERY );
152                 }
153 
154                 if ( xUriFac.is() )
155                 {
156                     ::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) );
157                     Reference<  uri::XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY );
158 
159                     if ( xUriRef.is() )
160                     {
161                         ::rtl::OUString aScheme = xUriRef->getScheme();
162                         if ( aScheme.equalsIgnoreAsciiCaseAscii( "file" ) )
163                         {
164                             aFileURL = aLinkURL;
165                         }
166                         else if ( aScheme.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.pkg" ) )
167                         {
168                             ::rtl::OUString aAuthority = xUriRef->getAuthority();
169                             if ( aAuthority.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.expand:" ) ) )
170                             {
171                                 ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
172                                 aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
173                                 Reference<util::XMacroExpander> xMacroExpander(
174                                     m_xContext->getValueByName(
175                                     ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ),
176                                     UNO_QUERY );
177                                 if ( xMacroExpander.is() )
178                                     aFileURL = xMacroExpander->expandMacros( aDecodedURL );
179                             }
180                         }
181                     }
182                 }
183             }
184 
185             if ( aFileURL.getLength() )
186             {
187                 osl::DirectoryItem aFileItem;
188                 osl::FileStatus aFileStatus( FileStatusMask_FileURL );
189                 OSL_VERIFY( osl::DirectoryItem::get( aFileURL, aFileItem ) == osl::FileBase::E_None );
190                 OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None );
191                 ::rtl::OUString aCanonicalFileURL( aFileStatus.getFileURL() );
192 
193                 ::rtl::OUString aSearchURL1( RTL_CONSTASCII_USTRINGPARAM( "share/basic" ) );
194 				::rtl::OUString aSearchURL2( RTL_CONSTASCII_USTRINGPARAM( "share/uno_packages" ) );
195 				if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 )
196                     bIsShared = true;
197             }
198         }
199 
200         return bIsShared;
201     }
202 
203     // -----------------------------------------------------------------------------
204     // XServiceInfo
205     // -----------------------------------------------------------------------------
206 
getImplementationName()207     ::rtl::OUString BasicProviderImpl::getImplementationName(  ) throw (RuntimeException)
208     {
209         return getImplementationName_BasicProviderImpl();
210     }
211 
212     // -----------------------------------------------------------------------------
213 
supportsService(const::rtl::OUString & rServiceName)214     sal_Bool BasicProviderImpl::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
215     {
216 	    Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
217 	    const ::rtl::OUString* pNames = aNames.getConstArray();
218 	    const ::rtl::OUString* pEnd = pNames + aNames.getLength();
219 	    for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
220 		    ;
221 
222 	    return pNames != pEnd;
223     }
224 
225     // -----------------------------------------------------------------------------
226 
getSupportedServiceNames()227     Sequence< ::rtl::OUString > BasicProviderImpl::getSupportedServiceNames(  ) throw (RuntimeException)
228     {
229         return getSupportedServiceNames_BasicProviderImpl();
230     }
231 
232     // -----------------------------------------------------------------------------
233     // XInitialization
234     // -----------------------------------------------------------------------------
235 
initialize(const Sequence<Any> & aArguments)236     void BasicProviderImpl::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
237     {
238         // TODO
239 
240         ::vos::OGuard aGuard( Application::GetSolarMutex() );
241 
242         if ( aArguments.getLength() != 1 )
243         {
244             throw IllegalArgumentException(
245                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicProviderImpl::initialize: incorrect argument count." ) ),
246                 *this,
247                 1
248             );
249         }
250 
251         Reference< frame::XModel > xModel;
252 
253         m_xInvocationContext.set( aArguments[0], UNO_QUERY );;
254         if ( m_xInvocationContext.is() )
255         {
256             xModel.set( m_xInvocationContext->getScriptContainer(), UNO_QUERY );
257             if ( !xModel.is() )
258             {
259                 throw IllegalArgumentException(
260                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicProviderImpl::initialize: unable to determine the document model from the script invocation context." ) ),
261                     *this,
262                     1
263                 );
264             }
265         }
266         else
267         {
268             if ( !( aArguments[0] >>= m_sScriptingContext ) )
269             {
270                 throw IllegalArgumentException(
271                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicProviderImpl::initialize: incorrect argument type " )  ).concat(  aArguments[0].getValueTypeName() ),
272                     *this,
273                     1
274                 );
275             }
276 
277             ::rtl::OUString sDoc = OUSTR("vnd.sun.star.tdoc");
278             if ( m_sScriptingContext.indexOf( sDoc  ) == 0 )
279             {
280                 xModel = MiscUtils::tDocUrlToModel(  m_sScriptingContext );
281                 // TODO: use ScriptingContantsPool for SCRIPTING_DOC_REF
282             }
283         }
284 
285         if ( xModel.is() )
286         {
287             Reference< XEmbeddedScripts > xDocumentScripts( xModel, UNO_QUERY );
288             if ( xDocumentScripts.is() )
289             {
290                 m_pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( xModel );
291                 m_xLibContainerDoc.set( xDocumentScripts->getBasicLibraries(), UNO_QUERY );
292                 OSL_ENSURE( m_pDocBasicManager && m_xLibContainerDoc.is(),
293                     "BasicProviderImpl::initialize: invalid BasicManager, or invalid script container!" );
294             }
295             m_bIsAppScriptCtx = false;
296         }
297         else
298         {
299             // Provider has been created with application context for user
300             // or share
301             if ( !m_sScriptingContext.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "user" ) ) )
302             {
303                 m_bIsUserCtx = false;
304             }
305             else
306             {
307                 /*
308                 throw RuntimeException(
309                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicProviderImpl::initialize: no scripting context!" ) ),
310                     Reference< XInterface >() );
311                 */
312             }
313         }
314 
315         // TODO
316         if ( !m_pAppBasicManager )
317             m_pAppBasicManager = SFX_APP()->GetBasicManager();
318 
319         if ( !m_xLibContainerApp.is() )
320             m_xLibContainerApp = Reference< script::XLibraryContainer >( SFX_APP()->GetBasicContainer(), UNO_QUERY );
321     }
322 
323     // -----------------------------------------------------------------------------
324 
325     // XScriptProvider
326     // -----------------------------------------------------------------------------
327 
getScript(const::rtl::OUString & scriptURI)328     Reference < provider::XScript > BasicProviderImpl::getScript( const ::rtl::OUString& scriptURI )
329         throw ( provider::ScriptFrameworkErrorException, RuntimeException)
330     {
331         // TODO
332 
333         ::vos::OGuard aGuard( Application::GetSolarMutex() );
334 
335         Reference< provider::XScript > xScript;
336         Reference< lang::XMultiComponentFactory > xMcFac ( m_xContext->getServiceManager() );
337         Reference< uri::XUriReferenceFactory > xFac (
338             xMcFac->createInstanceWithContext( rtl::OUString::createFromAscii(
339             "com.sun.star.uri.UriReferenceFactory"), m_xContext ) , UNO_QUERY );
340 
341         if ( !xFac.is() )
342         {
343             throw provider::ScriptFrameworkErrorException(
344                 OUSTR( "Failed to instantiate UriReferenceFactory" ), Reference< XInterface >(),
345                 scriptURI, OUSTR("Basic"),
346                 provider::ScriptFrameworkErrorType::UNKNOWN );
347         }
348 
349         Reference<  uri::XUriReference > uriRef(
350             xFac->parse( scriptURI ), UNO_QUERY );
351 
352         Reference < uri::XVndSunStarScriptUrl > sfUri( uriRef, UNO_QUERY );
353 
354         if ( !uriRef.is() || !sfUri.is() )
355         {
356             ::rtl::OUString errorMsg = ::rtl::OUString::createFromAscii( "BasicProviderImpl::getScript: failed to parse URI: " );
357             errorMsg = errorMsg.concat( scriptURI );
358             throw provider::ScriptFrameworkErrorException(
359                 errorMsg, Reference< XInterface >(),
360                 scriptURI, OUSTR("Basic"),
361                 provider::ScriptFrameworkErrorType::MALFORMED_URL );
362         }
363 
364 
365         ::rtl::OUString aDescription = sfUri->getName();
366         ::rtl::OUString aLocation = sfUri->getParameter(
367             ::rtl::OUString::createFromAscii( "location" ) );
368 
369         sal_Int32 nIndex = 0;
370         ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
371         ::rtl::OUString aModule;
372         if ( nIndex != -1 )
373             aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
374         ::rtl::OUString aMethod;
375         if ( nIndex != -1 )
376             aMethod = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
377 
378         if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
379         {
380             BasicManager* pBasicMgr =  NULL;
381             if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
382             {
383                 pBasicMgr = m_pDocBasicManager;
384             }
385             else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
386             {
387                 pBasicMgr = m_pAppBasicManager;
388             }
389 
390             if ( pBasicMgr )
391             {
392                 StarBASIC* pBasic = pBasicMgr->GetLib( aLibrary );
393                 if ( !pBasic )
394                 {
395                     sal_uInt16 nId = pBasicMgr->GetLibId( aLibrary );
396                     if ( nId != LIB_NOTFOUND )
397                     {
398                         pBasicMgr->LoadLib( nId );
399                         pBasic = pBasicMgr->GetLib( aLibrary );
400                     }
401                 }
402                 if ( pBasic )
403                 {
404                     SbModule* pModule = pBasic->FindModule( aModule );
405                     if ( pModule )
406                     {
407                         SbxArray* pMethods = pModule->GetMethods();
408                         if ( pMethods )
409                         {
410                             SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( aMethod, SbxCLASS_METHOD ) );
411                             if ( pMethod && !pMethod->IsHidden() )
412                             {
413                                 if ( m_pDocBasicManager == pBasicMgr )
414                                     xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext );
415                                 else
416                                     xScript = new BasicScriptImpl( aDescription, pMethod );
417                             }
418                         }
419                     }
420                 }
421             }
422         }
423 
424         if ( !xScript.is() )
425         {
426             ::rtl::OUStringBuffer aMessage;
427             aMessage.appendAscii( "The following Basic script could not be found:\n" );
428             aMessage.appendAscii( "library: '" ).append( aLibrary ).appendAscii( "'\n" );
429             aMessage.appendAscii( "module: '" ).append( aModule ).appendAscii( "'\n" );
430             aMessage.appendAscii( "method: '" ).append( aMethod ).appendAscii( "'\n" );
431             aMessage.appendAscii( "location: '" ).append( aLocation ).appendAscii( "'\n" );
432             throw provider::ScriptFrameworkErrorException(
433                 aMessage.makeStringAndClear(),
434                 Reference< XInterface >(),
435                 scriptURI, OUSTR("Basic"),
436                 provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT );
437         }
438 
439         return xScript;
440     }
441 
442     // -----------------------------------------------------------------------------
443     // XBrowseNode
444     // -----------------------------------------------------------------------------
445 
getName()446     ::rtl::OUString BasicProviderImpl::getName(  ) throw (RuntimeException)
447     {
448         // TODO
449 
450         ::vos::OGuard aGuard( Application::GetSolarMutex() );
451 
452         return ::rtl::OUString::createFromAscii( "Basic" );
453     }
454 
455     // -----------------------------------------------------------------------------
456 
getChildNodes()457     Sequence< Reference< browse::XBrowseNode > > BasicProviderImpl::getChildNodes(  ) throw (RuntimeException)
458     {
459         ::vos::OGuard aGuard( Application::GetSolarMutex() );
460 
461         Reference< script::XLibraryContainer > xLibContainer;
462         BasicManager* pBasicManager = NULL;
463 
464         if ( m_bIsAppScriptCtx )
465         {
466             xLibContainer = m_xLibContainerApp;
467             pBasicManager = m_pAppBasicManager;
468         }
469         else
470         {
471             xLibContainer = m_xLibContainerDoc;
472             pBasicManager = m_pDocBasicManager;
473         }
474 
475         Sequence< Reference< browse::XBrowseNode > > aChildNodes;
476 
477         if ( pBasicManager && xLibContainer.is() )
478         {
479             Sequence< ::rtl::OUString > aLibNames = xLibContainer->getElementNames();
480             sal_Int32 nLibCount = aLibNames.getLength();
481             const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
482             aChildNodes.realloc( nLibCount );
483             Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
484             sal_Int32 childsFound = 0;
485 
486             for ( sal_Int32 i = 0 ; i < nLibCount ; ++i )
487             {
488                 bool bCreate = false;
489                 if ( m_bIsAppScriptCtx )
490                 {
491                     bool bShared = isLibraryShared( xLibContainer, pLibNames[i] );
492                     if ( ( m_bIsUserCtx && !bShared ) || ( !m_bIsUserCtx && bShared ) )
493                         bCreate = true;
494                 }
495                 else
496                 {
497                     bCreate = true;
498                 }
499                 if ( bCreate )
500                 {
501                     pChildNodes[childsFound++] = static_cast< browse::XBrowseNode* >( new BasicLibraryNodeImpl(
502                         m_xContext, m_sScriptingContext, pBasicManager, xLibContainer, pLibNames[i], m_bIsAppScriptCtx ) );
503                 }
504             }
505 
506             if ( childsFound != nLibCount )
507                 aChildNodes.realloc( childsFound );
508         }
509 
510         return aChildNodes;
511     }
512 
513     // -----------------------------------------------------------------------------
514 
hasChildNodes()515     sal_Bool BasicProviderImpl::hasChildNodes(  ) throw (RuntimeException)
516     {
517         ::vos::OGuard aGuard( Application::GetSolarMutex() );
518 
519         sal_Bool bReturn = sal_False;
520         Reference< script::XLibraryContainer > xLibContainer;
521         if ( m_bIsAppScriptCtx )
522         {
523             xLibContainer = m_xLibContainerApp;
524         }
525         else
526         {
527              xLibContainer = m_xLibContainerDoc;
528         }
529         if ( xLibContainer.is() )
530             bReturn = xLibContainer->hasElements();
531 
532         return bReturn;
533     }
534 
535     // -----------------------------------------------------------------------------
536 
getType()537     sal_Int16 BasicProviderImpl::getType(  ) throw (RuntimeException)
538     {
539         ::vos::OGuard aGuard( Application::GetSolarMutex() );
540 
541         return browse::BrowseNodeTypes::CONTAINER;
542     }
543 
544     // =============================================================================
545     // component operations
546     // =============================================================================
547 
create_BasicProviderImpl(Reference<XComponentContext> const & xContext)548     static Reference< XInterface > SAL_CALL create_BasicProviderImpl(
549         Reference< XComponentContext > const & xContext )
550         SAL_THROW( () )
551     {
552         return static_cast< lang::XTypeProvider * >( new BasicProviderImpl( xContext ) );
553     }
554 
555     // -----------------------------------------------------------------------------
556 
557     static struct ::cppu::ImplementationEntry s_component_entries [] =
558     {
559         {
560             create_BasicProviderImpl, getImplementationName_BasicProviderImpl,
561             getSupportedServiceNames_BasicProviderImpl, ::cppu::createSingleComponentFactory,
562             0, 0
563         },
564         { 0, 0, 0, 0, 0, 0 }
565     };
566 
567     // -----------------------------------------------------------------------------
568 
569 //.........................................................................
570 }	// namespace basprov
571 //.........................................................................
572 
573 
574 // =============================================================================
575 // component exports
576 // =============================================================================
577 
578 extern "C"
579 {
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment ** ppEnv)580     SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
581         const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
582     {
583 		(void)ppEnv;
584 
585         *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
586     }
587 
component_getFactory(const sal_Char * pImplName,lang::XMultiServiceFactory * pServiceManager,registry::XRegistryKey * pRegistryKey)588     SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
589         const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
590         registry::XRegistryKey * pRegistryKey )
591     {
592         return ::cppu::component_getFactoryHelper(
593             pImplName, pServiceManager, pRegistryKey, ::basprov::s_component_entries );
594     }
595 }
596