LCOV - code coverage report
Current view: top level - scripting/source/provider - MasterScriptProvider.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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                 :            : #ifndef _FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
      21                 :            : #define _FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
      22                 :            : 
      23                 :            : #include <rtl/ustring.hxx>
      24                 :            : 
      25                 :            : #include <cppuhelper/implbase5.hxx>
      26                 :            : 
      27                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      28                 :            : #include <com/sun/star/uno/RuntimeException.hpp>
      29                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      30                 :            : #include <com/sun/star/document/XScriptInvocationContext.hpp>
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      33                 :            : 
      34                 :            : #include <com/sun/star/script/provider/XScriptProvider.hpp>
      35                 :            : #include <com/sun/star/script/browse/XBrowseNode.hpp>
      36                 :            : 
      37                 :            : #include "ProviderCache.hxx"
      38                 :            : 
      39                 :            : namespace css = ::com::sun::star;
      40                 :            : 
      41                 :            : namespace func_provider
      42                 :            : {
      43                 :            : 
      44                 :            :  typedef ::cppu::WeakImplHelper5<
      45                 :            :      css::script::provider::XScriptProvider,
      46                 :            :      css::script::browse::XBrowseNode, css::lang::XServiceInfo,
      47                 :            :      css::lang::XInitialization,
      48                 :            :      css::container::XNameContainer > t_helper;
      49                 :            : 
      50                 :            : class MasterScriptProvider :
      51                 :            :             public t_helper
      52                 :            : {
      53                 :            : public:
      54                 :            :     MasterScriptProvider(
      55                 :            :         const css::uno::Reference< css::uno::XComponentContext >
      56                 :            :         & xContext ) throw( css::uno::RuntimeException );
      57                 :            :     ~MasterScriptProvider();
      58                 :            : 
      59                 :            :     // XServiceInfo implementation
      60                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName( )
      61                 :            :         throw( css::uno::RuntimeException );
      62                 :            : 
      63                 :            :     // XBrowseNode implementation
      64                 :            :     virtual ::rtl::OUString SAL_CALL getName()
      65                 :            :         throw ( css::uno::RuntimeException );
      66                 :            :     virtual css::uno::Sequence< css::uno::Reference< css::script::browse::XBrowseNode > > SAL_CALL getChildNodes()
      67                 :            :         throw ( css::uno::RuntimeException );
      68                 :            :     virtual sal_Bool SAL_CALL hasChildNodes()
      69                 :            :         throw ( css::uno::RuntimeException );
      70                 :            :     virtual sal_Int16 SAL_CALL getType()
      71                 :            :         throw ( css::uno::RuntimeException );
      72                 :            :     // XNameContainer
      73                 :            :     virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw ( css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, css::uno::RuntimeException);
      74                 :            :     virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
      75                 :            : 
      76                 :            :     // XNameReplace
      77                 :            :     virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const css::uno::Any& aElement ) throw ( css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
      78                 :            :     // XNameAccess
      79                 :            :     virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
      80                 :            :     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw ( css::uno::RuntimeException);
      81                 :            :     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
      82                 :            : 
      83                 :            :     // XElementAccess
      84                 :            :     virtual css::uno::Type SAL_CALL getElementType(  ) throw ( css::uno::RuntimeException);
      85                 :            :     virtual sal_Bool SAL_CALL hasElements(  ) throw ( css::uno::RuntimeException);
      86                 :            :     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
      87                 :            :         throw( css::uno::RuntimeException );
      88                 :            :     virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
      89                 :            :         throw( css::uno::RuntimeException );
      90                 :            : 
      91                 :            :     // XScriptProvider implementation
      92                 :            :     virtual css::uno::Reference < css::script::provider::XScript > SAL_CALL
      93                 :            :         getScript( const ::rtl::OUString& scriptURI )
      94                 :            :         throw( css::script::provider::ScriptFrameworkErrorException,
      95                 :            :                css::uno::RuntimeException );
      96                 :            : 
      97                 :            :     /**
      98                 :            :      *  XInitialise implementation
      99                 :            :      *
     100                 :            :      * @param args expected to contain a single ::rtl::OUString
     101                 :            :      * containing the URI
     102                 :            :      */
     103                 :            :     virtual void SAL_CALL initialize( const css::uno::Sequence < css::uno::Any > & args )
     104                 :            :         throw ( css::uno::Exception, css::uno::RuntimeException);
     105                 :            : 
     106                 :            :     // Public method to return all Language Providers in this MasterScriptProviders
     107                 :            :     // context.
     108                 :            :     css::uno::Sequence< css::uno::Reference< css::script::provider::XScriptProvider > > SAL_CALL
     109                 :            :         getAllProviders() throw ( css::uno::RuntimeException );
     110                 :            : 
     111                 :          0 :     bool isPkgProvider() { return m_bIsPkgMSP; }
     112                 :          0 :     css::uno::Reference< css::script::provider::XScriptProvider > getPkgProvider() { return m_xMSPPkg; }
     113                 :            :     // returns context string for this provider, eg
     114                 :          0 :     ::rtl::OUString getContextString() { return m_sCtxString; }
     115                 :            : 
     116                 :            : private:
     117                 :            :     ::rtl::OUString parseLocationName( const ::rtl::OUString& location );
     118                 :            :     void  createPkgProvider();
     119                 :            :     bool  isValid();
     120                 :            :     ::rtl::OUString getURLForModel();
     121                 :            :     const css::uno::Sequence< ::rtl::OUString >& getProviderNames();
     122                 :            : 
     123                 :            :     ProviderCache* providerCache();
     124                 :            :     /* to obtain other services if needed */
     125                 :            :     css::uno::Reference< css::uno::XComponentContext >              m_xContext;
     126                 :            :     css::uno::Reference< css::lang::XMultiComponentFactory >        m_xMgr;
     127                 :            :     css::uno::Reference< css::frame::XModel >                       m_xModel;
     128                 :            :     css::uno::Reference< css::document::XScriptInvocationContext >  m_xInvocationContext;
     129                 :            :     css::uno::Sequence< css::uno::Any >                             m_sAargs;
     130                 :            :     ::rtl::OUString                                                 m_sNodeName;
     131                 :            : 
     132                 :            :     // This component supports XInitialization, it can be created
     133                 :            :     // using createInstanceXXX() or createInstanceWithArgumentsXXX using
     134                 :            :     // the service Mangager.
     135                 :            :     // Need to detect proper initialisation and validity
     136                 :            :     // for the object, so m_bIsValid indicates that the object is valid is set in ctor
     137                 :            :     // in case of createInstanceWithArgumentsXXX() called m_bIsValid is set to reset
     138                 :            :     // and then set to true when initialisation is complete
     139                 :            :     bool m_bIsValid;
     140                 :            :     // m_bInitialised ensure initialisation only takes place once.
     141                 :            :     bool m_bInitialised;
     142                 :            :     bool m_bIsPkgMSP;
     143                 :            :     css::uno::Reference< css::script::provider::XScriptProvider > m_xMSPPkg;
     144                 :            :     ProviderCache* m_pPCache;
     145                 :            :     osl::Mutex m_mutex;
     146                 :            :     ::rtl::OUString m_sCtxString;
     147                 :            : };
     148                 :            : } // namespace func_provider
     149                 :            : #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
     150                 :            : 
     151                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10