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 :
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 :
52 : class ScSpreadsheetSettings : public cppu::WeakImplHelper3<
53 : com::sun::star::sheet::XGlobalSheetSettings,
54 : com::sun::star::beans::XPropertySet,
55 : com::sun::star::lang::XServiceInfo>
56 : {
57 : private:
58 : SfxItemPropertySet aPropSet;
59 :
60 :
61 : sal_Bool getPropertyBool(const OUString& aPropertyName) throw (css::uno::RuntimeException);
62 : sal_Int16 getPropertyInt16(const OUString& aPropertyName) throw (css::uno::RuntimeException);
63 30 : void setProperty(const OUString& aPropertyName, sal_Bool p1) throw (css::uno::RuntimeException)
64 30 : { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
65 0 : void setProperty(const OUString& aPropertyName, sal_Int16 p1) throw (css::uno::RuntimeException)
66 0 : { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
67 : public:
68 : ScSpreadsheetSettings();
69 : virtual ~ScSpreadsheetSettings();
70 :
71 : static OUString getImplementationName_Static();
72 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static();
73 :
74 : // XGlobalSheetSettings
75 0 : virtual sal_Bool SAL_CALL getMoveSelection() throw (css::uno::RuntimeException)
76 0 : { return getPropertyBool("MoveSelection"); }
77 0 : virtual void SAL_CALL setMoveSelection(sal_Bool p1) throw (css::uno::RuntimeException)
78 0 : { setProperty("MoveSelection", p1); }
79 0 : virtual sal_Int16 SAL_CALL getMoveDirection() throw (css::uno::RuntimeException)
80 0 : { return getPropertyInt16("MoveDirection"); }
81 0 : virtual void SAL_CALL setMoveDirection(sal_Int16 p1) throw (css::uno::RuntimeException)
82 0 : { setProperty("MoveDirection", p1); }
83 0 : virtual sal_Bool SAL_CALL getEnterEdit() throw (css::uno::RuntimeException)
84 0 : { return getPropertyBool("EnterEdit"); }
85 0 : virtual void SAL_CALL setEnterEdit(sal_Bool p1) throw (css::uno::RuntimeException)
86 0 : { setProperty("EnterEdit", p1); }
87 0 : virtual sal_Bool SAL_CALL getExtendFormat() throw (css::uno::RuntimeException)
88 0 : { return getPropertyBool("ExtendFormat"); }
89 0 : virtual void SAL_CALL setExtendFormat(sal_Bool p1) throw (css::uno::RuntimeException)
90 0 : { setProperty("ExtendFormat", p1); }
91 0 : virtual sal_Bool SAL_CALL getRangeFinder() throw (css::uno::RuntimeException)
92 0 : { return getPropertyBool("RangeFinder"); }
93 0 : virtual void SAL_CALL setRangeFinder(sal_Bool p1) throw (css::uno::RuntimeException)
94 0 : { setProperty("RangeFinder", p1); }
95 0 : virtual sal_Bool SAL_CALL getExpandReferences() throw (css::uno::RuntimeException)
96 0 : { return getPropertyBool("ExpandReferences"); }
97 0 : virtual void SAL_CALL setExpandReferences(sal_Bool p1) throw (css::uno::RuntimeException)
98 0 : { setProperty("ExpandReferences", p1); }
99 0 : virtual sal_Bool SAL_CALL getMarkHeader() throw (css::uno::RuntimeException)
100 0 : { return getPropertyBool("MarkHeader"); }
101 0 : virtual void SAL_CALL setMarkHeader(sal_Bool p1) throw (css::uno::RuntimeException)
102 0 : { setProperty("MarkHeader", p1); }
103 0 : virtual sal_Bool SAL_CALL getUseTabCol() throw (css::uno::RuntimeException)
104 0 : { return getPropertyBool("UseTabCol"); }
105 0 : virtual void SAL_CALL setUseTabCol(sal_Bool p1) throw (css::uno::RuntimeException)
106 0 : { setProperty("UseTabCol", p1); }
107 34 : virtual sal_Int16 SAL_CALL getMetric() throw (css::uno::RuntimeException)
108 34 : { return getPropertyInt16("Metric"); }
109 0 : virtual void SAL_CALL setMetric(sal_Int16 p1) throw (css::uno::RuntimeException)
110 0 : { setProperty("Metric", p1); }
111 0 : virtual sal_Int16 SAL_CALL getScale() throw (css::uno::RuntimeException)
112 0 : { return getPropertyInt16("Scale"); }
113 0 : virtual void SAL_CALL setScale(sal_Int16 p1) throw (css::uno::RuntimeException)
114 0 : { setProperty("Scale", p1); }
115 0 : virtual sal_Bool SAL_CALL getDoAutoComplete() throw (css::uno::RuntimeException)
116 0 : { return getPropertyBool("DoAutoComplete"); }
117 0 : virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) throw (css::uno::RuntimeException)
118 0 : { setProperty("DoAutoComplete", p1); }
119 0 : virtual sal_Int16 SAL_CALL getStatusBarFunction() throw (css::uno::RuntimeException)
120 0 : { return getPropertyInt16("StatusBarFunction"); }
121 0 : virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) throw (css::uno::RuntimeException)
122 0 : { setProperty("StatusBarFunction", p1); }
123 0 : virtual css::uno::Sequence<OUString> SAL_CALL getUserLists() throw (css::uno::RuntimeException)
124 : {
125 0 : css::uno::Any any = getPropertyValue("UserLists");
126 0 : css::uno::Sequence<OUString> b;
127 0 : any >>= b;
128 0 : return b;
129 : }
130 0 : virtual void SAL_CALL setUserLists(const css::uno::Sequence<OUString>& p1) throw (css::uno::RuntimeException)
131 0 : { setPropertyValue( "UserLists", css::uno::Any(p1) ); }
132 0 : virtual sal_Int16 SAL_CALL getLinkUpdateMode() throw (css::uno::RuntimeException)
133 0 : { return getPropertyInt16("LinkUpdateMode"); }
134 0 : virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) throw (css::uno::RuntimeException)
135 0 : { setProperty("LinkUpdateMode", p1); }
136 0 : virtual sal_Bool SAL_CALL getPrintAllSheets() throw (css::uno::RuntimeException)
137 0 : { return getPropertyBool("PrintAllSheets"); }
138 0 : virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) throw (css::uno::RuntimeException)
139 0 : { setProperty("PrintAllSheets", p1); }
140 0 : virtual sal_Bool SAL_CALL getPrintEmptyPages() throw (css::uno::RuntimeException)
141 0 : { return getPropertyBool("PrintEmptyPages"); }
142 0 : virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) throw (css::uno::RuntimeException)
143 0 : { setProperty("PrintEmptyPages", p1); }
144 0 : virtual sal_Bool SAL_CALL getUsePrinterMetrics() throw (css::uno::RuntimeException)
145 0 : { return getPropertyBool("UsePrinterMetrics"); }
146 0 : virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) throw (css::uno::RuntimeException)
147 0 : { setProperty("UsePrinterMetrics", p1); }
148 15 : virtual sal_Bool SAL_CALL getReplaceCellsWarning() throw (css::uno::RuntimeException)
149 15 : { return getPropertyBool("ReplaceCellsWarning"); }
150 30 : virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) throw (css::uno::RuntimeException)
151 30 : { setProperty("ReplaceCellsWarning", p1); }
152 :
153 : // XPropertySet
154 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
155 : SAL_CALL getPropertySetInfo()
156 : throw(::com::sun::star::uno::RuntimeException);
157 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
158 : const ::com::sun::star::uno::Any& aValue )
159 : throw(::com::sun::star::beans::UnknownPropertyException,
160 : ::com::sun::star::beans::PropertyVetoException,
161 : ::com::sun::star::lang::IllegalArgumentException,
162 : ::com::sun::star::lang::WrappedTargetException,
163 : ::com::sun::star::uno::RuntimeException);
164 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
165 : const OUString& PropertyName )
166 : throw(::com::sun::star::beans::UnknownPropertyException,
167 : ::com::sun::star::lang::WrappedTargetException,
168 : ::com::sun::star::uno::RuntimeException);
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);
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);
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);
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);
193 :
194 : // XServiceInfo
195 : virtual OUString SAL_CALL getImplementationName()
196 : throw(::com::sun::star::uno::RuntimeException);
197 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
198 : throw(::com::sun::star::uno::RuntimeException);
199 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
200 : throw(::com::sun::star::uno::RuntimeException);
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);
218 : virtual void SAL_CALL setRecentFunctionIds( const ::com::sun::star::uno::Sequence<
219 : sal_Int32 >& aRecentFunctionIds )
220 : throw(::com::sun::star::uno::RuntimeException);
221 : virtual sal_Int32 SAL_CALL getMaxRecentFunctions()
222 : throw(::com::sun::star::uno::RuntimeException);
223 :
224 : // XServiceInfo
225 : virtual OUString SAL_CALL getImplementationName()
226 : throw(::com::sun::star::uno::RuntimeException);
227 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
228 : throw(::com::sun::star::uno::RuntimeException);
229 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
230 : throw(::com::sun::star::uno::RuntimeException);
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);
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);
258 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
259 : throw(::com::sun::star::uno::RuntimeException);
260 : virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
261 : throw(::com::sun::star::uno::RuntimeException);
262 :
263 : // XIndexAccess
264 : virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
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);
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);
273 :
274 : // XElementAccess
275 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
276 : throw(::com::sun::star::uno::RuntimeException);
277 : virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
278 :
279 : // XServiceInfo
280 : virtual OUString SAL_CALL getImplementationName()
281 : throw(::com::sun::star::uno::RuntimeException);
282 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
283 : throw(::com::sun::star::uno::RuntimeException);
284 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
285 : throw(::com::sun::star::uno::RuntimeException);
286 : };
287 :
288 :
289 :
290 : #endif
291 :
292 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|