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