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
|
|
|
|
2014-04-18 22:47:44 +02:00
|
|
|
#ifndef INCLUDED_SCRIPTING_SOURCE_PROVIDER_MASTERSCRIPTPROVIDER_HXX
|
|
|
|
#define INCLUDED_SCRIPTING_SOURCE_PROVIDER_MASTERSCRIPTPROVIDER_HXX
|
2003-08-19 08:46:43 +00:00
|
|
|
|
2006-06-19 09:21:21 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
2004-07-23 13:10:31 +00:00
|
|
|
|
2015-08-29 07:48:41 +09:00
|
|
|
#include <cppuhelper/implbase.hxx>
|
2004-07-23 13:10:31 +00:00
|
|
|
|
2017-05-30 10:57:29 +02:00
|
|
|
#include <com/sun/star/frame/XModel.hpp>
|
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"
|
2017-05-31 15:40:25 +02:00
|
|
|
#include <memory>
|
2004-07-23 13:10:31 +00:00
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
namespace func_provider
|
|
|
|
{
|
|
|
|
|
2015-08-29 07:48:41 +09:00
|
|
|
typedef ::cppu::WeakImplHelper<
|
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:
|
2017-01-19 17:52:02 +01:00
|
|
|
/// @throws css::uno::RuntimeException
|
2015-11-02 09:52:33 +00:00
|
|
|
explicit MasterScriptProvider(
|
2003-08-19 08:46:43 +00:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >
|
2017-01-26 12:28:58 +01:00
|
|
|
& xContext );
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~MasterScriptProvider() override;
|
2003-08-19 08:46:43 +00:00
|
|
|
|
|
|
|
// XServiceInfo implementation
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual OUString SAL_CALL getImplementationName( ) override;
|
2003-08-27 12:57:48 +00:00
|
|
|
|
|
|
|
// XBrowseNode implementation
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual OUString SAL_CALL getName() override;
|
|
|
|
virtual css::uno::Sequence< css::uno::Reference< css::script::browse::XBrowseNode > > SAL_CALL getChildNodes() override;
|
|
|
|
virtual sal_Bool SAL_CALL hasChildNodes() override;
|
|
|
|
virtual sal_Int16 SAL_CALL getType() override;
|
2004-07-23 13:10:31 +00:00
|
|
|
// XNameContainer
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override;
|
|
|
|
virtual void SAL_CALL removeByName( const OUString& Name ) override;
|
2003-08-27 12:57:48 +00:00
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
// XNameReplace
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
|
2004-07-23 13:10:31 +00:00
|
|
|
// XNameAccess
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
|
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
|
2003-09-10 07:08:14 +00:00
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
// XElementAccess
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Type SAL_CALL getElementType( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL hasElements( ) override;
|
|
|
|
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
|
|
|
|
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
|
2003-08-19 08:46:43 +00:00
|
|
|
|
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
|
2017-01-26 12:28:58 +01:00
|
|
|
getScript( const OUString& scriptURI ) override;
|
2003-08-19 08:46:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* XInitialise implementation
|
|
|
|
*
|
2013-04-07 12:06:47 +02:00
|
|
|
* @param args expected to contain a single OUString
|
2003-08-19 08:46:43 +00:00
|
|
|
* containing the URI
|
|
|
|
*/
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL initialize( const css::uno::Sequence < css::uno::Any > & args ) override;
|
2003-09-10 07:08:14 +00:00
|
|
|
|
2004-07-23 13:10:31 +00:00
|
|
|
// returns context string for this provider, eg
|
2016-04-14 10:20:52 +02:00
|
|
|
const OUString& getContextString() { return m_sCtxString; }
|
2008-03-06 15:29:00 +00:00
|
|
|
|
2003-08-19 08:46:43 +00:00
|
|
|
private:
|
2015-04-10 11:07:36 +02:00
|
|
|
static OUString parseLocationName( const OUString& location );
|
2004-05-19 07:28:24 +00:00
|
|
|
void createPkgProvider();
|
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;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sNodeName;
|
2008-03-06 15:29:00 +00:00
|
|
|
|
2003-09-10 07:08:14 +00:00
|
|
|
// This component supports XInitialization, it can be created
|
|
|
|
// using createInstanceXXX() or createInstanceWithArgumentsXXX using
|
2015-09-29 17:57:10 +02:00
|
|
|
// the service Manager.
|
2003-09-10 07:08:14 +00:00
|
|
|
// 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;
|
2017-05-31 15:40:25 +02:00
|
|
|
std::unique_ptr<ProviderCache> m_pPCache;
|
2003-08-19 08:46:43 +00:00
|
|
|
osl::Mutex m_mutex;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sCtxString;
|
2003-08-19 08:46:43 +00:00
|
|
|
};
|
2014-04-14 15:51:37 +02:00
|
|
|
|
|
|
|
OUString SAL_CALL mspf_getImplementationName() ;
|
|
|
|
css::uno::Reference< css::uno::XInterface > SAL_CALL mspf_create( css::uno::Reference< css::uno::XComponentContext > const & xComponentContext );
|
|
|
|
css::uno::Sequence< OUString > SAL_CALL mspf_getSupportedServiceNames();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace browsenodefactory
|
|
|
|
{
|
|
|
|
OUString SAL_CALL bnf_getImplementationName() ;
|
|
|
|
css::uno::Reference< css::uno::XInterface > SAL_CALL bnf_create( css::uno::Reference< css::uno::XComponentContext > const & xComponentContext );
|
|
|
|
css::uno::Sequence< OUString > SAL_CALL bnf_getSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
2014-04-18 22:47:44 +02:00
|
|
|
#endif // INCLUDED_SCRIPTING_SOURCE_PROVIDER_MASTERSCRIPTPROVIDER_HXX
|
2010-10-27 13:11:31 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|