summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-11 21:52:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-12 11:51:10 +0100
commit3bc03cd0c10a74d929f21e84772416c9ee300c70 (patch)
treecf300a37ba3255a53ef5515f0f4cedcabc7db8c5 /sc
parentfd0e548c4a1528499e95ff169866ed153d08bf54 (diff)
SvtFilterOptions::Get can never be NULL, return ref and don't leak
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/excimp8.cxx8
-rw-r--r--sc/source/filter/excel/expop2.cxx10
-rw-r--r--sc/source/filter/excel/xiescher.cxx16
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx21
4 files changed, 24 insertions, 31 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 801cdc594f10..6ede078c076f 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -328,12 +328,12 @@ void ImportExcel8::ReadBasic( void )
{
SfxObjectShell* pShell = GetDocShell();
SotStorageRef xRootStrg = GetRootStorage();
- SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get();
+ const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
if( pShell && xRootStrg.Is() ) try
{
- bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode();
- bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable();
- bool bLoadStrg = pFilterOpt->IsLoadExcelBasicStorage();
+ bool bLoadCode = rFilterOpt.IsLoadExcelBasicCode();
+ bool bLoadExecutable = rFilterOpt.IsLoadExcelBasicExecutable();
+ bool bLoadStrg = rFilterOpt.IsLoadExcelBasicStorage();
// #FIXME need to get rid of this, we can also do this from within oox
// via the "ooo.vba.VBAGlobals" service
if( bLoadCode || bLoadStrg )
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index 553ab2e28794..f0f4e265d8c8 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -88,11 +88,9 @@ FltError ExportBiff5::Write()
bool bWriteBasicStrg = false;
if( GetBiff() == EXC_BIFF8 )
{
- if( SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get() )
- {
- bWriteBasicCode = pFilterOpt->IsLoadExcelBasicCode();
- bWriteBasicStrg = pFilterOpt->IsLoadExcelBasicStorage();
- }
+ const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
+ bWriteBasicCode = rFilterOpt.IsLoadExcelBasicCode();
+ bWriteBasicStrg = rFilterOpt.IsLoadExcelBasicStorage();
}
if( pDocShell && xRootStrg.Is() && bWriteBasicStrg )
@@ -116,7 +114,7 @@ FltError ExportBiff5::Write()
pDocShell->GetModel(), uno::UNO_QUERY_THROW);
uno::Reference<document::XDocumentProperties> xDocProps
= xDPS->getDocumentProperties();
- if ( SvtFilterOptions::Get()->IsEnableCalcPreview() )
+ if ( SvtFilterOptions::Get().IsEnableCalcPreview() )
{
::boost::shared_ptr<GDIMetaFile> pMetaFile =
pDocShell->GetPreviewMetaFile (false);
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index bc186e039116..396c171bc196 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3161,15 +3161,13 @@ XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffS
maFormCtrlHelper( GetMedium().GetInputStream(), lcl_getUnoCtx(), GetDocShell()->GetModel() ),
mnOleImpFlags( 0 )
{
- if( SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get() )
- {
- if( pFilterOpt->IsMathType2Math() )
- mnOleImpFlags |= OLE_MATHTYPE_2_STARMATH;
- if( pFilterOpt->IsWinWord2Writer() )
- mnOleImpFlags |= OLE_WINWORD_2_STARWRITER;
- if( pFilterOpt->IsPowerPoint2Impress() )
- mnOleImpFlags |= OLE_POWERPOINT_2_STARIMPRESS;
- }
+ const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
+ if( rFilterOpt.IsMathType2Math() )
+ mnOleImpFlags |= OLE_MATHTYPE_2_STARMATH;
+ if( rFilterOpt.IsWinWord2Writer() )
+ mnOleImpFlags |= OLE_WINWORD_2_STARWRITER;
+ if( rFilterOpt.IsPowerPoint2Impress() )
+ mnOleImpFlags |= OLE_POWERPOINT_2_STARIMPRESS;
// try to open the 'Ctls' storage stream containing OCX control properties
mxCtlsStrm = OpenStream( EXC_STREAM_CTLS );
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 17b9946d60db..00f0b63fe273 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -853,21 +853,18 @@ void XclObjOle::WriteSubRecs( XclExpStream& rStrm )
// set version to "old" version, because it must be
// saved in MS notation.
sal_uInt32 nFl = 0;
- SvtFilterOptions* pFltOpts = SvtFilterOptions::Get();
- if( pFltOpts )
- {
- if( pFltOpts->IsMath2MathType() )
- nFl |= OLE_STARMATH_2_MATHTYPE;
+ const SvtFilterOptions& rFltOpts = SvtFilterOptions::Get();
+ if( rFltOpts.IsMath2MathType() )
+ nFl |= OLE_STARMATH_2_MATHTYPE;
- if( pFltOpts->IsWriter2WinWord() )
- nFl |= OLE_STARWRITER_2_WINWORD;
+ if( rFltOpts.IsWriter2WinWord() )
+ nFl |= OLE_STARWRITER_2_WINWORD;
- if( pFltOpts->IsCalc2Excel() )
- nFl |= OLE_STARCALC_2_EXCEL;
+ if( rFltOpts.IsCalc2Excel() )
+ nFl |= OLE_STARCALC_2_EXCEL;
- if( pFltOpts->IsImpress2PowerPoint() )
- nFl |= OLE_STARIMPRESS_2_POWERPOINT;
- }
+ if( rFltOpts.IsImpress2PowerPoint() )
+ nFl |= OLE_STARIMPRESS_2_POWERPOINT;
SvxMSExportOLEObjects aOLEExpFilt( nFl );
aOLEExpFilt.ExportOLEObject( xObj, *xOleStg );