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>
This commit is contained in:
Noel Grandin 2020-06-03 10:52:46 +02:00
parent 7b905c8f1d
commit b83ac35bf4
55 changed files with 110 additions and 112 deletions

View File

@ -423,9 +423,7 @@ bool SimplifyPointerToBool::VisitBinaryOperator(BinaryOperator const* binOp)
if (ignoreLocation(binOp))
return true;
auto opCode = binOp->getOpcode();
//TODO if (opCode != BO_EQ && opCode != BO_NE)
// return true;
if (opCode != BO_NE)
if (opCode != BO_EQ && opCode != BO_NE)
return true;
const Expr* possibleMemberCall = nullptr;
if (isa<CXXNullPtrLiteralExpr>(binOp->getLHS()->IgnoreParenImpCasts()))

View File

@ -31,7 +31,7 @@ void test2(std::shared_ptr<int> p)
// expected-error@+1 {{simplify, drop the get() [loplugin:simplifypointertobool]}}
if (p.get())
foo();
// TODOexpected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
// expected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
if (p.get() == nullptr)
foo();
// TODOexpected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
@ -40,7 +40,7 @@ void test2(std::shared_ptr<int> p)
// TODOexpected-error@+1 {{simplify, convert to 'x' [loplugin:simplifypointertobool]}}
if (p != nullptr)
foo();
// TODOexpected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
// expected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
if (nullptr == p.get())
foo();
// expected-error@+1 {{simplify, convert to 'x' [loplugin:simplifypointertobool]}}
@ -66,7 +66,7 @@ void test2(css::uno::Reference<css::uno::XInterface> const& p)
// expected-error@+1 {{simplify, drop the get() [loplugin:simplifypointertobool]}}
if (p.get())
foo();
// TODOexpected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
// expected-error@+1 {{simplify, convert to '!x' [loplugin:simplifypointertobool]}}
if (p.get() == nullptr)
foo();
}

View File

@ -2860,7 +2860,7 @@ namespace cppcanvas::internal
// make sure canvas and graphic device are valid; action
// creation don't check that every time
if( rCanvas.get() == nullptr ||
if( !rCanvas ||
!rCanvas->getUNOCanvas().is() ||
!rCanvas->getUNOCanvas()->getDevice().is() )
{

View File

@ -40,7 +40,7 @@ namespace cppcanvas
OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createPolyPolygon(): Invalid canvas" );
if( rCanvas.get() == nullptr )
if( !rCanvas )
return PolyPolygonSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
@ -59,7 +59,7 @@ namespace cppcanvas
OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == nullptr )
if( !rCanvas )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
@ -77,7 +77,7 @@ namespace cppcanvas
OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
"BaseGfxFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == nullptr )
if( !rCanvas )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );

View File

@ -56,7 +56,7 @@ namespace cppcanvas::internal
OSL_ENSURE( pCanvas && pCanvas->getUNOCanvas().is(),
"ImplBitmap::draw: invalid canvas" );
if( pCanvas.get() == nullptr ||
if( !pCanvas ||
!pCanvas->getUNOCanvas().is() )
{
return false;
@ -77,7 +77,7 @@ namespace cppcanvas::internal
OSL_ENSURE( pCanvas && pCanvas->getUNOCanvas().is(),
"ImplBitmap::drawAlphaModulated(): invalid canvas" );
if( pCanvas.get() == nullptr ||
if( !pCanvas ||
!pCanvas->getUNOCanvas().is() )
{
return;

View File

@ -57,7 +57,7 @@ namespace cppcanvas::internal
return CanvasSharedPtr();
// cache content canvas C++ wrapper
if( mpLastCanvas.get() == nullptr ||
if( !mpLastCanvas ||
mpLastCanvas->getUNOCanvas() != xCanvas )
{
mpLastCanvas = std::make_shared<ImplCanvas>( xCanvas );

View File

@ -91,7 +91,7 @@ namespace cppcanvas::internal
OSL_ENSURE( pCanvas && pCanvas->getUNOCanvas().is(),
"ImplBitmap::draw: invalid canvas" );
if( pCanvas.get() == nullptr ||
if( !pCanvas ||
!pCanvas->getUNOCanvas().is() )
return false;

View File

@ -59,7 +59,7 @@ namespace cppcanvas
OSL_ENSURE( rCanvas && rCanvas->getUNOCanvas().is(),
"VCLFactory::createBitmap(): Invalid canvas" );
if( rCanvas.get() == nullptr )
if( !rCanvas )
return BitmapSharedPtr();
uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );

View File

@ -176,7 +176,7 @@ void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce
SetControlDefault(Any());
}
bool bForce = _bForce || pOldType.get() == nullptr || pOldType->nType != _pType->nType;
bool bForce = _bForce || !pOldType || pOldType->nType != _pType->nType;
switch ( _pType->nType )
{
case DataType::CHAR:

View File

@ -137,7 +137,7 @@ namespace pcr
private:
/// determines whether the instance is already disposed
bool impl_isDisposed() const { return m_pCollectedUIs.get() == nullptr; }
bool impl_isDisposed() const { return !m_pCollectedUIs; }
/// throws an exception if the component is already disposed
void impl_checkDisposed() const;

View File

@ -40,7 +40,7 @@ public:
AttributeListBuilder::AttributeListBuilder( const uno::Reference< xml::sax::XFastAttributeList >& a )
{
if( a.get() == nullptr )
if( !a )
return;
const uno::Sequence< xml::FastAttribute > aFastAttrSeq = a->getFastAttributes();
for( const xml::FastAttribute& rFastAttr : aFastAttrSeq )

View File

@ -955,7 +955,7 @@ void FastSaxParserImpl::produce( bool bForceFlush )
}
rEntity.maPendingEvents.push(std::move(rEntity.mxProducedEvents));
assert(rEntity.mxProducedEvents.get() == nullptr);
assert(!rEntity.mxProducedEvents);
aGuard.clear(); // unlock

View File

@ -378,7 +378,7 @@ void ScDocument::DelayFormulaGrouping( bool delay )
{
if( delay )
{
if( pDelayedFormulaGrouping.get() == nullptr )
if( !pDelayedFormulaGrouping )
pDelayedFormulaGrouping.reset( new ScRange( ScAddress::INITIALIZE_INVALID ));
}
else

View File

@ -3216,7 +3216,7 @@ CustomAnimationEffectPtr MainSequence::findEffect( const css::uno::Reference< cs
{
CustomAnimationEffectPtr pEffect = EffectSequenceHelper::findEffect( xNode );
if( pEffect.get() == nullptr )
if( !pEffect )
{
for (auto const& interactiveSequence : maInteractiveSequenceVector)
{

View File

@ -638,7 +638,7 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect
}
// if there is not yet a group, create it
if( pGroup.get() == nullptr )
if( !pGroup )
{
CustomAnimationEffectPtr pShapeEffect;

View File

@ -1156,7 +1156,7 @@ std::unique_ptr<STLPropertySet> CustomAnimationPane::createSelectionSet()
pTextGroup = pEffectSequence->findGroup( nGroupId );
addValue( pSet, nHandleTextGrouping, makeAny( pTextGroup ? pTextGroup->getTextGrouping() : sal_Int32(-1) ) );
addValue( pSet, nHandleAnimateForm, makeAny( pTextGroup.get() == nullptr || pTextGroup->getAnimateForm() ) );
addValue( pSet, nHandleAnimateForm, makeAny( !pTextGroup || pTextGroup->getAnimateForm() ) );
addValue( pSet, nHandleTextGroupingAuto, makeAny( pTextGroup ? pTextGroup->getTextGroupingAuto() : -1.0 ) );
addValue( pSet, nHandleTextReverse, makeAny( pTextGroup && pTextGroup->getTextReverse() ) );

View File

@ -629,7 +629,7 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void)
// if we stop pressing the button without a mouse move we open the popup
mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
mpListenWindow = nullptr;
if( mpAnnotationWindow.get() == nullptr )
if( !mpAnnotationWindow )
OpenPopup(false);
}
break;

View File

@ -51,7 +51,7 @@ FullScreenPane::FullScreenPane (
sal_Int32 nScreenNumber = 1;
ExtractArguments(rxPaneId, nScreenNumber);
if (mpWorkWindow.get() == nullptr)
if (!mpWorkWindow)
return;
// Create a new top-level window that is displayed full screen.

View File

@ -392,7 +392,7 @@ Reference<rendering::XBitmap> SAL_CALL PresenterHelper::loadBitmap (
cppcanvas::BitmapSharedPtr xBitmap(
cppcanvas::VCLFactory::createBitmap(pCanvas,
aBitmapEx));
if (xBitmap.get() == nullptr)
if (!xBitmap)
return nullptr;
return xBitmap->getUNOBitmap();
}

View File

@ -445,7 +445,7 @@ void LayoutMenu::AssignLayoutToSelectedSlides (AutoLayout aLayout)
pPageSelection = pSlideSorter->GetPageSelection();
}
if( (pSlideSorter == nullptr) || (pPageSelection.get() == nullptr) || pPageSelection->empty() )
if( (pSlideSorter == nullptr) || !pPageSelection || pPageSelection->empty() )
{
// No valid slide sorter available. Ask the main view shell for
// its current page.

View File

@ -254,7 +254,7 @@ void MasterPageContainer::AcquireToken (Token aToken)
void MasterPageContainer::ReleaseToken (Token aToken)
{
SharedMasterPageDescriptor pDescriptor = mpImpl->GetDescriptor(aToken);
if (pDescriptor.get() == nullptr)
if (!pDescriptor)
return;
OSL_ASSERT(pDescriptor->mnUseCount>0);
@ -885,7 +885,7 @@ void MasterPageContainer::Implementation::CleanContainer()
// elements in the middle can not be removed because that would
// invalidate the references still held by others.
int nIndex (maContainer.size()-1);
while (nIndex>=0 && maContainer[nIndex].get()==nullptr)
while (nIndex>=0 && !maContainer[nIndex])
--nIndex;
maContainer.resize(++nIndex);
}

View File

@ -268,7 +268,7 @@ MasterPageDescriptor::URLComparator::URLComparator (const OUString& sURL)
bool MasterPageDescriptor::URLComparator::operator() (
const SharedMasterPageDescriptor& rDescriptor)
{
if (rDescriptor.get() == nullptr)
if (!rDescriptor)
return false;
else
return rDescriptor->msURL == msURL;
@ -284,7 +284,7 @@ MasterPageDescriptor::StyleNameComparator::StyleNameComparator (const OUString&
bool MasterPageDescriptor::StyleNameComparator::operator() (
const SharedMasterPageDescriptor& rDescriptor)
{
if (rDescriptor.get() == nullptr)
if (!rDescriptor)
return false;
else
return rDescriptor->msStyleName == msStyleName;
@ -300,7 +300,7 @@ MasterPageDescriptor::PageObjectComparator::PageObjectComparator (const SdPage*
bool MasterPageDescriptor::PageObjectComparator::operator() (
const SharedMasterPageDescriptor& rDescriptor)
{
if (rDescriptor.get() == nullptr)
if (!rDescriptor)
return false;
else
return rDescriptor->mpMasterPage==mpMasterPage;
@ -315,7 +315,7 @@ MasterPageDescriptor::AllComparator::AllComparator(const SharedMasterPageDescrip
bool MasterPageDescriptor::AllComparator::operator() (const SharedMasterPageDescriptor&rDescriptor)
{
if (rDescriptor.get() == nullptr)
if (!rDescriptor)
return false;
else
{

View File

@ -46,12 +46,12 @@ std::shared_ptr<CacheConfiguration> CacheConfiguration::Instance()
{
SolarMutexGuard aSolarGuard;
CacheConfigSharedPtr &rInstancePtr = theInstance::get();
if (rInstancePtr.get() == nullptr)
if (!rInstancePtr)
{
// Maybe somebody else kept a previously created instance alive.
if ( ! mpWeakInstance.expired())
rInstancePtr = std::shared_ptr<CacheConfiguration>(mpWeakInstance);
if (rInstancePtr.get() == nullptr)
if (!rInstancePtr)
{
// We have to create a new instance.
rInstancePtr.reset(new CacheConfiguration());

View File

@ -121,7 +121,7 @@ void CurrentSlideManager::SwitchCurrentSlide (
const SharedPageDescriptor& rpDescriptor,
const bool bUpdateSelection)
{
if (rpDescriptor.get() == nullptr || mpCurrentSlide==rpDescriptor)
if (!rpDescriptor || mpCurrentSlide==rpDescriptor)
return;
ReleaseCurrentSlide();

View File

@ -183,7 +183,7 @@ void FocusManager::ShowFocusIndicator (
const model::SharedPageDescriptor& rpDescriptor,
const bool bScrollToFocus)
{
if (rpDescriptor.get() == nullptr)
if (!rpDescriptor)
return;
mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, true);

View File

@ -139,7 +139,7 @@ void PageSelector::SelectPage (const SdPage* pPage)
void PageSelector::SelectPage (const SharedPageDescriptor& rpDescriptor)
{
if (rpDescriptor.get()==nullptr
if (!rpDescriptor
|| !mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, true))
return;
@ -171,7 +171,7 @@ void PageSelector::DeselectPage (
const SharedPageDescriptor& rpDescriptor,
const bool bUpdateCurrentPage)
{
if (rpDescriptor.get()==nullptr
if (!rpDescriptor
|| !mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, false))
return;

View File

@ -1155,7 +1155,7 @@ void NormalModeHandler::RangeSelect (const model::SharedPageDescriptor& rpDescri
model::SharedPageDescriptor pAnchor (rSelector.GetSelectionAnchor());
DeselectAllPages();
if (pAnchor.get() == nullptr)
if (!pAnchor)
return;
// Select all pages between the anchor and the given one, including

View File

@ -221,7 +221,7 @@ sal_Int32 SlideSorterModel::GetIndex (const Reference<drawing::XDrawPage>& rxSli
// Make sure that the descriptor exists. Without it the given slide
// can not be found.
if (pDescriptor.get() == nullptr)
if (!pDescriptor)
{
// Call GetPageDescriptor() to create the missing descriptor.
pDescriptor = GetPageDescriptor(nIndex);
@ -259,7 +259,7 @@ sal_Int32 SlideSorterModel::GetIndex (const SdrPage* pPage) const
// Make sure that the descriptor exists. Without it the given slide
// can not be found.
if (pDescriptor.get() == nullptr)
if (!pDescriptor)
{
// Call GetPageDescriptor() to create the missing descriptor.
pDescriptor = GetPageDescriptor(nIndex);

View File

@ -147,7 +147,7 @@ void FormShellManager::RegisterAtCenterPane()
WindowEventHandler));
// Create a shell factory and with it activate the form shell.
OSL_ASSERT(mpSubShellFactory.get()==nullptr);
OSL_ASSERT(!mpSubShellFactory);
mpSubShellFactory = std::make_shared<FormShellManagerFactory>(*pShell, *this);
mrBase.GetViewShellManager()->AddSubShellFactory(pShell,mpSubShellFactory);
mrBase.GetViewShellManager()->ActivateSubShell(*pShell, ToolbarId::FormLayer_Toolbox);

View File

@ -767,7 +767,7 @@ void ViewShell::SetupRulers()
long nHRulerOfs = 0;
if ( mpVerticalRuler.get() == nullptr )
if ( !mpVerticalRuler )
{
mpVerticalRuler.reset(CreateVRuler(GetActiveWindow()));
if ( mpVerticalRuler )
@ -777,7 +777,7 @@ void ViewShell::SetupRulers()
mpVerticalRuler->Show();
}
}
if ( mpHorizontalRuler.get() == nullptr )
if ( !mpHorizontalRuler )
{
mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow()));
if ( mpHorizontalRuler )

View File

@ -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());

View File

@ -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())

View File

@ -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);

View File

@ -375,7 +375,7 @@ void PresenterHelpView::ProcessString (
void PresenterHelpView::CheckFontSize()
{
if (mpFont.get() == nullptr)
if (!mpFont)
return;
sal_Int32 nBestSize (6);

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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);

View File

@ -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());

View File

@ -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;

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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())

View File

@ -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();

View File

@ -658,7 +658,7 @@ void SidebarController::CreateDeck(const OUString& rDeckId, const Context& rCont
return;
VclPtr<Deck> aDeck = xDeckDescriptor->mpDeck;
if (aDeck.get()==nullptr || bForceCreate)
if (!aDeck || bForceCreate)
{
if (aDeck)
aDeck.disposeAndClear();

View File

@ -579,7 +579,7 @@ void SfxViewShell::SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter )
void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rProps, bool bIsAPI, bool bIsDirect )
{
assert( pImpl->m_xPrinterController.get() == nullptr );
assert( !pImpl->m_xPrinterController );
// get the current selection; our controller should know it
Reference< frame::XController > xController( GetController() );

View File

@ -418,7 +418,7 @@ class PageHolderObject
public:
bool construct (rtl::Reference< PageData::Allocator > const & rxAllocator)
{
if ((m_xPage.get() == nullptr) && rxAllocator.is())
if (!m_xPage && rxAllocator.is())
{
std::shared_ptr<PageData> tmp (rxAllocator->construct<T>(), PageData::Deallocate(rxAllocator));
m_xPage.swap (tmp);

View File

@ -178,7 +178,7 @@ void GridFieldValueListener::dispose()
{
if (m_bDisposed)
{
DBG_ASSERT(m_pRealListener.get() == nullptr, "GridFieldValueListener::dispose : inconsistent !");
DBG_ASSERT(!m_pRealListener, "GridFieldValueListener::dispose : inconsistent !");
return;
}

View File

@ -1178,7 +1178,7 @@ namespace svx
// if we found a rich text control, we need context menu support
if ( m_bActiveControlIsRichText )
{
DBG_ASSERT( nullptr == m_aContextMenuObserver.get(), "FmTextControlShell::controlActivated: already have an observer!" );
DBG_ASSERT( !m_aContextMenuObserver, "FmTextControlShell::controlActivated: already have an observer!" );
m_aContextMenuObserver = MouseListenerAdapter( new FmMouseListenerAdapter( _rxControl, this ) );
}

View File

@ -136,7 +136,7 @@ TableBoxVectorPtr WW8TableNodeInfoInner::getTableBoxesOfRow() const
WW8TableCellGrid::Pointer_t pCellGrid =
mpParent->getParent()->getCellGridForTable(getTable(), false);
if (pCellGrid.get() == nullptr)
if (!pCellGrid)
{
const SwTableLine * pTabLine = getTableBox()->GetUpper();
const SwTableBoxes & rTableBoxes = pTabLine->GetTabBoxes();
@ -227,7 +227,7 @@ WidthsPtr WW8TableNodeInfoInner::getColumnWidthsBasedOnAllRows() const
WW8TableCellGrid::Pointer_t pCellGrid =
mpParent->getParent()->getCellGridForTable(getTable(), false);
if (pCellGrid.get() == nullptr)
if (!pCellGrid)
{
const SwTable * pTable = getTable();
const SwTableLines& rTableLines = pTable->GetTabLines();
@ -284,7 +284,7 @@ WidthsPtr WW8TableNodeInfoInner::getWidthsOfRow() const
WW8TableCellGrid::Pointer_t pCellGrid =
mpParent->getParent()->getCellGridForTable(getTable(), false);
if (pCellGrid.get() == nullptr)
if (!pCellGrid)
{
const SwTableBox * pTabBox = getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
@ -317,7 +317,7 @@ RowSpansPtr WW8TableNodeInfoInner::getRowSpansOfRow() const
WW8TableCellGrid::Pointer_t pCellGrid =
mpParent->getParent()->getCellGridForTable(getTable(), false);
if (pCellGrid.get() == nullptr)
if (!pCellGrid)
{
const SwTableBox * pTabBox = getTableBox();
const SwTableLine * pTabLine = pTabBox->GetUpper();
@ -840,7 +840,7 @@ WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo
{
WW8TableNodeInfo::Pointer_t pNodeInfo = getTableNodeInfo(pNode);
if (pNodeInfo.get() == nullptr)
if (!pNodeInfo)
{
pNodeInfo =
std::make_shared<ww8::WW8TableNodeInfo>(this, pNode);

View File

@ -36,7 +36,7 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler,
Id nDefine = pHandler->getDefine();
OOXMLFactory_ns::Pointer_t pFactory = getFactoryForNamespace(nDefine);
if (pFactory.get() == nullptr)
if (!pFactory)
return;
sax_fastparser::FastAttributeList& rAttribs =

View File

@ -77,7 +77,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
m_bDiscardChildren(false),
m_bTookChoice(false)
{
if (mpParserState.get() == nullptr)
if (!mpParserState)
mpParserState = new OOXMLParserState();
mpParserState->incContextCount();
@ -101,7 +101,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler(OOXMLFastContextHandler * pCont
m_bDiscardChildren(pContext->m_bDiscardChildren),
m_bTookChoice(pContext->m_bTookChoice)
{
if (mpParserState.get() == nullptr)
if (!mpParserState)
mpParserState = new OOXMLParserState();
mpParserState->incContextCount();
@ -1197,7 +1197,7 @@ void OOXMLFastContextHandlerValue::lcl_endFastElement
void OOXMLFastContextHandlerValue::setDefaultBooleanValue()
{
if (mpValue.get() == nullptr)
if (!mpValue)
{
OOXMLValue::Pointer_t pValue = OOXMLBooleanValue::Create(true);
setValue(pValue);
@ -1206,7 +1206,7 @@ void OOXMLFastContextHandlerValue::setDefaultBooleanValue()
void OOXMLFastContextHandlerValue::setDefaultIntegerValue()
{
if (mpValue.get() == nullptr)
if (!mpValue)
{
OOXMLValue::Pointer_t pValue = OOXMLIntegerValue::Create(0);
setValue(pValue);
@ -1215,7 +1215,7 @@ void OOXMLFastContextHandlerValue::setDefaultIntegerValue()
void OOXMLFastContextHandlerValue::setDefaultHexValue()
{
if (mpValue.get() == nullptr)
if (!mpValue)
{
OOXMLValue::Pointer_t pValue(new OOXMLHexValue(sal_uInt32(0)));
setValue(pValue);
@ -1224,7 +1224,7 @@ void OOXMLFastContextHandlerValue::setDefaultHexValue()
void OOXMLFastContextHandlerValue::setDefaultStringValue()
{
if (mpValue.get() == nullptr)
if (!mpValue)
{
OOXMLValue::Pointer_t pValue(new OOXMLStringValue(OUString()));
setValue(pValue);

View File

@ -119,7 +119,7 @@ void OOXMLParserState::resolveCharacterProperties(Stream & rStream)
void OOXMLParserState::setCharacterProperties(const OOXMLPropertySet::Pointer_t& pProps)
{
if (mpCharacterProps.get() == nullptr)
if (!mpCharacterProps)
mpCharacterProps = pProps;
else
mpCharacterProps->add(pProps);
@ -131,7 +131,7 @@ void OOXMLParserState::setCellProperties(const OOXMLPropertySet::Pointer_t& pPro
{
OOXMLPropertySet::Pointer_t & rCellProps = mCellProps.top();
if (rCellProps.get() == nullptr)
if (!rCellProps)
rCellProps = pProps;
else
rCellProps->add(pProps);
@ -144,7 +144,7 @@ void OOXMLParserState::setRowProperties(const OOXMLPropertySet::Pointer_t& pProp
{
OOXMLPropertySet::Pointer_t & rRowProps = mRowProps.top();
if (rRowProps.get() == nullptr)
if (!rRowProps)
rRowProps = pProps;
else
rRowProps->add(pProps);
@ -199,7 +199,7 @@ void OOXMLParserState::setTableProperties(const OOXMLPropertySet::Pointer_t& pPr
if (!mTableProps.empty())
{
OOXMLPropertySet::Pointer_t & rTableProps = mTableProps.top();
if (rTableProps.get() == nullptr)
if (!rTableProps)
rTableProps = pProps;
else
rTableProps->add(pProps);