xref: /aoo4110/main/sc/inc/funcuno.hxx (revision b1cdbd2c)
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 								throw(::com::sun::star::container::NoSuchElementException,
89 									::com::sun::star::lang::IllegalArgumentException,
90 									::com::sun::star::uno::RuntimeException);
91 
92 							// XPropertySet
93 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
94 							SAL_CALL getPropertySetInfo()
95 								throw(::com::sun::star::uno::RuntimeException);
96 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
97 									const ::com::sun::star::uno::Any& aValue )
98 								throw(::com::sun::star::beans::UnknownPropertyException,
99 									::com::sun::star::beans::PropertyVetoException,
100 									::com::sun::star::lang::IllegalArgumentException,
101 									::com::sun::star::lang::WrappedTargetException,
102 									::com::sun::star::uno::RuntimeException);
103 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
104 									const ::rtl::OUString& PropertyName )
105 								throw(::com::sun::star::beans::UnknownPropertyException,
106 									::com::sun::star::lang::WrappedTargetException,
107 									::com::sun::star::uno::RuntimeException);
108 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
109 									const ::com::sun::star::uno::Reference<
110 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
111 								throw(::com::sun::star::beans::UnknownPropertyException,
112 									::com::sun::star::lang::WrappedTargetException,
113 									::com::sun::star::uno::RuntimeException);
114 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
115 									const ::com::sun::star::uno::Reference<
116 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
117 								throw(::com::sun::star::beans::UnknownPropertyException,
118 									::com::sun::star::lang::WrappedTargetException,
119 									::com::sun::star::uno::RuntimeException);
120 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
121 									const ::com::sun::star::uno::Reference<
122 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
123 								throw(::com::sun::star::beans::UnknownPropertyException,
124 									::com::sun::star::lang::WrappedTargetException,
125 									::com::sun::star::uno::RuntimeException);
126 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
127 									const ::com::sun::star::uno::Reference<
128 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
129 								throw(::com::sun::star::beans::UnknownPropertyException,
130 									::com::sun::star::lang::WrappedTargetException,
131 									::com::sun::star::uno::RuntimeException);
132 
133 							// XServiceInfo
134 	virtual ::rtl::OUString SAL_CALL getImplementationName()
135 								throw(::com::sun::star::uno::RuntimeException);
136 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
137 								throw(::com::sun::star::uno::RuntimeException);
138 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
139 								throw(::com::sun::star::uno::RuntimeException);
140 };
141 
142 
143 #endif
144 
145