diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-29 09:08:21 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-29 10:40:08 +0000 |
commit | 836023dedc36cbfe946c42d629ece34174c6bd2b (patch) | |
tree | 4348c53ae2e8e3af5cc3f50264ecad1703bbb1ad /svx | |
parent | 9b8f91d348a51b0f0cd1bedb5168c2ca0888505a (diff) |
coverity#1242433 SdrMakeOutliner alway derefs pMod
so change from a pointer to a reference
Change-Id: I81eb2c9e4df8353fbbdad7058c6ca7ea22286e62
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sdr/properties/textproperties.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdetc.cxx | 32 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdoutlinercache.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdtext.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/tablecontroller.cxx | 6 | ||||
-rw-r--r-- | svx/source/table/tablertfimporter.cxx | 2 |
8 files changed, 18 insertions, 34 deletions
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index d28b38822e14..96552fd6aa0d 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -405,7 +405,7 @@ namespace sdr && !rObj.IsTextEditActive() && !rObj.IsLinkedText()) { - Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel()); + Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *rObj.GetModel()); const svx::ITextProvider& rTextProvider(getTextProvider()); sal_Int32 nText = rTextProvider.getTextCount(); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 00e51b058b44..4568e1696421 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -602,7 +602,7 @@ bool SdrObjEditView::SdrBeginTextEdit( mxTextEditObj.reset( pObj ); pTextEditOutliner=pGivenOutliner; if (pTextEditOutliner==NULL) - pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, mxTextEditObj->GetModel() ); + pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, *mxTextEditObj->GetModel() ); { SvtAccessibilityOptions aOptions; diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx index b9bdbf07e6b3..32eb75aebca3 100644 --- a/svx/source/svdraw/svdetc.cxx +++ b/svx/source/svdraw/svdetc.cxx @@ -386,8 +386,6 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol) return bRetval; } - - SdrEngineDefaults::SdrEngineDefaults(): aFontName( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ).GetName() ), eFontFamily(FAMILY_ROMAN), @@ -407,26 +405,20 @@ SdrEngineDefaults& SdrEngineDefaults::GetDefaults() return *rGlobalData.pDefaults; } - - -SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pModel ) +SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rModel) { - SfxItemPool* pPool = &pModel->GetItemPool(); + SfxItemPool* pPool = &rModel.GetItemPool(); SdrOutliner* pOutl = new SdrOutliner( pPool, nOutlinerMode ); pOutl->SetEditTextObjectPool( pPool ); - pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>( pModel->GetStyleSheetPool() ) ); - pOutl->SetDefTab( pModel->GetDefaultTabulator() ); - pOutl->SetForbiddenCharsTable( pModel->GetForbiddenCharsTable() ); - pOutl->SetAsianCompressionMode( pModel->GetCharCompressType() ); - pOutl->SetKernAsianPunctuation( pModel->IsKernAsianPunctuation() ); - pOutl->SetAddExtLeading( pModel->IsAddExtLeading() ); - + pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(rModel.GetStyleSheetPool())); + pOutl->SetDefTab(rModel.GetDefaultTabulator()); + pOutl->SetForbiddenCharsTable(rModel.GetForbiddenCharsTable()); + pOutl->SetAsianCompressionMode(rModel.GetCharCompressType()); + pOutl->SetKernAsianPunctuation(rModel.IsKernAsianPunctuation()); + pOutl->SetAddExtLeading(rModel.IsAddExtLeading()); return pOutl; } - - - SdrLinkList& ImpGetUserMakeObjHdl() { SdrGlobalData& rGlobalData=GetSdrGlobalData(); @@ -439,8 +431,6 @@ SdrLinkList& ImpGetUserMakeObjUserDataHdl() return rGlobalData.aUserMakeObjUserDataHdl; } - - ResMgr* ImpGetResMgr() { SdrGlobalData& rGlobalData = GetSdrGlobalData(); @@ -454,15 +444,11 @@ ResMgr* ImpGetResMgr() return rGlobalData.pResMgr; } - - OUString ImpGetResStr(sal_uInt16 nResID) { return ResId(nResID, *ImpGetResMgr()).toString(); } - - namespace sdr { OUString GetResourceString(sal_uInt16 nResID) @@ -471,8 +457,6 @@ namespace sdr } } - - bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE) { bool bHas=false; diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index f06d66700b63..a2974b117958 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -208,10 +208,10 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe // can't create DrawOutliner OnDemand, because I can't get the Pool, // then (only from 302 onwards!) - pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); + pDrawOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *this); ImpSetOutlinerDefaults(pDrawOutliner, true); - pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); + pHitTestOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *this); ImpSetOutlinerDefaults(pHitTestOutliner, true); ImpCreateTables(); diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx index c85266837534..3c733ef96ed7 100644 --- a/svx/source/svdraw/svdoutlinercache.cxx +++ b/svx/source/svdraw/svdoutlinercache.cxx @@ -45,7 +45,7 @@ SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode ) } else { - pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel ); + pOutliner = SdrMakeOutliner(nOutlinerMode, *mpModel); Outliner& aDrawOutliner = mpModel->GetDrawOutliner(); pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() ); maActiveOutliners.push_back(pOutliner); diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx index ed99ae31008f..5563bf333134 100644 --- a/svx/source/svdraw/svdtext.cxx +++ b/svx/source/svdraw/svdtext.cxx @@ -173,7 +173,7 @@ void SdrText::ForceOutlinerParaObject( sal_uInt16 nOutlMode ) { if( mpModel && !mpOutlinerParaObject ) { - boost::scoped_ptr<Outliner> pOutliner(SdrMakeOutliner( nOutlMode, mpModel )); + boost::scoped_ptr<Outliner> pOutliner(SdrMakeOutliner(nOutlMode, *mpModel)); if( pOutliner ) { Outliner& aDrawOutliner = mpModel->GetDrawOutliner(); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 13699d485483..3ef0370b00ef 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -1825,11 +1825,11 @@ void SvxTableController::EditCell( const CellPos& rPos, vcl::Window* pWindow, co pTableObj->setActiveCell( aPos ); // create new outliner, owner will be the SdrObjEditView - SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpModel ); - if( pTableObj->IsVerticalWriting() ) + SdrOutliner* pOutl = mpModel ? SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpModel) : NULL; + if (pOutl && pTableObj->IsVerticalWriting()) pOutl->SetVertical( true ); - if(mpView->SdrBeginTextEdit(pTableObj, pPV, pWindow, true, pOutl)) + if (mpView->SdrBeginTextEdit(pTableObj, pPV, pWindow, true, pOutl)) { maCursorLastPos = maCursorFirstPos = rPos; diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index fe7bf94abb25..caf0570e2306 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -127,7 +127,7 @@ private: SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj ) : mrTableObj( rTableObj ) -, mpOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, rTableObj.GetModel() ) ) +, mpOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, *rTableObj.GetModel() ) ) , mrItemPool( rTableObj.GetModel()->GetItemPool() ) , mnLastToken( 0 ) , mbNewDef( false ) |