/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
namespace
{ //thread-safe method to ensure createNonDocMSPs is called once void ensureNonDocMSPs(ActiveMSPList *pList)
{ static NonDocMSPCreator theCreator(pList);
}
}
Reference< document::XEmbeddedScripts > xScripts( xModel, UNO_QUERY );
Reference< document::XScriptInvocationContext > xScriptsContext( xModel, UNO_QUERY ); if ( !xScripts.is() && !xScriptsContext.is() )
{ throw lang::IllegalArgumentException( "Failed to create MasterScriptProvider for '"
+ context + "': Either XEmbeddScripts or XScriptInvocationContext need to be supported by the document.",
nullptr, 1 );
}
{ try
{
Reference< XInterface > xNormalized( Source.Source, UNO_QUERY ); if ( xNormalized.is() )
{
::osl::MutexGuard guard( m_mutex );
ScriptComponent_map::iterator pos = m_mScriptComponents.find( xNormalized ); if ( pos != m_mScriptComponents.end() )
m_mScriptComponents.erase( pos );
}
} catch ( const Exception& )
{ // if we get an exception here, there is not much we can do about // it can't throw as it will screw up the model that is calling dispose
DBG_UNHANDLED_EXCEPTION("scripting");
}
}
void
ActiveMSPList::createNonDocMSPs()
{ // do creation of user and share MSPs here
OUString serviceName(u"com.sun.star.script.provider.MasterScriptProvider"_ustr);
Sequence< Any > args{ Any(userDirString) }; // should check if provider reference is valid
m_hMsps[ userDirString ].set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
args = { Any(shareDirString) }; // should check if provider reference is valid
m_hMsps[ shareDirString ].set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
args = { Any(bundledDirString) }; // should check if provider reference is valid
m_hMsps[ bundledDirString ].set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.