diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 15:23:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-17 08:25:47 +0200 |
commit | ccb2a1f650bc505f8a4f1abebf8ce4f9396562a8 (patch) | |
tree | 2ee2fd4f300ae95cf23bade1f242e02f9b276c07 /sd/source/ui/view | |
parent | da5c3a1ee43dd1a07cbd1b8005488bf05432593d (diff) |
clang-tidy readability-redundant-smartptr-get
redundant get() call on smart pointer
Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd
Reviewed-on: https://gerrit.libreoffice.org/61837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 20 | ||||
-rw-r--r-- | sd/source/ui/view/ToolBarManager.cxx | 42 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellImplementation.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsa.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/viewshe2.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 4 |
9 files changed, 57 insertions, 55 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index f0513c0f16f1..5cb954286aba 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -450,7 +450,7 @@ bool SdOutliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) { std::shared_ptr<sd::ViewShell> pShell (pBase->GetMainViewShell()); SetViewShell(pShell); - if (pShell.get() == nullptr) + if (pShell == nullptr) bAbort = true; else switch (pShell->GetShellType()) @@ -859,7 +859,7 @@ void SdOutliner::DetectChange() std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); // Detect whether the view has been switched from the outside. - if (pDrawViewShell.get() != nullptr + if (pDrawViewShell != nullptr && (aPosition.meEditMode != pDrawViewShell->GetEditMode() || aPosition.mePageKind != pDrawViewShell->GetPageKind())) { @@ -962,7 +962,7 @@ void SdOutliner::RememberStartPosition() { std::shared_ptr<sd::DrawViewShell> pDrawViewShell ( std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); - if (pDrawViewShell.get() != nullptr) + if (pDrawViewShell != nullptr) { meStartViewMode = pDrawViewShell->GetPageKind(); meStartEditMode = pDrawViewShell->GetEditMode(); @@ -1018,7 +1018,7 @@ void SdOutliner::RestoreStartPosition() std::shared_ptr<sd::DrawViewShell> pDrawViewShell ( std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); SetViewMode (meStartViewMode); - if (pDrawViewShell.get() != nullptr) + if (pDrawViewShell != nullptr) { SetPage (meStartEditMode, mnStartPageIndex); mpObj = mpStartEditedObject; @@ -1332,7 +1332,7 @@ void SdOutliner::SetViewMode (PageKind ePageKind) std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); std::shared_ptr<sd::DrawViewShell> pDrawViewShell( std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); - if (pDrawViewShell.get()!=nullptr && ePageKind != pDrawViewShell->GetPageKind()) + if (pDrawViewShell != nullptr && ePageKind != pDrawViewShell->GetPageKind()) { // Restore old edit mode. pDrawViewShell->ChangeEditMode(mpImpl->meOriginalEditMode, false); @@ -1385,8 +1385,8 @@ void SdOutliner::SetViewMode (PageKind ePageKind) // Save edit mode so that it can be restored when switching the view // shell again. pDrawViewShell = std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell); - OSL_ASSERT(pDrawViewShell.get()!=nullptr); - if (pDrawViewShell.get() != nullptr) + OSL_ASSERT(pDrawViewShell != nullptr); + if (pDrawViewShell != nullptr) mpImpl->meOriginalEditMode = pDrawViewShell->GetEditMode(); } } @@ -1398,8 +1398,8 @@ void SdOutliner::SetPage (EditMode eEditMode, sal_uInt16 nPageIndex) std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock()); std::shared_ptr<sd::DrawViewShell> pDrawViewShell( std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell)); - OSL_ASSERT(pDrawViewShell.get()!=nullptr); - if (pDrawViewShell.get() != nullptr) + OSL_ASSERT(pDrawViewShell != nullptr); + if (pDrawViewShell != nullptr) { pDrawViewShell->ChangeEditMode(eEditMode, false); pDrawViewShell->SwitchPage(nPageIndex); @@ -1752,7 +1752,7 @@ void SdOutliner::Implementation::ProvideOutlinerView ( const std::shared_ptr<sd::ViewShell>& rpViewShell, vcl::Window* pWindow) { - if (rpViewShell.get() != nullptr) + if (rpViewShell != nullptr) { switch (rpViewShell->GetShellType()) { diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index d82b529ea24c..cb802fd3ef9d 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -368,13 +368,13 @@ ToolBarManager::~ToolBarManager() void ToolBarManager::Shutdown() { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) mpImpl.reset(); } void ToolBarManager::ResetToolBars (ToolBarGroup eGroup) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->ResetToolBars(eGroup); @@ -383,7 +383,7 @@ void ToolBarManager::ResetToolBars (ToolBarGroup eGroup) void ToolBarManager::ResetAllToolBars() { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->ResetAllToolBars(); @@ -394,7 +394,7 @@ void ToolBarManager::AddToolBar ( ToolBarGroup eGroup, const OUString& rsToolBarName) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->AddToolBar(eGroup,rsToolBarName); @@ -405,7 +405,7 @@ void ToolBarManager::AddToolBarShell ( ToolBarGroup eGroup, ShellId nToolBarId) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->AddToolBarShell(eGroup,nToolBarId); @@ -416,7 +416,7 @@ void ToolBarManager::RemoveToolBar ( ToolBarGroup eGroup, const OUString& rsToolBarName) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->RemoveToolBar(eGroup,rsToolBarName); @@ -427,7 +427,7 @@ void ToolBarManager::SetToolBar ( ToolBarGroup eGroup, const OUString& rsToolBarName) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->ResetToolBars(eGroup); @@ -439,7 +439,7 @@ void ToolBarManager::SetToolBarShell ( ToolBarGroup eGroup, ShellId nToolBarId) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { UpdateLock aLock (shared_from_this()); mpImpl->ResetToolBars(eGroup); @@ -449,37 +449,37 @@ void ToolBarManager::SetToolBarShell ( void ToolBarManager::PreUpdate() { - if (mpImpl.get()!=nullptr) + if (mpImpl != nullptr) mpImpl->PreUpdate(); } void ToolBarManager::RequestUpdate() { - if (mpImpl.get()!=nullptr) + if (mpImpl != nullptr) mpImpl->RequestUpdate(); } void ToolBarManager::LockViewShellManager() { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) mpImpl->LockViewShellManager(); } void ToolBarManager::LockUpdate() { - if (mpImpl.get()!=nullptr) + if (mpImpl != nullptr) mpImpl->LockUpdate(); } void ToolBarManager::UnlockUpdate() { - if (mpImpl.get()!=nullptr) + if (mpImpl != nullptr) mpImpl->UnlockUpdate(); } void ToolBarManager::MainViewShellChanged () { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { mpImpl->ReleaseAllToolBarShells(); mpImpl->GetToolBarRules().MainViewShellChanged(ViewShell::ST_NONE); @@ -488,7 +488,7 @@ void ToolBarManager::MainViewShellChanged () void ToolBarManager::MainViewShellChanged (const ViewShell& rMainViewShell) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) { mpImpl->ReleaseAllToolBarShells(); mpImpl->GetToolBarRules().MainViewShellChanged(rMainViewShell); @@ -499,13 +499,13 @@ void ToolBarManager::SelectionHasChanged ( const ViewShell& rViewShell, const SdrView& rView) { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) mpImpl->GetToolBarRules().SelectionHasChanged(rViewShell,rView); } void ToolBarManager::ToolBarsDestroyed() { - if (mpImpl.get() != nullptr) + if (mpImpl != nullptr) mpImpl->ToolBarsDestroyed(); } @@ -727,7 +727,7 @@ void ToolBarManager::Implementation::PostUpdate() void ToolBarManager::Implementation::LockViewShellManager() { - if (mpViewShellManagerLock.get() == nullptr) + if (mpViewShellManagerLock == nullptr) mpViewShellManagerLock.reset( new ViewShellManager::UpdateLock(mrBase.GetViewShellManager())); } @@ -740,7 +740,7 @@ void ToolBarManager::Implementation::LockUpdate() DBG_ASSERT(mnLockCount<100, "ToolBarManager lock count unusually high"); if (mnLockCount == 0) { - OSL_ASSERT(mpSynchronousLayouterLock.get()==nullptr); + OSL_ASSERT(mpSynchronousLayouterLock == nullptr); mpSynchronousLayouterLock.reset(new LayouterLock(mxLayouter)); } @@ -792,7 +792,7 @@ void ToolBarManager::Implementation::Update ( // functionality. Those that are not used anymore are // deactivated now. Those that are missing are activated in the // next step together with the view shells. - if (mpViewShellManagerLock.get() == nullptr) + if (mpViewShellManagerLock == nullptr) mpViewShellManagerLock.reset( new ViewShellManager::UpdateLock(mrBase.GetViewShellManager())); maToolBarShellList.UpdateShells( @@ -1384,7 +1384,7 @@ void ToolBarShellList::UpdateShells ( const std::shared_ptr<ViewShell>& rpMainViewShell, const std::shared_ptr<ViewShellManager>& rpManager) { - if (rpMainViewShell.get() != nullptr) + if (rpMainViewShell != nullptr) { GroupedShellList aList; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index a01519d09661..a5c135d6e645 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -382,7 +382,7 @@ std::shared_ptr<ViewShell> ViewShellBase::GetMainViewShell() const std::shared_ptr<ViewShell> pMainViewShell ( framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this)) ->GetViewShell(framework::FrameworkHelper::msCenterPaneURL)); - if (pMainViewShell.get() == nullptr) + if (pMainViewShell == nullptr) pMainViewShell = framework::FrameworkHelper::Instance(*const_cast<ViewShellBase*>(this)) ->GetViewShell(framework::FrameworkHelper::msFullScreenPaneURL); return pMainViewShell; @@ -532,7 +532,7 @@ Reference<view::XRenderable> ViewShellBase::GetRenderable() SfxPrinter* ViewShellBase::GetPrinter (bool bCreate) { - OSL_ASSERT(mpImpl.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); return GetDocShell()->GetPrinter (bCreate); } @@ -541,7 +541,7 @@ sal_uInt16 ViewShellBase::SetPrinter ( SfxPrinter* pNewPrinter, SfxPrinterChangeFlags nDiffFlags) { - OSL_ASSERT(mpImpl.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); GetDocShell()->SetPrinter(pNewPrinter); @@ -920,8 +920,8 @@ OUString ViewShellBase::GetInitialViewShellType() std::shared_ptr<tools::EventMultiplexer> const & ViewShellBase::GetEventMultiplexer() { - OSL_ASSERT(mpImpl.get()!=nullptr); - OSL_ASSERT(mpImpl->mpEventMultiplexer.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); + OSL_ASSERT(mpImpl->mpEventMultiplexer != nullptr); return mpImpl->mpEventMultiplexer; } @@ -933,37 +933,37 @@ const ::tools::Rectangle& ViewShellBase::getClientRectangle() const std::shared_ptr<ToolBarManager> const & ViewShellBase::GetToolBarManager() const { - OSL_ASSERT(mpImpl.get()!=nullptr); - OSL_ASSERT(mpImpl->mpToolBarManager.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); + OSL_ASSERT(mpImpl->mpToolBarManager != nullptr); return mpImpl->mpToolBarManager; } std::shared_ptr<FormShellManager> const & ViewShellBase::GetFormShellManager() const { - OSL_ASSERT(mpImpl.get()!=nullptr); - OSL_ASSERT(mpImpl->mpFormShellManager.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); + OSL_ASSERT(mpImpl->mpFormShellManager != nullptr); return mpImpl->mpFormShellManager; } DrawController& ViewShellBase::GetDrawController() const { - OSL_ASSERT(mpImpl.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); return *mpImpl->mpController; } void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabBar) { - OSL_ASSERT(mpImpl.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); mpImpl->mpViewTabBar = rViewTabBar; } vcl::Window* ViewShellBase::GetViewWindow() { - OSL_ASSERT(mpImpl.get()!=nullptr); + OSL_ASSERT(mpImpl != nullptr); return mpImpl->mpViewWindow.get(); } @@ -1438,7 +1438,7 @@ void FocusForwardingWindow::dispose() void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt) { std::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell(); - if (pViewShell.get() != nullptr) + if (pViewShell != nullptr) { vcl::Window* pWindow = pViewShell->GetActiveWindow(); if (pWindow != nullptr) @@ -1455,7 +1455,7 @@ void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt) void FocusForwardingWindow::Command (const CommandEvent& rEvent) { std::shared_ptr<ViewShell> pViewShell = mrBase.GetMainViewShell(); - if (pViewShell.get() != nullptr) + if (pViewShell != nullptr) { vcl::Window* pWindow = pViewShell->GetActiveWindow(); if (pWindow != nullptr) diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 110e752b389b..a0957f886984 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -74,7 +74,7 @@ ViewShell::Implementation::~Implementation() COVERITY_NOEXCEPT_FALSE if ( ! mpUpdateLockForMouse.expired()) { std::shared_ptr<ToolBarManagerLock> pLock(mpUpdateLockForMouse); - if (pLock.get() != nullptr) + if (pLock != nullptr) { // Force the ToolBarManagerLock to be released even when the // IsUICaptured() returns <TRUE/>. diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 129f7904a949..f66533ea1a84 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -682,7 +682,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } else if( SfxItemState::DEFAULT == rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) ) { - if (mpCurrentClipboardFormats.get() != nullptr) + if (mpCurrentClipboardFormats != nullptr) rSet.Put(*mpCurrentClipboardFormats); } } diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 6fc9e12def03..d19758c1b1d7 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -747,13 +747,13 @@ void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint) void DrawViewShell::ExecuteAnnotation (SfxRequest const & rRequest) { - if( mpAnnotationManager.get() ) + if (mpAnnotationManager) mpAnnotationManager->ExecuteAnnotation( rRequest ); } void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) { - if( mpAnnotationManager.get() ) + if (mpAnnotationManager) mpAnnotationManager->GetAnnotationState( rItemSet ); } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 5df2438bd791..796f29347eed 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -136,7 +136,8 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie */ OutlineView::~OutlineView() { - DBG_ASSERT(maDragAndDropModelGuard.get() == nullptr, "sd::OutlineView::~OutlineView(), prior drag operation not finished correctly!" ); + DBG_ASSERT(maDragAndDropModelGuard == nullptr, + "sd::OutlineView::~OutlineView(), prior drag operation not finished correctly!"); Link<tools::EventMultiplexerEvent&,void> aLink( LINK(this,OutlineView,EventMultiplexerListener) ); mrOutlineViewShell.GetViewShellBase().GetEventMultiplexer()->RemoveEventListener( aLink ); @@ -332,7 +333,7 @@ IMPL_LINK( OutlineView, ParagraphInsertedHdl, Outliner::ParagraphHdlParam, aPara { // we get calls to this handler during binary insert of drag and drop contents but // we ignore it here and handle it later in OnEndPasteOrDrop() - if( maDragAndDropModelGuard.get() == nullptr ) + if (maDragAndDropModelGuard == nullptr) { OutlineViewPageChangesGuard aGuard(this); @@ -751,7 +752,8 @@ IMPL_LINK_NOARG(OutlineView, StatusEventHdl, EditStatus&, void) IMPL_LINK_NOARG(OutlineView, BeginDropHdl, EditView*, void) { - DBG_ASSERT(maDragAndDropModelGuard.get() == nullptr, "sd::OutlineView::BeginDropHdl(), prior drag operation not finished correctly!" ); + DBG_ASSERT(maDragAndDropModelGuard == nullptr, + "sd::OutlineView::BeginDropHdl(), prior drag operation not finished correctly!"); maDragAndDropModelGuard.reset( new OutlineViewModelChangeGuard( *this ) ); } diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 6d1ce78e86ec..bed0ee921646 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -911,7 +911,7 @@ void ViewShell::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert // usually be the called view shell, but to be on the safe side we call // the main view shell explicitly. SfxInterfaceId nViewID (IMPRESS_FACTORY_ID); - if (GetViewShellBase().GetMainViewShell().get() != nullptr) + if (GetViewShellBase().GetMainViewShell() != nullptr) nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId(); rSequence[nIndex].Name = sUNO_View_ViewId; rSequence[nIndex].Value <<= "view" + OUString::number( static_cast<sal_uInt16>(nViewID)); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 47917c01647f..0398ff0488f5 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -608,7 +608,7 @@ void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) { std::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock( mpImpl->mpUpdateLockForMouse); - if (pLock.get() != nullptr) + if (pLock != nullptr) pLock->Release(); } } @@ -665,7 +665,7 @@ void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) { std::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock( mpImpl->mpUpdateLockForMouse); - if (pLock.get() != nullptr) + if (pLock != nullptr) pLock->Release(); } } |