Kaydet (Commit) 9476ecb7 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:collapseif in sd

Change-Id: I0751c9d3f379a3621bdc7ccce6a0d58c701a0261
Reviewed-on: https://gerrit.libreoffice.org/62955
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 83241dba
......@@ -2104,15 +2104,12 @@ static SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourc
OUString aName( rPage.GetLayoutName() + " " + OUString::number( nLevel ) );
SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>( rModel.GetStyleSheetPool()->Find(aName, SfxStyleFamily::Page) );
if (pSheet)
if (pSheet && nLevel == 1)
{
if (nLevel == 1)
{
SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
SfxStyleSheet* pSubtitleSheet = rPage.GetStyleSheetForPresObj(PRESOBJ_TEXT);
if (pSubtitleSheet)
pOutlParaObj->ChangeStyleSheetName(SfxStyleFamily::Page, pSubtitleSheet->GetName(), pSheet->GetName());
}
if (pSubtitleSheet)
pOutlParaObj->ChangeStyleSheetName(SfxStyleFamily::Page, pSubtitleSheet->GetName(), pSheet->GetName());
}
}
......
......@@ -1207,27 +1207,24 @@ void AnimationImporter::importAnimateAttributeTargetContainer( const Atom* pAtom
// nAccumulate 0 = none, 1 = always
// nTransformType 0: "property" else "image"
if( nBits & 3 )
if( nBits & 3 && xAnimate.is() )
{
if( xAnimate.is() )
if( nBits & 1 )
{
if( nBits & 1 )
sal_Int16 nTemp = AnimationAdditiveMode::BASE;
switch( nAdditive )
{
sal_Int16 nTemp = AnimationAdditiveMode::BASE;
switch( nAdditive )
{
case 1: nTemp = AnimationAdditiveMode::SUM; break;
case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
case 4: nTemp = AnimationAdditiveMode::NONE; break;
}
xAnimate->setAdditive( nTemp );
case 1: nTemp = AnimationAdditiveMode::SUM; break;
case 2: nTemp = AnimationAdditiveMode::REPLACE; break;
case 3: nTemp = AnimationAdditiveMode::MULTIPLY; break;
case 4: nTemp = AnimationAdditiveMode::NONE; break;
}
xAnimate->setAdditive( nTemp );
}
if( nBits & 2 )
{
xAnimate->setAccumulate( nAccumulate == 0 );
}
if( nBits & 2 )
{
xAnimate->setAccumulate( nAccumulate == 0 );
}
}
#ifdef DBG_ANIM_LOG
......
......@@ -837,27 +837,24 @@ bool MotionPathTag::getContext( SdrViewContext& rContext )
void MotionPathTag::CheckPossibilities()
{
if( mpPathObj )
if( mpPathObj && isSelected() )
{
if( isSelected() )
{
mrView.SetMoveAllowed( true );
mrView.SetMoveProtected( false );
mrView.SetResizeFreeAllowed( true );
mrView.SetResizePropAllowed( true );
mrView.SetResizeProtected( false );
mrView.SetMoveAllowed( true );
mrView.SetMoveProtected( false );
mrView.SetResizeFreeAllowed( true );
mrView.SetResizePropAllowed( true );
mrView.SetResizeProtected( false );
if( !mrView.IsFrameDragSingles() )
{
bool b1stSmooth(true);
bool b1stSegm(true);
bool bCurve(false);
bool bSmoothFuz(false);
bool bSegmFuz(false);
basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
}
if( !mrView.IsFrameDragSingles() )
{
bool b1stSmooth(true);
bool b1stSegm(true);
bool bCurve(false);
bool bSmoothFuz(false);
bool bSegmFuz(false);
basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
}
}
}
......
......@@ -522,9 +522,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
// Point IS marked and NO shift is pressed. Start
// dragging of selected point(s)
pHdl = mpView->PickHandle(aMDPos);
if(pHdl)
if ( ! rMEvt.IsRight())
mpView->BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
if(pHdl && ! rMEvt.IsRight())
mpView->BegDragObj(aMDPos, nullptr, pHdl, nDrgLog);
}
}
else
......@@ -683,14 +682,11 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
**************************************************************/
SdrPageView* pPV;
SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
if (pObj)
if (pObj && pPV->IsObjMarkable(pObj))
{
if (pPV->IsObjMarkable(pObj))
{
mpView->UnmarkAllObj();
mpView->MarkObj(pObj,pPV);
return true;
}
mpView->UnmarkAllObj();
mpView->MarkObj(pObj,pPV);
return true;
}
/**************************************************************
* Toggle between selection and rotation
......
......@@ -669,14 +669,11 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
**************************************************************/
SdrPageView* pPV;
SdrObject* pObj = mpView->PickObj(aMDPos, mpView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK);
if (pObj)
if (pObj && pPV->IsObjMarkable(pObj))
{
if (pPV->IsObjMarkable(pObj))
{
mpView->UnmarkAllObj();
mpView->MarkObj(pObj,pPV);
return bReturn;
}
mpView->UnmarkAllObj();
mpView->MarkObj(pObj,pPV);
return bReturn;
}
}
}
......
......@@ -191,11 +191,8 @@ void InsertAnimator::Implementation::SetInsertPosition (
// When the new insert position is in a different run then move the page
// objects in the old run to their default positions.
if (pOldRun != pCurrentRun)
{
if (pOldRun)
pOldRun->ResetOffsets(eMode);
}
if (pOldRun != pCurrentRun && pOldRun)
pOldRun->ResetOffsets(eMode);
if (pCurrentRun)
{
......
......@@ -3041,11 +3041,8 @@ void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape )
if( pShape )
{
SdrObject* pObj = pShape->GetSdrObject();
if( pObj )
{
if( GetPage()->IsPresObj( pObj ) )
GetPage()->RemovePresObj(pObj);
}
if( pObj && GetPage()->IsPresObj( pObj ) )
GetPage()->RemovePresObj(pObj);
}
SdGenericDrawPage::remove( xShape );
......
......@@ -1196,11 +1196,8 @@ public:
}
}
if (bIsValueChanged)
{
if ( ! mpOptions )
mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
}
if (bIsValueChanged && ! mpOptions )
mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
if( bIsValueChanged || bIsPaperChanged )
PreparePages();
}
......
......@@ -842,19 +842,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
if (pArgs)
if (pArgs->Count () == 3)
{
const SfxUInt32Item* pWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEWIDTH);
const SfxUInt32Item* pHeight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEHEIGHT);
const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
if (pArgs && pArgs->Count () == 3)
{
const SfxUInt32Item* pWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEWIDTH);
const SfxUInt32Item* pHeight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEHEIGHT);
const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
Size aSize (pWidth->GetValue (), pHeight->GetValue ());
Size aSize (pWidth->GetValue (), pHeight->GetValue ());
SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
SetupPage (aSize, 0, 0, 0, 0, true, false, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
......@@ -866,23 +865,22 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
const SfxItemSet *pArgs = rReq.GetArgs ();
if (pArgs)
if (pArgs->Count () == 5)
{
const SfxUInt32Item* pLeft = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGELEFT);
const SfxUInt32Item* pRight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGERIGHT);
const SfxUInt32Item* pUpper = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGETOP);
const SfxUInt32Item* pLower = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEBOTTOM);
const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
if (pArgs && pArgs->Count () == 5)
{
const SfxUInt32Item* pLeft = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGELEFT);
const SfxUInt32Item* pRight = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGERIGHT);
const SfxUInt32Item* pUpper = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGETOP);
const SfxUInt32Item* pLower = rReq.GetArg<SfxUInt32Item>(ID_VAL_PAGEBOTTOM);
const SfxBoolItem* pScaleAll = rReq.GetArg<SfxBoolItem>(ID_VAL_SCALEOBJECTS);
Size aEmptySize (0, 0);
Size aEmptySize (0, 0);
SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
pUpper->GetValue (), pLower->GetValue (),
false, true, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
SetupPage (aEmptySize, pLeft->GetValue (), pRight->GetValue (),
pUpper->GetValue (), pLower->GetValue (),
false, true, pScaleAll->GetValue ());
rReq.Ignore ();
break;
}
#if HAVE_FEATURE_SCRIPTING
StarBASIC::FatalError (ERRCODE_BASIC_WRONG_ARGS);
#endif
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment