Kaydet (Commit) 297c10cc authored tarafından Kurt Zenker's avatar Kurt Zenker

INTEGRATION: CWS npower9 (1.12.8); FILE MERGED

2008/04/22 09:17:04 npower 1.12.8.5: RESYNC: (1.13-1.15); FILE MERGED
2008/02/25 11:12:21 npower 1.12.8.4: RESYNC: (1.12-1.13); FILE MERGED
2008/01/30 16:27:48 npower 1.12.8.3: #i84808# move OSL_ENSURE macro to non-legacy mode branch
2008/01/15 12:57:32 npower 1.12.8.2: #i84808#
2007/12/20 21:20:04 npower 1.12.8.1: #i84808#
üst 9896a09d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite * OpenOffice.org - a multi-platform office productivity suite
* *
* $RCSfile: dlgprov.cxx,v $ * $RCSfile: dlgprov.cxx,v $
* $Revision: 1.15 $ * $Revision: 1.16 $
* *
* This file is part of OpenOffice.org. * This file is part of OpenOffice.org.
* *
...@@ -80,6 +80,7 @@ namespace dlgprov ...@@ -80,6 +80,7 @@ namespace dlgprov
{ {
//......................................................................... //.........................................................................
static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
// ============================================================================= // =============================================================================
// component operations // component operations
// ============================================================================= // =============================================================================
...@@ -177,9 +178,41 @@ namespace dlgprov ...@@ -177,9 +178,41 @@ namespace dlgprov
return xStringResourceManager; return xStringResourceManager;
} }
Reference< container::XNameContainer > DialogProviderImpl::createControlModel() throw ( Exception )
{
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager(), UNO_QUERY_THROW );
Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), m_xContext ), UNO_QUERY_THROW );
return xControlModel;
}
Reference< container::XNameContainer > DialogProviderImpl::createDialogModel( const Reference< io::XInputStream >& xInput, const Reference< resource::XStringResourceManager >& xStringResourceManager ) throw ( Exception )
{
Reference< container::XNameContainer > xDialogModel( createControlModel() );
::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
// Set resource property
if( xStringResourceManager.is() )
{
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
Any aStringResourceManagerAny;
aStringResourceManagerAny <<= xStringResourceManager;
xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
}
return xDialogModel;
}
Reference< XControlModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception )
{
if ( !m_BasicInfo.get() )
// shouln't get here
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("No information to create dialog" ) ), Reference< XInterface >() );
Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib );
Reference< XControlModel > xCtrlModel( createDialogModel( m_BasicInfo->mxInput, xStringResourceManager ), UNO_QUERY_THROW );
return xCtrlModel;
}
Reference< XControlModel > DialogProviderImpl::createDialogModel( const ::rtl::OUString& sURL ) Reference< XControlModel > DialogProviderImpl::createDialogModel( const ::rtl::OUString& sURL )
{ {
static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" );
::rtl::OUString aURL( sURL ); ::rtl::OUString aURL( sURL );
...@@ -371,24 +404,6 @@ namespace dlgprov ...@@ -371,24 +404,6 @@ namespace dlgprov
Reference< XControlModel > xCtrlModel; Reference< XControlModel > xCtrlModel;
if ( xInput.is() && m_xContext.is() ) if ( xInput.is() && m_xContext.is() )
{ {
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager() );
if ( xSMgr_.is() )
{
Reference< container::XNameContainer > xDialogModel( xSMgr_->createInstanceWithContext(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), m_xContext ), UNO_QUERY );
if ( xDialogModel.is() )
{
Any aDialogSourceURLAny;
aDialogSourceURLAny <<= aURL;
::rtl::OUString aDlgSrcUrlPropName( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ) );
Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURLAny );
::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
xCtrlModel = Reference< XControlModel >( xDialogModel, UNO_QUERY );
Reference< resource::XStringResourceManager > xStringResourceManager; Reference< resource::XStringResourceManager > xStringResourceManager;
if( bSingleDialog ) if( bSingleDialog )
{ {
...@@ -409,7 +424,7 @@ namespace dlgprov ...@@ -409,7 +424,7 @@ namespace dlgprov
Reference< task::XInteractionHandler > xDummyHandler; Reference< task::XInteractionHandler > xDummyHandler;
aArgs[5] <<= xDummyHandler; aArgs[5] <<= xDummyHandler;
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager(), UNO_QUERY_THROW );
// TODO: Ctor // TODO: Ctor
xStringResourceManager = Reference< resource::XStringResourceManager >( xSMgr_->createInstanceWithContext xStringResourceManager = Reference< resource::XStringResourceManager >( xSMgr_->createInstanceWithContext
( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ), ( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ),
...@@ -426,16 +441,15 @@ namespace dlgprov ...@@ -426,16 +441,15 @@ namespace dlgprov
xStringResourceManager = getStringResourceFromDialogLibrary( xDialogLib ); xStringResourceManager = getStringResourceFromDialogLibrary( xDialogLib );
} }
// Set resource property Reference< container::XNameContainer > xDialogModel( createDialogModel( xInput , xStringResourceManager ), UNO_QUERY_THROW );
if( xStringResourceManager.is() ) Any aDialogSourceURLAny;
{ aDialogSourceURLAny <<= aURL;
Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); ::rtl::OUString aDlgSrcUrlPropName( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ) );
Any aStringResourceManagerAny; Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
aStringResourceManagerAny <<= xStringResourceManager; xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURLAny );
xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
}
} xCtrlModel = Reference< XControlModel >( xDialogModel, UNO_QUERY );
}
} }
return xCtrlModel; return xCtrlModel;
} }
...@@ -526,19 +540,13 @@ namespace dlgprov ...@@ -526,19 +540,13 @@ namespace dlgprov
// also add the dialog control itself to the sequence // also add the dialog control itself to the sequence
pObjects[nControlCount] = Reference< XInterface >( rxControl, UNO_QUERY ); pObjects[nControlCount] = Reference< XInterface >( rxControl, UNO_QUERY );
Reference< XScriptListener > xScriptListener = new DialogScriptListenerImpl
( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, bDialogProviderMode );
if ( xScriptListener.is() )
{
if ( !m_xScriptEventsAttacher.is() ) if ( !m_xScriptEventsAttacher.is() )
m_xScriptEventsAttacher = new DialogEventsAttacherImpl( m_xContext ); m_xScriptEventsAttacher = new DialogEventsAttacherImpl( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
if ( m_xScriptEventsAttacher.is() ) if ( m_xScriptEventsAttacher.is() )
{ {
Any aHelper; Any aHelper;
m_xScriptEventsAttacher->attachEvents( aObjects, xScriptListener, aHelper ); m_xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
}
} }
} }
} }
...@@ -635,7 +643,19 @@ namespace dlgprov ...@@ -635,7 +643,19 @@ namespace dlgprov
Reference< XInterface >() ); Reference< XInterface >() );
} }
} }
else if ( aArguments.getLength() > 1 ) else if ( aArguments.getLength() == 4 )
{
// call from RTL_Impl_CreateUnoDialog
aArguments[0] >>= m_xModel;
m_BasicInfo.reset( new BasicRTLParams() );
m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
// leave the possibility to optionally allow the old dialog creation
// to use the new XScriptListener ( which converts the old style macro
// to a SF url )
m_BasicInfo->mxBasicRTLListener.set( aArguments[ 3 ], UNO_QUERY);
}
else if ( aArguments.getLength() > 4 )
{ {
throw RuntimeException( throw RuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogProviderImpl::initialize: invalid number of arguments!" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogProviderImpl::initialize: invalid number of arguments!" ) ),
...@@ -661,13 +681,20 @@ namespace dlgprov ...@@ -661,13 +681,20 @@ namespace dlgprov
::osl::MutexGuard aGuard( getMutex() ); ::osl::MutexGuard aGuard( getMutex() );
OSL_ENSURE( URL.getLength(), "DialogProviderImpl::getDialog: no URL!" );
// m_xHandler = xHandler; // m_xHandler = xHandler;
//Reference< XDialog > xDialog; //Reference< XDialog > xDialog;
Reference< XControl > xCtrl; Reference< XControl > xCtrl;
Reference< XControlModel > xCtrlMod( createDialogModel( URL ) ); Reference< XControlModel > xCtrlMod;
// add support for basic RTL_FUNCTION
if ( m_BasicInfo.get() )
xCtrlMod = createDialogModelForBasic();
else
{
OSL_ENSURE( URL.getLength(), "DialogProviderImpl::getDialog: no URL!" );
xCtrlMod = createDialogModel( URL );
}
if ( xCtrlMod.is() ) if ( xCtrlMod.is() )
{ {
// i83963 Force decoration // i83963 Force decoration
......
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