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 #ifndef _FRAMEWORK_SCRIPT_PROVIDER_XSCRIPTURIHELPER_HXX_ 25 #define _FRAMEWORK_SCRIPT_PROVIDER_XSCRIPTURIHELPER_HXX_ 26 27 #include <com/sun/star/script/provider/XScriptURIHelper.hpp> 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/lang/XInitialization.hpp> 30 #include <com/sun/star/uno/XComponentContext.hpp> 31 #include <com/sun/star/uno/RuntimeException.hpp> 32 #include <com/sun/star/ucb/XSimpleFileAccess.hpp> 33 #include <com/sun/star/uri/XUriReferenceFactory.hpp> 34 35 #include <rtl/ustring.hxx> 36 #include <cppuhelper/implbase3.hxx> 37 38 namespace func_provider 39 { 40 41 #define css ::com::sun::star 42 43 class ScriptingFrameworkURIHelper : 44 public ::cppu::WeakImplHelper3< 45 css::script::provider::XScriptURIHelper, 46 css::lang::XServiceInfo, 47 css::lang::XInitialization > 48 { 49 private: 50 51 css::uno::Reference< css::ucb::XSimpleFileAccess > m_xSimpleFileAccess; 52 css::uno::Reference<css::uri::XUriReferenceFactory> m_xUriReferenceFactory; 53 54 ::rtl::OUString m_sLanguage; 55 ::rtl::OUString m_sLocation; 56 ::rtl::OUString m_sBaseURI; 57 58 ::rtl::OUString SCRIPTS_PART; 59 60 bool initBaseURI(); 61 ::rtl::OUString getLanguagePart(const ::rtl::OUString& rStorageURI); 62 ::rtl::OUString getLanguagePath(const ::rtl::OUString& rLanguagePart); 63 64 public: 65 66 ScriptingFrameworkURIHelper( 67 const css::uno::Reference< css::uno::XComponentContext >& xContext ); 68 69 ~ScriptingFrameworkURIHelper(); 70 71 virtual void SAL_CALL 72 initialize( const css::uno::Sequence < css::uno::Any > & args ); 73 74 virtual ::rtl::OUString SAL_CALL 75 getRootStorageURI(); 76 77 virtual ::rtl::OUString SAL_CALL 78 getScriptURI( const ::rtl::OUString& rStorageURI ); 79 80 virtual ::rtl::OUString SAL_CALL 81 getStorageURI( const ::rtl::OUString& rScriptURI ); 82 83 virtual ::rtl::OUString SAL_CALL 84 getImplementationName(); 85 86 virtual sal_Bool SAL_CALL 87 supportsService( const ::rtl::OUString& ServiceName ); 88 89 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL 90 getSupportedServiceNames(); 91 }; 92 93 } // namespace func_provider 94 #endif //_FRAMEWORK_SCRIPT_PROVIDER_XSCRIPTURIHELPER_HXX_ 95