diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-03 10:52:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-04 08:23:43 +0200 |
commit | b83ac35bf46ecbebf7f806235eca38a71e521c32 (patch) | |
tree | 660cb00ba4045c7238e9d43176196339ecf901f0 /sdext | |
parent | 7b905c8f1d520ae1aaf4bd2fbb6a3325b404ea95 (diff) |
loplugin:simplifypointertobool improve (2)
to look for the
x.get() == null
pattern, which can be simplified to
!x
Change-Id: I0eddf93257ab53ab31949961d7c33ac2dd7288ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95400
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/presenter/PresenterButton.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterCanvasHelper.cxx | 2 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterController.cxx | 6 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterHelpView.cxx | 2 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterNotesView.cxx | 6 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterPaintManager.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterPaneContainer.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterPaneFactory.cxx | 2 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterProtocolHandler.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterScrollBar.cxx | 6 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterSlideShowView.cxx | 6 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterSlideSorter.cxx | 6 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterTheme.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterTimer.cxx | 4 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterToolBar.cxx | 28 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterWindowManager.cxx | 4 |
16 files changed, 46 insertions, 46 deletions
diff --git a/sdext/source/presenter/PresenterButton.cxx b/sdext/source/presenter/PresenterButton.cxx index 77964c5e8965..6c053a40e2ce 100644 --- a/sdext/source/presenter/PresenterButton.cxx +++ b/sdext/source/presenter/PresenterButton.cxx @@ -301,7 +301,7 @@ css::geometry::IntegerSize2D PresenterButton::CalculateButtonSize() { if (mpFont && !mpFont->mxFont.is() && mxCanvas.is()) mpFont->PrepareFont(mxCanvas); - if (mpFont.get()==nullptr || !mpFont->mxFont.is()) + if (!mpFont || !mpFont->mxFont.is()) return geometry::IntegerSize2D(-1,-1); geometry::RealSize2D aTextSize (PresenterCanvasHelper::GetTextSize(mpFont->mxFont,msText)); @@ -333,7 +333,7 @@ void PresenterButton::RenderButton ( GetBitmap(rpCenter, eMode), GetBitmap(rpRight, eMode)); - if (rpFont.get()==nullptr || ! rpFont->mxFont.is()) + if (!rpFont || ! rpFont->mxFont.is()) return; const rendering::StringContext aContext (msText, 0, msText.getLength()); diff --git a/sdext/source/presenter/PresenterCanvasHelper.cxx b/sdext/source/presenter/PresenterCanvasHelper.cxx index d2dbf5741dd8..8381f8d5aabd 100644 --- a/sdext/source/presenter/PresenterCanvasHelper.cxx +++ b/sdext/source/presenter/PresenterCanvasHelper.cxx @@ -64,7 +64,7 @@ void PresenterCanvasHelper::PaintRectangle ( const css::rendering::ViewState& rDefaultViewState, const css::rendering::RenderState& rDefaultRenderState) { - if (rpBitmap.get() == nullptr) + if (!rpBitmap) return; if ( ! rxCanvas.is() || ! rxCanvas->getDevice().is()) diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index 12787a546d18..c37ee6f8b097 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -484,7 +484,7 @@ void PresenterController::ShowView (const OUString& rsViewURL) { PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( mpPaneContainer->FindViewURL(rsViewURL)); - if (pDescriptor.get() == nullptr) + if (!pDescriptor) return; pDescriptor->mbIsActive = true; @@ -994,7 +994,7 @@ void PresenterController::HandleNumericKeyPress ( // Ctrl-1, Ctrl-2, and Ctrl-3 are used to switch between views // (slide view, notes view, normal). Ctrl-4 switches monitors mnPendingSlideNumber = -1; - if (mpWindowManager.get() == nullptr) + if (!mpWindowManager) return; switch(nKey) { @@ -1129,7 +1129,7 @@ void PresenterController::UpdatePendingSlideNumber (const sal_Int32 nPendingSlid PresenterTheme::SharedFontDescriptor pFont ( mpTheme->GetFont("PendingSlideNumberFont")); - if (pFont.get() == nullptr) + if (!pFont) return; pFont->PrepareFont(mxCanvas); diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx index ecff22e648d6..3b7cfc4979b6 100644 --- a/sdext/source/presenter/PresenterHelpView.cxx +++ b/sdext/source/presenter/PresenterHelpView.cxx @@ -375,7 +375,7 @@ void PresenterHelpView::ProcessString ( void PresenterHelpView::CheckFontSize() { - if (mpFont.get() == nullptr) + if (!mpFont) return; sal_Int32 nBestSize (6); diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx index a9fa7446b693..f0c3d1eadde2 100644 --- a/sdext/source/presenter/PresenterNotesView.cxx +++ b/sdext/source/presenter/PresenterNotesView.cxx @@ -182,7 +182,7 @@ void PresenterNotesView::CreateToolBar ( const css::uno::Reference<css::uno::XComponentContext>& rxContext, const ::rtl::Reference<PresenterController>& rpPresenterController) { - if (rpPresenterController.get() == nullptr) + if (!rpPresenterController) return; Reference<drawing::XPresenterHelper> xPresenterHelper ( @@ -484,7 +484,7 @@ void PresenterNotesView::Paint (const awt::Rectangle& rUpdateBox) if ( ! mxCanvas.is()) return; - if (mpBackground.get() == nullptr) + if (!mpBackground) mpBackground = mpPresenterController->GetViewBackground(mxViewId->getResourceURL()); if (rUpdateBox.Y < maTextBoundingBox.Y2 @@ -637,7 +637,7 @@ const std::shared_ptr<PresenterTextView>& PresenterNotesView::GetTextView() cons void PresenterNotesView::UpdateScrollBar() { - if (mpScrollBar.get() == nullptr) + if (!mpScrollBar) return; try diff --git a/sdext/source/presenter/PresenterPaintManager.cxx b/sdext/source/presenter/PresenterPaintManager.cxx index 812b7249aea2..ba1bc48defb7 100644 --- a/sdext/source/presenter/PresenterPaintManager.cxx +++ b/sdext/source/presenter/PresenterPaintManager.cxx @@ -56,7 +56,7 @@ void PresenterPaintManager::Invalidate ( PresenterPaneContainer::SharedPaneDescriptor pDescriptor( mpPaneContainer->FindContentWindow(rxWindow)); - if (pDescriptor.get()==nullptr || ! pDescriptor->mbIsOpaque) + if (!pDescriptor || ! pDescriptor->mbIsOpaque) nInvalidateMode |= awt::InvalidateStyle::TRANSPARENT; else nInvalidateMode |= awt::InvalidateStyle::NOTRANSPARENT; @@ -98,7 +98,7 @@ void PresenterPaintManager::Invalidate ( PresenterPaneContainer::SharedPaneDescriptor pDescriptor( mpPaneContainer->FindContentWindow(rxWindow)); - if (pDescriptor.get()==nullptr || ! pDescriptor->mbIsOpaque) + if (!pDescriptor || ! pDescriptor->mbIsOpaque) nInvalidateMode |= awt::InvalidateStyle::TRANSPARENT; else nInvalidateMode |= awt::InvalidateStyle::NOTRANSPARENT; diff --git a/sdext/source/presenter/PresenterPaneContainer.cxx b/sdext/source/presenter/PresenterPaneContainer.cxx index a102304258fb..a7320fdb2c09 100644 --- a/sdext/source/presenter/PresenterPaneContainer.cxx +++ b/sdext/source/presenter/PresenterPaneContainer.cxx @@ -106,7 +106,7 @@ PresenterPaneContainer::SharedPaneDescriptor sPaneURL = xPaneId->getResourceURL(); pDescriptor = FindPaneURL(sPaneURL); - if (pDescriptor.get() == nullptr) + if (!pDescriptor) PreparePane(xPaneId, OUString(), OUString(), OUString(), false, ViewInitializationFunction()); pDescriptor = FindPaneURL(sPaneURL); @@ -290,7 +290,7 @@ OUString PresenterPaneContainer::GetPaneURLForViewURL (const OUString& rsViewURL void PresenterPaneContainer::ToTop (const SharedPaneDescriptor& rpDescriptor) { - if (rpDescriptor.get() == nullptr) + if (!rpDescriptor) return; // Find iterator for pDescriptor. diff --git a/sdext/source/presenter/PresenterPaneFactory.cxx b/sdext/source/presenter/PresenterPaneFactory.cxx index e2e2a8c0de0a..067243cf4836 100644 --- a/sdext/source/presenter/PresenterPaneFactory.cxx +++ b/sdext/source/presenter/PresenterPaneFactory.cxx @@ -181,7 +181,7 @@ void SAL_CALL PresenterPaneFactory::releaseResource (const Reference<XResource>& const OUString sPaneURL (rxResource->getResourceId()->getResourceURL()); PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( pPaneContainer->FindPaneURL(sPaneURL)); - if (pDescriptor.get() == nullptr) + if (!pDescriptor) return; pDescriptor->SetActivationState(false); diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx index 9ea7790ce6eb..cb8cb6db2d27 100644 --- a/sdext/source/presenter/PresenterProtocolHandler.cxx +++ b/sdext/source/presenter/PresenterProtocolHandler.cxx @@ -706,13 +706,13 @@ NotesFontSizeCommand::NotesFontSizeCommand( ::rtl::Reference<PresenterNotesView> NotesFontSizeCommand::GetNotesView() const { - if (mpPresenterController.get() == nullptr) + if (!mpPresenterController) return nullptr; PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( mpPresenterController->GetPaneContainer()->FindViewURL( PresenterViewFactory::msNotesViewURL)); - if (pDescriptor.get() == nullptr) + if (!pDescriptor) return nullptr; return dynamic_cast<PresenterNotesView*>(pDescriptor->mxView.get()); diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx index be498680fafa..cb3efd61aed5 100644 --- a/sdext/source/presenter/PresenterScrollBar.cxx +++ b/sdext/source/presenter/PresenterScrollBar.cxx @@ -440,7 +440,7 @@ void PresenterScrollBar::Repaint ( void PresenterScrollBar::PaintBackground( const css::awt::Rectangle& rUpdateBox) { - if (mpBackgroundBitmap.get() == nullptr) + if (!mpBackgroundBitmap) return; const awt::Rectangle aWindowBox (mxWindow->getPosSize()); @@ -537,7 +537,7 @@ css::uno::Reference<css::rendering::XBitmap> PresenterScrollBar::GetBitmap ( const Area eArea, const SharedBitmapDescriptor& rpBitmaps) const { - if (rpBitmaps.get() == nullptr) + if (!rpBitmaps) return nullptr; else return rpBitmaps->GetBitmap(GetBitmapMode(eArea)); @@ -797,7 +797,7 @@ void PresenterScrollBar::MousePressRepeater::SetMouseArea(const PresenterScrollB void PresenterScrollBar::MousePressRepeater::Callback () { - if (mpScrollBar.get() == nullptr) + if (!mpScrollBar) { Stop(); return; diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx index 9cf7b5c5c85d..f4bb536d6d3e 100644 --- a/sdext/source/presenter/PresenterSlideShowView.cxx +++ b/sdext/source/presenter/PresenterSlideShowView.cxx @@ -650,7 +650,7 @@ void PresenterSlideShowView::PaintOuterWindow (const awt::Rectangle& rRepaintBox if ( ! mxCanvas.is()) return; - if (mpBackground.get() == nullptr) + if (!mpBackground) return; const rendering::ViewState aViewState( @@ -727,7 +727,7 @@ void PresenterSlideShowView::PaintEndSlide (const awt::Rectangle& rRepaintBox) do { - if (mpPresenterController.get() == nullptr) + if (!mpPresenterController) break; std::shared_ptr<PresenterTheme> pTheme (mpPresenterController->GetTheme()); if (pTheme == nullptr) @@ -735,7 +735,7 @@ void PresenterSlideShowView::PaintEndSlide (const awt::Rectangle& rRepaintBox) const OUString sViewStyle (pTheme->GetStyleName(mxViewId->getResourceURL())); PresenterTheme::SharedFontDescriptor pFont (pTheme->GetFont(sViewStyle)); - if (pFont.get() == nullptr) + if (!pFont) break; /// this is responsible of the " presentation exit " text inside the slide windows diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx index 1bbb30147d4f..ce687f8e9438 100644 --- a/sdext/source/presenter/PresenterSlideSorter.cxx +++ b/sdext/source/presenter/PresenterSlideSorter.cxx @@ -254,7 +254,7 @@ PresenterSlideSorter::PresenterSlideSorter ( if ( ! rxContext.is() || ! rxViewId.is() || ! rxController.is() - || rpPresenterController.get()==nullptr) + || ! rpPresenterController) { throw lang::IllegalArgumentException(); } @@ -642,7 +642,7 @@ void PresenterSlideSorter::UpdateLayout() mxViewId->getResourceURL())); do { - if (pPane.get() == nullptr) + if (!pPane) break; if ( ! pPane->mxPane.is()) break; @@ -1532,7 +1532,7 @@ Reference<rendering::XBitmap> PresenterSlideSorter::MouseOverManager::CreateBitm if ( ! mxCanvas.is()) return nullptr; - if (mpFont.get()==nullptr || !mpFont->mxFont.is()) + if (!mpFont || !mpFont->mxFont.is()) return nullptr; // Long text has to be shortened. diff --git a/sdext/source/presenter/PresenterTheme.cxx b/sdext/source/presenter/PresenterTheme.cxx index 2cc7f2efa252..896498ec184c 100644 --- a/sdext/source/presenter/PresenterTheme.cxx +++ b/sdext/source/presenter/PresenterTheme.cxx @@ -370,7 +370,7 @@ SharedBitmapDescriptor PresenterTheme::GetBitmap ( if (rsBitmapName == "Background") { std::shared_ptr<Theme> pTheme (mpTheme); - while (pTheme != nullptr && pTheme->mpBackground.get() == nullptr) + while (pTheme != nullptr && !pTheme->mpBackground) pTheme = pTheme->mpParentTheme; if (pTheme != nullptr) return pTheme->mpBackground; @@ -409,7 +409,7 @@ SharedBitmapDescriptor PresenterTheme::GetBitmap ( if (rsBitmapName == "Background") { std::shared_ptr<Theme> pTheme (mpTheme); - while (pTheme != nullptr && pTheme->mpBackground.get() == nullptr) + while (pTheme != nullptr && !pTheme->mpBackground) pTheme = pTheme->mpParentTheme; if (pTheme != nullptr) return pTheme->mpBackground; diff --git a/sdext/source/presenter/PresenterTimer.cxx b/sdext/source/presenter/PresenterTimer.cxx index 0ecbad47da14..356b3751c2e2 100644 --- a/sdext/source/presenter/PresenterTimer.cxx +++ b/sdext/source/presenter/PresenterTimer.cxx @@ -220,7 +220,7 @@ SharedTimerTask TimerScheduler::CreateTimerTask ( void TimerScheduler::ScheduleTask (const SharedTimerTask& rpTask) { - if (rpTask.get() == nullptr) + if (!rpTask) return; if (rpTask->mbIsCanceled) return; @@ -326,7 +326,7 @@ void SAL_CALL TimerScheduler::run() mpCurrentTask = pTask; } - if (pTask.get() == nullptr) + if (!pTask) { // Wait until the first task becomes due. TimeValue aTimeValue; diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx index 4edce3701bdb..a21cf2a1c5cb 100644 --- a/sdext/source/presenter/PresenterToolBar.cxx +++ b/sdext/source/presenter/PresenterToolBar.cxx @@ -791,7 +791,7 @@ geometry::RealSize2D PresenterToolBar::CalculatePartSize ( // Calculate the summed width of all elements. for (const auto& rxElement : *rpPart) { - if (rxElement.get() == nullptr) + if (!rxElement) continue; const awt::Size aBSize (rxElement->GetBoundingSize(rxCanvas)); @@ -836,7 +836,7 @@ void PresenterToolBar::LayoutPart ( if(!AllSettings::GetLayoutRTL()){ for (auto& rxElement : *rpPart) { - if (rxElement.get() == nullptr) + if (!rxElement) continue; const awt::Size aElementSize (rxElement->GetBoundingSize(rxCanvas)); @@ -966,7 +966,7 @@ void PresenterToolBar::CheckMouseOver ( { for (auto& rxElement : *rxPart) { - if (rxElement.get() == nullptr) + if (!rxElement) continue; awt::Rectangle aBox (rxElement->GetBoundingBox()); @@ -1217,10 +1217,10 @@ bool Element::SetState ( if (mpMode->msAction.isEmpty()) break; - if (mpToolBar.get() == nullptr) + if (!mpToolBar) break; - if (mpToolBar->GetPresenterController().get() == nullptr) + if (!mpToolBar->GetPresenterController()) break; mpToolBar->GetPresenterController()->DispatchUnoCommand(mpMode->msAction); @@ -1269,7 +1269,7 @@ void Element::UpdateState() OSL_ASSERT(mpToolBar); OSL_ASSERT(mpToolBar->GetPresenterController()); - if (mpMode.get() == nullptr) + if (!mpMode) return; util::URL aURL (mpToolBar->GetPresenterController()->CreateURLFromString(mpMode->msAction)); @@ -1422,10 +1422,10 @@ void Button::Paint ( { OSL_ASSERT(rxCanvas.is()); - if (mpMode.get() == nullptr) + if (!mpMode) return; - if (mpMode->mpIcon.get() == nullptr) + if (!mpMode->mpIcon) return; geometry::RealRectangle2D aTextBBox (mpMode->maText.GetBoundingBox(rxCanvas)); @@ -1438,7 +1438,7 @@ void Button::Paint ( awt::Size Button::CreateBoundingSize ( const Reference<rendering::XCanvas>& rxCanvas) { - if (mpMode.get() == nullptr) + if (!mpMode) return awt::Size(); geometry::RealRectangle2D aTextBBox (mpMode->maText.GetBoundingBox(rxCanvas)); @@ -1464,7 +1464,7 @@ void Button::PaintIcon ( const sal_Int32 nTextHeight, const rendering::ViewState& rViewState) { - if (mpMode.get() == nullptr) + if (!mpMode) return; Reference<rendering::XBitmap> xBitmap (mpMode->mpIcon->GetBitmap(GetMode())); @@ -1532,7 +1532,7 @@ Label::Label (const ::rtl::Reference<PresenterToolBar>& rpToolBar) awt::Size Label::CreateBoundingSize ( const Reference<rendering::XCanvas>& rxCanvas) { - if (mpMode.get() == nullptr) + if (!mpMode) return awt::Size(0,0); geometry::RealRectangle2D aTextBBox (mpMode->maText.GetBoundingBox(rxCanvas)); @@ -1544,7 +1544,7 @@ awt::Size Label::CreateBoundingSize ( void Label::SetText (const OUString& rsText) { OSL_ASSERT(mpToolBar); - if (mpMode.get() == nullptr) + if (!mpMode) return; const bool bRequestLayout (mpMode->maText.GetText().getLength() != rsText.getLength()); @@ -1564,7 +1564,7 @@ void Label::Paint ( const rendering::ViewState& rViewState) { OSL_ASSERT(rxCanvas.is()); - if (mpMode.get() == nullptr) + if (!mpMode) return; mpMode->maText.Paint(rxCanvas, rViewState, GetBoundingBox()); @@ -1620,7 +1620,7 @@ void Text::Paint ( if (msText.isEmpty()) return; - if (mpFont.get() == nullptr) + if (!mpFont) return; if ( ! mpFont->mxFont.is()) diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx index 7b01ac83a53a..713a14e15959 100644 --- a/sdext/source/presenter/PresenterWindowManager.cxx +++ b/sdext/source/presenter/PresenterWindowManager.cxx @@ -687,7 +687,7 @@ void PresenterWindowManager::LayoutNotesMode() // width. This takes into account the slide aspect ratio and thus has to // go over the inner pane size. pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); - if (pPane.get() == nullptr) + if (!pPane) return; const awt::Size aNextSlideOuterBox (CalculatePaneSize( @@ -907,7 +907,7 @@ void PresenterWindowManager::PaintBackground (const awt::Rectangle& rUpdateBox) rendering::CompositeOperation::SOURCE); // Paint the background. - if (mpBackgroundBitmap.get() == nullptr) + if (!mpBackgroundBitmap) return; ProvideBackgroundBitmap(); |