Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_INC_FUNCUNO_HXX
21 : #define INCLUDED_SC_INC_FUNCUNO_HXX
22 :
23 : #include <com/sun/star/lang/XServiceInfo.hpp>
24 : #include <com/sun/star/sheet/XFunctionAccess.hpp>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <cppuhelper/implbase3.hxx>
27 : #include <svl/lstner.hxx>
28 :
29 : class ScDocument;
30 : class ScDocOptions;
31 :
32 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
33 : ScFunctionAccess_CreateInstance(
34 : const ::com::sun::star::uno::Reference<
35 : ::com::sun::star::lang::XMultiServiceFactory >& );
36 :
37 : class ScTempDocCache
38 : {
39 : private:
40 : ScDocument* pDoc;
41 : bool bInUse;
42 :
43 : public:
44 : ScTempDocCache();
45 : ~ScTempDocCache();
46 :
47 0 : ScDocument* GetDocument() const { return pDoc; }
48 0 : bool IsInUse() const { return bInUse; }
49 0 : void SetInUse( bool bSet ) { bInUse = bSet; }
50 :
51 : void SetDocument( ScDocument* pNew );
52 : void Clear();
53 : };
54 :
55 : class ScFunctionAccess : public cppu::WeakImplHelper3<
56 : com::sun::star::sheet::XFunctionAccess,
57 : com::sun::star::beans::XPropertySet,
58 : com::sun::star::lang::XServiceInfo>,
59 : public SfxListener
60 : {
61 : private:
62 : ScTempDocCache aDocCache;
63 : ScDocOptions* pOptions;
64 : SfxItemPropertyMap aPropertyMap;
65 : bool mbArray;
66 : bool mbValid;
67 :
68 : public:
69 : ScFunctionAccess();
70 : virtual ~ScFunctionAccess();
71 :
72 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
73 :
74 : // XFunctionAccess
75 : virtual ::com::sun::star::uno::Any SAL_CALL callFunction(
76 : const OUString& aName,
77 : const ::com::sun::star::uno::Sequence<
78 : ::com::sun::star::uno::Any >& aArguments )
79 : throw (::com::sun::star::container::NoSuchElementException,
80 : ::com::sun::star::lang::IllegalArgumentException,
81 : ::com::sun::star::uno::RuntimeException,
82 : std::exception) SAL_OVERRIDE;
83 :
84 : // XPropertySet
85 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
86 : SAL_CALL getPropertySetInfo()
87 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
89 : const ::com::sun::star::uno::Any& aValue )
90 : throw(::com::sun::star::beans::UnknownPropertyException,
91 : ::com::sun::star::beans::PropertyVetoException,
92 : ::com::sun::star::lang::IllegalArgumentException,
93 : ::com::sun::star::lang::WrappedTargetException,
94 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
96 : const OUString& PropertyName )
97 : throw(::com::sun::star::beans::UnknownPropertyException,
98 : ::com::sun::star::lang::WrappedTargetException,
99 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
101 : const ::com::sun::star::uno::Reference<
102 : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
103 : throw(::com::sun::star::beans::UnknownPropertyException,
104 : ::com::sun::star::lang::WrappedTargetException,
105 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
107 : const ::com::sun::star::uno::Reference<
108 : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
109 : throw(::com::sun::star::beans::UnknownPropertyException,
110 : ::com::sun::star::lang::WrappedTargetException,
111 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
113 : const ::com::sun::star::uno::Reference<
114 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
115 : throw(::com::sun::star::beans::UnknownPropertyException,
116 : ::com::sun::star::lang::WrappedTargetException,
117 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
119 : const ::com::sun::star::uno::Reference<
120 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
121 : throw(::com::sun::star::beans::UnknownPropertyException,
122 : ::com::sun::star::lang::WrappedTargetException,
123 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : // XServiceInfo
126 : virtual OUString SAL_CALL getImplementationName()
127 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
129 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
131 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 : };
133 :
134 : #endif
135 :
136 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|