1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _FRAMEWORK_SCRIPT_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_ 29 #define _FRAMEWORK_SCRIPT_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_ 30 31 32 #include <osl/mutex.hxx> 33 #include <rtl/ustring.hxx> 34 #include <cppuhelper/implbase1.hxx> 35 #include <comphelper/uno3.hxx> 36 #include <comphelper/propertycontainer.hxx> 37 #include <comphelper/proparrhlp.hxx> 38 39 #include <cppuhelper/implbase1.hxx> 40 #include <cppuhelper/weak.hxx> 41 #include <com/sun/star/lang/XServiceInfo.hpp> 42 #include <com/sun/star/uno/RuntimeException.hpp> 43 #include <com/sun/star/uno/RuntimeException.hpp> 44 #include <com/sun/star/beans/XPropertySet.hpp> 45 #include <comphelper/broadcasthelper.hxx> 46 namespace func_provider 47 { 48 // for simplification 49 #define css ::com::sun::star 50 51 //Typedefs 52 //============================================================================= 53 //typedef ::cppu::WeakImplHelper1< css::beans::XPropertySet > ScriptingContextImpl_BASE; 54 55 class ScriptingContext : public ::comphelper::OMutexAndBroadcastHelper, public ::comphelper::OPropertyContainer, 56 public ::comphelper::OPropertyArrayUsageHelper< ScriptingContext >, public css::lang::XTypeProvider, public ::cppu::OWeakObject 57 { 58 59 public: 60 ScriptingContext( const css::uno::Reference< css::uno::XComponentContext > & xContext ); 61 ~ScriptingContext(); 62 // XInterface 63 64 css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) 65 throw( css::uno::RuntimeException ) 66 { 67 css::uno::Any aRet( OPropertySetHelper::queryInterface( rType ) ); 68 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); 69 } 70 void SAL_CALL acquire() throw() { ::cppu::OWeakObject::acquire(); } 71 void SAL_CALL release() throw() { ::cppu::OWeakObject::release(); } 72 // XPropertySet 73 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) 74 throw ( css::uno::RuntimeException ); 75 //XTypeProvider 76 DECLARE_XTYPEPROVIDER( ) 77 78 protected: 79 80 // OPropertySetHelper 81 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ); 82 83 // OPropertyArrayUsageHelper 84 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; 85 private: 86 css::uno::Reference< css::uno::XComponentContext > m_xContext; 87 88 89 }; 90 } // func_provider 91 #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_ 92