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 : static OUString getImplementationName_Static();
73 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static();
74 :
75 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
76 :
77 : // XFunctionAccess
78 : virtual ::com::sun::star::uno::Any SAL_CALL callFunction(
79 : const OUString& aName,
80 : const ::com::sun::star::uno::Sequence<
81 : ::com::sun::star::uno::Any >& aArguments )
82 : throw (::com::sun::star::container::NoSuchElementException,
83 : ::com::sun::star::lang::IllegalArgumentException,
84 : ::com::sun::star::uno::RuntimeException,
85 : std::exception) SAL_OVERRIDE;
86 :
87 : // XPropertySet
88 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
89 : SAL_CALL getPropertySetInfo()
90 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
92 : const ::com::sun::star::uno::Any& aValue )
93 : throw(::com::sun::star::beans::UnknownPropertyException,
94 : ::com::sun::star::beans::PropertyVetoException,
95 : ::com::sun::star::lang::IllegalArgumentException,
96 : ::com::sun::star::lang::WrappedTargetException,
97 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
99 : const OUString& PropertyName )
100 : throw(::com::sun::star::beans::UnknownPropertyException,
101 : ::com::sun::star::lang::WrappedTargetException,
102 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
104 : const ::com::sun::star::uno::Reference<
105 : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
106 : throw(::com::sun::star::beans::UnknownPropertyException,
107 : ::com::sun::star::lang::WrappedTargetException,
108 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
110 : const ::com::sun::star::uno::Reference<
111 : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
112 : throw(::com::sun::star::beans::UnknownPropertyException,
113 : ::com::sun::star::lang::WrappedTargetException,
114 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
116 : const ::com::sun::star::uno::Reference<
117 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
118 : throw(::com::sun::star::beans::UnknownPropertyException,
119 : ::com::sun::star::lang::WrappedTargetException,
120 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
122 : const ::com::sun::star::uno::Reference<
123 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
124 : throw(::com::sun::star::beans::UnknownPropertyException,
125 : ::com::sun::star::lang::WrappedTargetException,
126 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 :
128 : // XServiceInfo
129 : virtual OUString SAL_CALL getImplementationName()
130 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
132 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
134 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 : };
136 :
137 : #endif
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|