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 | |
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>
55 files changed, 110 insertions, 112 deletions
diff --git a/compilerplugins/clang/simplifypointertobool.cxx b/compilerplugins/clang/simplifypointertobool.cxx index 4f8abb52c74f..4630556984a3 100644 --- a/compilerplugins/clang/simplifypointertobool.cxx +++ b/compilerplugins/clang/simplifypointertobool.cxx @@ -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())) diff --git a/compilerplugins/clang/test/simplifypointertobool.cxx b/compilerplugins/clang/test/simplifypointertobool.cxx index 05f78d52ed78..2980003e19c7 100644 --- a/compilerplugins/clang/test/simplifypointertobool.cxx +++ b/compilerplugins/clang/test/simplifypointertobool.cxx @@ -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(); } diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8e7b03559447..efd276991370 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -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() ) { diff --git a/cppcanvas/source/wrapper/basegfxfactory.cxx b/cppcanvas/source/wrapper/basegfxfactory.cxx index 8f11c6bb4a49..5b06bcfd9715 100644 --- a/cppcanvas/source/wrapper/basegfxfactory.cxx +++ b/cppcanvas/source/wrapper/basegfxfactory.cxx @@ -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() ); diff --git a/cppcanvas/source/wrapper/implbitmap.cxx b/cppcanvas/source/wrapper/implbitmap.cxx index 4ca8980a1b15..9b7883f053a3 100644 --- a/cppcanvas/source/wrapper/implbitmap.cxx +++ b/cppcanvas/source/wrapper/implbitmap.cxx @@ -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; diff --git a/cppcanvas/source/wrapper/implcustomsprite.cxx b/cppcanvas/source/wrapper/implcustomsprite.cxx index e30adf085374..71fe28a6682a 100644 --- a/cppcanvas/source/wrapper/implcustomsprite.cxx +++ b/cppcanvas/source/wrapper/implcustomsprite.cxx @@ -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 ); diff --git a/cppcanvas/source/wrapper/implpolypolygon.cxx b/cppcanvas/source/wrapper/implpolypolygon.cxx index 54f0fe30818c..308d3dace114 100644 --- a/cppcanvas/source/wrapper/implpolypolygon.cxx +++ b/cppcanvas/source/wrapper/implpolypolygon.cxx @@ -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; diff --git a/cppcanvas/source/wrapper/vclfactory.cxx b/cppcanvas/source/wrapper/vclfactory.cxx index 9d286ec7d8d3..a750b2e88066 100644 --- a/cppcanvas/source/wrapper/vclfactory.cxx +++ b/cppcanvas/source/wrapper/vclfactory.cxx @@ -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() ); diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index 6882f12166a7..ba04bfa22cb0 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -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: diff --git a/extensions/source/propctrlr/composeduiupdate.hxx b/extensions/source/propctrlr/composeduiupdate.hxx index a3d620c003a3..0d25847c76bd 100644 --- a/extensions/source/propctrlr/composeduiupdate.hxx +++ b/extensions/source/propctrlr/composeduiupdate.hxx @@ -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; diff --git a/oox/source/mathml/importutils.cxx b/oox/source/mathml/importutils.cxx index d2727d17e326..caeaf7de05f8 100644 --- a/oox/source/mathml/importutils.cxx +++ b/oox/source/mathml/importutils.cxx @@ -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 ) diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 1c4d5531a747..49648fe626b2 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -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 diff --git a/sc/source/core/data/document10.cxx b/sc/source/core/data/document10.cxx index 85158474cb0a..59f0787591f1 100644 --- a/sc/source/core/data/document10.cxx +++ b/sc/source/core/data/document10.cxx @@ -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 diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index d01e46262c70..40ac14ab27fb 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -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) { diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 58cf4c30b016..9a21767141c0 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -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; diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 8af4b358e074..45e44c0d8628 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -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() ) ); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 67d6366de7db..68a3e9a73efc 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -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; diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index fd32ba6c9026..6a0e153b5399 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -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. diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx index 66774bd1e5ef..912821982a97 100644 --- a/sd/source/ui/presenter/PresenterHelper.cxx +++ b/sd/source/ui/presenter/PresenterHelper.cxx @@ -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(); } diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index af19e712c751..968f5dcf01f0 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -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. diff --git a/sd/source/ui/sidebar/MasterPageContainer.cxx b/sd/source/ui/sidebar/MasterPageContainer.cxx index 767c1e332133..ebdf2121447a 100644 --- a/sd/source/ui/sidebar/MasterPageContainer.cxx +++ b/sd/source/ui/sidebar/MasterPageContainer.cxx @@ -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); } diff --git a/sd/source/ui/sidebar/MasterPageDescriptor.cxx b/sd/source/ui/sidebar/MasterPageDescriptor.cxx index edd0dbb0811a..0e886023e620 100644 --- a/sd/source/ui/sidebar/MasterPageDescriptor.cxx +++ b/sd/source/ui/sidebar/MasterPageDescriptor.cxx @@ -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 { diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx index f4f0a6c2e1c3..150791213b13 100644 --- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx +++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx @@ -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()); diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx index 1d9970bb201b..538187cdfb8a 100644 --- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx @@ -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(); diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx index 60f0bd48d763..1c7be02427b8 100644 --- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx @@ -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); diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index b9d428297c8a..df639ae41d48 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -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; diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 0bf400aad1f7..272403364abe 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -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 diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx index 4afc516a9b84..ccf933346167 100644 --- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx +++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx @@ -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); diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index 522efec6fcfd..d780b0c4e0d1 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -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); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 9ba96ff29a87..e1af322f88eb 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -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 ) 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(); diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 378a7c47832d..c9526248f755 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -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(); diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index a2d6e6823bf6..f0200f421b91 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -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() ); diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 7829ae1c4a79..f4745d7c6885 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -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); diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 4c9795badad6..a37ce469905f 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -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; } diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 1177e6eb3e9e..0d723fad96bc 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -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 ) ); } diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index ec7ec7603c64..f9c2cad6b26d 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -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); diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx index 9c2c51c36a2c..51d6ada11dab 100644 --- a/writerfilter/source/ooxml/OOXMLFactory.cxx +++ b/writerfilter/source/ooxml/OOXMLFactory.cxx @@ -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 = diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 42888678f98e..ffcf4ca20b4a 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -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); diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx index bab418a2f2ff..c103566d5331 100644 --- a/writerfilter/source/ooxml/OOXMLParserState.cxx +++ b/writerfilter/source/ooxml/OOXMLParserState.cxx @@ -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); |