Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "appluno.hxx"
31 : : #include "sal/types.h"
32 : : #include <osl/diagnose.h>
33 : : #include <cppuhelper/factory.hxx>
34 : :
35 : : #include <sfx2/app.hxx>
36 : : #include <sfx2/sfxmodelfactory.hxx>
37 : : #include "afmtuno.hxx"
38 : : #include "funcuno.hxx"
39 : : #include "filtuno.hxx"
40 : : #include "miscuno.hxx"
41 : : #include "scmod.hxx"
42 : : #include "appoptio.hxx"
43 : : #include "inputopt.hxx"
44 : : #include "printopt.hxx"
45 : : #include "userlist.hxx"
46 : : #include "sc.hrc" // VAR_ARGS
47 : : #include "unonames.hxx"
48 : : #include "funcdesc.hxx"
49 : : #include <com/sun/star/sheet/FunctionArgument.hpp>
50 : :
51 : : using namespace com::sun::star;
52 : :
53 : : //------------------------------------------------------------------------
54 : :
55 : : // Calc document
56 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScDocument_getSupportedServiceNames() throw();
57 : : extern rtl::OUString SAL_CALL ScDocument_getImplementationName() throw();
58 : : extern uno::Reference< uno::XInterface > SAL_CALL ScDocument_createInstance(
59 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr, const sal_uInt64 _nCreationFlags ) throw( uno::Exception );
60 : :
61 : : // Calc XML import
62 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw();
63 : : extern rtl::OUString SAL_CALL ScXMLImport_getImplementationName() throw();
64 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance(
65 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
66 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw();
67 : : extern rtl::OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw();
68 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
69 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
70 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw();
71 : : extern rtl::OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw();
72 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
73 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
74 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw();
75 : : extern rtl::OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw();
76 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
77 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
78 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw();
79 : : extern rtl::OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw();
80 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
81 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
82 : :
83 : : // Calc XML export
84 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_getSupportedServiceNames() throw();
85 : : extern rtl::OUString SAL_CALL ScXMLOOoExport_getImplementationName() throw();
86 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_createInstance(
87 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
88 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Meta_getSupportedServiceNames() throw();
89 : : extern rtl::OUString SAL_CALL ScXMLOOoExport_Meta_getImplementationName() throw();
90 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Meta_createInstance(
91 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
92 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Styles_getSupportedServiceNames() throw();
93 : : extern rtl::OUString SAL_CALL ScXMLOOoExport_Styles_getImplementationName() throw();
94 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Styles_createInstance(
95 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
96 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Content_getSupportedServiceNames() throw();
97 : : extern rtl::OUString SAL_CALL ScXMLOOoExport_Content_getImplementationName() throw();
98 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Content_createInstance(
99 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
100 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Settings_getSupportedServiceNames() throw();
101 : : extern rtl::OUString SAL_CALL ScXMLOOoExport_Settings_getImplementationName() throw();
102 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Settings_createInstance(
103 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
104 : :
105 : : // Calc XML Oasis export
106 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_getSupportedServiceNames() throw();
107 : : extern rtl::OUString SAL_CALL ScXMLOasisExport_getImplementationName() throw();
108 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_createInstance(
109 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
110 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Meta_getSupportedServiceNames() throw();
111 : : extern rtl::OUString SAL_CALL ScXMLOasisExport_Meta_getImplementationName() throw();
112 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Meta_createInstance(
113 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
114 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Styles_getSupportedServiceNames() throw();
115 : : extern rtl::OUString SAL_CALL ScXMLOasisExport_Styles_getImplementationName() throw();
116 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Styles_createInstance(
117 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
118 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Content_getSupportedServiceNames() throw();
119 : : extern rtl::OUString SAL_CALL ScXMLOasisExport_Content_getImplementationName() throw();
120 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Content_createInstance(
121 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
122 : : extern uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Settings_getSupportedServiceNames() throw();
123 : : extern rtl::OUString SAL_CALL ScXMLOasisExport_Settings_getImplementationName() throw();
124 : : extern uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Settings_createInstance(
125 : : const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
126 : :
127 : : //------------------------------------------------------------------------
128 : :
129 : : // Anzahl der Funktionen, die als zuletzt benutzt gespeichert werden
130 : : //! Define mit funcpage.hxx und dwfunctr.hxx zusammenfassen !!!
131 : : #define LRU_MAX 10
132 : :
133 : : // Spezial-Werte fuer Zoom
134 : : //! irgendwo zentral
135 : : #define SC_ZOOMVAL_OPTIMAL (-1)
136 : : #define SC_ZOOMVAL_WHOLEPAGE (-2)
137 : : #define SC_ZOOMVAL_PAGEWIDTH (-3)
138 : :
139 : : // Anzahl der PropertyValues in einer Function-Description
140 : : #define SC_FUNCDESC_PROPCOUNT 5
141 : :
142 : : //------------------------------------------------------------------------
143 : :
144 : : // alles ohne Which-ID, Map nur fuer PropertySetInfo
145 : :
146 : 3 : static const SfxItemPropertyMapEntry* lcl_GetSettingsPropertyMap()
147 : : {
148 : : static SfxItemPropertyMapEntry aSettingsPropertyMap_Impl[] =
149 : : {
150 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_DOAUTOCP), 0, &getBooleanCppuType(), 0, 0},
151 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_ENTERED), 0, &getBooleanCppuType(), 0, 0},
152 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_EXPREF), 0, &getBooleanCppuType(), 0, 0},
153 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_EXTFMT), 0, &getBooleanCppuType(), 0, 0},
154 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_LINKUPD), 0, &getCppuType((sal_Int16*)0), 0, 0},
155 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_MARKHDR), 0, &getBooleanCppuType(), 0, 0},
156 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_METRIC), 0, &getCppuType((sal_Int16*)0), 0, 0},
157 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_MOVEDIR), 0, &getCppuType((sal_Int16*)0), 0, 0},
158 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_MOVESEL), 0, &getBooleanCppuType(), 0, 0},
159 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_PRALLSH), 0, &getBooleanCppuType(), 0, 0},
160 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_PREMPTY), 0, &getBooleanCppuType(), 0, 0},
161 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_RANGEFIN), 0, &getBooleanCppuType(), 0, 0},
162 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_SCALE), 0, &getCppuType((sal_Int16*)0), 0, 0},
163 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_STBFUNC), 0, &getCppuType((sal_Int16*)0), 0, 0},
164 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_ULISTS), 0, &getCppuType((uno::Sequence<rtl::OUString>*)0), 0, 0},
165 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_PRMETRICS),0, &getBooleanCppuType(), 0, 0},
166 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_USETABCOL),0, &getBooleanCppuType(), 0, 0},
167 [ + - ]: 3 : {MAP_CHAR_LEN(SC_UNONAME_REPLWARN), 0, &getBooleanCppuType(), 0, 0},
168 : : {0,0,0,0,0,0}
169 [ + - ][ + - ]: 6 : };
[ # # ]
170 : 3 : return aSettingsPropertyMap_Impl;
171 : : }
172 : :
173 : : //------------------------------------------------------------------------
174 : :
175 : : #define SCFUNCTIONLISTOBJ_SERVICE "com.sun.star.sheet.FunctionDescriptions"
176 : : #define SCRECENTFUNCTIONSOBJ_SERVICE "com.sun.star.sheet.RecentFunctions"
177 : : #define SCSPREADSHEETSETTINGS_SERVICE "com.sun.star.sheet.GlobalSheetSettings"
178 : :
179 [ # # ]: 0 : SC_SIMPLE_SERVICE_INFO( ScFunctionListObj, "ScFunctionListObj", SCFUNCTIONLISTOBJ_SERVICE )
180 [ # # ]: 0 : SC_SIMPLE_SERVICE_INFO( ScRecentFunctionsObj, "ScRecentFunctionsObj", SCRECENTFUNCTIONSOBJ_SERVICE )
181 [ # # ]: 1 : SC_SIMPLE_SERVICE_INFO( ScSpreadsheetSettings, "ScSpreadsheetSettings", SCSPREADSHEETSETTINGS_SERVICE )
182 : :
183 : : //------------------------------------------------------------------------
184 : :
185 : : extern "C" {
186 : :
187 : 181 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL sc_component_getFactory(
188 : : const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
189 : : {
190 [ - + ]: 181 : if (!pServiceManager)
191 : 0 : return NULL;
192 : :
193 : 181 : uno::Reference<lang::XSingleServiceFactory> xFactory;
194 : 181 : rtl::OUString aImpl(rtl::OUString::createFromAscii(pImplName));
195 : :
196 [ + + ][ + - ]: 181 : if ( aImpl == ScSpreadsheetSettings::getImplementationName_Static() )
197 : : xFactory.set(cppu::createOneInstanceFactory(
198 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
199 : : ScSpreadsheetSettings::getImplementationName_Static(),
200 : : ScSpreadsheetSettings_CreateInstance,
201 [ + - ][ + - ]: 3 : ScSpreadsheetSettings::getSupportedServiceNames_Static() ));
[ + - ][ + - ]
[ + - ][ + - ]
202 : :
203 [ + - ][ + + ]: 181 : if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() )
204 : : xFactory.set(cppu::createOneInstanceFactory(
205 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
206 : : ScRecentFunctionsObj::getImplementationName_Static(),
207 : : ScRecentFunctionsObj_CreateInstance,
208 [ + - ][ + - ]: 1 : ScRecentFunctionsObj::getSupportedServiceNames_Static() ));
[ + - ][ + - ]
[ + - ][ + - ]
209 : :
210 [ + - ][ + + ]: 181 : if ( aImpl == ScFunctionListObj::getImplementationName_Static() )
211 : : xFactory.set(cppu::createOneInstanceFactory(
212 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
213 : : ScFunctionListObj::getImplementationName_Static(),
214 : : ScFunctionListObj_CreateInstance,
215 [ + - ][ + - ]: 1 : ScFunctionListObj::getSupportedServiceNames_Static() ));
[ + - ][ + - ]
[ + - ][ + - ]
216 : :
217 [ + - ][ + + ]: 181 : if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() )
218 : : xFactory.set(cppu::createOneInstanceFactory(
219 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
220 : : ScAutoFormatsObj::getImplementationName_Static(),
221 : : ScAutoFormatsObj_CreateInstance,
222 [ + - ][ + - ]: 1 : ScAutoFormatsObj::getSupportedServiceNames_Static() ));
[ + - ][ + - ]
[ + - ][ + - ]
223 : :
224 [ + - ][ - + ]: 181 : if ( aImpl == ScFunctionAccess::getImplementationName_Static() )
225 : : xFactory.set(cppu::createOneInstanceFactory(
226 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
227 : : ScFunctionAccess::getImplementationName_Static(),
228 : : ScFunctionAccess_CreateInstance,
229 [ # # ][ # # ]: 0 : ScFunctionAccess::getSupportedServiceNames_Static() ));
[ # # ][ # # ]
[ # # ][ # # ]
230 : :
231 [ + - ][ - + ]: 181 : if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() )
232 : : xFactory.set(cppu::createSingleFactory(
233 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
234 : : ScFilterOptionsObj::getImplementationName_Static(),
235 : : ScFilterOptionsObj_CreateInstance,
236 [ # # ][ # # ]: 0 : ScFilterOptionsObj::getSupportedServiceNames_Static() ));
[ # # ][ # # ]
[ # # ][ # # ]
237 : :
238 [ - + ]: 181 : if ( aImpl == ScXMLImport_getImplementationName() )
239 : : xFactory.set(cppu::createSingleFactory(
240 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
241 : : ScXMLImport_getImplementationName(),
242 : : ScXMLImport_createInstance,
243 [ # # ][ # # ]: 0 : ScXMLImport_getSupportedServiceNames() ));
[ # # ][ # # ]
244 : :
245 [ + + ]: 181 : if ( aImpl == ScXMLImport_Meta_getImplementationName() )
246 : : xFactory.set(cppu::createSingleFactory(
247 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
248 : : ScXMLImport_Meta_getImplementationName(),
249 : : ScXMLImport_Meta_createInstance,
250 [ + - ][ + - ]: 27 : ScXMLImport_Meta_getSupportedServiceNames() ));
[ + - ][ + - ]
251 : :
252 [ + + ]: 181 : if ( aImpl == ScXMLImport_Styles_getImplementationName() )
253 : : xFactory.set(cppu::createSingleFactory(
254 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
255 : : ScXMLImport_Styles_getImplementationName(),
256 : : ScXMLImport_Styles_createInstance,
257 [ + - ][ + - ]: 27 : ScXMLImport_Styles_getSupportedServiceNames() ));
[ + - ][ + - ]
258 : :
259 [ + + ]: 181 : if ( aImpl == ScXMLImport_Content_getImplementationName() )
260 : : xFactory.set(cppu::createSingleFactory(
261 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
262 : : ScXMLImport_Content_getImplementationName(),
263 : : ScXMLImport_Content_createInstance,
264 [ + - ][ + - ]: 27 : ScXMLImport_Content_getSupportedServiceNames() ));
[ + - ][ + - ]
265 : :
266 [ + + ]: 181 : if ( aImpl == ScXMLImport_Settings_getImplementationName() )
267 : : xFactory.set(cppu::createSingleFactory(
268 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
269 : : ScXMLImport_Settings_getImplementationName(),
270 : : ScXMLImport_Settings_createInstance,
271 [ + - ][ + - ]: 27 : ScXMLImport_Settings_getSupportedServiceNames() ));
[ + - ][ + - ]
272 : :
273 [ + + ]: 181 : if ( aImpl == ScXMLOOoExport_getImplementationName() )
274 : : xFactory = cppu::createSingleFactory(
275 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
276 : : ScXMLOOoExport_getImplementationName(),
277 : : ScXMLOOoExport_createInstance,
278 [ + - ][ + - ]: 1 : ScXMLOOoExport_getSupportedServiceNames() );
[ + - ][ + - ]
279 : :
280 [ + + ]: 181 : if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() )
281 : : xFactory = cppu::createSingleFactory(
282 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
283 : : ScXMLOOoExport_Meta_getImplementationName(),
284 : : ScXMLOOoExport_Meta_createInstance,
285 [ + - ][ + - ]: 2 : ScXMLOOoExport_Meta_getSupportedServiceNames() );
[ + - ][ + - ]
286 : :
287 [ + + ]: 181 : if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() )
288 : : xFactory = cppu::createSingleFactory(
289 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
290 : : ScXMLOOoExport_Styles_getImplementationName(),
291 : : ScXMLOOoExport_Styles_createInstance,
292 [ + - ][ + - ]: 3 : ScXMLOOoExport_Styles_getSupportedServiceNames() );
[ + - ][ + - ]
293 : :
294 [ + + ]: 181 : if ( aImpl == ScXMLOOoExport_Content_getImplementationName() )
295 : : xFactory = cppu::createSingleFactory(
296 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
297 : : ScXMLOOoExport_Content_getImplementationName(),
298 : : ScXMLOOoExport_Content_createInstance,
299 [ + - ][ + - ]: 2 : ScXMLOOoExport_Content_getSupportedServiceNames() );
[ + - ][ + - ]
300 : :
301 [ + + ]: 181 : if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() )
302 : : xFactory = cppu::createSingleFactory(
303 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
304 : : ScXMLOOoExport_Settings_getImplementationName(),
305 : : ScXMLOOoExport_Settings_createInstance,
306 [ + - ][ + - ]: 3 : ScXMLOOoExport_Settings_getSupportedServiceNames() );
[ + - ][ + - ]
307 : :
308 [ - + ]: 181 : if ( aImpl == ScXMLOasisExport_getImplementationName() )
309 : : xFactory = cppu::createSingleFactory(
310 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
311 : : ScXMLOasisExport_getImplementationName(),
312 : : ScXMLOasisExport_createInstance,
313 [ # # ][ # # ]: 0 : ScXMLOasisExport_getSupportedServiceNames() );
[ # # ][ # # ]
314 [ + + ]: 181 : if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() )
315 : : xFactory = cppu::createSingleFactory(
316 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
317 : : ScXMLOasisExport_Meta_getImplementationName(),
318 : : ScXMLOasisExport_Meta_createInstance,
319 [ + - ][ + - ]: 2 : ScXMLOasisExport_Meta_getSupportedServiceNames() );
[ + - ][ + - ]
320 [ + + ]: 181 : if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() )
321 : : xFactory = cppu::createSingleFactory(
322 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
323 : : ScXMLOasisExport_Styles_getImplementationName(),
324 : : ScXMLOasisExport_Styles_createInstance,
325 [ + - ][ + - ]: 2 : ScXMLOasisExport_Styles_getSupportedServiceNames() );
[ + - ][ + - ]
326 [ + + ]: 181 : if ( aImpl == ScXMLOasisExport_Content_getImplementationName() )
327 : : xFactory = cppu::createSingleFactory(
328 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
329 : : ScXMLOasisExport_Content_getImplementationName(),
330 : : ScXMLOasisExport_Content_createInstance,
331 [ + - ][ + - ]: 2 : ScXMLOasisExport_Content_getSupportedServiceNames() );
[ + - ][ + - ]
332 [ + + ]: 181 : if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() )
333 : : xFactory = cppu::createSingleFactory(
334 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
335 : : ScXMLOasisExport_Settings_getImplementationName(),
336 : : ScXMLOasisExport_Settings_createInstance,
337 [ + - ][ + - ]: 2 : ScXMLOasisExport_Settings_getSupportedServiceNames() );
[ + - ][ + - ]
338 : :
339 [ + + ]: 181 : if ( aImpl == ScDocument_getImplementationName() )
340 : : xFactory.set(sfx2::createSfxModelFactory(
341 : : reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager),
342 : : ScDocument_getImplementationName(),
343 : : ScDocument_createInstance,
344 [ + - ][ + - ]: 48 : ScDocument_getSupportedServiceNames() ));
[ + - ][ + - ]
345 : :
346 : 181 : void* pRet = NULL;
347 [ + - ]: 181 : if (xFactory.is())
348 : : {
349 [ + - ]: 181 : xFactory->acquire();
350 [ + - ]: 181 : pRet = xFactory.get();
351 : : }
352 : 181 : return pRet;
353 : : }
354 : :
355 : : } // extern C
356 : :
357 : : //------------------------------------------------------------------------
358 : :
359 : 3 : ScSpreadsheetSettings::ScSpreadsheetSettings() :
360 [ + - ][ + - ]: 3 : aPropSet( lcl_GetSettingsPropertyMap() )
361 : : {
362 : 3 : }
363 : :
364 [ + - ]: 3 : ScSpreadsheetSettings::~ScSpreadsheetSettings()
365 : : {
366 [ - + ]: 6 : }
367 : :
368 : 3 : uno::Reference<uno::XInterface> SAL_CALL ScSpreadsheetSettings_CreateInstance(
369 : : const uno::Reference<lang::XMultiServiceFactory>& /* rSMgr */ )
370 : : {
371 [ + - ]: 3 : SolarMutexGuard aGuard;
372 [ + - ]: 3 : ScDLL::Init();
373 [ + - ][ + - ]: 3 : static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScSpreadsheetSettings());
[ + - ][ + - ]
[ # # ]
374 [ + - ]: 3 : return xInst;
375 : : }
376 : :
377 : 184 : rtl::OUString ScSpreadsheetSettings::getImplementationName_Static()
378 : : {
379 : 184 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "stardiv.StarCalc.ScSpreadsheetSettings" ));
380 : : }
381 : :
382 : 3 : uno::Sequence<rtl::OUString> ScSpreadsheetSettings::getSupportedServiceNames_Static()
383 : : {
384 : 3 : uno::Sequence<rtl::OUString> aRet(1);
385 [ + - ]: 3 : rtl::OUString* pArray = aRet.getArray();
386 [ + - ]: 3 : pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCSPREADSHEETSETTINGS_SERVICE ));
387 : 3 : return aRet;
388 : : }
389 : :
390 : : // XPropertySet
391 : :
392 : 37 : uno::Reference<beans::XPropertySetInfo> SAL_CALL ScSpreadsheetSettings::getPropertySetInfo()
393 : : throw(uno::RuntimeException)
394 : : {
395 [ + - ]: 37 : SolarMutexGuard aGuard;
396 : : static uno::Reference<beans::XPropertySetInfo> aRef(
397 [ + + ][ + - ]: 37 : new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ));
[ + - ][ + - ]
[ + - ][ # # ]
398 [ + - ]: 37 : return aRef;
399 : : }
400 : :
401 : 54 : void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
402 : : const rtl::OUString& aPropertyName, const uno::Any& aValue )
403 : : throw(beans::UnknownPropertyException, beans::PropertyVetoException,
404 : : lang::IllegalArgumentException, lang::WrappedTargetException,
405 : : uno::RuntimeException)
406 : : {
407 [ + - ]: 54 : SolarMutexGuard aGuard;
408 [ + - ]: 54 : String aString(aPropertyName);
409 : :
410 [ + - ]: 54 : ScModule* pScMod = SC_MOD();
411 [ + - ][ + - ]: 54 : ScAppOptions aAppOpt(pScMod->GetAppOptions());
412 [ + - ][ + - ]: 54 : ScInputOptions aInpOpt(pScMod->GetInputOptions());
413 : 54 : sal_Bool bSaveApp = false;
414 : 54 : sal_Bool bSaveInp = false;
415 : : // print options aren't loaded until needed
416 : :
417 [ + - ][ + + ]: 54 : if (aString.EqualsAscii( SC_UNONAME_DOAUTOCP ))
418 : : {
419 [ + - ]: 3 : aAppOpt.SetAutoComplete( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
420 : 3 : bSaveApp = sal_True;
421 : : }
422 [ + - ][ + + ]: 51 : else if (aString.EqualsAscii( SC_UNONAME_ENTERED ))
423 : : {
424 [ + - ]: 3 : aInpOpt.SetEnterEdit( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
425 : 3 : bSaveInp = sal_True;
426 : : }
427 [ + - ][ + + ]: 48 : else if (aString.EqualsAscii( SC_UNONAME_EXPREF ))
428 : : {
429 [ + - ]: 3 : aInpOpt.SetExpandRefs( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
430 : 3 : bSaveInp = sal_True;
431 : : }
432 [ + - ][ + + ]: 45 : else if (aString.EqualsAscii( SC_UNONAME_EXTFMT ))
433 : : {
434 [ + - ]: 3 : aInpOpt.SetExtendFormat( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
435 : 3 : bSaveInp = sal_True;
436 : : }
437 [ + - ][ + + ]: 42 : else if (aString.EqualsAscii( SC_UNONAME_LINKUPD ))
438 : : {
439 [ + - ]: 3 : aAppOpt.SetLinkMode( (ScLkUpdMode) ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
440 : 3 : bSaveApp = sal_True;
441 : : }
442 [ + - ][ + + ]: 39 : else if (aString.EqualsAscii( SC_UNONAME_MARKHDR ))
443 : : {
444 [ + - ]: 3 : aInpOpt.SetMarkHeader( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
445 : 3 : bSaveInp = sal_True;
446 : : }
447 [ + - ][ + + ]: 36 : else if (aString.EqualsAscii( SC_UNONAME_MOVESEL ))
448 : : {
449 [ + - ]: 3 : aInpOpt.SetMoveSelection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
450 : 3 : bSaveInp = sal_True;
451 : : }
452 [ + - ][ + + ]: 33 : else if (aString.EqualsAscii( SC_UNONAME_RANGEFIN ))
453 : : {
454 [ + - ]: 3 : aInpOpt.SetRangeFinder( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
455 : 3 : bSaveInp = sal_True;
456 : : }
457 [ + - ][ + + ]: 30 : else if (aString.EqualsAscii( SC_UNONAME_USETABCOL ))
458 : : {
459 [ + - ]: 3 : aInpOpt.SetUseTabCol( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
460 : 3 : bSaveInp = sal_True;
461 : : }
462 [ + - ][ + + ]: 27 : else if (aString.EqualsAscii( SC_UNONAME_PRMETRICS ))
463 : : {
464 [ + - ]: 3 : aInpOpt.SetTextWysiwyg( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
465 : 3 : bSaveInp = sal_True;
466 : : }
467 [ + - ][ + + ]: 24 : else if (aString.EqualsAscii( SC_UNONAME_REPLWARN ))
468 : : {
469 [ + - ]: 3 : aInpOpt.SetReplaceCellsWarn( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
470 : 3 : bSaveInp = sal_True;
471 : : }
472 [ + - ][ + + ]: 21 : else if (aString.EqualsAscii( SC_UNONAME_METRIC ))
473 : : {
474 [ + - ]: 3 : aAppOpt.SetAppMetric( (FieldUnit) ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
475 : 3 : bSaveApp = sal_True;
476 : : }
477 [ + - ][ + + ]: 18 : else if (aString.EqualsAscii( SC_UNONAME_MOVEDIR ))
478 : : {
479 [ + - ]: 3 : aInpOpt.SetMoveDir( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
480 : 3 : bSaveInp = sal_True;
481 : : }
482 [ + - ][ + + ]: 15 : else if (aString.EqualsAscii( SC_UNONAME_SCALE ))
483 : : {
484 [ + - ]: 3 : short nVal = ScUnoHelpFunctions::GetInt16FromAny( aValue );
485 [ - + ]: 3 : if ( nVal < 0 )
486 : : {
487 : 0 : SvxZoomType eType = SVX_ZOOM_PERCENT;
488 [ # # # # ]: 0 : switch (nVal)
489 : : {
490 : 0 : case SC_ZOOMVAL_OPTIMAL: eType = SVX_ZOOM_OPTIMAL; break;
491 : 0 : case SC_ZOOMVAL_WHOLEPAGE: eType = SVX_ZOOM_WHOLEPAGE; break;
492 : 0 : case SC_ZOOMVAL_PAGEWIDTH: eType = SVX_ZOOM_PAGEWIDTH; break;
493 : : }
494 : 0 : aAppOpt.SetZoomType( eType );
495 : : }
496 [ + - ][ + - ]: 3 : else if ( nVal >= MINZOOM && nVal <= MAXZOOM )
497 : : {
498 : 3 : aAppOpt.SetZoom( nVal );
499 : 3 : aAppOpt.SetZoomType( SVX_ZOOM_PERCENT );
500 : : }
501 : 3 : bSaveApp = sal_True;
502 : : }
503 [ + - ][ + + ]: 12 : else if (aString.EqualsAscii( SC_UNONAME_STBFUNC ))
504 : : {
505 [ + - ]: 3 : aAppOpt.SetStatusFunc( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
506 : 3 : bSaveApp = sal_True;
507 : : }
508 [ + - ][ + + ]: 9 : else if (aString.EqualsAscii( SC_UNONAME_ULISTS ))
509 : : {
510 [ + - ]: 3 : ScUserList* pUserList = ScGlobal::GetUserList();
511 [ + - ]: 3 : uno::Sequence<rtl::OUString> aSeq;
512 [ + - ][ + - ]: 3 : if ( pUserList && ( aValue >>= aSeq ) )
[ + - ][ + - ]
513 : : {
514 : : // es wird direkt die "lebende" Liste veraendert,
515 : : // mehr tut ScGlobal::SetUserList auch nicht
516 : :
517 [ + - ]: 3 : pUserList->clear(); // alle Eintraege raus
518 : 3 : sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
519 : 3 : const rtl::OUString* pAry = aSeq.getConstArray();
520 [ + + ]: 27 : for (sal_uInt16 i=0; i<nCount; i++)
521 : : {
522 [ + - ]: 24 : String aEntry = pAry[i];
523 [ + - ][ + - ]: 24 : ScUserListData* pData = new ScUserListData(aEntry);
[ + - ]
524 [ + - ]: 24 : pUserList->push_back(pData);
525 [ + - ]: 24 : }
526 : 3 : bSaveApp = sal_True; // Liste wird mit den App-Optionen gespeichert
527 [ + - ]: 3 : }
528 : : }
529 [ + - ][ + + ]: 6 : else if (aString.EqualsAscii( SC_UNONAME_PRALLSH ))
530 : : {
531 [ + - ][ + - ]: 3 : ScPrintOptions aPrintOpt(pScMod->GetPrintOptions());
532 [ + - ]: 3 : aPrintOpt.SetAllSheets( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
533 [ + - ][ + - ]: 3 : pScMod->SetPrintOptions( aPrintOpt );
534 : : }
535 [ + - ][ + - ]: 3 : else if (aString.EqualsAscii( SC_UNONAME_PREMPTY ))
536 : : {
537 [ + - ][ + - ]: 3 : ScPrintOptions aPrintOpt(pScMod->GetPrintOptions());
538 [ + - ]: 3 : aPrintOpt.SetSkipEmpty( !ScUnoHelpFunctions::GetBoolFromAny( aValue ) ); // reversed
539 [ + - ]: 3 : pScMod->SetPrintOptions( aPrintOpt );
540 [ + - ][ + - ]: 3 : SFX_APP()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) ); // update previews
[ + - ][ + - ]
[ + - ]
541 : : }
542 : :
543 [ + + ]: 54 : if ( bSaveApp )
544 [ + - ]: 18 : pScMod->SetAppOptions( aAppOpt );
545 [ + + ]: 54 : if ( bSaveInp )
546 [ + - ][ + - ]: 54 : pScMod->SetInputOptions( aInpOpt );
[ + - ][ + - ]
[ + - ]
547 : 54 : }
548 : :
549 : 148 : uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const rtl::OUString& aPropertyName )
550 : : throw(beans::UnknownPropertyException, lang::WrappedTargetException,
551 : : uno::RuntimeException)
552 : : {
553 [ + - ]: 148 : SolarMutexGuard aGuard;
554 [ + - ]: 148 : String aString = aPropertyName;
555 : 148 : uno::Any aRet;
556 : :
557 [ + - ]: 148 : ScModule* pScMod = SC_MOD();
558 [ + - ][ + - ]: 148 : ScAppOptions aAppOpt = pScMod->GetAppOptions();
559 [ + - ][ + - ]: 148 : ScInputOptions aInpOpt = pScMod->GetInputOptions();
560 : : // print options aren't loaded until needed
561 : :
562 [ + - ][ + + ]: 148 : if (aString.EqualsAscii( SC_UNONAME_DOAUTOCP )) ScUnoHelpFunctions::SetBoolInAny( aRet, aAppOpt.GetAutoComplete() );
[ + - ]
563 [ + - ][ + + ]: 141 : else if (aString.EqualsAscii( SC_UNONAME_ENTERED )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetEnterEdit() );
[ + - ]
564 [ + - ][ + + ]: 134 : else if (aString.EqualsAscii( SC_UNONAME_EXPREF )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExpandRefs() );
[ + - ]
565 [ + - ][ + + ]: 127 : else if (aString.EqualsAscii( SC_UNONAME_EXTFMT )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetExtendFormat() );
[ + - ]
566 [ + - ][ + + ]: 120 : else if (aString.EqualsAscii( SC_UNONAME_LINKUPD )) aRet <<= (sal_Int16) aAppOpt.GetLinkMode();
[ + - ]
567 [ + - ][ + + ]: 113 : else if (aString.EqualsAscii( SC_UNONAME_MARKHDR )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMarkHeader() );
[ + - ]
568 [ + - ][ + + ]: 106 : else if (aString.EqualsAscii( SC_UNONAME_MOVESEL )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetMoveSelection() );
[ + - ]
569 [ + - ][ + + ]: 99 : else if (aString.EqualsAscii( SC_UNONAME_RANGEFIN )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetRangeFinder() );
[ + - ]
570 [ + - ][ + + ]: 92 : else if (aString.EqualsAscii( SC_UNONAME_USETABCOL )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetUseTabCol() );
[ + - ]
571 [ + - ][ + + ]: 85 : else if (aString.EqualsAscii( SC_UNONAME_PRMETRICS )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetTextWysiwyg() );
[ + - ]
572 [ + - ][ + + ]: 78 : else if (aString.EqualsAscii( SC_UNONAME_REPLWARN )) ScUnoHelpFunctions::SetBoolInAny( aRet, aInpOpt.GetReplaceCellsWarn() );
[ + - ]
573 [ + - ][ + + ]: 71 : else if (aString.EqualsAscii( SC_UNONAME_METRIC )) aRet <<= (sal_Int16) aAppOpt.GetAppMetric();
[ + - ]
574 [ + - ][ + + ]: 42 : else if (aString.EqualsAscii( SC_UNONAME_MOVEDIR )) aRet <<= (sal_Int16) aInpOpt.GetMoveDir();
[ + - ]
575 [ + - ][ + + ]: 35 : else if (aString.EqualsAscii( SC_UNONAME_STBFUNC )) aRet <<= (sal_Int16) aAppOpt.GetStatusFunc();
[ + - ]
576 [ + - ][ + + ]: 28 : else if (aString.EqualsAscii( SC_UNONAME_SCALE ))
577 : : {
578 : 7 : sal_Int16 nZoomVal = 0;
579 [ + - - - : 7 : switch ( aAppOpt.GetZoomType() )
- ]
580 : : {
581 : 7 : case SVX_ZOOM_PERCENT: nZoomVal = aAppOpt.GetZoom(); break;
582 : 0 : case SVX_ZOOM_OPTIMAL: nZoomVal = SC_ZOOMVAL_OPTIMAL; break;
583 : 0 : case SVX_ZOOM_WHOLEPAGE: nZoomVal = SC_ZOOMVAL_WHOLEPAGE; break;
584 : 0 : case SVX_ZOOM_PAGEWIDTH: nZoomVal = SC_ZOOMVAL_PAGEWIDTH; break;
585 : : default:
586 : : {
587 : : // added to avoid warnings
588 : : }
589 : : }
590 [ + - ]: 7 : aRet <<= (sal_Int16) nZoomVal;
591 : : }
592 [ + - ][ + + ]: 21 : else if (aString.EqualsAscii( SC_UNONAME_ULISTS ))
593 : : {
594 [ + - ]: 7 : ScUserList* pUserList = ScGlobal::GetUserList();
595 [ + - ]: 7 : if (pUserList)
596 : : {
597 [ + - ]: 7 : size_t nCount = pUserList->size();
598 [ + - ]: 7 : uno::Sequence<rtl::OUString> aSeq(nCount);
599 [ + - ]: 7 : rtl::OUString* pAry = aSeq.getArray();
600 [ + + ]: 60 : for (size_t i=0; i<nCount; ++i)
601 : : {
602 [ + - ][ + - ]: 53 : String aEntry((*pUserList)[i]->GetString());
603 [ + - ]: 53 : pAry[i] = aEntry;
604 [ + - ]: 53 : }
605 [ + - ][ + - ]: 7 : aRet <<= aSeq;
606 : : }
607 : : }
608 [ + - ][ + + ]: 14 : else if (aString.EqualsAscii( SC_UNONAME_PRALLSH ))
609 [ + - ][ + - ]: 7 : ScUnoHelpFunctions::SetBoolInAny( aRet, pScMod->GetPrintOptions().GetAllSheets() );
610 [ + - ][ + - ]: 7 : else if (aString.EqualsAscii( SC_UNONAME_PREMPTY ))
611 [ + - ][ + - ]: 7 : ScUnoHelpFunctions::SetBoolInAny( aRet, !pScMod->GetPrintOptions().GetSkipEmpty() ); // reversed
612 : :
613 [ + - ][ + - ]: 148 : return aRet;
[ + - ][ + - ]
614 : : }
615 : :
616 : 0 : SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSpreadsheetSettings )
617 : :
618 : : //------------------------------------------------------------------------
619 : :
620 : 1 : ScRecentFunctionsObj::ScRecentFunctionsObj()
621 : : {
622 : 1 : }
623 : :
624 : 1 : ScRecentFunctionsObj::~ScRecentFunctionsObj()
625 : : {
626 [ - + ]: 2 : }
627 : :
628 : : // stuff for exService_...
629 : :
630 : 1 : uno::Reference<uno::XInterface> SAL_CALL ScRecentFunctionsObj_CreateInstance(
631 : : const uno::Reference<lang::XMultiServiceFactory>& /* rSMgr */ )
632 : : {
633 [ + - ]: 1 : SolarMutexGuard aGuard;
634 [ + - ]: 1 : ScDLL::Init();
635 [ + - ][ + - ]: 1 : static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScRecentFunctionsObj());
[ + - ][ + - ]
[ # # ]
636 [ + - ]: 1 : return xInst;
637 : : }
638 : :
639 : 182 : rtl::OUString ScRecentFunctionsObj::getImplementationName_Static()
640 : : {
641 : 182 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "stardiv.StarCalc.ScRecentFunctionsObj" ));
642 : : }
643 : :
644 : 1 : uno::Sequence<rtl::OUString> ScRecentFunctionsObj::getSupportedServiceNames_Static()
645 : : {
646 : 1 : uno::Sequence<rtl::OUString> aRet(1);
647 [ + - ]: 1 : rtl::OUString* pArray = aRet.getArray();
648 [ + - ]: 1 : pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCRECENTFUNCTIONSOBJ_SERVICE ));
649 : 1 : return aRet;
650 : : }
651 : :
652 : : // XRecentFunctions
653 : :
654 : 0 : uno::Sequence<sal_Int32> SAL_CALL ScRecentFunctionsObj::getRecentFunctionIds()
655 : : throw(uno::RuntimeException)
656 : : {
657 [ # # ]: 0 : SolarMutexGuard aGuard;
658 [ # # ][ # # ]: 0 : const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
659 : 0 : sal_uInt16 nCount = rOpt.GetLRUFuncListCount();
660 : 0 : const sal_uInt16* pFuncs = rOpt.GetLRUFuncList();
661 [ # # ]: 0 : if (pFuncs)
662 : : {
663 [ # # ]: 0 : uno::Sequence<sal_Int32> aSeq(nCount);
664 [ # # ]: 0 : sal_Int32* pAry = aSeq.getArray();
665 [ # # ]: 0 : for (sal_uInt16 i=0; i<nCount; i++)
666 : 0 : pAry[i] = pFuncs[i];
667 [ # # ][ # # ]: 0 : return aSeq;
668 : : }
669 [ # # ][ # # ]: 0 : return uno::Sequence<sal_Int32>(0);
670 : : }
671 : :
672 : 0 : void SAL_CALL ScRecentFunctionsObj::setRecentFunctionIds(
673 : : const uno::Sequence<sal_Int32>& aRecentFunctionIds )
674 : : throw(uno::RuntimeException)
675 : : {
676 [ # # ]: 0 : SolarMutexGuard aGuard;
677 : 0 : sal_uInt16 nCount = (sal_uInt16) Min( aRecentFunctionIds.getLength(), (sal_Int32) LRU_MAX );
678 : 0 : const sal_Int32* pAry = aRecentFunctionIds.getConstArray();
679 : :
680 [ # # ][ # # ]: 0 : sal_uInt16* pFuncs = nCount ? new sal_uInt16[nCount] : NULL;
681 [ # # ]: 0 : for (sal_uInt16 i=0; i<nCount; i++)
682 : 0 : pFuncs[i] = (sal_uInt16)pAry[i]; //! auf gueltige Werte testen?
683 : :
684 [ # # ]: 0 : ScModule* pScMod = SC_MOD();
685 [ # # ][ # # ]: 0 : ScAppOptions aNewOpts(pScMod->GetAppOptions());
686 [ # # ]: 0 : aNewOpts.SetLRUFuncList(pFuncs, nCount);
687 [ # # ]: 0 : pScMod->SetAppOptions(aNewOpts);
688 : :
689 [ # # ]: 0 : pScMod->RecentFunctionsChanged(); // update function list child window
690 : :
691 [ # # ][ # # ]: 0 : delete[] pFuncs;
[ # # ]
692 : 0 : }
693 : :
694 : 0 : sal_Int32 SAL_CALL ScRecentFunctionsObj::getMaxRecentFunctions() throw(uno::RuntimeException)
695 : : {
696 : 0 : return LRU_MAX;
697 : : }
698 : :
699 : : //------------------------------------------------------------------------
700 : :
701 : 1 : ScFunctionListObj::ScFunctionListObj()
702 : : {
703 : 1 : }
704 : :
705 : 1 : ScFunctionListObj::~ScFunctionListObj()
706 : : {
707 [ - + ]: 2 : }
708 : :
709 : : // stuff for exService_...
710 : :
711 : 1 : uno::Reference<uno::XInterface> SAL_CALL ScFunctionListObj_CreateInstance(
712 : : const uno::Reference<lang::XMultiServiceFactory>& /* rSMgr */ )
713 : : {
714 [ + - ]: 1 : SolarMutexGuard aGuard;
715 [ + - ]: 1 : ScDLL::Init();
716 [ + - ][ + - ]: 1 : static uno::Reference<uno::XInterface> xInst((cppu::OWeakObject*)new ScFunctionListObj());
[ + - ][ + - ]
[ # # ]
717 [ + - ]: 1 : return xInst;
718 : : }
719 : :
720 : 182 : rtl::OUString ScFunctionListObj::getImplementationName_Static()
721 : : {
722 : 182 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "stardiv.StarCalc.ScFunctionListObj" ));
723 : : }
724 : :
725 : 1 : uno::Sequence<rtl::OUString> ScFunctionListObj::getSupportedServiceNames_Static()
726 : : {
727 : 1 : uno::Sequence<rtl::OUString> aRet(1);
728 [ + - ]: 1 : rtl::OUString* pArray = aRet.getArray();
729 [ + - ]: 1 : pArray[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCFUNCTIONLISTOBJ_SERVICE ));
730 : 1 : return aRet;
731 : : }
732 : :
733 : :
734 : 402 : static void lcl_FillSequence( uno::Sequence<beans::PropertyValue>& rSequence, const ScFuncDesc& rDesc )
735 : : {
736 : 402 : rDesc.initArgumentInfo(); // full argument info is needed
737 : :
738 : : OSL_ENSURE( rSequence.getLength() == SC_FUNCDESC_PROPCOUNT, "Falscher Count" );
739 : :
740 : 402 : beans::PropertyValue* pArray = rSequence.getArray();
741 : :
742 : 402 : pArray[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ID ));
743 [ + - ]: 402 : pArray[0].Value <<= (sal_Int32) rDesc.nFIndex;
744 : :
745 : 402 : pArray[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CATEGORY ));
746 [ + - ]: 402 : pArray[1].Value <<= (sal_Int32) rDesc.nCategory;
747 : :
748 : 402 : pArray[2].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_NAME ));
749 [ + - ]: 402 : if (rDesc.pFuncName)
750 [ + - ]: 402 : pArray[2].Value <<= rtl::OUString( *rDesc.pFuncName );
751 : :
752 : 402 : pArray[3].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_DESCRIPTION ));
753 [ + - ]: 402 : if (rDesc.pFuncDesc)
754 [ + - ]: 402 : pArray[3].Value <<= rtl::OUString( *rDesc.pFuncDesc );
755 : :
756 : 402 : pArray[4].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ARGUMENTS ));
757 [ + - ][ + - ]: 402 : if (rDesc.ppDefArgNames && rDesc.ppDefArgDescs && rDesc.pDefArgFlags )
[ + + ]
758 : : {
759 : 394 : sal_uInt16 nCount = rDesc.nArgCount;
760 [ + + ]: 394 : if (nCount >= VAR_ARGS)
761 : 42 : nCount -= VAR_ARGS - 1;
762 : 394 : sal_uInt16 nSeqCount = rDesc.GetSuppressedArgCount();
763 [ + + ]: 394 : if (nSeqCount >= VAR_ARGS)
764 : 42 : nSeqCount -= VAR_ARGS - 1;
765 : :
766 [ + - ]: 394 : if (nSeqCount)
767 : : {
768 [ + - ]: 394 : uno::Sequence<sheet::FunctionArgument> aArgSeq(nSeqCount);
769 [ + - ]: 394 : sheet::FunctionArgument* pArgAry = aArgSeq.getArray();
770 [ + + ]: 1294 : for (sal_uInt16 i=0, j=0; i<nCount; i++)
771 : : {
772 [ + - ]: 900 : if (!rDesc.pDefArgFlags[i].bSuppress)
773 : : {
774 [ + - ]: 900 : String aArgName;
775 [ + - ][ + - ]: 900 : if (rDesc.ppDefArgNames[i]) aArgName = *rDesc.ppDefArgNames[i];
776 [ + - ]: 900 : String aArgDesc;
777 [ + - ][ + - ]: 900 : if (rDesc.ppDefArgDescs[i]) aArgDesc = *rDesc.ppDefArgDescs[i];
778 : 900 : sheet::FunctionArgument aArgument;
779 [ + - ]: 900 : aArgument.Name = aArgName;
780 [ + - ]: 900 : aArgument.Description = aArgDesc;
781 : 900 : aArgument.IsOptional = rDesc.pDefArgFlags[i].bOptional;
782 [ + - ][ + - ]: 900 : pArgAry[j++] = aArgument;
783 : : }
784 : : }
785 [ + - ][ + - ]: 394 : pArray[4].Value <<= aArgSeq;
786 : : }
787 : : }
788 : 402 : }
789 : :
790 : : // XFunctionDescriptions
791 : :
792 : 2 : uno::Sequence<beans::PropertyValue> SAL_CALL ScFunctionListObj::getById( sal_Int32 nId )
793 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
794 : : {
795 [ + - ]: 2 : SolarMutexGuard aGuard;
796 [ + - ]: 2 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
797 [ + - ]: 2 : if ( pFuncList )
798 : : {
799 : 2 : sal_uInt16 nCount = (sal_uInt16)pFuncList->GetCount();
800 [ + + ]: 470 : for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++)
801 : : {
802 [ + - ]: 469 : const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
803 [ + - ][ + + ]: 469 : if ( pDesc && pDesc->nFIndex == nId )
804 : : {
805 [ + - ]: 1 : uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
806 [ + - ]: 1 : lcl_FillSequence( aSeq, *pDesc );
807 [ + - ][ + - ]: 2 : return aSeq;
808 : : }
809 : : }
810 : :
811 [ + - ]: 1 : throw lang::IllegalArgumentException(); // not found
812 : : }
813 : : else
814 [ + - ][ # # ]: 2 : throw uno::RuntimeException(); // should not happen
815 : : }
816 : :
817 : : // XNameAccess
818 : :
819 : 2 : uno::Any SAL_CALL ScFunctionListObj::getByName( const rtl::OUString& aName )
820 : : throw(container::NoSuchElementException,
821 : : lang::WrappedTargetException, uno::RuntimeException)
822 : : {
823 [ + - ]: 2 : SolarMutexGuard aGuard;
824 : 2 : ::rtl::OUString aNameStr(aName);
825 [ + - ]: 2 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
826 [ + - ]: 2 : if ( pFuncList )
827 : : {
828 : 2 : sal_uInt16 nCount = (sal_uInt16)pFuncList->GetCount();
829 [ + + ]: 398 : for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++)
830 : : {
831 [ + - ]: 397 : const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
832 : : //! Case-insensitiv ???
833 [ + - ][ + - ]: 397 : if ( pDesc && pDesc->pFuncName && aNameStr == *pDesc->pFuncName )
[ + + ][ + + ]
834 : : {
835 [ + - ]: 1 : uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
836 [ + - ]: 1 : lcl_FillSequence( aSeq, *pDesc );
837 [ + - ][ + - ]: 2 : return uno::makeAny(aSeq);
838 : : }
839 : : }
840 : :
841 [ + - ]: 1 : throw container::NoSuchElementException(); // not found
842 : : }
843 : : else
844 [ + - ][ # # ]: 2 : throw uno::RuntimeException(); // should not happen
845 : : }
846 : :
847 : : // XIndexAccess
848 : :
849 : 400 : sal_Int32 SAL_CALL ScFunctionListObj::getCount() throw(uno::RuntimeException)
850 : : {
851 [ + - ]: 400 : SolarMutexGuard aGuard;
852 : 400 : sal_Int32 nCount = 0;
853 [ + - ]: 400 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
854 [ + - ]: 400 : if ( pFuncList )
855 : 400 : nCount = static_cast<sal_Int32>(pFuncList->GetCount());
856 [ + - ]: 400 : return nCount;
857 : : }
858 : :
859 : 402 : uno::Any SAL_CALL ScFunctionListObj::getByIndex( sal_Int32 nIndex )
860 : : throw(lang::IndexOutOfBoundsException,
861 : : lang::WrappedTargetException, uno::RuntimeException)
862 : : {
863 [ + - ]: 402 : SolarMutexGuard aGuard;
864 [ + - ]: 402 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
865 [ + - ]: 402 : if ( pFuncList )
866 : : {
867 [ + - ][ + + ]: 402 : if ( nIndex >= 0 && nIndex < (sal_Int32)pFuncList->GetCount() )
[ + + ]
868 : : {
869 [ + - ]: 400 : const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
870 [ + - ]: 400 : if ( pDesc )
871 : : {
872 [ + - ]: 400 : uno::Sequence<beans::PropertyValue> aSeq( SC_FUNCDESC_PROPCOUNT );
873 [ + - ]: 400 : lcl_FillSequence( aSeq, *pDesc );
874 [ + - ][ + - ]: 800 : return uno::makeAny(aSeq);
875 : : }
876 : : }
877 : :
878 [ + - ]: 2 : throw lang::IndexOutOfBoundsException(); // illegal index
879 : : }
880 : : else
881 [ + - ][ # # ]: 402 : throw uno::RuntimeException(); // should not happen
882 : : }
883 : :
884 : : // XEnumerationAccess
885 : :
886 : 2 : uno::Reference<container::XEnumeration> SAL_CALL ScFunctionListObj::createEnumeration()
887 : : throw(uno::RuntimeException)
888 : : {
889 [ + - ]: 2 : SolarMutexGuard aGuard;
890 [ + - ][ + - ]: 2 : return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.FunctionDescriptionEnumeration")));
[ + - ][ + - ]
[ + - ][ + - ]
891 : : }
892 : :
893 : : // XElementAccess
894 : :
895 : 1 : uno::Type SAL_CALL ScFunctionListObj::getElementType() throw(uno::RuntimeException)
896 : : {
897 [ + - ]: 1 : SolarMutexGuard aGuard;
898 [ + - ][ + - ]: 1 : return getCppuType((uno::Sequence<beans::PropertyValue>*)0);
899 : : }
900 : :
901 : 1 : sal_Bool SAL_CALL ScFunctionListObj::hasElements() throw(uno::RuntimeException)
902 : : {
903 [ + - ]: 1 : SolarMutexGuard aGuard;
904 [ + - ][ + - ]: 1 : return ( getCount() > 0 );
905 : : }
906 : :
907 : 1 : uno::Sequence<rtl::OUString> SAL_CALL ScFunctionListObj::getElementNames() throw(uno::RuntimeException)
908 : : {
909 [ + - ]: 1 : SolarMutexGuard aGuard;
910 [ + - ]: 1 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
911 [ + - ]: 1 : if ( pFuncList )
912 : : {
913 : 1 : sal_uInt32 nCount = pFuncList->GetCount();
914 [ + - ]: 1 : uno::Sequence<rtl::OUString> aSeq(nCount);
915 [ + - ]: 1 : rtl::OUString* pAry = aSeq.getArray();
916 [ + + ]: 397 : for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
917 : : {
918 [ + - ]: 396 : const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
919 [ + - ][ + - ]: 396 : if ( pDesc && pDesc->pFuncName )
920 : 396 : pAry[nIndex] = *pDesc->pFuncName;
921 : : }
922 [ + - ][ + - ]: 1 : return aSeq;
923 : : }
924 [ # # ][ + - ]: 1 : return uno::Sequence<rtl::OUString>(0);
925 : : }
926 : :
927 : 2 : sal_Bool SAL_CALL ScFunctionListObj::hasByName( const rtl::OUString& aName )
928 : : throw(uno::RuntimeException)
929 : : {
930 [ + - ]: 2 : SolarMutexGuard aGuard;
931 [ + - ]: 2 : const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
932 [ + - ]: 2 : if ( pFuncList )
933 : : {
934 : 2 : sal_uInt32 nCount = pFuncList->GetCount();
935 [ + + ]: 398 : for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
936 : : {
937 [ + - ]: 397 : const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex);
938 : : //! Case-insensitiv ???
939 [ + - ][ + - ]: 397 : if ( pDesc && pDesc->pFuncName && aName == *pDesc->pFuncName )
[ + + ][ + + ]
940 : 1 : return sal_True;
941 : : }
942 : : }
943 [ + - ]: 2 : return false;
944 : : }
945 : :
946 : : //------------------------------------------------------------------------
947 : :
948 : :
949 : :
950 : :
951 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|