LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - appluno.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 382 434 88.0 %
Date: 2014-11-03 Functions: 40 54 74.1 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10