From 85185f8884278ace3024d38ac16739bf637eae1b Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 8 Jul 2016 16:40:20 +0200 Subject: loplugin:redundantcast: redundant static_casts in sd Change-Id: I843ca15d3515273bd78bf9f111974f9be5252549 --- sd/source/core/drawdoc3.cxx | 4 ++-- sd/source/core/sdpage.cxx | 4 ++-- sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx | 3 +-- sd/source/ui/app/sdxfer.cxx | 2 +- sd/source/ui/dlg/animobjs.cxx | 3 +-- sd/source/ui/dlg/tpaction.cxx | 2 +- sd/source/ui/presenter/PresenterPreviewCache.cxx | 4 ++-- sd/source/ui/sidebar/DocumentHelper.cxx | 3 +-- sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx | 6 +++--- sd/source/ui/view/ViewShellManager.cxx | 2 +- sd/source/ui/view/drviews7.cxx | 2 +- sd/source/ui/view/outlview.cxx | 2 +- 12 files changed, 17 insertions(+), 20 deletions(-) (limited to 'sd') diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index d857b380e238..b371fe7a71a0 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1476,8 +1476,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, if( (pMaster == nullptr) || (pNotesMaster == nullptr) ) { // so take the first MasterPage - pMaster = static_cast( pSourceDoc->GetMasterSdPage(0, PK_STANDARD) ); - pNotesMaster = static_cast( pSourceDoc->GetMasterSdPage(0, PK_NOTES) ); + pMaster = pSourceDoc->GetMasterSdPage(0, PK_STANDARD); + pNotesMaster = pSourceDoc->GetMasterSdPage(0, PK_NOTES); } } diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 001994566324..d7435c044547 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -463,7 +463,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const Rec pOutliner->SetStyleSheet( 0, nullptr ); pOutliner->SetVertical( bVertical ); - SetObjText( static_cast(pSdrObj), static_cast(pOutliner), eObjKind, aString ); + SetObjText( static_cast(pSdrObj), pOutliner, eObjKind, aString ); pOutliner->Init( nOutlMode ); pOutliner->SetStyleSheet( 0, nullptr ); @@ -2076,7 +2076,7 @@ SdrObject* convertPresentationObjectImpl(SdPage& rPage, SdrObject* pSourceObj, P if( !pModel || !pSourceObj ) return pSourceObj; - ::svl::IUndoManager* pUndoManager = static_cast(pModel)->GetUndoManager(); + ::svl::IUndoManager* pUndoManager = pModel->GetUndoManager(); const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && rPage.IsInserted(); SdrObject* pNewObj = pSourceObj; diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx index e055a70df1dd..1f6e89dc84b1 100644 --- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx +++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx @@ -170,8 +170,7 @@ IMPL_LINK_TYPED(AccessibleDocumentViewBase, WindowChildEventListener, // Window is dying. Unregister from VCL Window. // This is also attempted in the disposing() method. vcl::Window* pWindow = maShapeTreeInfo.GetWindow(); - vcl::Window* pDyingWindow = static_cast( - rEvent.GetWindow()); + vcl::Window* pDyingWindow = rEvent.GetWindow(); if (pWindow==pDyingWindow && pWindow!=nullptr && maWindowLink.IsSet()) { pWindow->RemoveChildEventListener (maWindowLink); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 835434c049f0..2091166dacd2 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -246,7 +246,7 @@ void SdTransferable::CreateObjectReplacement( SdrObject* pObj ) } } - SdIMapInfo* pInfo = static_cast< SdDrawDocument* >( pObj->GetModel() )->GetIMapInfo( static_cast< SdrObject* >( pObj ) ); + SdIMapInfo* pInfo = static_cast< SdDrawDocument* >( pObj->GetModel() )->GetIMapInfo( pObj ); if( pInfo ) mpImageMap = new ImageMap( pInfo->GetImageMap() ); diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx index bd08b87dd9b8..a2cded4fef15 100644 --- a/sd/source/ui/dlg/animobjs.cxx +++ b/sd/source/ui/dlg/animobjs.cxx @@ -526,8 +526,7 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls) BitmapEx aBmp(*m_FrameList[m_nCurrentFrame].first); SdPage* pPage = pMyDoc->GetSdPage(0, PK_STANDARD); - SdrObject *const pObject = - static_cast(pPage->GetObj(m_nCurrentFrame)); + SdrObject *const pObject = pPage->GetObj(m_nCurrentFrame); if( pObject ) { ScopedVclPtrInstance< VirtualDevice > pVD; diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 26654f706110..9e158bdd22bc 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -167,7 +167,7 @@ void SdTPAction::SetView( const ::sd::View* pSdView ) mpView = pSdView; // get ColorTable and fill ListBox - ::sd::DrawDocShell* pDocSh = static_cast(mpView)->GetDocSh(); + ::sd::DrawDocShell* pDocSh = mpView->GetDocSh(); if( pDocSh && pDocSh->GetViewShell() ) { mpDoc = pDocSh->GetDoc(); diff --git a/sd/source/ui/presenter/PresenterPreviewCache.cxx b/sd/source/ui/presenter/PresenterPreviewCache.cxx index 30df3ebfd66b..050611202a3b 100644 --- a/sd/source/ui/presenter/PresenterPreviewCache.cxx +++ b/sd/source/ui/presenter/PresenterPreviewCache.cxx @@ -286,7 +286,7 @@ bool PresenterPreviewCache::PresenterCacheContext::IsVisible (CacheKey aKey) for (sal_Int32 nIndex=mnFirstVisibleSlideIndex; nIndex<=mnLastVisibleSlideIndex; ++nIndex) { const SdrPage* pPage = GetPage(nIndex); - if (pPage == static_cast(aKey)) + if (pPage == aKey) return true; } return false; @@ -294,7 +294,7 @@ bool PresenterPreviewCache::PresenterCacheContext::IsVisible (CacheKey aKey) const SdrPage* PresenterPreviewCache::PresenterCacheContext::GetPage (CacheKey aKey) { - return static_cast(aKey); + return aKey; } std::shared_ptr > diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx index 9e1d855e469d..30e43c9b15f8 100644 --- a/sd/source/ui/sidebar/DocumentHelper.cxx +++ b/sd/source/ui/sidebar/DocumentHelper.cxx @@ -93,8 +93,7 @@ SdPage* DocumentHelper::CopyMasterPageToLocalDocument ( sal_uInt16 nMasterPageCount(rTargetDocument.GetMasterSdPageCount(PK_STANDARD)); for (sal_uInt16 nMaster=0; nMaster( - rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD)); + SdPage* pCandidate = rTargetDocument.GetMasterSdPage (nMaster, PK_STANDARD); if (pMasterPage!=nullptr && pCandidate->GetName() == pMasterPage->GetName()) { diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx index 6ff1d404165f..065c2491da8d 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx @@ -80,7 +80,7 @@ bool ViewCacheContext::IsVisible (cache::CacheKey aKey) const SdrPage* ViewCacheContext::GetPage (cache::CacheKey aKey) { - return static_cast(aKey); + return aKey; } std::shared_ptr > ViewCacheContext::GetEntryList (bool bVisible) @@ -103,12 +103,12 @@ std::shared_ptr > ViewCacheContext::GetEntryList (b sal_Int32 ViewCacheContext::GetPriority (cache::CacheKey aKey) { - return - (static_cast(aKey)->GetPageNum()-1) / 2; + return - (aKey->GetPageNum()-1) / 2; } model::SharedPageDescriptor ViewCacheContext::GetDescriptor (cache::CacheKey aKey) { - sal_uInt16 nPageIndex ((static_cast(aKey)->GetPageNum() - 1) / 2); + sal_uInt16 nPageIndex ((aKey->GetPageNum() - 1) / 2); return mrModel.GetPageDescriptor(nPageIndex); } diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index c2432ac34ec4..c5c60589d695 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -996,7 +996,7 @@ IMPL_LINK_TYPED(ViewShellManager::Implementation, WindowEventHandler, VclWindowE aI!=maActiveViewShells.end(); ++aI) { - if (pEventWindow == static_cast< vcl::Window*>(aI->GetWindow())) + if (pEventWindow == aI->GetWindow()) { MoveToTop(*aI->mpShell); break; diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 58693504eedd..83e3b28c8ac2 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1325,7 +1325,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj); // Current size of the OBJ_GRAF - const Rectangle aRect = static_cast(pObj)->GetLogicRect(); + const Rectangle aRect = pObj->GetLogicRect(); const Size aCurrentSizeofObj = aRect.GetSize(); // Original size of the OBJ_GRAF diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 7b184a29b38c..00dd7eb55cbb 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1227,7 +1227,7 @@ SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara ) } if( nPageToSelect < (sal_uInt32)mrDoc.GetSdPageCount( PK_STANDARD ) ) - return static_cast< SdPage* >( mrDoc.GetSdPage( (sal_uInt16)nPageToSelect, PK_STANDARD) ); + return mrDoc.GetSdPage( (sal_uInt16)nPageToSelect, PK_STANDARD ); return nullptr; } -- cgit