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

Generated by: LCOV version 1.10