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_APPLUNO_HXX
21 : #define INCLUDED_SC_INC_APPLUNO_HXX
22 :
23 : #include <svl/itemprop.hxx>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/beans/XPropertySet.hpp>
27 : #include <com/sun/star/sheet/XRecentFunctions.hpp>
28 : #include <com/sun/star/sheet/XFunctionDescriptions.hpp>
29 : #include <com/sun/star/sheet/XGlobalSheetSettings.hpp>
30 : #include <com/sun/star/container/XEnumerationAccess.hpp>
31 : #include <com/sun/star/container/XNameAccess.hpp>
32 : #include <cppuhelper/implbase2.hxx>
33 : #include <cppuhelper/implbase3.hxx>
34 : #include <cppuhelper/implbase4.hxx>
35 : #include <rtl/ustring.hxx>
36 : #include <sfx2/sfxmodelfactory.hxx>
37 :
38 : com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL
39 : ScSpreadsheetSettings_CreateInstance(
40 : const com::sun::star::uno::Reference<
41 : com::sun::star::lang::XMultiServiceFactory>& rSMgr );
42 : com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL
43 : ScRecentFunctionsObj_CreateInstance(
44 : const com::sun::star::uno::Reference<
45 : com::sun::star::lang::XMultiServiceFactory>& rSMgr );
46 : com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL
47 : ScFunctionListObj_CreateInstance(
48 : const com::sun::star::uno::Reference<
49 : com::sun::star::lang::XMultiServiceFactory>& rSMgr );
50 :
51 : // Calc document
52 : css::uno::Sequence< OUString > SAL_CALL ScDocument_getSupportedServiceNames() throw();
53 : OUString SAL_CALL ScDocument_getImplementationName() throw();
54 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScDocument_createInstance(
55 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr, SfxModelFlags _nCreationFlags ) throw( css::uno::Exception, std::exception );
56 :
57 : // Calc XML import
58 : css::uno::Sequence< OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw();
59 : OUString SAL_CALL ScXMLImport_getImplementationName() throw();
60 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScXMLImport_createInstance(
61 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( css::uno::Exception );
62 : css::uno::Sequence< OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw();
63 : OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw();
64 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
65 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( css::uno::Exception );
66 : css::uno::Sequence< OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw();
67 : OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw();
68 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
69 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( css::uno::Exception );
70 : css::uno::Sequence< OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw();
71 : OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw();
72 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
73 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( css::uno::Exception );
74 : css::uno::Sequence< OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw();
75 : OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw();
76 : css::uno::Reference< css::uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
77 : const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr ) throw( css::uno::Exception );
78 :
79 : class ScSpreadsheetSettings : public cppu::WeakImplHelper3<
80 : com::sun::star::sheet::XGlobalSheetSettings,
81 : com::sun::star::beans::XPropertySet,
82 : com::sun::star::lang::XServiceInfo>
83 : {
84 : private:
85 : SfxItemPropertySet aPropSet;
86 :
87 : bool getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException);
88 : sal_Int16 getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException);
89 30 : void setProperty(const OUString& aPropertyName, bool p1) throw (css::uno::RuntimeException)
90 30 : { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
91 0 : void setProperty(const OUString& aPropertyName, sal_Int16 p1) throw (css::uno::RuntimeException)
92 0 : { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
93 : public:
94 : ScSpreadsheetSettings();
95 : virtual ~ScSpreadsheetSettings();
96 :
97 : static OUString getImplementationName_Static();
98 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static();
99 :
100 : // XGlobalSheetSettings
101 0 : virtual sal_Bool SAL_CALL getMoveSelection() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
102 0 : { return getPropertyBool("MoveSelection"); }
103 0 : virtual void SAL_CALL setMoveSelection(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
104 0 : { setProperty("MoveSelection", (bool)p1); }
105 0 : virtual sal_Int16 SAL_CALL getMoveDirection() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
106 0 : { return getPropertyInt16("MoveDirection"); }
107 0 : virtual void SAL_CALL setMoveDirection(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
108 0 : { setProperty("MoveDirection", p1); }
109 0 : virtual sal_Bool SAL_CALL getEnterEdit() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
110 0 : { return getPropertyBool("EnterEdit"); }
111 0 : virtual void SAL_CALL setEnterEdit(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
112 0 : { setProperty("EnterEdit", (bool)p1); }
113 0 : virtual sal_Bool SAL_CALL getExtendFormat() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
114 0 : { return getPropertyBool("ExtendFormat"); }
115 0 : virtual void SAL_CALL setExtendFormat(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
116 0 : { setProperty("ExtendFormat", (bool)p1); }
117 0 : virtual sal_Bool SAL_CALL getRangeFinder() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
118 0 : { return getPropertyBool("RangeFinder"); }
119 0 : virtual void SAL_CALL setRangeFinder(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
120 0 : { setProperty("RangeFinder", (bool)p1); }
121 0 : virtual sal_Bool SAL_CALL getExpandReferences() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
122 0 : { return getPropertyBool("ExpandReferences"); }
123 0 : virtual void SAL_CALL setExpandReferences(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
124 0 : { setProperty("ExpandReferences", (bool)p1); }
125 0 : virtual sal_Bool SAL_CALL getMarkHeader() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
126 0 : { return getPropertyBool("MarkHeader"); }
127 0 : virtual void SAL_CALL setMarkHeader(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
128 0 : { setProperty("MarkHeader", (bool)p1); }
129 0 : virtual sal_Bool SAL_CALL getUseTabCol() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
130 0 : { return getPropertyBool("UseTabCol"); }
131 0 : virtual void SAL_CALL setUseTabCol(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
132 0 : { setProperty("UseTabCol", (bool)p1); }
133 98 : virtual sal_Int16 SAL_CALL getMetric() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
134 98 : { return getPropertyInt16("Metric"); }
135 0 : virtual void SAL_CALL setMetric(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
136 0 : { setProperty("Metric", p1); }
137 0 : virtual sal_Int16 SAL_CALL getScale() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
138 0 : { return getPropertyInt16("Scale"); }
139 0 : virtual void SAL_CALL setScale(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
140 0 : { setProperty("Scale", p1); }
141 0 : virtual sal_Bool SAL_CALL getDoAutoComplete() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
142 0 : { return getPropertyBool("DoAutoComplete"); }
143 0 : virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
144 0 : { setProperty("DoAutoComplete", (bool)p1); }
145 0 : virtual sal_Int16 SAL_CALL getStatusBarFunction() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
146 0 : { return getPropertyInt16("StatusBarFunction"); }
147 0 : virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
148 0 : { setProperty("StatusBarFunction", p1); }
149 0 : virtual css::uno::Sequence<OUString> SAL_CALL getUserLists() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
150 : {
151 0 : css::uno::Any any = getPropertyValue("UserLists");
152 0 : css::uno::Sequence<OUString> b;
153 0 : any >>= b;
154 0 : return b;
155 : }
156 0 : virtual void SAL_CALL setUserLists(const css::uno::Sequence<OUString>& p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
157 0 : { setPropertyValue( "UserLists", css::uno::Any(p1) ); }
158 0 : virtual sal_Int16 SAL_CALL getLinkUpdateMode() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
159 0 : { return getPropertyInt16("LinkUpdateMode"); }
160 0 : virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
161 0 : { setProperty("LinkUpdateMode", p1); }
162 0 : virtual sal_Bool SAL_CALL getPrintAllSheets() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
163 0 : { return getPropertyBool("PrintAllSheets"); }
164 0 : virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
165 0 : { setProperty("PrintAllSheets", (bool)p1); }
166 0 : virtual sal_Bool SAL_CALL getPrintEmptyPages() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
167 0 : { return getPropertyBool("PrintEmptyPages"); }
168 0 : virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
169 0 : { setProperty("PrintEmptyPages", (bool)p1); }
170 0 : virtual sal_Bool SAL_CALL getUsePrinterMetrics() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
171 0 : { return getPropertyBool("UsePrinterMetrics"); }
172 0 : virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
173 0 : { setProperty("UsePrinterMetrics", (bool)p1); }
174 15 : virtual sal_Bool SAL_CALL getReplaceCellsWarning() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
175 15 : { return getPropertyBool("ReplaceCellsWarning"); }
176 30 : virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
177 30 : { setProperty("ReplaceCellsWarning", (bool)p1); }
178 :
179 : // XPropertySet
180 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
181 : SAL_CALL getPropertySetInfo()
182 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
184 : const ::com::sun::star::uno::Any& aValue )
185 : throw (::com::sun::star::beans::UnknownPropertyException,
186 : ::com::sun::star::beans::PropertyVetoException,
187 : ::com::sun::star::lang::IllegalArgumentException,
188 : ::com::sun::star::lang::WrappedTargetException,
189 : ::com::sun::star::uno::RuntimeException,
190 : std::exception) SAL_OVERRIDE;
191 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
192 : const OUString& PropertyName )
193 : throw (::com::sun::star::beans::UnknownPropertyException,
194 : ::com::sun::star::lang::WrappedTargetException,
195 : ::com::sun::star::uno::RuntimeException,
196 : std::exception) SAL_OVERRIDE;
197 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
198 : const ::com::sun::star::uno::Reference<
199 : ::com::sun::star::beans::XPropertyChangeListener >& xListener )
200 : throw(::com::sun::star::beans::UnknownPropertyException,
201 : ::com::sun::star::lang::WrappedTargetException,
202 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
204 : const ::com::sun::star::uno::Reference<
205 : ::com::sun::star::beans::XPropertyChangeListener >& aListener )
206 : throw(::com::sun::star::beans::UnknownPropertyException,
207 : ::com::sun::star::lang::WrappedTargetException,
208 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
209 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
210 : const ::com::sun::star::uno::Reference<
211 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
212 : throw(::com::sun::star::beans::UnknownPropertyException,
213 : ::com::sun::star::lang::WrappedTargetException,
214 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
216 : const ::com::sun::star::uno::Reference<
217 : ::com::sun::star::beans::XVetoableChangeListener >& aListener )
218 : throw(::com::sun::star::beans::UnknownPropertyException,
219 : ::com::sun::star::lang::WrappedTargetException,
220 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
221 :
222 : // XServiceInfo
223 : virtual OUString SAL_CALL getImplementationName()
224 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
226 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
227 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
228 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
229 : };
230 :
231 : class ScRecentFunctionsObj : public cppu::WeakImplHelper2<
232 : com::sun::star::sheet::XRecentFunctions,
233 : com::sun::star::lang::XServiceInfo>
234 : {
235 : public:
236 : ScRecentFunctionsObj();
237 : virtual ~ScRecentFunctionsObj();
238 :
239 : // XRecentFunctions
240 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds()
241 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
242 : virtual void SAL_CALL setRecentFunctionIds( const ::com::sun::star::uno::Sequence<
243 : sal_Int32 >& aRecentFunctionIds )
244 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
245 : virtual sal_Int32 SAL_CALL getMaxRecentFunctions()
246 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
247 :
248 : // XServiceInfo
249 : virtual OUString SAL_CALL getImplementationName()
250 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
251 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
252 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
253 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
254 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
255 : };
256 :
257 : class ScFunctionListObj : public cppu::WeakImplHelper4<
258 : com::sun::star::sheet::XFunctionDescriptions,
259 : com::sun::star::container::XEnumerationAccess,
260 : com::sun::star::container::XNameAccess,
261 : com::sun::star::lang::XServiceInfo>
262 : {
263 : public:
264 : ScFunctionListObj();
265 : virtual ~ScFunctionListObj();
266 :
267 : // XFunctionDescriptions
268 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
269 : getById( sal_Int32 nId )
270 : throw(::com::sun::star::lang::IllegalArgumentException,
271 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
272 :
273 : // XNameAccess
274 : virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
275 : throw(::com::sun::star::container::NoSuchElementException,
276 : ::com::sun::star::lang::WrappedTargetException,
277 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
278 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
279 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
280 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
281 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
282 :
283 : // XIndexAccess
284 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
285 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
286 : throw(::com::sun::star::lang::IndexOutOfBoundsException,
287 : ::com::sun::star::lang::WrappedTargetException,
288 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
289 :
290 : // XEnumerationAccess
291 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
292 : createEnumeration() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
293 :
294 : // XElementAccess
295 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
296 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
297 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
298 :
299 : // XServiceInfo
300 : virtual OUString SAL_CALL getImplementationName()
301 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
302 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
303 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
304 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
305 : throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
306 : };
307 :
308 : #endif
309 :
310 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|