Kaydet (Commit) 2f1eed48 authored tarafından Caolán McNamara's avatar Caolán McNamara

createNonDocMSPs->ensureNonDocMSPs

put the double-lockery into ensureNonDocMSPs and
the contents into a new createNonDocMSPs

Change-Id: Id09c933396e1a6ae1c45be79131a75729b16932b
üst 316a5574
......@@ -105,7 +105,7 @@ ActiveMSPList::getMSPFromAnyContext( const Any& aContext )
return msp;
}
createNonDocMSPs();
ensureNonDocMSPs();
return m_hMsps[ shareDirString ];
}
......@@ -264,9 +264,31 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception )
}
}
void
ActiveMSPList::createNonDocMSPs()
{
// do creation of user and share MSPs here
OUString serviceName("com.sun.star.script.provider.MasterScriptProvider");
Sequence< Any > args(1);
args[ 0 ] <<= userDirString;
Reference< provider::XScriptProvider > userMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ userDirString ] = userMsp;
args[ 0 ] <<= shareDirString;
Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ shareDirString ] = shareMsp;
args[ 0 ] <<= bundledDirString;
Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ bundledDirString ] = bundledMsp;
}
void
ActiveMSPList::ensureNonDocMSPs()
{
static bool created = false;
if ( created )
......@@ -280,28 +302,9 @@ ActiveMSPList::createNonDocMSPs()
{
return;
}
// do creation of user and share MSPs here
OUString serviceName("com.sun.star.script.provider.MasterScriptProvider");
Sequence< Any > args(1);
args[ 0 ] <<= userDirString;
Reference< provider::XScriptProvider > userMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ userDirString ] = userMsp;
args[ 0 ] <<= shareDirString;
Reference< provider::XScriptProvider > shareMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ shareDirString ] = shareMsp;
args[ 0 ] <<= bundledDirString;
Reference< provider::XScriptProvider > bundledMsp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, m_xContext ), UNO_QUERY );
// should check if provider reference is valid
m_hMsps[ bundledDirString ] = bundledMsp;
createNonDocMSPs();
created = true;
}
}
......
......@@ -88,6 +88,7 @@ private:
return createNewMSP( css::uno::makeAny( context ) );
}
void ensureNonDocMSPs();
void createNonDocMSPs();
Msp_hash m_hMsps;
ScriptComponent_map m_mScriptComponents;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment