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

Generated by: LCOV version 1.10