diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-11 21:52:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-12 11:51:10 +0100 |
commit | 3bc03cd0c10a74d929f21e84772416c9ee300c70 (patch) | |
tree | cf300a37ba3255a53ef5515f0f4cedcabc7db8c5 /sd | |
parent | fd0e548c4a1528499e95ff169866ed153d08bf54 (diff) |
SvtFilterOptions::Get can never be NULL, return ref and don't leak
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 25 | ||||
-rw-r--r-- | sd/source/filter/sdpptwrp.cxx | 29 |
2 files changed, 24 insertions, 30 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index c2a7ea4d4006..bae84f0f735b 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -217,20 +217,17 @@ ImplSdPPTImport::ImplSdPPTImport( SdDrawDocument* pDocument, SvStorage& rStorage } sal_uInt32 nSvxMSDffOLEConvFlags2 = 0; - SvtFilterOptions* pBasOpt = SvtFilterOptions::Get(); - if ( pBasOpt ) - { - if ( pBasOpt->IsLoadPPointBasicCode() ) - mnFilterOptions |= 1; - if ( pBasOpt->IsMathType2Math() ) - nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH; - if ( pBasOpt->IsWinWord2Writer() ) - nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER; - if ( pBasOpt->IsExcel2Calc() ) - nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC; - if ( pBasOpt->IsPowerPoint2Impress() ) - nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS; - } + const SvtFilterOptions& rBasOpt = SvtFilterOptions::Get(); + if ( rBasOpt.IsLoadPPointBasicCode() ) + mnFilterOptions |= 1; + if ( rBasOpt.IsMathType2Math() ) + nSvxMSDffOLEConvFlags2 |= OLE_MATHTYPE_2_STARMATH; + if ( rBasOpt.IsWinWord2Writer() ) + nSvxMSDffOLEConvFlags2 |= OLE_WINWORD_2_STARWRITER; + if ( rBasOpt.IsExcel2Calc() ) + nSvxMSDffOLEConvFlags2 |= OLE_EXCEL_2_STARCALC; + if ( rBasOpt.IsPowerPoint2Impress() ) + nSvxMSDffOLEConvFlags2 |= OLE_POWERPOINT_2_STARIMPRESS; InitSvxMSDffManager( nDggContainerOfs, pStData, nSvxMSDffOLEConvFlags2 ); SetSvxMSDffSettings( SVXMSDFF_SETTINGS_CROP_BITMAPS diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index c87de890363c..62ddab21eea7 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -149,20 +149,17 @@ sal_Bool SdPPTFilter::Export() if( PPTExport && xStorRef.Is() ) { sal_uInt32 nCnvrtFlags = 0; - SvtFilterOptions* pFilterOptions = SvtFilterOptions::Get(); - if ( pFilterOptions ) - { - if ( pFilterOptions->IsMath2MathType() ) - nCnvrtFlags |= OLE_STARMATH_2_MATHTYPE; - if ( pFilterOptions->IsWriter2WinWord() ) - nCnvrtFlags |= OLE_STARWRITER_2_WINWORD; - if ( pFilterOptions->IsCalc2Excel() ) - nCnvrtFlags |= OLE_STARCALC_2_EXCEL; - if ( pFilterOptions->IsImpress2PowerPoint() ) - nCnvrtFlags |= OLE_STARIMPRESS_2_POWERPOINT; - if ( pFilterOptions->IsEnablePPTPreview() ) - nCnvrtFlags |= 0x8000; - } + const SvtFilterOptions& rFilterOptions = SvtFilterOptions::Get(); + if ( rFilterOptions.IsMath2MathType() ) + nCnvrtFlags |= OLE_STARMATH_2_MATHTYPE; + if ( rFilterOptions.IsWriter2WinWord() ) + nCnvrtFlags |= OLE_STARWRITER_2_WINWORD; + if ( rFilterOptions.IsCalc2Excel() ) + nCnvrtFlags |= OLE_STARCALC_2_EXCEL; + if ( rFilterOptions.IsImpress2PowerPoint() ) + nCnvrtFlags |= OLE_STARIMPRESS_2_POWERPOINT; + if ( rFilterOptions.IsEnablePPTPreview() ) + nCnvrtFlags |= 0x8000; mrDocument.SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); @@ -180,8 +177,8 @@ sal_Bool SdPPTFilter::Export() void SdPPTFilter::PreSaveBasic() { - SvtFilterOptions* pFilterOptions = SvtFilterOptions::Get(); - if( pFilterOptions && pFilterOptions->IsLoadPPointBasicStorage() ) + const SvtFilterOptions& rFilterOptions = SvtFilterOptions::Get(); + if( rFilterOptions.IsLoadPPointBasicStorage() ) { ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() ); if( pLibrary ) |