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_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
25 #define _FRAMEWORK_SCRIPT_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
26 
27 
28 #include <osl/mutex.hxx>
29 #include <rtl/ustring.hxx>
30 #include <cppuhelper/implbase1.hxx>
31 #include <comphelper/uno3.hxx>
32 #include <comphelper/propertycontainer.hxx>
33 #include <comphelper/proparrhlp.hxx>
34 
35 #include <cppuhelper/implbase1.hxx>
36 #include <cppuhelper/weak.hxx>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/uno/RuntimeException.hpp>
39 #include <com/sun/star/uno/RuntimeException.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <comphelper/broadcasthelper.hxx>
42 namespace func_provider
43 {
44 // for simplification
45 #define css ::com::sun::star
46 
47 //Typedefs
48 //=============================================================================
49 //typedef ::cppu::WeakImplHelper1< css::beans::XPropertySet > ScriptingContextImpl_BASE;
50 
51 class ScriptingContext : public ::comphelper::OMutexAndBroadcastHelper, public ::comphelper::OPropertyContainer,
52                          public ::comphelper::OPropertyArrayUsageHelper< ScriptingContext >,  public css::lang::XTypeProvider, public ::cppu::OWeakObject
53 {
54 
55 public:
56     ScriptingContext( const css::uno::Reference< css::uno::XComponentContext > & xContext );
57     ~ScriptingContext();
58     // XInterface
59 
queryInterface(const css::uno::Type & rType)60     css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType )
61         throw( css::uno::RuntimeException )
62     {
63         css::uno::Any aRet( OPropertySetHelper::queryInterface( rType ) );
64         return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
65     }
acquire()66     void SAL_CALL acquire() throw() { ::cppu::OWeakObject::acquire(); }
release()67     void SAL_CALL release() throw() { ::cppu::OWeakObject::release(); }
68     // XPropertySet
69     virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  )
70             throw ( css::uno::RuntimeException );
71     //XTypeProvider
72     DECLARE_XTYPEPROVIDER( )
73 
74 protected:
75 
76     // OPropertySetHelper
77     virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(  );
78 
79     // OPropertyArrayUsageHelper
80     virtual ::cppu::IPropertyArrayHelper* createArrayHelper(  ) const;
81 private:
82     css::uno::Reference< css::uno::XComponentContext > m_xContext;
83 
84 
85 };
86 } // func_provider
87 #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
88