diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 20:42:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 22:33:02 +0200 |
commit | fe6cce01c88d045a1fcf09acf049c34c22299b02 (patch) | |
tree | c118594a43386096bca55179f31b2b61e64dfa48 /sw | |
parent | b894a3d7f991dd248dfd8935b31da8bccfd130b2 (diff) |
Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptr
...where the get member function is defined on a std::__shared_ptr base class,
so loplugin:simplifypointertobool used to miss those until now. (While e.g.
using libc++ on macOS found those cases.)
366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool"
was mistaken in breaking isSmartPointerType(const clang::Type* t) out of
isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix
detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had
introduced that indivisible two-step algorithm on purpose.
The amount of additional hits (on Linux) apparently asked for turning
loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed
that the naive adivce to just "drop the get()" is not sufficient in places that
are not contextually converted to bool, as those places need to be wrapped in a
bool(...) functional cast now. If the expression was already wrapped in
parentheses, those could be reused as part of the functional cast, but
implementing that showed that such cases are not yet found at all by the
existing loplugin:simplifypointertobool. Lets leave that TODO for another
commit.
Besides the changes to compilerplugins/ itself, this change has been generated
fully automatically with the rewriting plugin on Linux.
Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
28 files changed, 59 insertions, 59 deletions
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 30f72d7fc3ac..a69dbf12592f 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -402,7 +402,7 @@ SfxItemState SwFormat::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, cons const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper(); // check if the new fill attributes are used - if(aFill.get() && aFill->isUsed()) + if(aFill && aFill->isUsed()) { // if yes, fill the local SvxBrushItem using the new fill attributes // as good as possible to have an instance for the pointer to point @@ -435,7 +435,7 @@ SfxItemState SwFormat::GetBackgroundState(std::unique_ptr<SvxBrushItem>& rItem) const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper(); // check if the new fill attributes are used - if(aFill.get() && aFill->isUsed()) + if(aFill && aFill->isUsed()) { // if yes, fill the local SvxBrushItem using the new fill attributes // as good as possible to have an instance for the pointer to point @@ -765,7 +765,7 @@ IDocumentChartDataProviderAccess& SwFormat::getIDocumentChartDataProviderAccess( void SwFormat::GetGrabBagItem(uno::Any& rVal) const { - if (m_pGrabBagItem.get()) + if (m_pGrabBagItem) m_pGrabBagItem->QueryValue(rVal); else rVal <<= uno::Sequence<beans::PropertyValue>(); @@ -773,7 +773,7 @@ void SwFormat::GetGrabBagItem(uno::Any& rVal) const void SwFormat::SetGrabBagItem(const uno::Any& rVal) { - if (!m_pGrabBagItem.get()) + if (!m_pGrabBagItem) m_pGrabBagItem = std::make_shared<SfxGrabBagItem>(); m_pGrabBagItem->PutValue(rVal, 0); diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index fa58d9ed789f..d871a8033410 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1078,7 +1078,7 @@ void SwNumRule::dumpAsXml(xmlTextWriterPtr pWriter) const void SwNumRule::GetGrabBagItem(uno::Any& rVal) const { - if (mpGrabBagItem.get()) + if (mpGrabBagItem) mpGrabBagItem->QueryValue(rVal); else rVal <<= uno::Sequence<beans::PropertyValue>(); @@ -1086,7 +1086,7 @@ void SwNumRule::GetGrabBagItem(uno::Any& rVal) const void SwNumRule::SetGrabBagItem(const uno::Any& rVal) { - if (!mpGrabBagItem.get()) + if (!mpGrabBagItem) mpGrabBagItem = std::make_shared<SfxGrabBagItem>(); mpGrabBagItem->PutValue(rVal, 0); diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx index 3af1b80d7596..cfca5ee5b27a 100644 --- a/sw/source/core/doc/swstylemanager.cxx +++ b/sw/source/core/doc/swstylemanager.cxx @@ -45,7 +45,7 @@ void SwStyleCache::addCompletePool( StylePool& rPool ) { std::unique_ptr<IStylePoolIteratorAccess> pIter = rPool.createIterator(); std::shared_ptr<SfxItemSet> pStyle = pIter->getNext(); - while( pStyle.get() ) + while( pStyle ) { OUString aName( StylePool::nameOf(pStyle) ); mMap[ aName ] = pStyle; @@ -129,7 +129,7 @@ std::shared_ptr<SfxItemSet> SwStyleManager::getByName( const OUString& rName, if( !rpCache ) rpCache.reset(new SwStyleCache()); std::shared_ptr<SfxItemSet> pStyle = rpCache->getByName( rName ); - if( !pStyle.get() ) + if( !pStyle ) { // Ok, ok, it's allowed to ask for uncached styles (from UNO) but it should not be done // during loading a document @@ -147,7 +147,7 @@ void SwStyleManager::getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rSt // setup <StylePool> iterator, which skips unused styles and ignorable items std::unique_ptr<IStylePoolIteratorAccess> pIter = rAutoPool.createIterator( true, true ); std::shared_ptr<SfxItemSet> pStyle = pIter->getNext(); - while( pStyle.get() ) + while( pStyle ) { rStyles.push_back( pStyle ); diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index 6be756061b6d..9029f9348827 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -55,7 +55,7 @@ SwNoTextNode::~SwNoTextNode() /// and graphics-attributes. void SwNoTextNode::NewAttrSet( SwAttrPool& rPool ) { - OSL_ENSURE( !mpAttrSet.get(), "AttrSet is already set" ); + OSL_ENSURE( !mpAttrSet, "AttrSet is already set" ); SwAttrSet aNewAttrSet( rPool, aNoTextNodeSetRange ); // put names of parent style and conditional style: diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index a4253380c6cd..e5b0a4061d64 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1080,7 +1080,7 @@ SwContentNode::~SwContentNode() m_aCondCollListener.EndListeningAll(); m_pCondColl = nullptr; - if ( mpAttrSet.get() && mbSetModifyAtAttr ) + if ( mpAttrSet && mbSetModifyAtAttr ) const_cast<SwAttrSet*>(static_cast<const SwAttrSet*>(mpAttrSet.get()))->SetModifyAtAttr( nullptr ); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index f6475124cddf..ae9311d2231d 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2536,7 +2536,7 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) RES_FOOTER, false, reinterpret_cast<const SfxPoolItem**>(&pF) ); // reset fill information - if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet()) + if (maFillAttributes && supportsFullDrawingLayerFillAttributeSet()) { SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()); bool bReset(false); @@ -2555,7 +2555,7 @@ void SwFrameFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) else if(RES_FMT_CHG == nWhich) { // reset fill information on format change (e.g. style changed) - if (maFillAttributes.get() && supportsFullDrawingLayerFillAttributeSet()) + if (maFillAttributes && supportsFullDrawingLayerFillAttributeSet()) { maFillAttributes.reset(); } @@ -3517,7 +3517,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrameFormat::getSdrAllF if (supportsFullDrawingLayerFillAttributeSet()) { // create FillAttributes on demand - if(!maFillAttributes.get()) + if(!maFillAttributes) { const_cast< SwFrameFormat* >(this)->maFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(GetAttrSet()); } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index f89d9166e4a9..252101334374 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1848,7 +1848,7 @@ void SwFlyFrame::ActiveUnfloatButton(SwWrtShell* pWrtSh) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager(); SwFrameControlPtr pControl = rMngr.GetControl(FrameControlType::FloatingTable, this); - if (pControl.get() || pControl->GetWindow()) + if (pControl || pControl->GetWindow()) { pControl->GetWindow()->MouseButtonDown(MouseEvent()); } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 4c41de8ed325..72d673b224d4 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -351,7 +351,7 @@ bool SwFlyFreeFrame::supportsAutoContour() const { const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(GetFormat()->getSdrAllFillAttributesHelper()); - if(aFillAttributes.get() && aFillAttributes->isUsed()) + if(aFillAttributes && aFillAttributes->isUsed()) { return false; } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d43191d63ecc..b55f56775bb2 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -207,7 +207,7 @@ SwFrameNotify::~SwFrameNotify() COVERITY_NOEXCEPT_FALSE if (mpFrame->supportsFullDrawingLayerFillAttributeSet()) { drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(mpFrame->getSdrAllFillAttributesHelper()); - if(aFillAttributes.get() && aFillAttributes->isUsed()) + if(aFillAttributes && aFillAttributes->isUsed()) { bUseNewFillProperties = true; // use SetCompletePaint if needed diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 8c9872b7743f..a77960ee3e98 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1717,7 +1717,7 @@ bool DrawFillAttributes( const basegfx::utils::B2DClipState& rClipState, vcl::RenderContext& rOut) { - if(rFillAttributes.get() && rFillAttributes->isUsed()) + if(rFillAttributes && rFillAttributes->isUsed()) { basegfx::B2DRange aPaintRange( rPaintRegion.GetOrigin().Left(), @@ -3052,7 +3052,7 @@ void SwRootFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& { pHiddenPage = static_cast< const SwPageFrame* >( pHiddenPage->GetPrev() ); SwFrameControlPtr pControl = rMngr.GetControl( FrameControlType::PageBreak, pHiddenPage ); - if ( pControl.get() ) + if ( pControl ) pControl->ShowAll( false ); } } @@ -3765,7 +3765,7 @@ bool SwFlyFrame::IsBackgroundTransparent() const { bBackgroundTransparent = true; } - else if(aFillAttributes.get() && aFillAttributes->isUsed()) + else if(aFillAttributes && aFillAttributes->isUsed()) { bBackgroundTransparent = aFillAttributes->isTransparent(); } @@ -3973,7 +3973,7 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrameFormat->getSdrAllFillAttributesHelper()); // check if the new fill attributes are used - if(aFillAttributes.get() && aFillAttributes->isUsed()) + if(aFillAttributes && aFillAttributes->isUsed()) { bPaintCompleteBack = true; } @@ -6328,7 +6328,7 @@ void SwFrame::PaintSwFrameBackground( const SwRect &rRect, const SwPageFrame *pP // #i125189# We are also done when the new DrawingLayer FillAttributes are used // or the FillStyle is set (different from drawing::FillStyle_NONE) - if(pOut && aFillAttributes.get()) + if(pOut && aFillAttributes) { if(aFillAttributes->isUsed()) { @@ -7023,7 +7023,7 @@ Color SwPageFrame::GetDrawBackgrdColor() const if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true, /*bConsiderTextBox=*/false) ) { - if(aFillAttributes.get() && aFillAttributes->isUsed()) + if(aFillAttributes && aFillAttributes->isUsed()) { // let SdrAllFillAttributesHelper do the average color calculation return Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor())); @@ -7274,7 +7274,7 @@ bool SwFrame::GetBackgroundBrush( // transparence is at 100% while no fill is the criteria for derivation bool bNewDrawingLayerFillStyleIsUsedAndNotNoFill(false); - if(rFillAttributes.get()) + if(rFillAttributes) { // the new DrawingLayer FillStyle is used if(rFillAttributes->isUsed()) diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 5442f3f87922..463e7668f4e7 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -458,7 +458,7 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm // TODO: apparently Word can apply Character Style too, see testParagraphMark // Check each item and in case it should be ignored, then clear it. - if (pSet.get()) + if (pSet) { std::unique_ptr<SfxItemSet> const pCleanedSet = pSet->Clone(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index d105736ad5ff..decea02c4864 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2619,7 +2619,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) /// is a background brush and its color is *not* "no fill"/"auto fill". if( GetFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/true ) ) { - if (aFillAttributes.get() && aFillAttributes->isUsed()) + if (aFillAttributes && aFillAttributes->isUsed()) { // First see if fill attributes provide a color. aColor = Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor())); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d0f6ea3d94e5..6200eb040abd 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1139,7 +1139,7 @@ void SwTextNode::JoinPrev() // create an AttrSet with ranges for Frame-/Para/Char-attributes void SwTextNode::NewAttrSet( SwAttrPool& rPool ) { - OSL_ENSURE( !mpAttrSet.get(), "AttrSet is set after all" ); + OSL_ENSURE( !mpAttrSet, "AttrSet is set after all" ); SwAttrSet aNewAttrSet( rPool, aTextNodeSetRange ); // put names of parent style and conditional style: @@ -3939,7 +3939,7 @@ SwFormatColl* SwTextNode::ChgFormatColl( SwFormatColl *pNewColl ) } // reset fill information on parent style change - if(maFillAttributes.get()) + if(maFillAttributes) { maFillAttributes.reset(); } @@ -5274,7 +5274,7 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) } // reset fill information - if (maFillAttributes.get() && pNewValue) + if (maFillAttributes && pNewValue) { const sal_uInt16 nWhich = pNewValue->Which(); bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style changed) @@ -5334,7 +5334,7 @@ SwTextNode::MakeUnoObject() drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTextNode::getSdrAllFillAttributesHelper() const { // create SdrAllFillAttributesHelper on demand - if(!maFillAttributes.get()) + if(!maFillAttributes) { const_cast< SwTextNode* >(this)->maFillAttributes = std::make_shared<drawinglayer::attribute::SdrAllFillAttributesHelper>(GetSwAttrSet()); } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 2dcb0dd9d457..51b3edd81cb6 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -954,7 +954,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint, pNewAttr = &rNewHint; bDestroyHint = false; } - else if ( pNewStyle.get() ) + else if ( pNewStyle ) { pNewAttr = MakeTextAttr( *rNode.GetDoc(), *pNewStyle, nPorStart, nPorEnd ); diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index c79e8baf3338..cbc5f4f396d7 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -493,7 +493,7 @@ void SwTextNode::RstTextAttr( { delAttributes.push_back(pHt); - if ( pStyleHandle.get() ) + if ( pStyleHandle ) { SwTextAttr* pNew = MakeTextAttr( *GetDoc(), *pStyleHandle, nAttrStart, nAttrEnd ); @@ -508,7 +508,7 @@ void SwTextNode::RstTextAttr( pHt->SetStart(nEnd); m_pSwpHints->NoteInHistory( pHt, true ); - if ( pStyleHandle.get() && nAttrStart < nEnd ) + if ( pStyleHandle && nAttrStart < nEnd ) { SwTextAttr* pNew = MakeTextAttr( *GetDoc(), *pStyleHandle, nAttrStart, nEnd ); @@ -536,7 +536,7 @@ void SwTextNode::RstTextAttr( pHt->SetEnd(nStt); m_pSwpHints->NoteInHistory( pHt, true ); - if ( pStyleHandle.get() ) + if ( pStyleHandle ) { SwTextAttr* pNew = MakeTextAttr( *GetDoc(), *pStyleHandle, nStt, nAttrEnd ); @@ -558,7 +558,7 @@ void SwTextNode::RstTextAttr( pHt->SetEnd(nStt); m_pSwpHints->NoteInHistory( pHt, true ); - if ( pStyleHandle.get() && nStt < nEnd ) + if ( pStyleHandle && nStt < nEnd ) { SwTextAttr* pNew = MakeTextAttr( *GetDoc(), *pStyleHandle, nStt, nEnd ); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 5a38afee94b7..61629e087bc7 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -62,7 +62,7 @@ UndoManager::UndoManager(std::shared_ptr<SwNodes> const & xUndoNodes, , m_pDocShell(nullptr) , m_pView(nullptr) { - assert(m_xUndoNodes.get()); + assert(bool(m_xUndoNodes)); // writer expects it to be disabled initially // Undo is enabled by SwEditShell constructor SdrUndoManager::EnableUndo(false); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index c3690beab846..5b6a296c6065 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -213,7 +213,7 @@ lcl_setAutoStyle(IStyleAccess & rStyleAccess, const uno::Any & rValue, std::shared_ptr<SfxItemSet> pStyle = bPara ? rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_PARA ): rStyleAccess.getByName(uStyle, IStyleAccess::AUTO_STYLE_CHAR ); - if(!pStyle.get()) + if(!pStyle) { throw lang::IllegalArgumentException(); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index f43ba36c59a7..fedbf6ece9ac 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3933,7 +3933,7 @@ void SwXAutoStyle::setPropertyValues( uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) { - if( !mpSet.get() ) + if( !mpSet ) { throw uno::RuntimeException(); } @@ -4131,7 +4131,7 @@ uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName ) uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates( const uno::Sequence< OUString >& rPropertyNames ) { - if (!mpSet.get()) + if (!mpSet) { throw uno::RuntimeException(); } @@ -4230,7 +4230,7 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults( uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() { - if( !mpSet.get() ) + if( !mpSet ) throw uno::RuntimeException(); SolarMutexGuard aGuard; std::vector< beans::PropertyValue > aPropertyVector; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index fa70b2767f09..83a02160b6ef 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1669,7 +1669,7 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem, { const SwFormatAutoFormat& rAutoFormat = static_cast<const SwFormatAutoFormat&>(rItem); const std::shared_ptr<SfxItemSet>& pSet = rAutoFormat.GetStyleHandle(); - if( pSet.get() ) + if( pSet ) Insert( *pSet, nStart, nEnd, rFormatInfos, true, bParaAttrs ); } break; diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index c42bc5eedfd2..9104497ccd2e 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -2859,7 +2859,7 @@ public: bool bReadOpt ); void AddContents( std::unique_ptr<HTMLTableCnts> pNewCnts ); - bool HasFirstContents() const { return m_xCnts.get(); } + bool HasFirstContents() const { return bool(m_xCnts); } void ClearIsInSection() { m_pCurrCnts = nullptr; } bool IsInSection() const { return m_pCurrCnts!=nullptr; } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 94f4842029a0..940642a816d4 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -505,7 +505,7 @@ SwHTMLParser::~SwHTMLParser() DeleteFormImpl(); m_pFootEndNoteImpl.reset(); - OSL_ENSURE(!m_xTable.get(), "It exists still an open table"); + OSL_ENSURE(!m_xTable, "It exists still an open table"); m_pImageMaps.reset(); OSL_ENSURE( m_vPendingStack.empty(), @@ -1753,7 +1753,7 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken ) { if( m_nOpenParaToken != HtmlTokenId::NONE ) EndPara(); - OSL_ENSURE(!m_xTable.get(), "table in table not allowed here"); + OSL_ENSURE(!m_xTable, "table in table not allowed here"); if( !m_xTable && (IsNewDoc() || !m_pPam->GetNode().FindTableNode()) && (m_pPam->GetPoint()->nNode.GetIndex() > m_xDoc->GetNodes().GetEndOfExtras().GetIndex() || diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 16c9e518f544..f5551f90ce57 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -388,7 +388,7 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText m_nColBreakStatus = COLBRK_WRITE; // Output table/table row/table cell starts if needed - if ( pTextNodeInfo.get() ) + if ( pTextNodeInfo ) { // New cell/row? if ( m_tableReference->m_nTableDepth > 0 && !m_tableReference->m_bTableCellOpen ) @@ -912,7 +912,7 @@ void DocxAttributeOutput::SyncNodelessCells(ww8::WW8TableNodeInfoInner::Pointer_ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t const & pInner, bool bForceEmptyParagraph ) { - if ( pInner.get() ) + if ( pInner ) { // Where are we in the table sal_uInt32 nRow = pInner->getRow(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ebb5bd5d66d5..e2e75a4d78ab 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -382,7 +382,7 @@ bool BasicProjImportHelper::import( const uno::Reference< io::XInputStream >& rx { oox::ole::OleStorage root( mxCtx, rxIn, false ); oox::StorageRef vbaStg = root.openSubStorage( "Macros" , false ); - if ( vbaStg.get() ) + if ( vbaStg ) { oox::ole::VbaProject aVbaPrj( mxCtx, mrDocShell.GetModel(), "Writer" ); bRet = aVbaPrj.importVbaProject( *vbaStg ); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index 3cb4f4e335f9..f41121945dd2 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -302,7 +302,7 @@ bool Customization::ImportMenu( SwCTBWrapper& rWrapper, CustomToolBarImportHelpe aPopupMenu[3].Name = "ItemDescriptorContainer"; uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW ); aPopupMenu[3].Value <<= xMenuContainer; - if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) ) + if ( pCust->customizationDataCTB && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) ) return false; SAL_INFO("sw.ww8","** there are " << xIndexContainer->getCount() << " menu items on the bar, inserting after that"); xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) ); @@ -326,7 +326,7 @@ bool Customization::ImportCustomToolBar( SwCTBWrapper& rWrapper, CustomToolBarIm { if ( tbidForTBD == 0x25 ) return ImportMenu( rWrapper, helper ); - if ( !customizationDataCTB.get() ) + if ( !customizationDataCTB ) return false; if ( !customizationDataCTB->IsMenuToolbar() ) { @@ -512,7 +512,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< // cmtNil 0x7 No command. See Cid. bool bBuiltin = false; sal_Int16 cmdId = 0; - if ( cid.get() ) + if ( cid ) { const sal_uInt32 nCid = ( *cid & 0xFFFF ); @@ -541,7 +541,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< } } - if ( tbcd.get() ) + if ( tbcd ) { std::vector< css::beans::PropertyValue > props; if ( bBuiltin ) @@ -605,7 +605,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< OUString SwTBC::GetCustomText() { - if ( tbcd.get() ) + if ( tbcd ) return tbcd->getGeneralInfo().CustomText(); return OUString(); } diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index ca803eaf8e80..af04be582cda 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -370,19 +370,19 @@ public: } uno::Any getValue() { - if ( mpPropGetSetHelper.get() ) + if ( mpPropGetSetHelper ) return mpPropGetSetHelper->getPropertyValue( msOOOPropName ); return uno::Any(); } void setValue( const uno::Any& rValue ) { - if ( mpPropGetSetHelper.get() ) + if ( mpPropGetSetHelper ) mpPropGetSetHelper->setPropertyValue( msOOOPropName, rValue ); } uno::Reference< beans::XPropertySet > getUserDefinedProperties() { uno::Reference< beans::XPropertySet > xProps; - if ( mpPropGetSetHelper.get() ) + if ( mpPropGetSetHelper ) return mpPropGetSetHelper->getUserDefinedProperties(); return xProps; } diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index e8bfe164cdca..d92879eb3c0e 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -610,7 +610,7 @@ void SwMailMergeWizardExecutor::EndDialogHdl(sal_Int32 nRet) default: // finish { std::shared_ptr<SwMailMergeConfigItem> xMMConfig = m_pView->GetMailMergeConfigItem(); - SwView* pSourceView = xMMConfig.get() ? xMMConfig->GetSourceView() : nullptr; + SwView* pSourceView = xMMConfig ? xMMConfig->GetSourceView() : nullptr; if(pSourceView) { xMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear(); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 88d45a8141bc..8cb4910502c5 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6179,7 +6179,7 @@ bool SwEditWin::IsInHeaderFooter( const Point &rDocPt, FrameControlType &rContro if ( rSh.IsShowHeaderFooterSeparator( FrameControlType::Header ) ) { SwFrameControlPtr pControl = rMgr.GetControl( FrameControlType::Header, pPageFrame ); - if ( pControl.get() && pControl->Contains( aPoint ) ) + if ( pControl && pControl->Contains( aPoint ) ) { rControl = FrameControlType::Header; return true; @@ -6189,7 +6189,7 @@ bool SwEditWin::IsInHeaderFooter( const Point &rDocPt, FrameControlType &rContro if ( rSh.IsShowHeaderFooterSeparator( FrameControlType::Footer ) ) { SwFrameControlPtr pControl = rMgr.GetControl( FrameControlType::Footer, pPageFrame ); - if ( pControl.get() && pControl->Contains( aPoint ) ) + if ( pControl && pControl->Contains( aPoint ) ) { rControl = FrameControlType::Footer; return true; diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index e994505427f0..8d458f016806 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -217,7 +217,7 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr const tools::Rectangle aDefineRect(aRect); const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); - if (!rFillAttributes.get() || !rFillAttributes->isUsed()) + if (!rFillAttributes || !rFillAttributes->isUsed()) { // If there is no fill, use fallback color const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); |