xref: /trunk/main/sc/inc/funcuno.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 SC_FUNCUNO_HXX
29 #define SC_FUNCUNO_HXX
30 
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/sheet/XFunctionAccess.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <cppuhelper/implbase3.hxx>
35 #include <svl/lstner.hxx>
36 
37 class ScDocument;
38 class ScDocOptions;
39 
40 
41 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
42     ScFunctionAccess_CreateInstance(
43         const ::com::sun::star::uno::Reference<
44             ::com::sun::star::lang::XMultiServiceFactory >& );
45 
46 
47 class ScTempDocCache
48 {
49 private:
50     ScDocument*     pDoc;
51     sal_Bool            bInUse;
52 
53 public:
54                 ScTempDocCache();
55                 ~ScTempDocCache();
56 
57     ScDocument* GetDocument() const     { return pDoc; }
58     sal_Bool        IsInUse() const         { return bInUse; }
59     void        SetInUse( sal_Bool bSet )   { bInUse = bSet; }
60 
61     void        SetDocument( ScDocument* pNew );
62     void        Clear();
63 };
64 
65 class ScFunctionAccess : public cppu::WeakImplHelper3<
66                                         com::sun::star::sheet::XFunctionAccess,
67                                         com::sun::star::beans::XPropertySet,
68                                         com::sun::star::lang::XServiceInfo>,
69                          public SfxListener
70 {
71 private:
72     ScTempDocCache  aDocCache;
73     ScDocOptions*   pOptions;
74     SfxItemPropertyMap aPropertyMap;
75     bool            mbArray;
76     bool            mbValid;
77 
78 public:
79                             ScFunctionAccess();
80     virtual                 ~ScFunctionAccess();
81 
82     static ::rtl::OUString  getImplementationName_Static();
83     static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static();
84 
85     virtual void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
86 
87                             // XFunctionAccess
88     virtual ::com::sun::star::uno::Any SAL_CALL callFunction(
89                                     const ::rtl::OUString& aName,
90                                     const ::com::sun::star::uno::Sequence<
91                                         ::com::sun::star::uno::Any >& aArguments )
92                                 throw(::com::sun::star::container::NoSuchElementException,
93                                     ::com::sun::star::lang::IllegalArgumentException,
94                                     ::com::sun::star::uno::RuntimeException);
95 
96                             // XPropertySet
97     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
98                             SAL_CALL getPropertySetInfo()
99                                 throw(::com::sun::star::uno::RuntimeException);
100     virtual void SAL_CALL   setPropertyValue( const ::rtl::OUString& aPropertyName,
101                                     const ::com::sun::star::uno::Any& aValue )
102                                 throw(::com::sun::star::beans::UnknownPropertyException,
103                                     ::com::sun::star::beans::PropertyVetoException,
104                                     ::com::sun::star::lang::IllegalArgumentException,
105                                     ::com::sun::star::lang::WrappedTargetException,
106                                     ::com::sun::star::uno::RuntimeException);
107     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
108                                     const ::rtl::OUString& PropertyName )
109                                 throw(::com::sun::star::beans::UnknownPropertyException,
110                                     ::com::sun::star::lang::WrappedTargetException,
111                                     ::com::sun::star::uno::RuntimeException);
112     virtual void SAL_CALL   addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
113                                     const ::com::sun::star::uno::Reference<
114                                         ::com::sun::star::beans::XPropertyChangeListener >& xListener )
115                                 throw(::com::sun::star::beans::UnknownPropertyException,
116                                     ::com::sun::star::lang::WrappedTargetException,
117                                     ::com::sun::star::uno::RuntimeException);
118     virtual void SAL_CALL   removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
119                                     const ::com::sun::star::uno::Reference<
120                                         ::com::sun::star::beans::XPropertyChangeListener >& aListener )
121                                 throw(::com::sun::star::beans::UnknownPropertyException,
122                                     ::com::sun::star::lang::WrappedTargetException,
123                                     ::com::sun::star::uno::RuntimeException);
124     virtual void SAL_CALL   addVetoableChangeListener( const ::rtl::OUString& PropertyName,
125                                     const ::com::sun::star::uno::Reference<
126                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
127                                 throw(::com::sun::star::beans::UnknownPropertyException,
128                                     ::com::sun::star::lang::WrappedTargetException,
129                                     ::com::sun::star::uno::RuntimeException);
130     virtual void SAL_CALL   removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
131                                     const ::com::sun::star::uno::Reference<
132                                         ::com::sun::star::beans::XVetoableChangeListener >& aListener )
133                                 throw(::com::sun::star::beans::UnknownPropertyException,
134                                     ::com::sun::star::lang::WrappedTargetException,
135                                     ::com::sun::star::uno::RuntimeException);
136 
137                             // XServiceInfo
138     virtual ::rtl::OUString SAL_CALL getImplementationName()
139                                 throw(::com::sun::star::uno::RuntimeException);
140     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
141                                 throw(::com::sun::star::uno::RuntimeException);
142     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
143                                 throw(::com::sun::star::uno::RuntimeException);
144 };
145 
146 
147 #endif
148 
149