loplugin:flatten in sd

Change-Id: I57cf26d800d8d414014b88c250ee1cbd47551bc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100007
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-08-03 15:52:33 +02:00
parent ece7781530
commit 186c34af5d
11 changed files with 543 additions and 544 deletions

View File

@@ -916,8 +916,9 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xShape )
{
std::unique_ptr<weld::TreeIter> xEntry = pTreeList->make_iterator();
if (pTreeList->get_iter_first(*xEntry))
{
if (!pTreeList->get_iter_first(*xEntry))
return;
do
{
CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry).toInt64());
@@ -929,7 +930,6 @@ static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xS
}
} while (pTreeList->iter_next(*xEntry));
}
}
void CustomAnimationList::onSelectionChanged(const Any& rSelection)
{

View File

@@ -141,8 +141,9 @@ SdTransferable::~SdTransferable()
void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
{
if( pObj )
{
if( !pObj )
return;
mpOLEDataHelper.reset();
mpGraphic.reset();
mpBookmark.reset();
@@ -236,7 +237,6 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
if( pInfo )
mpImageMap.reset( new ImageMap( pInfo->GetImageMap() ) );
}
}
void SdTransferable::CreateData()
{
@@ -301,10 +301,11 @@ void SdTransferable::CreateData()
}
// set VisArea and adjust objects if necessary
if( maVisArea.IsEmpty() &&
if( !(maVisArea.IsEmpty() &&
mpSdDrawDocumentIntern && mpSdViewIntern &&
mpSdDrawDocumentIntern->GetPageCount() )
{
mpSdDrawDocumentIntern->GetPageCount()) )
return;
SdPage* pPage = mpSdDrawDocumentIntern->GetSdPage( 0, PageKind::Standard );
if( 1 == mpSdDrawDocumentIntern->GetPageCount() )
@@ -327,7 +328,6 @@ void SdTransferable::CreateData()
// output is at the zero point
maVisArea.SetPos( Point() );
}
}
static bool lcl_HasOnlyControls( SdrModel* pModel )
{
@@ -375,8 +375,9 @@ static bool lcl_HasOnlyOneTable( SdrModel* pModel )
void SdTransferable::AddSupportedFormats()
{
if( !mbPageTransferable || mbPageTransferablePersistent )
{
if( !(!mbPageTransferable || mbPageTransferablePersistent) )
return;
if( !mbLateInit )
CreateData();
@@ -437,7 +438,6 @@ void SdTransferable::AddSupportedFormats()
if( mpImageMap )
AddFormat( SotClipboardFormatId::SVIM );
}
}
bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
{
@@ -666,8 +666,9 @@ void SdTransferable::SetObjectDescriptor( std::unique_ptr<TransferableObjectDesc
void SdTransferable::SetPageBookmarks( const std::vector<OUString> &rPageBookmarks, bool bPersistent )
{
if( mpSourceDoc )
{
if( !mpSourceDoc )
return;
if( mpSdViewIntern )
mpSdViewIntern->HideSdrPage();
@@ -704,7 +705,6 @@ void SdTransferable::SetPageBookmarks( const std::vector<OUString> &rPageBookmar
mbPageTransferable = true;
mbPageTransferablePersistent = bPersistent;
}
}
sal_Int64 SAL_CALL SdTransferable::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{

View File

@@ -217,10 +217,12 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg
mxFrame2->show();
}
if( eMode == DrawViewMode_DRAW )
{
if( mxFrame.is() )
{
if( eMode != DrawViewMode_DRAW )
return;
if( !mxFrame.is() )
return;
OUString sSlotStr;
if( bInsertPage )
@@ -244,8 +246,6 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg
mxMoreButton->connect_clicked(LINK(this, LayoutToolbarMenu, SelectToolbarMenuHdl));
mxMoreButton->show();
}
}
}
IMPL_LINK(LayoutToolbarMenu, SelectValueSetHdl, ValueSet*, pLayoutSet, void)
{

View File

@@ -821,8 +821,9 @@ IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const OString&, rIdent, void
}
}
}
if (bSucc)
{
if (!bSucc)
return;
aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
sal_uInt16 nMask = 1;
@@ -857,17 +858,18 @@ IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const OString&, rIdent, void
//needed due to asynchronous loading of graphics in the SvxBrushItem
aInvalidateTimer.Start();
}
}
IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButton&, void)
{
if (!m_xGalleryMenu)
{
if (m_xGalleryMenu)
return;
m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
weld::WaitObject aWait(p_Window);
if (GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
{
if (!GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
return;
GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
Graphic aGraphic;
@@ -888,8 +890,8 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButt
if (aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
{
bool bWidth = aSize.Width() > aSize.Height();
double nScale
= bWidth ? double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width())
double nScale = bWidth
? double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width())
: double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
aBitmap.Scale(nScale, nScale);
}
@@ -898,8 +900,7 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButt
// We want to show only icon names not full path.
aObj.removeExtension();
OUString sIconName
= aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
OUString sIconName = aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
m_xGalleryMenu->append(sItemId, sIconName, *pVD);
}
@@ -911,8 +912,6 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButt
}
GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
}
}
}
IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
{
@@ -950,8 +949,9 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
aMap.SetCharFont(aActBulletFont);
if (bSameBullet)
aMap.SetChar(cBullet);
if (aMap.run() == RET_OK)
{
if (aMap.run() != RET_OK)
return;
// change Font Numrules
aActBulletFont = aMap.GetCharFont();
@@ -970,7 +970,6 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
SetModified();
}
}
IMPL_LINK(SvxBulletAndPositionDlg, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
{

View File

@@ -358,8 +358,9 @@ IMPL_LINK(SdNavigatorWin, MenuSelectHdl, const OString&, rIdent, void)
sal_uInt32 nMenuId = rIdent.toUInt32();
NavigatorDragType eDT = static_cast<NavigatorDragType>(nMenuId);
if( meDragType != eDT )
{
if( meDragType == eDT )
return;
meDragType = eDT;
SetDragImage();
@@ -374,7 +375,6 @@ IMPL_LINK(SdNavigatorWin, MenuSelectHdl, const OString&, rIdent, void)
else
mxTlbObjects->set_selection_mode(SelectionMode::Multiple);
}
}
IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, const OString&, rIdent, void )
{
@@ -390,8 +390,9 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, const OString&, rIdent, void )
// Remember the selection in the FrameView.
NavDocInfo* pInfo = GetDocInfo();
if (pInfo != nullptr)
{
if (pInfo == nullptr)
return;
::sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
if (pDocShell != nullptr)
{
@@ -406,7 +407,6 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, const OString&, rIdent, void )
}
}
}
}
bool SdNavigatorWin::InsertFile(const OUString& rFileName)
{

View File

@@ -111,8 +111,9 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) )
maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue();
if (nSlotId == SID_DRAW_FREELINE_NOFILL)
{
if (nSlotId != SID_DRAW_FREELINE_NOFILL)
return;
const SfxUInt16Item* pTransparence = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
const SfxStringItem* pColor = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
const SfxUInt16Item* pWidth = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
@@ -135,7 +136,6 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
msShapeName = pShapeName->GetValue();
}
}
}
bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
{

View File

@@ -172,8 +172,9 @@ IMPL_LINK(MasterPagesSelector, RightClickHandler, const MouseEvent&, rEvent, voi
mxPreviewValueSet->GrabFocus ();
mxPreviewValueSet->ReleaseMouse();
SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
if (pViewFrame != nullptr)
{
if (pViewFrame == nullptr)
return;
SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
if (pDispatcher != nullptr)
{
@@ -186,15 +187,15 @@ IMPL_LINK(MasterPagesSelector, RightClickHandler, const MouseEvent&, rEvent, voi
}
}
}
}
void MasterPagesSelector::ShowContextMenu(const Point* pPos)
{
// Use the currently selected item and show the popup menu in its
// center.
const sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId();
if (nIndex > 0)
{
if (nIndex <= 0)
return;
// The position of the upper left corner of the context menu is
// taken either from the mouse position (when the command was sent
// as reaction to a right click) or in the center of the selected
@@ -222,7 +223,6 @@ void MasterPagesSelector::ShowContextMenu(const Point* pPos)
// Show the menu.
pMenu->Execute(this, ::tools::Rectangle(aPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
}
}
void MasterPagesSelector::Command (const CommandEvent& rEvent)
{

View File

@@ -1080,8 +1080,9 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, weld::ComboBox&, void)
{ &aSizeItem, mpPageItem.get(), &aFitObjs });
// Notify LOK clients of the page size change.
if (comphelper::LibreOfficeKit::isActive())
{
if (!comphelper::LibreOfficeKit::isActive())
return;
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)
{
@@ -1093,7 +1094,6 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, weld::ComboBox&, void)
pViewShell = SfxViewShell::GetNext(*pViewShell);
}
}
}
IMPL_LINK_NOARG(SlideBackground, FillColorHdl, ColorListBox&, void)
{

View File

@@ -1613,8 +1613,9 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
// Make FuText the current function.
SfxUInt16Item aItem (SID_TEXTEDIT, 1);
std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
if (pViewShell && pViewShell->GetDispatcher())
{
if (!(pViewShell && pViewShell->GetDispatcher()))
return;
pViewShell->GetDispatcher()->ExecuteList(
SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, {&aItem});
@@ -1640,7 +1641,6 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
SetUpdateMode(true);
mbFoundObject = true;
}
}
ESelection SdOutliner::GetSearchStartPosition() const
{

View File

@@ -296,8 +296,9 @@ void DrawView::SetMasterAttributes( SdrObject* pObject, const SdPage& rPage, Sfx
{
SdrInventor nInv = pObject->GetObjInventor();
if (nInv == SdrInventor::Default)
{
if (nInv != SdrInventor::Default)
return;
sal_uInt16 eObjKind = pObject->GetObjIdentifier();
PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
if (bSlide && eObjKind == OBJ_TEXT)
@@ -400,7 +401,6 @@ void DrawView::SetMasterAttributes( SdrObject* pObject, const SdPage& rPage, Sfx
bOk = true;
}
}
}
/**
* Notify for change of site arrangement

View File

@@ -75,8 +75,9 @@ namespace
OUString sColor;
const SfxPoolItem* pColorStringItem = nullptr;
if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
{
if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
return;
sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
if (sColor == "transparent")
@@ -102,7 +103,6 @@ namespace
}
}
}
}
namespace sd {