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 SC_FUNCUNO_HXX 25 #define SC_FUNCUNO_HXX 26 27 #include <com/sun/star/lang/XServiceInfo.hpp> 28 #include <com/sun/star/sheet/XFunctionAccess.hpp> 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 #include <cppuhelper/implbase3.hxx> 31 #include <svl/lstner.hxx> 32 33 class ScDocument; 34 class ScDocOptions; 35 36 37 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 38 ScFunctionAccess_CreateInstance( 39 const ::com::sun::star::uno::Reference< 40 ::com::sun::star::lang::XMultiServiceFactory >& ); 41 42 43 class ScTempDocCache 44 { 45 private: 46 ScDocument* pDoc; 47 sal_Bool bInUse; 48 49 public: 50 ScTempDocCache(); 51 ~ScTempDocCache(); 52 GetDocument() const53 ScDocument* GetDocument() const { return pDoc; } IsInUse() const54 sal_Bool IsInUse() const { return bInUse; } SetInUse(sal_Bool bSet)55 void SetInUse( sal_Bool bSet ) { bInUse = bSet; } 56 57 void SetDocument( ScDocument* pNew ); 58 void Clear(); 59 }; 60 61 class ScFunctionAccess : public cppu::WeakImplHelper3< 62 com::sun::star::sheet::XFunctionAccess, 63 com::sun::star::beans::XPropertySet, 64 com::sun::star::lang::XServiceInfo>, 65 public SfxListener 66 { 67 private: 68 ScTempDocCache aDocCache; 69 ScDocOptions* pOptions; 70 SfxItemPropertyMap aPropertyMap; 71 bool mbArray; 72 bool mbValid; 73 74 public: 75 ScFunctionAccess(); 76 virtual ~ScFunctionAccess(); 77 78 static ::rtl::OUString getImplementationName_Static(); 79 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(); 80 81 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 82 83 // XFunctionAccess 84 virtual ::com::sun::star::uno::Any SAL_CALL callFunction( 85 const ::rtl::OUString& aName, 86 const ::com::sun::star::uno::Sequence< 87 ::com::sun::star::uno::Any >& aArguments ); 88 89 // XPropertySet 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > 91 SAL_CALL getPropertySetInfo(); 92 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, 93 const ::com::sun::star::uno::Any& aValue ); 94 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 95 const ::rtl::OUString& PropertyName ); 96 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, 97 const ::com::sun::star::uno::Reference< 98 ::com::sun::star::beans::XPropertyChangeListener >& xListener ); 99 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, 100 const ::com::sun::star::uno::Reference< 101 ::com::sun::star::beans::XPropertyChangeListener >& aListener ); 102 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, 103 const ::com::sun::star::uno::Reference< 104 ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 105 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, 106 const ::com::sun::star::uno::Reference< 107 ::com::sun::star::beans::XVetoableChangeListener >& aListener ); 108 109 // XServiceInfo 110 virtual ::rtl::OUString SAL_CALL getImplementationName(); 111 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ); 112 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); 113 }; 114 115 116 #endif 117