23#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
54 m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
55 "com.sun.star.script.provider.MasterScriptProvider", args,
m_xContext ), UNO_QUERY );
71 void ensureNonDocMSPs(ActiveMSPList *pList)
73 static NonDocMSPCreator theCreator(pList);
82 if ( aContext >>= sContext )
91 if ( xScriptContext.is() )
97 if ( !
xModel.is() || (
xModel != xScriptContext->getScriptContainer() ) )
103 catch(
const lang::IllegalArgumentException& )
116 ensureNonDocMSPs(
this);
127 xScripts.set( xContext->getScriptContainer() );
128 if ( !xScripts.is() )
130 throw lang::IllegalArgumentException(
131 "Failed to create MasterScriptProvider for ScriptInvocationContext: "
132 "Component supporting XEmbeddScripts interface not found.",
136 ::osl::MutexGuard guard(
m_mutex );
160 if ( context.startsWith(
"vnd.sun.star.tdoc" ) )
166 if ( !xScripts.is() && !xScriptsContext.is() )
168 throw lang::IllegalArgumentException(
169 "Failed to create MasterScriptProvider for '"
171 "': Either XEmbeddScripts or XScriptInvocationContext need to be supported by the document.",
175 ::osl::MutexGuard guard(
m_mutex );
190 ::osl::MutexGuard guard(
m_mutex );
191 Msp_hash::iterator h_itEnd =
m_hMsps.end();
192 Msp_hash::const_iterator itr =
m_hMsps.find( context );
193 if ( itr == h_itEnd )
204 catch(
const lang::IllegalArgumentException& )
208 catch(
const RuntimeException& )
215 throw lang::WrappedTargetRuntimeException(
216 "Failed to create MasterScriptProvider for context '"
227 ::osl::MutexGuard guard(
m_mutex );
240 xBroadcaster->addEventListener(
this );
255 if ( xNormalized.is() )
257 ::osl::MutexGuard guard(
m_mutex );
275 OUString serviceName(
"com.sun.star.script.provider.MasterScriptProvider");
Reference< XComponentContext > m_xContext
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual ~ActiveMSPList() override
css::uno::Reference< css::script::provider::XScriptProvider > getMSPFromStringContext(const OUString &context)
ActiveMSPList(const css::uno::Reference< css::uno::XComponentContext > &xContext)
OUString bundledDirString
css::uno::Reference< css::script::provider::XScriptProvider > getMSPFromAnyContext(const css::uno::Any &context)
css::uno::Reference< css::script::provider::XScriptProvider > getMSPFromInvocationContext(const css::uno::Reference< css::document::XScriptInvocationContext > &context)
css::uno::Reference< css::script::provider::XScriptProvider > createNewMSP(const css::uno::Any &context)
css::uno::Reference< css::uno::XComponentContext > m_xContext
ScriptComponent_map m_mScriptComponents
void addActiveMSP(const css::uno::Reference< css::uno::XInterface > &xComponent, const css::uno::Reference< css::script::provider::XScriptProvider > &msp)
NonDocMSPCreator(ActiveMSPList *pList)
#define DBG_UNHANDLED_EXCEPTION(...)
Any SAL_CALL getCaughtException()
Reference< XModel > xModel