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 SCRIPTING_BASMETHNODE_HXX 25 #define SCRIPTING_BASMETHNODE_HXX 26 27 #include "bcholder.hxx" 28 #include <com/sun/star/beans/XPropertySet.hpp> 29 #include <com/sun/star/script/XInvocation.hpp> 30 #include <com/sun/star/script/browse/XBrowseNode.hpp> 31 #include <com/sun/star/uno/XComponentContext.hpp> 32 #include <comphelper/proparrhlp.hxx> 33 #include <comphelper/propertycontainer.hxx> 34 #include <comphelper/uno3.hxx> 35 #include <cppuhelper/implbase2.hxx> 36 37 38 class SbMethod; 39 40 41 //......................................................................... 42 namespace basprov 43 { 44 //......................................................................... 45 46 // ---------------------------------------------------- 47 // class BasicMethodNodeImpl 48 // ---------------------------------------------------- 49 50 typedef ::cppu::WeakImplHelper2< 51 ::com::sun::star::script::browse::XBrowseNode, 52 ::com::sun::star::script::XInvocation > BasicMethodNodeImpl_BASE; 53 54 class BasicMethodNodeImpl : public BasicMethodNodeImpl_BASE, 55 public ::scripting_helper::OMutexHolder, 56 public ::scripting_helper::OBroadcastHelperHolder, 57 public ::comphelper::OPropertyContainer, 58 public ::comphelper::OPropertyArrayUsageHelper< BasicMethodNodeImpl > 59 { 60 private: 61 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 62 ::rtl::OUString m_sScriptingContext; 63 SbMethod* m_pMethod; 64 bool m_bIsAppScript; 65 66 // properties 67 ::rtl::OUString m_sURI; 68 sal_Bool m_bEditable; 69 70 protected: 71 // OPropertySetHelper 72 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ); 73 74 // OPropertyArrayUsageHelper 75 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; 76 77 public: 78 BasicMethodNodeImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, 79 const ::rtl::OUString& sScriptingContext, 80 SbMethod* pMethod, bool isAppScript = true ); 81 virtual ~BasicMethodNodeImpl(); 82 83 // XInterface 84 DECLARE_XINTERFACE() 85 86 // XTypeProvider 87 DECLARE_XTYPEPROVIDER() 88 89 // XBrowseNode 90 virtual ::rtl::OUString SAL_CALL getName( ); 91 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > > SAL_CALL getChildNodes( ); 92 virtual sal_Bool SAL_CALL hasChildNodes( ); 93 virtual sal_Int16 SAL_CALL getType( ); 94 95 // XPropertySet 96 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ); 97 98 // XInvocation 99 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ); 100 virtual ::com::sun::star::uno::Any SAL_CALL invoke( 101 const ::rtl::OUString& aFunctionName, 102 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, 103 ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, 104 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ); 105 virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ); 106 virtual ::com::sun::star::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ); 107 virtual sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ); 108 virtual sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ); 109 }; 110 111 //......................................................................... 112 } // namespace basprov 113 //......................................................................... 114 115 #endif // SCRIPTING_BASMETHNODE_HXX 116