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