diff options
author | Noel Grandin <noel@peralex.com> | 2016-10-18 16:25:23 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-10-19 10:01:45 +0200 |
commit | f1693c5387833a6fc6ad87dedb3ebb5d3d8de852 (patch) | |
tree | 83dd1f351fcdab4250f600c4bdee5d0eab3d0f53 /sd | |
parent | 10cfa2abeec568d72fc1f6c110316e3be5336132 (diff) |
use early returns in View::OnEndPasteOrDrop
Change-Id: I37afbd64c4f4887aa6a0262ffc362ec8714cbf91
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/sdview.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index a4ed14783879..014a67d1fa3e 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1207,24 +1207,25 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) /* Style Sheet handling */ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( GetTextEditObject() ); SdrOutliner* pOutliner = GetTextEditOutliner(); - if( pOutliner && pTextObj && pTextObj->GetPage() ) + if( !pOutliner || !pTextObj || !pTextObj->GetPage() ) + return; + + SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() ); + const PresObjKind eKind = pPage->GetPresObjKind(pTextObj); + + // outline kinds are taken care of in Outliner::ImplSetLevelDependendStyleSheet + if( eKind == PRESOBJ_OUTLINE ) + return; + + SfxStyleSheet* pStyleSheet = nullptr; + if( eKind != PRESOBJ_NONE ) + pStyleSheet = pPage->GetStyleSheetForPresObj(eKind); + else + pStyleSheet = pTextObj->GetStyleSheet(); + // just put the object style on each new paragraph + for ( sal_Int32 nPara = pInfo->nStartPara; nPara <= pInfo->nEndPara; nPara++ ) { - SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() ); - const PresObjKind eKind = pPage->GetPresObjKind(pTextObj); - // outline kinds are taken care of in Outliner::ImplSetLevelDependendStyleSheet - if( eKind != PRESOBJ_OUTLINE ) - { - SfxStyleSheet* pStyleSheet = nullptr; - if( eKind != PRESOBJ_NONE ) - pStyleSheet = pPage->GetStyleSheetForPresObj(eKind); - else - pStyleSheet = pTextObj->GetStyleSheet(); - // just put the object style on each new paragraph - for ( sal_Int32 nPara = pInfo->nStartPara; nPara <= pInfo->nEndPara; nPara++ ) - { - pOutliner->SetStyleSheet( nPara, pStyleSheet ); - } - } + pOutliner->SetStyleSheet( nPara, pStyleSheet ); } } |