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.