2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-06 17:28:37 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2003-08-19 08:46:43 +00:00
|
|
|
|
|
|
|
#ifndef _FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
|
|
|
|
#define _FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
|
|
|
|
|
2006-06-19 09:21:21 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
2004-07-23 13:10:31 +00:00
|
|
|
|
|
|
|
#include <cppuhelper/implbase5.hxx>
|
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/uno/RuntimeException.hpp>
|
2004-07-23 13:10:31 +00:00
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
2008-03-06 15:29:00 +00:00
|
|
|
#include <com/sun/star/document/XScriptInvocationContext.hpp>
|
2004-07-23 13:10:31 +00:00
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
#include <com/sun/star/lang/XInitialization.hpp>
|
|
|
|
|
2004-10-22 13:06:56 +00:00
|
|
|
#include <com/sun/star/script/provider/XScriptProvider.hpp>
|
|
|
|
#include <com/sun/star/script/browse/XBrowseNode.hpp>
|
2003-08-27 12:57:48 +00:00
|
|
|
|
2003-09-04 06:24:47 +00:00
|
|
|
#include "ProviderCache.hxx"
|
2004-07-23 13:10:31 +00:00
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
namespace func_provider
|
|
|
|
{
|
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
typedef ::cppu::WeakImplHelper5<
|
2004-10-22 13:06:56 +00:00
|
|
|
css::script::provider::XScriptProvider,
|
|
|
|
css::script::browse::XBrowseNode, css::lang::XServiceInfo,
|
2004-07-23 13:10:31 +00:00
|
|
|
css::lang::XInitialization,
|
|
|
|
css::container::XNameContainer > t_helper;
|
|
|
|
|
|
|
|
class MasterScriptProvider :
|
|
|
|
public t_helper
|
2003-08-19 08:46:43 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
MasterScriptProvider(
|
|
|
|
const css::uno::Reference< css::uno::XComponentContext >
|
2003-08-27 12:57:48 +00:00
|
|
|
& xContext ) throw( css::uno::RuntimeException );
|
2003-08-19 08:46:43 +00:00
|
|
|
~MasterScriptProvider();
|
|
|
|
|
|
|
|
// XServiceInfo implementation
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( )
|
|
|
|
throw( css::uno::RuntimeException );
|
2003-08-27 12:57:48 +00:00
|
|
|
|
|
|
|
// XBrowseNode implementation
|
|
|
|
virtual ::rtl::OUString SAL_CALL getName()
|
|
|
|
throw ( css::uno::RuntimeException );
|
2004-10-22 13:06:56 +00:00
|
|
|
virtual css::uno::Sequence< css::uno::Reference< css::script::browse::XBrowseNode > > SAL_CALL getChildNodes()
|
2003-08-27 12:57:48 +00:00
|
|
|
throw ( css::uno::RuntimeException );
|
|
|
|
virtual sal_Bool SAL_CALL hasChildNodes()
|
|
|
|
throw ( css::uno::RuntimeException );
|
|
|
|
virtual sal_Int16 SAL_CALL getType()
|
|
|
|
throw ( css::uno::RuntimeException );
|
2004-07-23 13:10:31 +00:00
|
|
|
// XNameContainer
|
|
|
|
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);
|
|
|
|
virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
|
2003-08-27 12:57:48 +00:00
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
// XNameReplace
|
|
|
|
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);
|
|
|
|
// XNameAccess
|
|
|
|
virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw ( css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
|
|
|
|
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw ( css::uno::RuntimeException);
|
|
|
|
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
|
2003-09-10 07:08:14 +00:00
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
// XElementAccess
|
|
|
|
virtual css::uno::Type SAL_CALL getElementType( ) throw ( css::uno::RuntimeException);
|
|
|
|
virtual sal_Bool SAL_CALL hasElements( ) throw ( css::uno::RuntimeException);
|
2003-08-19 08:46:43 +00:00
|
|
|
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
|
|
|
|
throw( css::uno::RuntimeException );
|
|
|
|
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
|
|
|
|
throw( css::uno::RuntimeException );
|
|
|
|
|
2003-10-29 14:01:18 +00:00
|
|
|
// XScriptProvider implementation
|
2004-10-22 13:06:56 +00:00
|
|
|
virtual css::uno::Reference < css::script::provider::XScript > SAL_CALL
|
2003-08-19 08:46:43 +00:00
|
|
|
getScript( const ::rtl::OUString& scriptURI )
|
2004-10-22 13:06:56 +00:00
|
|
|
throw( css::script::provider::ScriptFrameworkErrorException,
|
2004-07-23 13:10:31 +00:00
|
|
|
css::uno::RuntimeException );
|
2003-08-19 08:46:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* XInitialise implementation
|
|
|
|
*
|
|
|
|
* @param args expected to contain a single ::rtl::OUString
|
|
|
|
* containing the URI
|
|
|
|
*/
|
2003-09-04 06:24:47 +00:00
|
|
|
virtual void SAL_CALL initialize( const css::uno::Sequence < css::uno::Any > & args )
|
2003-08-19 08:46:43 +00:00
|
|
|
throw ( css::uno::Exception, css::uno::RuntimeException);
|
2003-09-10 07:08:14 +00:00
|
|
|
|
|
|
|
// Public method to return all Language Providers in this MasterScriptProviders
|
|
|
|
// context.
|
2004-10-22 13:06:56 +00:00
|
|
|
css::uno::Sequence< css::uno::Reference< css::script::provider::XScriptProvider > > SAL_CALL
|
2003-09-10 07:08:14 +00:00
|
|
|
getAllProviders() throw ( css::uno::RuntimeException );
|
2004-07-23 13:10:31 +00:00
|
|
|
|
|
|
|
bool isPkgProvider() { return m_bIsPkgMSP; }
|
2004-10-22 13:06:56 +00:00
|
|
|
css::uno::Reference< css::script::provider::XScriptProvider > getPkgProvider() { return m_xMSPPkg; }
|
2004-07-23 13:10:31 +00:00
|
|
|
// returns context string for this provider, eg
|
|
|
|
::rtl::OUString getContextString() { return m_sCtxString; }
|
2008-03-06 15:29:00 +00:00
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
private:
|
2004-05-19 07:28:24 +00:00
|
|
|
::rtl::OUString parseLocationName( const ::rtl::OUString& location );
|
|
|
|
void createPkgProvider();
|
2003-08-27 12:57:48 +00:00
|
|
|
bool isValid();
|
2004-07-23 13:10:31 +00:00
|
|
|
::rtl::OUString getURLForModel();
|
2003-08-27 12:57:48 +00:00
|
|
|
const css::uno::Sequence< ::rtl::OUString >& getProviderNames();
|
2004-04-19 22:16:21 +00:00
|
|
|
|
2004-01-05 13:17:04 +00:00
|
|
|
ProviderCache* providerCache();
|
2003-08-19 08:46:43 +00:00
|
|
|
/* to obtain other services if needed */
|
2008-03-06 15:29:00 +00:00
|
|
|
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
|
|
|
css::uno::Reference< css::lang::XMultiComponentFactory > m_xMgr;
|
|
|
|
css::uno::Reference< css::frame::XModel > m_xModel;
|
|
|
|
css::uno::Reference< css::document::XScriptInvocationContext > m_xInvocationContext;
|
|
|
|
css::uno::Sequence< css::uno::Any > m_sAargs;
|
|
|
|
::rtl::OUString m_sNodeName;
|
|
|
|
|
2003-09-10 07:08:14 +00:00
|
|
|
// This component supports XInitialization, it can be created
|
|
|
|
// using createInstanceXXX() or createInstanceWithArgumentsXXX using
|
|
|
|
// the service Mangager.
|
|
|
|
// Need to detect proper initialisation and validity
|
|
|
|
// for the object, so m_bIsValid indicates that the object is valid is set in ctor
|
|
|
|
// in case of createInstanceWithArgumentsXXX() called m_bIsValid is set to reset
|
|
|
|
// and then set to true when initialisation is complete
|
2003-08-27 12:57:48 +00:00
|
|
|
bool m_bIsValid;
|
2003-09-10 07:08:14 +00:00
|
|
|
// m_bInitialised ensure initialisation only takes place once.
|
|
|
|
bool m_bInitialised;
|
2004-07-23 13:10:31 +00:00
|
|
|
bool m_bIsPkgMSP;
|
2004-10-22 13:06:56 +00:00
|
|
|
css::uno::Reference< css::script::provider::XScriptProvider > m_xMSPPkg;
|
2003-09-04 06:24:47 +00:00
|
|
|
ProviderCache* m_pPCache;
|
2003-08-19 08:46:43 +00:00
|
|
|
osl::Mutex m_mutex;
|
2004-05-19 07:28:24 +00:00
|
|
|
::rtl::OUString m_sCtxString;
|
2003-08-19 08:46:43 +00:00
|
|
|
};
|
|
|
|
} // namespace func_provider
|
|
|
|
#endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
|
2010-10-27 13:11:31 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|