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