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 /sw | |
parent | fd0e548c4a1528499e95ff169866ed153d08bf54 (diff) |
SvtFilterOptions::Get can never be NULL, return ref and don't leak
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 32 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/app/docsh.cxx | 6 |
5 files changed, 31 insertions, 35 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 8a4f4b86649c..9dac88544b93 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2907,14 +2907,14 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) if ( !pOLEExp ) { sal_uInt32 nSvxMSDffOLEConvFlags = 0; - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - if ( pOpt->IsMath2MathType() ) + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + if ( rOpt.IsMath2MathType() ) nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE; - if ( pOpt->IsWriter2WinWord() ) + if ( rOpt.IsWriter2WinWord() ) nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD; - if ( pOpt->IsCalc2Excel() ) + if ( rOpt.IsCalc2Excel() ) nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL; - if ( pOpt->IsImpress2PowerPoint() ) + if ( rOpt.IsImpress2PowerPoint() ) nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT; pOLEExp = new SvxMSExportOLEObjects( nSvxMSDffOLEConvFlags ); @@ -3276,7 +3276,7 @@ void WW8Export::PrepareStorage() if (xDocProps.is()) { - if ( SvtFilterOptions::Get()->IsEnableWordPreview() ) + if ( SvtFilterOptions::Get().IsEnableWordPreview() ) { ::boost::shared_ptr<GDIMetaFile> pMetaFile = pDocShell->GetPreviewMetaFile (sal_False); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 2ce7503130ff..663d80b7d38d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -349,17 +349,15 @@ SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr ) sal_uInt32 SwMSDffManager::GetFilterFlags() { sal_uInt32 nFlags(0); - if (const SvtFilterOptions* pOpt = SvtFilterOptions::Get()) - { - if (pOpt->IsMathType2Math()) - nFlags |= OLE_MATHTYPE_2_STARMATH; - if (pOpt->IsExcel2Calc()) - nFlags |= OLE_EXCEL_2_STARCALC; - if (pOpt->IsPowerPoint2Impress()) - nFlags |= OLE_POWERPOINT_2_STARIMPRESS; - if (pOpt->IsWinWord2Writer()) - nFlags |= OLE_WINWORD_2_STARWRITER; - } + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + if (rOpt.IsMathType2Math()) + nFlags |= OLE_MATHTYPE_2_STARMATH; + if (rOpt.IsExcel2Calc()) + nFlags |= OLE_EXCEL_2_STARCALC; + if (rOpt.IsPowerPoint2Impress()) + nFlags |= OLE_POWERPOINT_2_STARIMPRESS; + if (rOpt.IsWinWord2Writer()) + nFlags |= OLE_WINWORD_2_STARWRITER; return nFlags; } @@ -1643,11 +1641,9 @@ void SwWW8ImplReader::ImportDop() mpDocShell->SetModifyPasswordHash(pWDop->lKeyProtDoc); - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); - if (bUseEnhFields) { - rDoc.set(IDocumentSettingAccess::PROTECT_FORM, pWDop->fProtEnabled ); - } + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + if (rOpt.IsUseEnhancedFields()) + rDoc.set(IDocumentSettingAccess::PROTECT_FORM, pWDop->fProtEnabled ); maTracer.LeaveEnvironment(sw::log::eDocumentProperties); } @@ -3897,8 +3893,8 @@ bool wwSectionManager::IsNewDoc() const void wwSectionManager::InsertSegments() { - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields(); mySegIter aEnd = maSegments.end(); mySegIter aStart = maSegments.begin(); for (mySegIter aIter = aStart; aIter != aEnd; ++aIter) diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 1f3be72f6047..cd278c5889d1 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -133,8 +133,8 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, String& rStr ) text. */ - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields(); if (!bUseEnhFields) { aFormula.sDefault = GetFieldResult(pF); @@ -188,8 +188,8 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) if (0x01 == rStr.GetChar(writer_cast<xub_StrLen>(pF->nLCode-1))) ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_CHECKBOX); - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields(); if (!bUseEnhFields) { pFormImpl->InsertFormula(aFormula); @@ -245,8 +245,8 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, String& rStr) if (0x01 == rStr.GetChar(writer_cast<xub_StrLen>(pF->nLCode-1))) ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_DROPDOWN); - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + const SvtFilterOptions& rOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields(); if (!bUseEnhFields) { diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 0b654ae2efdf..9c87f1a5268d 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -677,8 +677,8 @@ sal_uInt16 SwWW8ImplReader::End_Field() if (!pF || !pF->EndPosIsFieldEnd()) return nRet; - const SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); + const SvtFilterOptions &rOpt = SvtFilterOptions::Get(); + sal_Bool bUseEnhFields = rOpt.IsUseEnhancedFields(); OSL_ENSURE(!maFieldStack.empty(), "Empty field stack\n"); if (!maFieldStack.empty()) diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index cd1b81d58c40..0b3bec5c2fb3 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -345,7 +345,7 @@ sal_Bool SwDocShell::Save() { if( pDoc->ContainsMSVBasic() ) { - if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) + if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) ); pDoc->SetContainsMSVBasic( sal_False ); } @@ -465,7 +465,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) if( pDoc->ContainsMSVBasic() ) { - if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) + if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this ); pDoc->SetContainsMSVBasic( sal_False ); } @@ -559,7 +559,7 @@ sal_Bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if( pDoc->ContainsMSVBasic() ) { sal_Bool bSave = pFlt->GetUserData().EqualsAscii( "CWW8" ) - && SvtFilterOptions::Get()->IsLoadWordBasicStorage(); + && SvtFilterOptions::Get().IsLoadWordBasicStorage(); if ( bSave ) { |