coverity#1242433 SdrMakeOutliner alway derefs pMod

so change from a pointer to a reference

Change-Id: I81eb2c9e4df8353fbbdad7058c6ca7ea22286e62
This commit is contained in:
Caolán McNamara 2014-10-29 09:08:21 +00:00
parent 9b8f91d348
commit 836023dedc
15 changed files with 29 additions and 45 deletions

View file

@ -98,7 +98,7 @@ OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & x
DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut, bool bPaintPageForEditMode)
: E3dView(pSdrModel, pOut)
, m_pMarkHandleProvider(NULL)
, m_apOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pSdrModel ) )
, m_apOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel))
, m_bRestoreMapMode( false )
{
SetBufferedOutputAllowed(true);

View file

@ -49,7 +49,7 @@ namespace com { namespace sun { namespace star { namespace lang {
// Ist pMod<>NULL, dann wird der MapMode des uebergebenen
// Models verwendet. Die resultierende Default-Fonthoehe bleibt
// jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rMod);
// Globale Defaulteinstellungen fuer die DrawingEngine.
// Diese Einstellungen sollte man direkt beim Applikationsstart
@ -100,7 +100,7 @@ public:
// Ist pMod<>NULL, dann wird der MapMode des uebergebenen
// Models verwendet. Die resultierende Default-Fonthoehe bleibt
// jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rMod);
};
class SfxItemSet;

View file

@ -27,7 +27,7 @@
SdrOutliner* FuText::MakeOutliner()
{
ScViewData& rViewData = pViewShell->GetViewData();
SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, pDrDoc);
SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *pDrDoc);
rViewData.UpdateOutlinerFlags(*pOutl);

View file

@ -190,7 +190,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
if( pOutlinerParaObject->GetDepth(0) != -1 )
{
SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_TITLEOBJECT, mpDoc );
SdrOutliner* pTempOutl = SdrMakeOutliner(OUTLINERMODE_TITLEOBJECT, *mpDoc);
pTempOutl->SetText( *pOutlinerParaObject );
@ -218,7 +218,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
// create structuring text objects
OutlinerParaObject* pOPO = pOutl->CreateParaObject(++nParaPos, nChildCount);
SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
SdrOutliner* pTempOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpDoc);
pTempOutl->SetText( *pOPO );
sal_Int32 nParaCount2 = pTempOutl->GetParagraphCount();

View file

@ -1038,7 +1038,7 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag)
nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) )
{
// create new outliner (owned by SdrObjEditView)
SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpDoc);
if (bEmptyOutliner)
mpView->SdrEndTextEdit(true);

View file

@ -672,7 +672,7 @@ bool View::SdrBeginTextEdit(
sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
if( pOutl==NULL && pObj )
pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
pOutl = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pObj->GetModel());
// make draw&impress specific initialisations
if( pOutl )
@ -1258,7 +1258,7 @@ bool View::ShouldToggleOn(
return false;
bool bToggleOn = false;
boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel));
boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel));
const size_t nMarkCount = GetMarkedObjectCount();
for (size_t nIndex = 0; nIndex < nMarkCount && !bToggleOn; ++nIndex)
{
@ -1330,7 +1330,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
? false
: ShouldToggleOn( bToggle, bHandleBullets );
boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel));
boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel));
boost::scoped_ptr<OutlinerView> pOutlinerView(new OutlinerView(pOutliner.get(), pWindow));
const size_t nMarkCount = GetMarkedObjectCount();

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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 )

View file

@ -511,7 +511,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
{
SwWrtShell *pSh = &GetWrtShell();
SdrView *pSdrView = pSh->GetDrawView();
SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrView->GetModel());
SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrView->GetModel());
uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() );
if (pOutliner)
{