diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-07 15:54:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-08 08:48:28 +0200 |
commit | 66d0815d790918b35dd413b64c467dc168d720bb (patch) | |
tree | fc2f90921af7e6d03094267fa8a7861eb5734cf8 /sc/source/filter/excel/excimp8.cxx | |
parent | 37c3da6d2c453448952783ef9437f12469edc316 (diff) |
loplugin:flatten in sc/filter/excel
Change-Id: I48ab5b20a3345cd40d4715c3ff025d2df3b491fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/excel/excimp8.cxx')
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 91f01290c154..0fef106161be 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -320,7 +320,10 @@ void ImportExcel8::ReadBasic() SfxObjectShell* pShell = GetDocShell(); tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get(); - if( pShell && xRootStrg.is() ) try + if( !pShell || !xRootStrg.is() ) + return; + + try { // #FIXME need to get rid of this, we can also do this from within oox // via the "ooo.vba.VBAGlobals" service @@ -357,7 +360,7 @@ void ImportExcel8::ReadBasic() aVbaPrj.setOleOverridesSink( xOleNameOverrideSink ); aVbaPrj.importVbaProject( *vbaStg ); GetObjectManager().SetOleNameOverrideInfo( xOleNameOverrideSink ); - } + } } catch( uno::Exception& ) { @@ -401,19 +404,20 @@ void ImportExcel8::PostDocLoad() } // read doc info (no docshell while pasting from clipboard) - if( SfxObjectShell* pShell = GetDocShell() ) + SfxObjectShell* pShell = GetDocShell(); + if(!pShell) + return; + + // BIFF5+ without storage is possible + tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + if( xRootStrg.is() ) try + { + uno::Reference< document::XDocumentPropertiesSupplier > xDPS( pShell->GetModel(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProps( xDPS->getDocumentProperties(), uno::UNO_SET_THROW ); + sfx2::LoadOlePropertySet( xDocProps, xRootStrg.get() ); + } + catch( uno::Exception& ) { - // BIFF5+ without storage is possible - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); - if( xRootStrg.is() ) try - { - uno::Reference< document::XDocumentPropertiesSupplier > xDPS( pShell->GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< document::XDocumentProperties > xDocProps( xDPS->getDocumentProperties(), uno::UNO_SET_THROW ); - sfx2::LoadOlePropertySet( xDocProps, xRootStrg.get() ); - } - catch( uno::Exception& ) - { - } } // #i45843# Pivot tables are now handled outside of PostDocLoad, so they are available @@ -496,21 +500,21 @@ void XclImpAutoFilterData::SetCellAttribs() void XclImpAutoFilterData::InsertQueryParam() { - if (pCurrDBData) - { - ScRange aAdvRange; - bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange ); - if( bHasAdv ) - pExcRoot->pIR->GetDoc().CreateQueryParam(aAdvRange, aParam); + if (!pCurrDBData) + return; - pCurrDBData->SetQueryParam( aParam ); - if( bHasAdv ) - pCurrDBData->SetAdvancedQuerySource( &aAdvRange ); - else - { - pCurrDBData->SetAutoFilter( true ); - SetCellAttribs(); - } + ScRange aAdvRange; + bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange ); + if( bHasAdv ) + pExcRoot->pIR->GetDoc().CreateQueryParam(aAdvRange, aParam); + + pCurrDBData->SetQueryParam( aParam ); + if( bHasAdv ) + pCurrDBData->SetAdvancedQuerySource( &aAdvRange ); + else + { + pCurrDBData->SetAutoFilter( true ); + SetCellAttribs(); } } |