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

coverity#1158398 Uncaught exception

Change-Id: I943b6233554d91e1a14f545e30f95528ca592924
üst b0bd6e9e
...@@ -420,45 +420,51 @@ SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XM ...@@ -420,45 +420,51 @@ SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XM
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const
{ {
const OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", OUString() ); try
const OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", OUString() );
const OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", OUString() );
const OUString sURL = io_rDescriptor.getOrDefault( "URL", OUString() );
// determine the full URL of the template to use, if any
OUString sTemplateURL;
if ( !sTemplateRegioName.isEmpty() && !sTemplateName.isEmpty() )
{
SfxDocumentTemplates aTmpFac;
aTmpFac.GetFull( sTemplateRegioName, sTemplateName, sTemplateURL );
}
else
{ {
if ( !sServiceName.isEmpty() ) const OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", OUString() );
sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); const OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", OUString() );
const OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", OUString() );
const OUString sURL = io_rDescriptor.getOrDefault( "URL", OUString() );
// determine the full URL of the template to use, if any
OUString sTemplateURL;
if ( !sTemplateRegioName.isEmpty() && !sTemplateName.isEmpty() )
{
SfxDocumentTemplates aTmpFac;
aTmpFac.GetFull( sTemplateRegioName, sTemplateName, sTemplateURL );
}
else else
sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); {
} if ( !sServiceName.isEmpty() )
sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName );
else
sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) );
}
if ( !sTemplateURL.isEmpty() ) if ( !sTemplateURL.isEmpty() )
{
// detect the filter for the template. Might still be NULL (if the template is broken, or does not
// exist, or some such), but this is handled by our caller the same way as if no template/URL was present.
const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SFX_APP()->GetFilterMatcher() );
if ( pTemplateFilter )
{ {
// load the template document, but, well, "as template" // detect the filter for the template. Might still be NULL (if the template is broken, or does not
io_rDescriptor.put( "FilterName", OUString( pTemplateFilter->GetName() ) ); // exist, or some such), but this is handled by our caller the same way as if no template/URL was present.
io_rDescriptor.put( "FileName", OUString( sTemplateURL ) ); const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SFX_APP()->GetFilterMatcher() );
io_rDescriptor.put( "AsTemplate", sal_True ); if ( pTemplateFilter )
{
// #i21583# // load the template document, but, well, "as template"
// the DocumentService property will finally be used to create the document. Thus, override any possibly io_rDescriptor.put( "FilterName", OUString( pTemplateFilter->GetName() ) );
// present value with the document service of the template. io_rDescriptor.put( "FileName", OUString( sTemplateURL ) );
io_rDescriptor.put( "DocumentService", OUString( pTemplateFilter->GetServiceName() ) ); io_rDescriptor.put( "AsTemplate", sal_True );
return true;
// #i21583#
// the DocumentService property will finally be used to create the document. Thus, override any possibly
// present value with the document service of the template.
io_rDescriptor.put( "DocumentService", OUString( pTemplateFilter->GetServiceName() ) );
return true;
}
} }
} }
catch (...)
{
}
return false; return false;
} }
......
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