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 #include "rtl/ustring.hxx" 24 #include "rtl/ref.hxx" 25 #include <cppuhelper/implbase2.hxx> 26 27 #include <com/sun/star/uno/XComponentContext.hpp> 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/uno/RuntimeException.hpp> 30 #include <com/sun/star/registry/XRegistryKey.hpp> 31 32 #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> 33 #include <com/sun/star/script/provider/XScriptProvider.hpp> 34 35 #include "ActiveMSPList.hxx" 36 37 namespace func_provider 38 { 39 // for simplification 40 #define css ::com::sun::star 41 42 class MasterScriptProviderFactory : 43 public ::cppu::WeakImplHelper2 < 44 css::script::provider::XScriptProviderFactory, 45 css::lang::XServiceInfo > 46 { 47 private: 48 49 mutable rtl::Reference< ActiveMSPList > m_MSPList; 50 51 const css::uno::Reference< css::uno::XComponentContext > m_xComponentContext; 52 53 const rtl::Reference< ActiveMSPList > & getActiveMSPList() const; 54 55 protected: 56 virtual ~MasterScriptProviderFactory(); 57 58 public: 59 MasterScriptProviderFactory( 60 css::uno::Reference< css::uno::XComponentContext > const & xComponentContext ); 61 62 // XServiceInfo 63 virtual ::rtl::OUString SAL_CALL getImplementationName() 64 throw ( css::uno::RuntimeException ); 65 66 virtual sal_Bool SAL_CALL 67 supportsService( ::rtl::OUString const & serviceName ) 68 throw ( css::uno::RuntimeException ); 69 70 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL 71 getSupportedServiceNames() 72 throw ( css::uno::RuntimeException ); 73 74 // XScriptProviderFactory 75 virtual css::uno::Reference< css::script::provider::XScriptProvider > 76 SAL_CALL createScriptProvider( const css::uno::Any& context ) 77 throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException); 78 }; 79 80 81 } // namespace func_provider 82