diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-08 12:36:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-10 12:02:44 +0200 |
commit | 366d08f2f6d4de922f6099c62bb81b49d89e0a68 (patch) | |
tree | b232884af6e844c2f0994859e4b42efbc1ce654c | |
parent | 75a2257a5bd716a9f937abe5e53f305c983afd5d (diff) |
new loplugin:simplifypointertobool
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
171 files changed, 620 insertions, 483 deletions
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index a4ab2f3fb112..9fad69016472 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -828,7 +828,7 @@ void ObjectPage::NewDialog() { m_xBasicBox->AddEntry(aDlgName, RID_BMP_DIALOG, xSubRootEntry.get(), false, std::make_unique<Entry>(OBJ_TYPE_DIALOG), xIter.get()); - assert(xIter.get() && "Insert entry failed!"); + assert(xIter && "Insert entry failed!"); } m_xBasicBox->set_cursor(*xIter); m_xBasicBox->select(*xIter); diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 88ade90a4677..0232c01ca44e 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2178,7 +2178,7 @@ SbxVariable* SbObjModule::Find( const OUString& rName, SbxClassType t ) { SbxVariable* pVar = nullptr; - if ( pDocObject.get() ) + if ( pDocObject ) pVar = pDocObject->Find( rName, t ); if ( !pVar ) pVar = SbModule::Find( rName, t ); diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index 280f8ebe869e..0dcd6c8aa78e 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -134,7 +134,7 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx ) SbxVariableRef& rRef = GetRef32( nIdx ); // tdf#122250. It is possible that I hold the last reference to myself, so check, otherwise I might // call SetFlag on myself after I have died. - bool removingMyself = rRef.get() && rRef->GetParameters() == this && GetRefCount() == 1; + bool removingMyself = rRef && rRef->GetParameters() == this && GetRefCount() == 1; if( rRef.get() != pVar ) { rRef = pVar; diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx index 5b1c65eba584..ef02a9d5a418 100644 --- a/canvas/source/tools/canvascustomspritehelper.cxx +++ b/canvas/source/tools/canvascustomspritehelper.cxx @@ -223,7 +223,7 @@ namespace canvas void CanvasCustomSpriteHelper::setAlpha( const Sprite::Reference& rSprite, double alpha ) { - if( !mpSpriteCanvas.get() ) + if( !mpSpriteCanvas ) return; // we're disposed if( alpha != mfAlpha ) @@ -244,7 +244,7 @@ namespace canvas const rendering::ViewState& viewState, const rendering::RenderState& renderState ) { - if( !mpSpriteCanvas.get() ) + if( !mpSpriteCanvas ) return; // we're disposed ::basegfx::B2DHomMatrix aTransform; @@ -330,7 +330,7 @@ namespace canvas void CanvasCustomSpriteHelper::setPriority( const Sprite::Reference& rSprite, double nPriority ) { - if( !mpSpriteCanvas.get() ) + if( !mpSpriteCanvas ) return; // we're disposed if( nPriority != mfPriority ) @@ -348,7 +348,7 @@ namespace canvas void CanvasCustomSpriteHelper::show( const Sprite::Reference& rSprite ) { - if( !mpSpriteCanvas.get() ) + if( !mpSpriteCanvas ) return; // we're disposed if( mbActive ) @@ -370,7 +370,7 @@ namespace canvas void CanvasCustomSpriteHelper::hide( const Sprite::Reference& rSprite ) { - if( !mpSpriteCanvas.get() ) + if( !mpSpriteCanvas ) return; // we're disposed if( !mbActive ) diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx index 74ed15836004..9d1f83a74ef7 100644 --- a/canvas/source/vcl/canvascustomsprite.cxx +++ b/canvas/source/vcl/canvascustomsprite.cxx @@ -39,7 +39,7 @@ namespace vclcanvas const OutDevProviderSharedPtr& rOutDevProvider, bool bShowSpriteBounds ) { - ENSURE_OR_THROW( rOwningSpriteCanvas.get() && + ENSURE_OR_THROW( rOwningSpriteCanvas && rOutDevProvider, "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); diff --git a/canvas/source/vcl/spritehelper.cxx b/canvas/source/vcl/spritehelper.cxx index 63a9407642a7..df8550c6c9f2 100644 --- a/canvas/source/vcl/spritehelper.cxx +++ b/canvas/source/vcl/spritehelper.cxx @@ -60,7 +60,7 @@ namespace vclcanvas const BackBufferSharedPtr& rBackBufferMask, bool bShowSpriteBounds ) { - ENSURE_OR_THROW( rOwningSpriteCanvas.get() && rBackBuffer && rBackBufferMask, + ENSURE_OR_THROW( rOwningSpriteCanvas && rBackBuffer && rBackBufferMask, "SpriteHelper::init(): Invalid sprite canvas or back buffer" ); mpBackBuffer = rBackBuffer; diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 86571ffeea7b..785a1d16528c 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -583,7 +583,7 @@ bool DataBrowser::MayMoveLeftColumns() const return ! IsReadOnly() && ( nColIdx > 1 ) && ( nColIdx <= ColCount() - 2 ) - && m_apDataBrowserModel.get() + && m_apDataBrowserModel && !m_apDataBrowserModel->isCategoriesColumn( nColIdx ); } @@ -600,7 +600,7 @@ bool DataBrowser::MayMoveRightColumns() const return ! IsReadOnly() && ( nColIdx > 0 ) && ( nColIdx < ColCount()-2 ) - && m_apDataBrowserModel.get() + && m_apDataBrowserModel && !m_apDataBrowserModel->isCategoriesColumn( nColIdx ); } @@ -701,7 +701,7 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const { aResult = OUString::number(static_cast< sal_Int32 >( nRow ) + 1); } - else if( nRow >= 0 && m_apDataBrowserModel.get()) + else if( nRow >= 0 && m_apDataBrowserModel) { sal_Int32 nColIndex = static_cast< sal_Int32 >( nColumnId ) - 1; @@ -758,8 +758,7 @@ double DataBrowser::GetCellNumber( long nRow, sal_uInt16 nColumnId ) const double fResult; ::rtl::math::setNan( & fResult ); - if(( nColumnId >= 1 ) && ( nRow >= 0 ) && - m_apDataBrowserModel.get()) + if(( nColumnId >= 1 ) && ( nRow >= 0 ) && m_apDataBrowserModel) { fResult = m_apDataBrowserModel->getCellNumber( static_cast< sal_Int32 >( nColumnId ) - 1, nRow ); @@ -878,8 +877,7 @@ void DataBrowser::InsertColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); - if( nColIdx >= 0 && - m_apDataBrowserModel.get()) + if( nColIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -894,8 +892,7 @@ void DataBrowser::InsertTextColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); - if( nColIdx >= 0 && - m_apDataBrowserModel.get()) + if( nColIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -910,8 +907,7 @@ void DataBrowser::RemoveColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); - if( nColIdx >= 0 && - m_apDataBrowserModel.get()) + if( nColIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -927,8 +923,7 @@ void DataBrowser::InsertRow() { sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow()); - if( nRowIdx >= 0 && - m_apDataBrowserModel.get()) + if( nRowIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -943,8 +938,7 @@ void DataBrowser::RemoveRow() { sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow()); - if( nRowIdx >= 0 && - m_apDataBrowserModel.get()) + if( nRowIdx >= 0 && m_apDataBrowserModel) { // save changes made to edit-field if( IsModified() ) @@ -960,8 +954,7 @@ void DataBrowser::MoveLeftColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); - if( !(nColIdx > 0 && - m_apDataBrowserModel.get())) + if( !(nColIdx > 0 && m_apDataBrowserModel)) return; // save changes made to edit-field @@ -982,8 +975,7 @@ void DataBrowser::MoveRightColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); - if( !(nColIdx >= 0 && - m_apDataBrowserModel.get())) + if( !(nColIdx >= 0 && m_apDataBrowserModel)) return; // save changes made to edit-field @@ -1004,8 +996,7 @@ void DataBrowser::MoveUpRow() { sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow()); - if( !(nRowIdx > 0 && - m_apDataBrowserModel.get())) + if( !(nRowIdx > 0 && m_apDataBrowserModel)) return; // save changes made to edit-field @@ -1026,8 +1017,7 @@ void DataBrowser::MoveDownRow() { sal_Int32 nRowIdx = lcl_getRowInData( GetCurRow()); - if( !(nRowIdx >= 0 && - m_apDataBrowserModel.get())) + if( !(nRowIdx >= 0 && m_apDataBrowserModel)) return; // save changes made to edit-field diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index b8511f21896c..aaa1c6eedb8b 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -230,7 +230,7 @@ void ErrorBarResources::UpdateControlStates() bool bShowRange = m_xRbRange->get_active(); bool bCanChooseRange = ( bShowRange && - m_apRangeSelectionHelper.get() && + m_apRangeSelectionHelper && m_apRangeSelectionHelper->hasRangeSelection()); m_xMfPositive->set_visible( ! bShowRange ); @@ -700,7 +700,7 @@ void ErrorBarResources::isRangeFieldContentValid(weld::Entry& rEdit) { OUString aRange( rEdit.get_text()); bool bIsValid = ( aRange.isEmpty() ) || - ( m_apRangeSelectionHelper.get() && + ( m_apRangeSelectionHelper && m_apRangeSelectionHelper->verifyCellRange( aRange )); if( bIsValid || !rEdit.get_sensitive()) diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 4a70f339df97..aa21b77fb451 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -501,10 +501,10 @@ void ControllerCommandDispatch::initialize() if( m_xSelectionSupplier.is() ) m_xSelectionSupplier->addSelectionChangeListener( this ); - if( m_apModelState.get() && xModel.is()) + if( m_apModelState && xModel.is()) m_apModelState->update( xModel ); - if( m_apControllerState.get() && xModel.is()) + if( m_apControllerState && xModel.is()) m_apControllerState->update( m_xChartController.get(), xModel ); updateCommandAvailability(); @@ -793,14 +793,14 @@ void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEve bool bUpdateCommandAvailability = false; // Update the "ModelState" Struct. - if( m_apModelState.get() && m_xChartController.is()) + if( m_apModelState && m_xChartController.is()) { m_apModelState->update( m_xChartController->getModel()); bUpdateCommandAvailability = true; } // Update the "ControllerState" Struct. - if( m_apControllerState.get() && m_xChartController.is()) + if( m_apControllerState && m_xChartController.is()) { m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel()); bUpdateCommandAvailability = true; @@ -823,7 +823,7 @@ void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEve void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObject& aEvent ) { // Update the "ControllerState" Struct. - if( m_apControllerState.get() && m_xChartController.is()) + if( m_apControllerState && m_xChartController.is()) { m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel()); updateCommandAvailability(); diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 1271a77c9cf0..46e601954e34 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -288,7 +288,7 @@ void SAL_CALL ElementSelectorToolbarController::release() throw () } void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::FeatureStateEvent& rEvent ) { - if( m_apSelectorListBox.get() ) + if( m_apSelectorListBox ) { SolarMutexGuard aSolarMutexGuard; if ( rEvent.FeatureURL.Path == "ChartElementSelector" ) @@ -303,7 +303,7 @@ void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::Feat uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::createItemWindow( const uno::Reference< awt::XWindow >& xParent ) { uno::Reference< awt::XWindow > xItemWindow; - if( !m_apSelectorListBox.get() ) + if( !m_apSelectorListBox ) { VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xParent ); if( pParent ) @@ -311,7 +311,7 @@ uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::create m_apSelectorListBox.reset(VclPtr<SelectorListBox>::Create(pParent)); } } - if( m_apSelectorListBox.get() ) + if( m_apSelectorListBox ) xItemWindow = VCLUnoHelper::GetInterface( m_apSelectorListBox.get() ); return xItemWindow; } diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 7c7509635bf5..c0d0616a090d 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -832,7 +832,7 @@ Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const if (!m_apSymbolProperties_Series) m_apSymbolProperties_Series = getSymbolPropertiesFromPropertySet(getPropertiesOfSeries()); - if( m_apSymbolProperties_Series.get() && m_apSymbolProperties_Series->Style != SymbolStyle_NONE ) + if( m_apSymbolProperties_Series && m_apSymbolProperties_Series->Style != SymbolStyle_NONE ) { if (!m_apSymbolProperties_InvisibleSymbolForSelection) { diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 9c61964c647a..f5c7069a17a7 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -374,7 +374,7 @@ namespace comphelper void EnumerableMap::impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues ) { - OSL_PRECOND( m_aData.m_pValues.get() && m_aData.m_pValues->empty(), "EnumerableMap::impl_initValues_throw: illegal call!" ); + OSL_PRECOND( m_aData.m_pValues && m_aData.m_pValues->empty(), "EnumerableMap::impl_initValues_throw: illegal call!" ); if (!m_aData.m_pValues || !m_aData.m_pValues->empty()) throw RuntimeException(); diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 14d8af8d65b3..ff15e06750e5 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -22,6 +22,7 @@ #include "compat.hxx" #include "pluginhandler.hxx" +#include "check.hxx" #if CLANG_VERSION >= 110000 #include "clang/AST/ParentMapContext.h" @@ -801,6 +802,43 @@ bool hasExternalLinkage(VarDecl const * decl) { return true; } +bool isSmartPointerType(const Expr* e) +{ + // First check the object type as written, in case the get member function is + // declared at a base class of std::unique_ptr or std::shared_ptr: + auto const t = e->IgnoreImpCasts()->getType(); + auto const tc1 = loplugin::TypeCheck(t); + if (tc1.ClassOrStruct("unique_ptr").StdNamespace() + || tc1.ClassOrStruct("shared_ptr").StdNamespace()) + return true; + return isSmartPointerType(e->getType().getTypePtr()); +} + +bool isSmartPointerType(const clang::Type* t) +{ + // Then check the object type coerced to the type of the get member function, in + // case the type-as-written is derived from one of these types (tools::SvRef is + // final, but the rest are not; but note that this will fail when the type-as- + // written is derived from std::unique_ptr or std::shared_ptr for which the get + // member function is declared at a base class): + auto const tc2 = loplugin::TypeCheck(t); + if (tc2.ClassOrStruct("unique_ptr").StdNamespace() + || tc2.ClassOrStruct("shared_ptr").StdNamespace() + || tc2.Class("Reference").Namespace("uno").Namespace("star") + .Namespace("sun").Namespace("com").GlobalNamespace() + || tc2.Class("Reference").Namespace("rtl").GlobalNamespace() + || tc2.Class("SvRef").Namespace("tools").GlobalNamespace() + || tc2.Class("WeakReference").Namespace("tools").GlobalNamespace() + || tc2.Class("ScopedReadAccess").Namespace("Bitmap").GlobalNamespace() + || tc2.Class("ScopedVclPtrInstance").GlobalNamespace() + || tc2.Class("VclPtr").GlobalNamespace() + || tc2.Class("ScopedVclPtr").GlobalNamespace()) + { + return true; + } + return false; +} + } // namespace diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx index 829d00518f50..bf238eb7767d 100644 --- a/compilerplugins/clang/plugin.hxx +++ b/compilerplugins/clang/plugin.hxx @@ -306,6 +306,9 @@ int derivedFromCount(const CXXRecordDecl* subtypeRecord, const CXXRecordDecl* ba // if it contained the 'extern' specifier: bool hasExternalLinkage(VarDecl const * decl); +bool isSmartPointerType(const clang::Type*); +bool isSmartPointerType(const Expr*); + } // namespace #endif // COMPILEPLUGIN_H diff --git a/compilerplugins/clang/redundantpointerops.cxx b/compilerplugins/clang/redundantpointerops.cxx index 7012365aaef3..45b0783af0ab 100644 --- a/compilerplugins/clang/redundantpointerops.cxx +++ b/compilerplugins/clang/redundantpointerops.cxx @@ -53,8 +53,6 @@ public: bool VisitFunctionDecl(FunctionDecl const *); bool VisitMemberExpr(MemberExpr const *); bool VisitUnaryOperator(UnaryOperator const *); -private: - bool isSmartPointerType(const Expr* e); }; bool RedundantPointerOps::VisitFunctionDecl(FunctionDecl const * functionDecl) @@ -104,7 +102,7 @@ bool RedundantPointerOps::VisitMemberExpr(MemberExpr const * memberExpr) if (methodDecl->getIdentifier() && methodDecl->getName() == "get") { auto const e = cxxMemberCallExpr->getImplicitObjectArgument(); - if (isSmartPointerType(e)) + if (loplugin::isSmartPointerType(e)) report( DiagnosticsEngine::Warning, "'get()' followed by '->' operating on %0, just use '->'", @@ -150,7 +148,7 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator if (methodDecl->getIdentifier() && methodDecl->getName() == "get") { auto const e = cxxMemberCallExpr->getImplicitObjectArgument(); - if (isSmartPointerType(e)) + if (loplugin::isSmartPointerType(e)) report( DiagnosticsEngine::Warning, "'*' followed by '.get()' operating on %0, just use '*'", @@ -162,39 +160,6 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator return true; } -bool RedundantPointerOps::isSmartPointerType(const Expr* e) -{ - // First check the object type as written, in case the get member function is - // declared at a base class of std::unique_ptr or std::shared_ptr: - auto const t = e->IgnoreImpCasts()->getType(); - auto const tc1 = loplugin::TypeCheck(t); - if (tc1.ClassOrStruct("unique_ptr").StdNamespace() - || tc1.ClassOrStruct("shared_ptr").StdNamespace()) - return true; - - // Then check the object type coerced to the type of the get member function, in - // case the type-as-written is derived from one of these types (tools::SvRef is - // final, but the rest are not; but note that this will fail when the type-as- - // written is derived from std::unique_ptr or std::shared_ptr for which the get - // member function is declared at a base class): - auto const tc2 = loplugin::TypeCheck(e->getType()); - if (tc2.ClassOrStruct("unique_ptr").StdNamespace() - || tc2.ClassOrStruct("shared_ptr").StdNamespace() - || tc2.Class("Reference").Namespace("uno").Namespace("star") - .Namespace("sun").Namespace("com").GlobalNamespace() - || tc2.Class("Reference").Namespace("rtl").GlobalNamespace() - || tc2.Class("SvRef").Namespace("tools").GlobalNamespace() - || tc2.Class("WeakReference").Namespace("tools").GlobalNamespace() - || tc2.Class("ScopedReadAccess").Namespace("Bitmap").GlobalNamespace() - || tc2.Class("ScopedVclPtrInstance").GlobalNamespace() - || tc2.Class("VclPtr").GlobalNamespace() - || tc2.Class("ScopedVclPtr").GlobalNamespace()) - { - return true; - } - return false; -} - loplugin::Plugin::Registration< RedundantPointerOps > redundantpointerops("redundantpointerops"); } // namespace diff --git a/compilerplugins/clang/simplifypointertobool.cxx b/compilerplugins/clang/simplifypointertobool.cxx new file mode 100644 index 000000000000..da6581915a1e --- /dev/null +++ b/compilerplugins/clang/simplifypointertobool.cxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <cassert> +#include <string> +#include <iostream> +#include <fstream> +#include <set> + +#include <clang/AST/CXXInheritance.h> +#include "plugin.hxx" +#include "check.hxx" + +/** + Simplify boolean expressions involving smart pointers e.g. + if (x.get()) + can be + if (x) +*/ +#ifndef LO_CLANG_SHARED_PLUGINS + +namespace +{ +class SimplifyPointerToBool : public loplugin::FilteringPlugin<SimplifyPointerToBool> +{ +public: + explicit SimplifyPointerToBool(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + virtual void run() override + { + if (preRun()) + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool VisitImplicitCastExpr(ImplicitCastExpr const*); +}; + +bool SimplifyPointerToBool::VisitImplicitCastExpr(ImplicitCastExpr const* castExpr) +{ + if (ignoreLocation(castExpr)) + return true; + if (castExpr->getCastKind() != CK_PointerToBoolean) + return true; + auto memberCallExpr = dyn_cast<CXXMemberCallExpr>(castExpr->getSubExpr()); + if (!memberCallExpr) + return true; + auto methodDecl = memberCallExpr->getMethodDecl(); + if (!methodDecl || !methodDecl->getIdentifier() || methodDecl->getName() != "get") + return true; + // castExpr->dump(); + // methodDecl->getParent()->getTypeForDecl()->dump(); + if (!loplugin::isSmartPointerType(methodDecl->getParent()->getTypeForDecl())) + return true; + // if (isa<CXXOperatorCallExpr>(callExpr)) + // return true; + // const FunctionDecl* functionDecl; + // if (isa<CXXMemberCallExpr>(callExpr)) + // { + // functionDecl = dyn_cast<CXXMemberCallExpr>(callExpr)->getMethodDecl(); + // } + // else + // { + // functionDecl = callExpr->getDirectCallee(); + // } + // if (!functionDecl) + // return true; + // + // unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams()); + // for (unsigned i = 0; i < len; ++i) + // { + // auto param = functionDecl->getParamDecl(i); + // auto paramTC = loplugin::TypeCheck(param->getType()); + // if (!paramTC.AnyBoolean()) + // continue; + // auto arg = callExpr->getArg(i)->IgnoreImpCasts(); + // auto argTC = loplugin::TypeCheck(arg->getType()); + // if (argTC.AnyBoolean()) + // continue; + // // sal_Bool is sometimes disguised + // if (isa<SubstTemplateTypeParmType>(arg->getType())) + // if (arg->getType()->getUnqualifiedDesugaredType()->isSpecificBuiltinType( + // clang::BuiltinType::UChar)) + // continue; + // if (arg->getType()->isDependentType()) + // continue; + // if (arg->getType()->isIntegerType()) + // { + // auto ret = getCallValue(arg); + // if (ret.hasValue() && (ret.getValue() == 1 || ret.getValue() == 0)) + // continue; + // // something like: priv->m_nLOKFeatures & LOK_FEATURE_DOCUMENT_PASSWORD + // if (isa<BinaryOperator>(arg->IgnoreParenImpCasts())) + // continue; + // // something like: pbEmbolden ? FcTrue : FcFalse + // if (isa<ConditionalOperator>(arg->IgnoreParenImpCasts())) + // continue; + // } + report(DiagnosticsEngine::Warning, "simplify, drop the get()", castExpr->getExprLoc()) + << castExpr->getSourceRange(); + // report(DiagnosticsEngine::Note, "method here", param->getLocation()) + // << param->getSourceRange(); + return true; +} + +loplugin::Plugin::Registration<SimplifyPointerToBool> + simplifypointertobool("simplifypointertobool"); + +} // namespace + +#endif // LO_CLANG_SHARED_PLUGINS + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/simplifypointertobool.cxx b/compilerplugins/clang/test/simplifypointertobool.cxx new file mode 100644 index 000000000000..901262c3d474 --- /dev/null +++ b/compilerplugins/clang/test/simplifypointertobool.cxx @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <memory> + +void foo(); + +void test1(std::unique_ptr<int> p2) +{ + // expected-error@+1 {{simplify, drop the get() [loplugin:simplifypointertobool]}} + if (p2.get()) + foo(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx index 5512c0bdbf7d..55cc47a97732 100644 --- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx +++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx @@ -451,7 +451,7 @@ namespace cppcanvas::internal sal_Int32 TransparencyGroupAction::getActionCount() const { - return mpGroupMtf.get() ? mpGroupMtf->GetActionSize() : 0; + return mpGroupMtf ? mpGroupMtf->GetActionSize() : 0; } } diff --git a/cppcanvas/source/uno/uno_mtfrenderer.cxx b/cppcanvas/source/uno/uno_mtfrenderer.cxx index 2e33d3e972f2..25540e2a54c1 100644 --- a/cppcanvas/source/uno/uno_mtfrenderer.cxx +++ b/cppcanvas/source/uno/uno_mtfrenderer.cxx @@ -21,7 +21,7 @@ void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& /*rMtf*/) void MtfRenderer::draw (double fScaleX, double fScaleY) { - if (mpMetafile && mxCanvas.get()) { + if (mpMetafile && mxCanvas) { cppcanvas::BitmapCanvasSharedPtr canvas = cppcanvas::VCLFactory::createBitmapCanvas (mxCanvas); cppcanvas::RendererSharedPtr renderer = cppcanvas::VCLFactory::createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ()); ::basegfx::B2DHomMatrix aMatrix; diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index 3731163a1f19..4054fa57336f 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -218,11 +218,11 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl( // get needed widgets mxPicture.reset(new weld::CustomWeld(rParentBuilder, "picture", maPicture)); - assert(mxPicture.get()); + assert(mxPicture); mxText = rParentBuilder.weld_text_view("text"); - assert(mxText.get()); + assert(mxText); mxSave = rParentBuilder.weld_button("save"); - assert(mxSave.get()); + assert(mxSave); // set screenshot image at DrawingArea, resize, set event listener if (mxPicture) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index b197d28787a1..62383ecd5479 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1488,7 +1488,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( ) // complete command, and thus the parameters, changed impl_disposeParametersContainer_nothrow(); - if ( !m_pParameters.get() && !m_aCommand.isEmpty() ) + if ( !m_pParameters && !m_aCommand.isEmpty() ) { try { diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx index e683a74e9c7a..eea0ecde4ae2 100644 --- a/dbaccess/source/core/api/RowSetCache.cxx +++ b/dbaccess/source/core/api/RowSetCache.cxx @@ -1555,7 +1555,7 @@ bool ORowSetCache::checkJoin(const Reference< XConnection>& _xConnection, OUString sErrorMsg; ::connectivity::OSQLParser aSqlParser( m_aContext ); std::unique_ptr< ::connectivity::OSQLParseNode> pSqlParseNode( aSqlParser.parseTree(sErrorMsg,sSql)); - if ( pSqlParseNode.get() && SQL_ISRULE(pSqlParseNode, select_statement) ) + if ( pSqlParseNode && SQL_ISRULE(pSqlParseNode, select_statement) ) { OSQLParseNode* pTableRefCommalist = pSqlParseNode->getByRule(::connectivity::OSQLParseNode::table_ref_commalist); OSL_ENSURE(pTableRefCommalist,"NO tables why!?"); diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 299c59eb1dad..64d84729c6e3 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -753,7 +753,7 @@ void ODBExport::exportCharSet() void ODBExport::exportDelimiter() { - if ( m_aDelimiter.get() && m_aDelimiter->bUsed ) + if ( m_aDelimiter && m_aDelimiter->bUsed ) { AddAttribute(XML_NAMESPACE_DB, XML_FIELD,m_aDelimiter->sField); AddAttribute(XML_NAMESPACE_DB, XML_STRING,m_aDelimiter->sText); diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index 123a329ee282..099199bc2ae4 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -112,7 +112,7 @@ namespace dbaui { const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); const vcl::KeyCode& aKeyCode = pKeyEvent->GetKeyCode(); - if ( m_pAccel.get() && m_pAccel->execute( aKeyCode ) ) + if ( m_pAccel && m_pAccel->execute( aKeyCode ) ) // the accelerator consumed the event return true; [[fallthrough]]; diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 22591dedc00d..aed45a4846e9 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -187,7 +187,7 @@ namespace dbaui public: ::osl::Mutex& getMutex() { return m_aMutex; } - bool isInitialized() const { return m_xSourceConnection.is() && m_pSourceObject.get() && m_xDestConnection.is(); } + bool isInitialized() const { return m_xSourceConnection.is() && m_pSourceObject && m_xDestConnection.is(); } protected: explicit CopyTableWizard( const Reference< XComponentContext >& _rxORB ); diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index ee1d6eb49886..394cd00695c6 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -534,7 +534,7 @@ BackendImpl::PackageImpl::isRegistered_( #if HAVE_FEATURE_EXTENSIONS const OUString url(getURL()); - if (!bReg && that->m_registeredPackages.get()) + if (!bReg && that->m_registeredPackages) { // fallback for user extension registered in berkeley DB bReg = that->m_registeredPackages->has( @@ -723,7 +723,7 @@ void BackendImpl::PackageImpl::processPackage_( { #if HAVE_FEATURE_EXTENSIONS if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv) && - that->m_registeredPackages.get()) { + that->m_registeredPackages) { // Obsolete package database handling - should be removed for LibreOffice 4.0 t_string2string_map entries( that->m_registeredPackages->getEntries()); diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index fb28995ecfc0..c66c0728d808 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -1445,7 +1445,7 @@ namespace emfplushelper SAL_INFO("drawinglayer", "EMF+\t TODO: use image attributes"); // For DrawImage and DrawImagePoints, source unit of measurement type must be 1 pixel - if (sourceUnit == UnitTypePixel && maEMFPObjects[flags & 0xff].get()) + if (sourceUnit == UnitTypePixel && maEMFPObjects[flags & 0xff]) { EMFPImage& image = *static_cast<EMFPImage *>(maEMFPObjects[flags & 0xff].get()); float sx, sy, sw, sh; diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index e0109fe6631f..628570fdca74 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -302,7 +302,7 @@ SvxEditSourceAdapter::~SvxEditSourceAdapter() std::unique_ptr<SvxEditSource> SvxEditSourceAdapter::Clone() const { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) { std::unique_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() ); @@ -319,7 +319,7 @@ std::unique_ptr<SvxEditSource> SvxEditSourceAdapter::Clone() const SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter() { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) { SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder(); @@ -341,7 +341,7 @@ SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder() SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder() { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) return mpAdaptee->GetViewForwarder(); return nullptr; @@ -349,7 +349,7 @@ SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder() SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( bool bCreate ) { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) { SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate); @@ -376,13 +376,13 @@ SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( bool bCreate ) void SvxEditSourceAdapter::UpdateData() { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) mpAdaptee->UpdateData(); } SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const { - if( mbEditSourceValid && mpAdaptee.get() ) + if( mbEditSourceValid && mpAdaptee ) return mpAdaptee->GetBroadcaster(); return maDummyBroadcaster; diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index 55ad72b82d3a..04a63cd55658 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -449,9 +449,9 @@ namespace pcr { std::vector< Property > aProperties; - bool bAllowCellLinking = m_pHelper.get() && m_pHelper->isCellBindingAllowed(); - bool bAllowCellIntLinking = m_pHelper.get() && m_pHelper->isCellIntegerBindingAllowed(); - bool bAllowListCellRange = m_pHelper.get() && m_pHelper->isListCellRangeAllowed(); + bool bAllowCellLinking = m_pHelper && m_pHelper->isCellBindingAllowed(); + bool bAllowCellIntLinking = m_pHelper && m_pHelper->isCellIntegerBindingAllowed(); + bool bAllowListCellRange = m_pHelper && m_pHelper->isListCellRangeAllowed(); if ( bAllowCellLinking || bAllowListCellRange || bAllowCellIntLinking ) { sal_Int32 nPos = ( bAllowCellLinking ? 1 : 0 ) diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 26d745b4ddc7..638ff02a77e8 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -809,7 +809,7 @@ namespace pcr nInitialSelection ) ); - if ( !pDialog.get() ) + if ( !pDialog ) return InteractiveSelectionResult_Cancelled; // DF definite problem here diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 1e00a9e33283..d75c117a3e20 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -639,7 +639,7 @@ namespace pcr void OPropertyBrowserController::Construct(const Reference<XWindow>& rContainerWindow, std::unique_ptr<weld::Builder> xBuilder) { DBG_ASSERT(!haveView(), "OPropertyBrowserController::Construct: already have a view!"); - assert(xBuilder.get() && "OPropertyBrowserController::Construct: invalid parent window!"); + assert(xBuilder && "OPropertyBrowserController::Construct: invalid parent window!"); m_xBuilder = std::move(xBuilder); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 9493174a4edd..c4337927846e 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -3325,7 +3325,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, } } - if(mapCurShape.get() && mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || aEndArrow.Count())) + if(mapCurShape && mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || aEndArrow.Count())) { ImplWriteShape( *mapCurShape ); diff --git a/forms/source/xforms/propertysetbase.cxx b/forms/source/xforms/propertysetbase.cxx index 26c8baa115b0..0b0787c49c3e 100644 --- a/forms/source/xforms/propertysetbase.cxx +++ b/forms/source/xforms/propertysetbase.cxx @@ -120,7 +120,7 @@ void PropertySetBase::initializePropertyValueCache( sal_Int32 nHandle ) PropertyAccessorBase& PropertySetBase::locatePropertyHandler( sal_Int32 nHandle ) const { PropertyAccessors::const_iterator aPropertyPos = m_aAccessors.find( nHandle ); - OSL_ENSURE( aPropertyPos != m_aAccessors.end() && aPropertyPos->second.get(), + OSL_ENSURE( aPropertyPos != m_aAccessors.end() && aPropertyPos->second, "PropertySetBase::locatePropertyHandler: accessor map is corrupted!" ); // neither should this be called for handles where there is no accessor, nor should a // NULL accessor be in the map diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 9a39c28d645d..d72d28e12298 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -1434,7 +1434,7 @@ oslGenericFunction LocaleDataImpl::getFunctionSymbol( const Locale& rLocale, con { lcl_LookupTableHelper & rLookupTable = lcl_LookupTableStatic::get(); - if (cachedItem.get() && cachedItem->equals(rLocale)) + if (cachedItem && cachedItem->equals(rLocale)) { OString sSymbolName = rtl::OStringView(pFunction) + "_" + cachedItem->localeName; diff --git a/include/tools/weakbase.h b/include/tools/weakbase.h index e614efcc4111..0f9a500bb55b 100644 --- a/include/tools/weakbase.h +++ b/include/tools/weakbase.h @@ -88,6 +88,9 @@ public: /** returns true if the reference object is not null and still alive */ inline bool is() const; + /** returns true if the reference object is not null and still alive */ + operator bool() const { return is(); } + /** returns the pointer to the reference object or null */ inline reference_type * get() const; diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index b67558954a2a..b60df05ad572 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -284,7 +284,7 @@ void ConvDic::AddEntry( const OUString &rLeftText, const OUString &rRightText ) { if (rLeftText.getLength() > nMaxLeftCharCount) nMaxLeftCharCount = static_cast<sal_Int16>(rLeftText.getLength()); - if (pFromRight.get() && rRightText.getLength() > nMaxRightCharCount) + if (pFromRight && rRightText.getLength() > nMaxRightCharCount) nMaxRightCharCount = static_cast<sal_Int16>(rRightText.getLength()); } diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index dcb49f11c13e..c68f1326e02f 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -525,7 +525,7 @@ rtl::Reference<LwpVirtualLayout> LwpHeadLayout::FindEnSuperTableLayout() { rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get())); o3tl::sorted_vector<LwpVirtualLayout*> aSeen; - while (xLayout.get()) + while (xLayout) { aSeen.insert(xLayout.get()); if (xLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT) diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx index db757cca43fc..0b15e79a633e 100644 --- a/lotuswordpro/source/filter/lwpstory.cxx +++ b/lotuswordpro/source/filter/lwpstory.cxx @@ -198,7 +198,7 @@ void LwpStory::SortPageLayout() //Get all the pagelayout and store in list std::vector<LwpPageLayout*> aLayoutList; rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr)); - while (xLayout.get()) + while (xLayout) { LwpPageLayout *pLayout = xLayout->IsPage() ? dynamic_cast<LwpPageLayout*>(xLayout.get()) @@ -347,7 +347,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont) void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont) { rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr)); - while (xLayout.get()) + while (xLayout) { rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get())); o3tl::sorted_vector<LwpVirtualLayout*> aSeen; diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx index 491bbba06677..47148729cb1a 100644 --- a/lotuswordpro/source/filter/xfilter/xftable.cxx +++ b/lotuswordpro/source/filter/xfilter/xftable.cxx @@ -84,7 +84,7 @@ void XFTable::SetColumnStyle(sal_Int32 col, const OUString& style) void XFTable::AddRow(rtl::Reference<XFRow> const & rRow) { - assert(rRow.get()); + assert(rRow); for (sal_Int32 i = 0; i < rRow->GetCellCount(); ++i) { diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index ce8805f6621c..178d7c21f26a 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -600,7 +600,7 @@ ContextHandlerRef GroupShapeContext::onCreateContext( sal_Int32 nElement, const // try to create a context of an embedded shape ContextHandlerRef xContext = createShapeContext( *this, mrShapes, nElement, rAttribs ); // handle remaining stuff of this shape in base class - return xContext.get() ? xContext : ShapeContext::onCreateContext( nElement, rAttribs ); + return xContext ? xContext : ShapeContext::onCreateContext( nElement, rAttribs ); } RectangleShapeContext::RectangleShapeContext(ContextHandler2Helper const& rParent, diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 507f8b8ef257..ae0802f65c0c 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1841,7 +1841,7 @@ void OStorage::InternalDispose( bool bNotifyImpl ) if ( m_pData->m_bReadOnlyWrap ) { - OSL_ENSURE( m_pData->m_aOpenSubComponentsVector.empty() || m_pData->m_pSubElDispListener.get(), + OSL_ENSURE( m_pData->m_aOpenSubComponentsVector.empty() || m_pData->m_pSubElDispListener, "If any subelements are open the listener must exist!" ); if (m_pData->m_pSubElDispListener) diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 9cca16c45616..6332f8b49f48 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -192,7 +192,7 @@ bool ODesignView::PreNotify( NotifyEvent& rNEvt ) const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); if ( handleKeyEvent(*pKeyEvent) ) bRet = true; - else if ( bRet && m_pAccel.get() ) + else if ( bRet && m_pAccel ) { const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); util::URL aUrl; diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 4f7eba282e59..9eb402e841e3 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -547,7 +547,7 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I bool OReportSection::handleKeyEvent(const KeyEvent& _rEvent) { - return m_pFunc.get() && m_pFunc->handleKeyEvent(_rEvent); + return m_pFunc && m_pFunc->handleKeyEvent(_rEvent); } void OReportSection::deactivateOle() diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 3a9c00f1ee80..edc4e78e665a 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -294,7 +294,7 @@ uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const Sdr aSets.push_back(CreateComponentPair(pObj)); // next element - pCurrent = pGroupIterator.get() && pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; } } return uno::Sequence< Reference<uno::XInterface> >(aSets.data(), aSets.size()); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0e8555687ae2..6e277f10a284 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -988,7 +988,7 @@ public: const OUString& aFileName, const OUString& aTabName ); - bool HasExternalRefManager() const { return pExternalRefMgr.get(); } + bool HasExternalRefManager() const { return bool(pExternalRefMgr); } SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const; bool IsInExternalReferenceMarking() const; void MarkUsedExternalReferences(); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 83a80871e9ef..33c9a2b5665b 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -613,7 +613,7 @@ ScExternalRefManager* ScDocument::GetExternalRefManager() const bool ScDocument::IsInExternalReferenceMarking() const { - return pExternalRefMgr.get() && pExternalRefMgr->isInReferenceMarking(); + return pExternalRefMgr && pExternalRefMgr->isInReferenceMarking(); } void ScDocument::MarkUsedExternalReferences() @@ -1860,7 +1860,7 @@ void ScDocument::SetDocProtection(const ScDocProtection* pProtect) bool ScDocument::IsDocProtected() const { - return pDocProtection.get() && pDocProtection->isProtected(); + return pDocProtection && pDocProtection->isProtected(); } bool ScDocument::IsDocEditable() const diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index a2e4171a3be9..0b9dd891e1d1 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -2358,7 +2358,7 @@ ScDPMember* ScDPMembers::getByIndex(long nIndex) const if (maMembers.empty()) maMembers.resize(nMbrCount); - if (!maMembers[nIndex].get()) + if (!maMembers[nIndex]) { rtl::Reference<ScDPMember> pNew; long nSrcDim = pSource->GetSourceDim( nDim ); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index e063f6a83da1..dd9a36b71763 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1049,7 +1049,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const maNoteData.mxCaption->getSdrModelFromSdrObject().setLock(true); // transfer ownership of outliner object to caption, or set simple text - OSL_ENSURE( xInitData->mxOutlinerObj.get() || !xInitData->maSimpleText.isEmpty(), + OSL_ENSURE( xInitData->mxOutlinerObj || !xInitData->maSimpleText.isEmpty(), "ScPostIt::CreateCaptionFromInitData - need either outliner para object or simple text" ); if (xInitData->mxOutlinerObj) maNoteData.mxCaption->SetOutlinerParaObject( std::move(xInitData->mxOutlinerObj) ); diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index d33ccf6ddf0d..189cad4c7328 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1039,7 +1039,7 @@ void ScTable::SetPageSize( const Size& rSize ) bool ScTable::IsProtected() const { - return pTabProtection.get() && pTabProtection->isProtected(); + return pTabProtection && pTabProtection->isProtected(); } void ScTable::SetProtection(const ScTableProtection* pProtect) diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index 98d64e5446e5..70b60e8263c9 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -317,8 +317,8 @@ void ScChartListener::SetUpdateQueue() bool ScChartListener::operator==( const ScChartListener& r ) const { - bool b1 = (mpTokens.get() && !mpTokens->empty()); - bool b2 = (r.mpTokens.get() && !r.mpTokens->empty()); + bool b1 = (mpTokens && !mpTokens->empty()); + bool b2 = (r.mpTokens && !r.mpTokens->empty()); if (mpDoc != r.mpDoc || bUsed != r.bUsed || bDirty != r.bDirty || GetName() != r.GetName() || b1 != b2) diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 1760b96c70ac..c1e67ffeaf5b 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -663,7 +663,7 @@ void ExcTable::FillAsEmptyTable( SCTAB nCodeNameIdx ) void ExcTable::Write( XclExpStream& rStrm ) { SetCurrScTab( mnScTab ); - if( mxCellTable.get() ) + if( mxCellTable ) mxCellTable->Finalize(true); aRecList.Save( rStrm ); } @@ -781,7 +781,7 @@ void ExcDocument::Write( SvStream& rSvStrm ) { // set current stream position in BOUNDSHEET record ExcBoundsheetRef xBoundsheet = maBoundsheetList.GetRecord( nTab ); - if( xBoundsheet.get() ) + if( xBoundsheet ) xBoundsheet->SetStreamPos( aXclStrm.GetSvStreamPos() ); // write the table maTableList.GetRecord( nTab )->Write( aXclStrm ); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index fa6a9c2c8874..9e524944e9ea 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1363,7 +1363,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat } aScRanges.Format( msSeqRef, ScRefFlags::VALID, GetDoc(), formula::FormulaGrammar::CONV_XL_OOX, ' ', true ); - if(!aExtEntries.empty() && xExtLst.get()) + if(!aExtEntries.empty() && xExtLst) { XclExpExt* pParent = xExtLst->GetItem( XclExpExtDataBarType ); if( !pParent ) @@ -1930,7 +1930,7 @@ void XclExpDval::SaveXml( XclExpXmlStream& rStrm ) XclExpDV& XclExpDval::SearchOrCreateDv( sal_uLong nScHandle ) { // test last found record - if( mxLastFoundDV.get() && (mxLastFoundDV->GetScHandle() == nScHandle) ) + if( mxLastFoundDV && (mxLastFoundDV->GetScHandle() == nScHandle) ) return *mxLastFoundDV; // binary search diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index b4a41c8a06b1..82aa24262314 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1559,7 +1559,7 @@ void XclExpObjectManager::InitStream( bool bTempFile ) } } - if( !mxDffStrm.get() ) + if( !mxDffStrm ) mxDffStrm = std::make_unique<SvMemoryStream>(); mxDffStrm->SetEndian( SvStreamEndian::LITTLE ); diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 41c531264b15..aea06c72157b 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -378,7 +378,7 @@ void XclExpPageSettings::Save( XclExpStream& rStrm ) XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).Save( rStrm ); XclExpSetup( maData ).Save( rStrm ); - if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem.get() ) + if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem ) if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() ) XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm ); } diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index b7775bf24cc0..67ec6c1cf11e 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -317,9 +317,9 @@ OUString XclImpHyperlink::ReadEmbeddedData( XclImpStream& rStrm ) OSL_ENSURE( rStrm.GetRecLeft() == 0, "XclImpHyperlink::ReadEmbeddedData - record size mismatch" ); - if (!xLongName && xShortName.get()) + if (!xLongName && xShortName) xLongName = std::move(xShortName); - else if (!xLongName && xTextMark.get()) + else if (!xLongName && xTextMark) xLongName.reset( new OUString ); if (xLongName) @@ -674,7 +674,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) const ScAddress aPos(rPos); //in case maRanges.Join invalidates it - if( !mxScCondFmt.get() ) + if( !mxScCondFmt ) { mxScCondFmt.reset( new ScConditionalFormat( 0/*nKey*/, &GetDoc() ) ); if(maRanges.size() > 1) @@ -689,7 +689,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) void XclImpCondFormat::Apply() { - if( mxScCondFmt.get() ) + if( mxScCondFmt ) { ScDocument& rDoc = GetDoc(); @@ -887,7 +887,7 @@ void XclImpValidationManager::ReadDV( XclImpStream& rStrm ) const ScRange& rScRange = aScRanges.front(); // aScRanges is not empty // process string list of a list validity (convert to list of string tokens) - if( xTokArr1.get() && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) ) + if( xTokArr1 && (eValMode == SC_VALID_LIST) && ::get_flag( nFlags, EXC_DV_STRINGLIST ) ) XclTokenArrayHelper::ConvertStringToList(*xTokArr1, rDoc.GetSharedStringPool(), '\n'); maDVItems.push_back( diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 6d2416557f59..e3410358896e 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -4400,7 +4400,7 @@ sal_uInt32 XclImpDffPropSet::GetPropertyValue( sal_uInt16 nPropId ) const void XclImpDffPropSet::FillToItemSet( SfxItemSet& rItemSet ) const { - if( mxMemStrm.get() ) + if( mxMemStrm ) maDffConv.ApplyAttributes( *mxMemStrm, rItemSet ); } diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index a887a5f776a4..c6ce9f58b9aa 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -413,14 +413,14 @@ XclImpExtName::~XclImpExtName() void XclImpExtName::CreateDdeData( ScDocument& rDoc, const OUString& rApplic, const OUString& rTopic ) const { ScMatrixRef xResults; - if( mxDdeMatrix.get() ) + if( mxDdeMatrix ) xResults = mxDdeMatrix->CreateScMatrix(rDoc.GetSharedStringPool()); rDoc.CreateDdeLink( rApplic, rTopic, maName, SC_DDE_DEFAULT, xResults ); } void XclImpExtName::CreateExtNameData( const ScDocument& rDoc, sal_uInt16 nFileId ) const { - if (!mxArray.get()) + if (!mxArray) return; ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager(); diff --git a/sc/source/filter/excel/xipage.cxx b/sc/source/filter/excel/xipage.cxx index db8f4377a1c2..7436c3eaed2c 100644 --- a/sc/source/filter/excel/xipage.cxx +++ b/sc/source/filter/excel/xipage.cxx @@ -248,7 +248,7 @@ void XclImpPageSettings::Finalize() sal_uInt16 nStartPage = maData.mbManualStart ? maData.mnStartPage : 0; ScfTools::PutItem( rItemSet, SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, nStartPage ), true ); - if( maData.mxBrushItem.get() ) + if( maData.mxBrushItem ) rItemSet.Put( *maData.mxBrushItem ); if( mbValidPaper ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 798dd8359ced..a4d9355864e2 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1238,7 +1238,7 @@ void XclImpXF::ReadXF( XclImpStream& rStrm ) const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) { - if( mpPattern.get() ) + if( mpPattern ) return *mpPattern; // create new pattern attribute set diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx index 1b9919d7f097..ed6ea6c1bfe0 100644 --- a/sc/source/filter/ftools/fprogressbar.cxx +++ b/sc/source/filter/ftools/fprogressbar.cxx @@ -86,7 +86,7 @@ void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment ) { mpParentProgress->SetCurrSegment( mpParentSegment ); } - else if( !mxSysProgress.get() && (mnTotalSize > 0) ) + else if( !mxSysProgress && (mnTotalSize > 0) ) { // System progress has an internal limit of ULONG_MAX/100. mnSysProgressScale = 1; @@ -121,7 +121,7 @@ void ScfProgressBar::IncreaseProgressBar( std::size_t nDelta ) mpParentProgress->ProgressAbs( nParentPos ); } // modify system progress bar - else if( mxSysProgress.get() ) + else if( mxSysProgress ) { if( nNewPos >= mnNextUnitPos ) { @@ -154,7 +154,7 @@ ScfProgressBar& ScfProgressBar::GetSegmentProgressBar( sal_Int32 nSegment ) OSL_ENSURE( !pSegment || (pSegment->mnPos == 0), "ScfProgressBar::GetSegmentProgressBar - segment already started" ); if( pSegment && (pSegment->mnPos == 0) ) { - if( !pSegment->mxProgress.get() ) + if( !pSegment->mxProgress ) pSegment->mxProgress.reset( new ScfProgressBar( *this, pSegment ) ); return *pSegment->mxProgress; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 564205bcf64e..4232fa45ad23 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1889,7 +1889,7 @@ ScHTMLTable::~ScHTMLTable() const SfxItemSet& ScHTMLTable::GetCurrItemSet() const { // first try cell item set, then row item set, then table item set - return mxDataItemSet.get() ? *mxDataItemSet : (mxRowItemSet.get() ? *mxRowItemSet : maTableItemSet); + return mxDataItemSet ? *mxDataItemSet : (mxRowItemSet ? *mxRowItemSet : maTableItemSet); } ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos ) const @@ -1905,20 +1905,20 @@ ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos ) const ScHTMLTable* ScHTMLTable::FindNestedTable( ScHTMLTableId nTableId ) const { - return mxNestedTables.get() ? mxNestedTables->FindTable( nTableId ) : nullptr; + return mxNestedTables ? mxNestedTables->FindTable( nTableId ) : nullptr; } void ScHTMLTable::PutItem( const SfxPoolItem& rItem ) { OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" ); - if( mxCurrEntry.get() && mxCurrEntry->IsEmpty() ) + if( mxCurrEntry && mxCurrEntry->IsEmpty() ) mxCurrEntry->GetItemSet().Put( rItem ); } void ScHTMLTable::PutText( const HtmlImportInfo& rInfo ) { OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PutText - no current entry" ); - if( mxCurrEntry.get() ) + if( mxCurrEntry ) { if( !mxCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) ) mxCurrEntry->AdjustStart( rInfo ); @@ -1929,7 +1929,7 @@ void ScHTMLTable::PutText( const HtmlImportInfo& rInfo ) void ScHTMLTable::InsertPara( const HtmlImportInfo& rInfo ) { - if( mxCurrEntry.get() && mbDataOn && !IsEmptyCell() ) + if( mxCurrEntry && mbDataOn && !IsEmptyCell() ) mxCurrEntry->SetImportAlways(); PushEntry( rInfo ); CreateNewEntry( rInfo ); @@ -1958,7 +1958,7 @@ void ScHTMLTable::AnchorOn() { OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" ); // don't skip entries with single hyperlinks - if( mxCurrEntry.get() ) + if( mxCurrEntry ) mxCurrEntry->SetImportAlways(); } @@ -2289,7 +2289,7 @@ ScHTMLTable::ScHTMLEntryPtr ScHTMLTable::CreateEntry() const void ScHTMLTable::CreateNewEntry( const HtmlImportInfo& rInfo ) { - OSL_ENSURE( !mxCurrEntry.get(), "ScHTMLTable::CreateNewEntry - old entry still present" ); + OSL_ENSURE( !mxCurrEntry, "ScHTMLTable::CreateNewEntry - old entry still present" ); mxCurrEntry = CreateEntry(); mxCurrEntry->aSel = rInfo.aSelection; } @@ -2305,7 +2305,7 @@ void ScHTMLTable::ImplPushEntryToVector( ScHTMLEntryVector& rEntryVector, ScHTML bool ScHTMLTable::PushEntry( ScHTMLEntryPtr& rxEntry ) { bool bPushed = false; - if( rxEntry.get() && rxEntry->HasContents() ) + if( rxEntry && rxEntry->HasContents() ) { if( mpCurrEntryVector ) { @@ -2334,7 +2334,7 @@ bool ScHTMLTable::PushEntry( const HtmlImportInfo& rInfo, bool bLastInCell ) { OSL_ENSURE( mxCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" ); bool bPushed = false; - if( mxCurrEntry.get() ) + if( mxCurrEntry ) { mxCurrEntry->AdjustEnd( rInfo ); mxCurrEntry->Strip( mrEditEngine ); @@ -2366,7 +2366,7 @@ void ScHTMLTable::PushTableEntry( ScHTMLTableId nTableId ) ScHTMLTable* ScHTMLTable::GetExistingTable( ScHTMLTableId nTableId ) const { - ScHTMLTable* pTable = ((nTableId != SC_HTML_GLOBAL_TABLE) && mxNestedTables.get()) ? + ScHTMLTable* pTable = ((nTableId != SC_HTML_GLOBAL_TABLE) && mxNestedTables) ? mxNestedTables->FindTable( nTableId, false ) : nullptr; OSL_ENSURE( pTable || (nTableId == SC_HTML_GLOBAL_TABLE), "ScHTMLTable::GetExistingTable - table not found" ); return pTable; @@ -2374,7 +2374,7 @@ ScHTMLTable* ScHTMLTable::GetExistingTable( ScHTMLTableId nTableId ) const ScHTMLTable* ScHTMLTable::InsertNestedTable( const HtmlImportInfo& rInfo, bool bPreFormText ) { - if( !mxNestedTables.get() ) + if( !mxNestedTables ) mxNestedTables.reset( new ScHTMLTableMap( *this ) ); if( bPreFormText ) // enclose new preformatted table with empty lines InsertLeadingEmptyLine(); diff --git a/sc/source/filter/oox/connectionsbuffer.cxx b/sc/source/filter/oox/connectionsbuffer.cxx index 1959f6ea155c..165772fefc3a 100644 --- a/sc/source/filter/oox/connectionsbuffer.cxx +++ b/sc/source/filter/oox/connectionsbuffer.cxx @@ -99,7 +99,7 @@ ConnectionModel::ConnectionModel() : WebPrModel& ConnectionModel::createWebPr() { - OSL_ENSURE( !mxWebPr.get(), "ConnectionModel::createWebPr - multiple call" ); + OSL_ENSURE( !mxWebPr, "ConnectionModel::createWebPr - multiple call" ); mxWebPr.reset( new WebPrModel ); return *mxWebPr; } @@ -154,7 +154,7 @@ void Connection::importWebPr( const AttributeList& rAttribs ) void Connection::importTables() { - if( maModel.mxWebPr.get() ) + if( maModel.mxWebPr ) { OSL_ENSURE( maModel.mxWebPr->maTables.empty(), "Connection::importTables - multiple calls" ); maModel.mxWebPr->maTables.clear(); @@ -163,7 +163,7 @@ void Connection::importTables() void Connection::importTable( const AttributeList& rAttribs, sal_Int32 nElement ) { - if( maModel.mxWebPr.get() ) + if( maModel.mxWebPr ) { Any aTableAny; switch( nElement ) @@ -250,7 +250,7 @@ void Connection::importWebPr( SequenceInputStream& rStrm ) void Connection::importWebPrTables( SequenceInputStream& /*rStrm*/ ) { - if( maModel.mxWebPr.get() ) + if( maModel.mxWebPr ) { OSL_ENSURE( maModel.mxWebPr->maTables.empty(), "Connection::importWebPrTables - multiple calls" ); maModel.mxWebPr->maTables.clear(); @@ -259,7 +259,7 @@ void Connection::importWebPrTables( SequenceInputStream& /*rStrm*/ ) void Connection::importWebPrTable( SequenceInputStream& rStrm, sal_Int32 nRecId ) { - if( maModel.mxWebPr.get() ) + if( maModel.mxWebPr ) { Any aTableAny; switch( nRecId ) diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 4fb6cfaacca2..800d52ef769c 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -173,7 +173,7 @@ ContextHandlerRef GroupShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { ContextHandlerRef xContext = createShapeContext( *this, *this, nElement, rAttribs, mpGroupShapePtr ); - return xContext.get() ? xContext.get() : ShapeGroupContext::onCreateContext( nElement, rAttribs ); + return xContext ? xContext : ShapeGroupContext::onCreateContext( nElement, rAttribs ); } DrawingFragment::DrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : @@ -212,9 +212,9 @@ ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const At case XDR_TOKEN( from ): case XDR_TOKEN( to ): return this; - case XDR_TOKEN( pos ): if( mxAnchor.get() ) mxAnchor->importPos( rAttribs ); break; - case XDR_TOKEN( ext ): if( mxAnchor.get() ) mxAnchor->importExt( rAttribs ); break; - case XDR_TOKEN( clientData ): if( mxAnchor.get() ) mxAnchor->importClientData( rAttribs ); break; + case XDR_TOKEN( pos ): if( mxAnchor ) mxAnchor->importPos( rAttribs ); break; + case XDR_TOKEN( ext ): if( mxAnchor ) mxAnchor->importExt( rAttribs ); break; + case XDR_TOKEN( clientData ): if( mxAnchor ) mxAnchor->importClientData( rAttribs ); break; default: return GroupShapeContext::createShapeContext( *this, *this, nElement, rAttribs, ShapePtr(), &mxShape ); } @@ -243,7 +243,7 @@ void DrawingFragment::onCharacters( const OUString& rChars ) case XDR_TOKEN( row ): case XDR_TOKEN( colOff ): case XDR_TOKEN( rowOff ): - if( mxAnchor.get() ) mxAnchor->setCellPos( getCurrentElement(), getParentElement(), rChars ); + if( mxAnchor ) mxAnchor->setCellPos( getCurrentElement(), getParentElement(), rChars ); break; } } @@ -255,7 +255,7 @@ void DrawingFragment::onEndElement() case XDR_TOKEN( absoluteAnchor ): case XDR_TOKEN( oneCellAnchor ): case XDR_TOKEN( twoCellAnchor ): - if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() ) + if( mxDrawPage.is() && mxShape.get() && mxAnchor ) { // Rotation is decided by orientation of shape determined // by the anchor position given by 'editAs="oneCell"' diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index d564806cd41c..de613565fd0f 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2127,7 +2127,7 @@ void Xf::writeToDoc( ScDocumentImport& rDoc, const ScRange& rRange ) const ::ScPatternAttr& Xf::createPattern( bool bSkipPoolDefs ) { - if( mpPattern.get() ) + if( mpPattern ) return *mpPattern; mpPattern.reset( new ::ScPatternAttr( getScDocument().GetPool() ) ); SfxItemSet& rItemSet = mpPattern->GetItemSet(); diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 3e909f3c309c..2223d3cb692b 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -524,7 +524,7 @@ void WorkbookGlobals::initialize() mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY ); OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" ); - if (mxDoc.get()) + if (mxDoc) { ScModelObj* pModel = dynamic_cast<ScModelObj*>(mxDoc.get()); if (pModel) diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index b53fe46c7146..e397192ceaea 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1234,7 +1234,7 @@ void ScXMLTableRowCellContext::AddTextAndValueCell( const ScAddress& rCellPos, } else { - if (!bWasEmpty || mxAnnotationData.get()) + if (!bWasEmpty || mxAnnotationData) { if (rCurrentPos.Row() > pDoc->MaxRow()) rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW); @@ -1316,7 +1316,7 @@ void ScXMLTableRowCellContext::AddNonFormulaCell( const ScAddress& rCellPos ) } ScAddress aCurrentPos( rCellPos ); - if( mxAnnotationData.get() || pDetectiveObjVec || pCellRangeSource ) // has special content + if( mxAnnotationData || pDetectiveObjVec || pCellRangeSource ) // has special content bIsEmpty = false; AddTextAndValueCell( rCellPos, pOUText, aCurrentPos ); diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index d2ae0c88ec4d..4dfc5848a0b3 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -489,7 +489,7 @@ ScChildrenShapes::GetAccessibleCaption (const css::uno::Reference < css::drawing return nullptr; ScAccessibleShapeData* pShape = it->second; css::uno::Reference< css::accessibility::XAccessible > xNewChild( pShape->pAccShape.get() ); - if(xNewChild.get()) + if(xNewChild) return xNewChild; return nullptr; } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 60c4928ef5e1..1d37e821be18 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1359,7 +1359,7 @@ void ScAccessibleCsvTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { mpWindow = nullptr; mpEditEngine = nullptr; - if (mpViewForwarder.get()) + if (mpViewForwarder) mpViewForwarder->SetInvalid(); } ScAccessibleTextData::Notify( rBC, rHint ); @@ -1376,7 +1376,7 @@ SvxTextForwarder* ScAccessibleCsvTextData::GetTextForwarder() { mpEditEngine->SetPaperSize( maCellSize ); mpEditEngine->SetText( maCellText ); - if( !mpTextForwarder.get() ) + if( !mpTextForwarder ) mpTextForwarder.reset( new SvxEditEngineForwarder( *mpEditEngine ) ); } else @@ -1386,7 +1386,7 @@ SvxTextForwarder* ScAccessibleCsvTextData::GetTextForwarder() SvxViewForwarder* ScAccessibleCsvTextData::GetViewForwarder() { - if( !mpViewForwarder.get() ) + if( !mpViewForwarder ) mpViewForwarder.reset( new ScCsvViewForwarder( mpWindow ) ); return mpViewForwarder.get(); } diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index d892e8015443..f6cc3fef223d 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -2025,7 +2025,7 @@ void ScCheckListMenuWindow::launch(const tools::Rectangle& rRect) void ScCheckListMenuWindow::close(bool bOK) { - if (bOK && mpOKAction.get()) + if (bOK && mpOKAction) mpOKAction->execute(); EndPopupMode(); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index a5149123db4f..e9663dc3ff9c 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -177,7 +177,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr) { m_bHighlightRef=true; ScViewData* pViewData=ScDocShell::GetViewData(); - if ( pViewData && m_pRefComp.get() ) + if ( pViewData && m_pRefComp ) { ScTabViewShell* pTabViewShell=pViewData->GetViewShell(); SCCOL nCol = pViewData->GetCurX(); diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 638ed247be6c..f1336a641b97 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -453,7 +453,7 @@ bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, const EditTextObject* pTextOb aSel.nStartPos = aSel.nEndPos; aSel.nEndPos++; std::unique_ptr< EditTextObject > pPageObj = pEngine->CreateTextObject(aSel); - if(pPageObj.get() && pPageObj->IsFieldObject() ) + if(pPageObj && pPageObj->IsFieldObject() ) { const SvxFieldItem* pFieldItem = pPageObj->GetField(); if(pFieldItem) diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 47e39f038c68..1c5854479125 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -706,7 +706,7 @@ void Chart2Positioner::calcGlueState(SCCOL nColSize, SCROW nRowSize) void Chart2Positioner::createPositionMap() { - if (meGlue == GLUETYPE_NA && mpPositionMap.get()) + if (meGlue == GLUETYPE_NA && mpPositionMap) mpPositionMap.reset(); if (mpPositionMap) @@ -2620,7 +2620,7 @@ sal_Int32 ScChart2DataSequence::FillCacheFromExternalRef(const ScTokenRef& pToke void ScChart2DataSequence::UpdateTokensFromRanges(const ScRangeList& rRanges) { - if (!m_pRangeIndices.get()) + if (!m_pRangeIndices) return; for ( size_t i = 0, nCount = rRanges.size(); i < nCount; ++i ) @@ -2642,7 +2642,7 @@ void ScChart2DataSequence::UpdateTokensFromRanges(const ScRangeList& rRanges) ScChart2DataSequence::ExternalRefListener* ScChart2DataSequence::GetExtRefListener() { - if (!m_pExtRefListener.get()) + if (!m_pExtRefListener) m_pExtRefListener.reset(new ExternalRefListener(*this, m_pDocument)); return m_pExtRefListener.get(); @@ -2650,7 +2650,7 @@ ScChart2DataSequence::ExternalRefListener* ScChart2DataSequence::GetExtRefListen void ScChart2DataSequence::StopListeningToAllExternalRefs() { - if (!m_pExtRefListener.get()) + if (!m_pExtRefListener) return; const std::unordered_set<sal_uInt16>& rFileIds = m_pExtRefListener->getAllFileIds(); @@ -2675,10 +2675,10 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r) m_aHiddenValues = r.m_aHiddenValues; m_aRole = r.m_aRole; - if (r.m_pRangeIndices.get()) + if (r.m_pRangeIndices) m_pRangeIndices.reset(new vector<sal_uInt32>(*r.m_pRangeIndices)); - if (r.m_pExtRefListener.get()) + if (r.m_pExtRefListener) { // Re-register all external files that the old instance was // listening to. @@ -2751,7 +2751,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint // The hint object provides the old ranges. Restore the old state // from these ranges. - if (!m_pRangeIndices.get() || m_pRangeIndices->empty()) + if (!m_pRangeIndices || m_pRangeIndices->empty()) { OSL_FAIL(" faulty range indices"); break; @@ -3229,7 +3229,7 @@ void SAL_CALL ScChart2DataSequence::removeModifyListener( const uno::Reference< if (m_pValueListener) m_pValueListener->EndListeningAll(); - if (m_pHiddenListener.get() && m_pDocument) + if (m_pHiddenListener && m_pDocument) { ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection(); if (pCLC) diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index 2bb6b2be5285..51e2d9edd728 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -620,7 +620,7 @@ void SAL_CALL ScVbaEventsHelper::notifyEvent( const css::document::EventObject& else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::VIEWCREATED ) ) { uno::Reference< frame::XController > xController( mxModel->getCurrentController() ); - if( mxListener.get() && xController.is() ) + if( mxListener && xController.is() ) mxListener->startControllerListening( xController ); } VbaEventsHelperBase::notifyEvent( rEvent ); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index e742b073bff8..d3a385752375 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -71,7 +71,7 @@ void ScSpellDialogChildWindow::InvalidateSpellDialog() svx::SpellPortions ScSpellDialogChildWindow::GetNextWrongSentence( bool /*bRecheck*/ ) { svx::SpellPortions aPortions; - if( mxEngine.get() && mpViewData ) + if( mxEngine && mpViewData ) { if( EditView* pEditView = mpViewData->GetSpellingView() ) { @@ -90,7 +90,7 @@ svx::SpellPortions ScSpellDialogChildWindow::GetNextWrongSentence( bool /*bReche void ScSpellDialogChildWindow::ApplyChangedSentence( const svx::SpellPortions& rChanged, bool bRecheck ) { - if( mxEngine.get() && mpViewData ) + if( mxEngine && mpViewData ) if( EditView* pEditView = mpViewData->GetSpellingView() ) { mxEngine->ApplyChangedSentence( *pEditView, rChanged, bRecheck ); @@ -122,7 +122,7 @@ void ScSpellDialogChildWindow::Reset() { if( mpViewShell && (mpViewShell == dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() )) ) { - if( mxEngine.get() && mxEngine->IsAnyModified() ) + if( mxEngine && mxEngine->IsAnyModified() ) { const ScAddress& rCursor = mxOldSel->GetCellCursor(); SCTAB nTab = rCursor.Tab(); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index fa8c8d854460..b8aa16165e24 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1650,7 +1650,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, // available to them. bool bInstalledScTabViewObjAsTempController = false; uno::Reference<frame::XController> xCurrentController(GetViewData().GetDocShell()->GetModel()->getCurrentController()); - if (!xCurrentController.get()) + if (!xCurrentController) { //GetController here returns the ScTabViewObj above GetViewData().GetDocShell()->GetModel()->setCurrentController(GetController()); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index f4462eb7262c..0fddf7862b82 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -819,10 +819,10 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : SCTAB nTableCount = pDoc->GetTableCount(); EnsureTabDataSize(nTableCount); - for ( auto &it : maTabData ) + for ( auto & xTabData : maTabData ) { - if (it.get()) - it->InitData( pDoc ); + if (xTabData) + xTabData->InitData( pDoc ); } } @@ -833,10 +833,10 @@ void ScViewData::InitData( ScDocument* pDocument ) { pDoc = pDocument; *pOptions = pDoc->GetViewOptions(); - for ( auto &it : maTabData ) + for ( auto & xTabData : maTabData ) { - if (it.get()) - it->InitData( pDocument ); + if (xTabData) + xTabData->InitData( pDocument ); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 26c672cb64f3..179d580e4a81 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1578,7 +1578,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( pDoc->CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc, true, bAsLink, false, bSkipEmpty); - if (pMixDoc.get()) + if (pMixDoc) pDoc->MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get()); AdjustBlockHeight(); // update row heights before pasting objects @@ -1737,7 +1737,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( false, false, true, bSkipEmpty); } - if (pMixDoc.get()) + if (pMixDoc) { for (size_t i = 0, n = aRanges.size(); i < n; ++i) pDoc->MixDocument(aRanges[i], nFunction, bSkipEmpty, pMixDoc.get()); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 13d54a55bb6c..15f952e7ad55 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -2647,7 +2647,7 @@ OUString HtmlExport::CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const // export navigation graphics from button set void HtmlExport::CreateBitmaps() { - if(mnButtonThema == -1 || !mpButtonSet.get()) + if(mnButtonThema == -1 || !mpButtonSet) return; for( int nButton = 0; nButton != SAL_N_ELEMENTS(pButtonNames); nButton++ ) diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 098a2a816cd7..67d6366de7db 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -553,7 +553,7 @@ void AnnotationTag::OpenPopup( bool bEdit ) if( !mxAnnotation.is() ) return; - if( !mpAnnotationWindow.get() ) + if( !mpAnnotationWindow ) { vcl::Window* pWindow = dynamic_cast< vcl::Window* >( getView().GetFirstOutputDevice() ); if( pWindow ) @@ -583,13 +583,13 @@ void AnnotationTag::OpenPopup( bool bEdit ) } } - if( bEdit && mpAnnotationWindow.get() ) + if( bEdit && mpAnnotationWindow ) mpAnnotationWindow->StartEdit(); } void AnnotationTag::ClosePopup() { - if( mpAnnotationWindow.get()) + if( mpAnnotationWindow ) { mpAnnotationWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); mpAnnotationWindow->Deactivate(); diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 95dc91b232f2..3779feec3f82 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -348,7 +348,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest& pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) ); } - if (pTempSet.get() && pStyleSheet) + if (pTempSet && pStyleSheet) { pStyleSheet->AdjustToFontHeight(*pTempSet); diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx index eaf7e0a3b7cf..2762342abdce 100644 --- a/sd/source/ui/slideshow/showwin.cxx +++ b/sd/source/ui/slideshow/showwin.cxx @@ -603,7 +603,7 @@ css::uno::Reference<css::accessibility::XAccessible> ShowWindow::CreateAccessible() { css::uno::Reference< css::accessibility::XAccessible > xAcc = GetAccessible(false); - if (xAcc.get()) + if (xAcc) { return xAcc; } diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 44a04b7728fb..aae9af937627 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -255,7 +255,7 @@ css::uno::Reference<css::accessibility::XAccessible> void SlideSorterViewShell::SwitchViewFireFocus(const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) { - if (xAcc.get()) + if (xAcc) { ::accessibility::AccessibleSlideSorterView* pBase = static_cast< ::accessibility::AccessibleSlideSorterView* >(xAcc.get()); if (pBase) diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 735b836875f7..544dca087d9e 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1146,7 +1146,7 @@ SdPage* OutlineView::GetActualPage() DBG_ASSERT( pCurrent || (mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->IsDoing()) || - maDragAndDropModelGuard.get(), + maDragAndDropModelGuard, "sd::OutlineView::GetActualPage(), no current page?" ); if( pCurrent ) diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index f7bb298d2b60..1c06ad1762f4 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -957,7 +957,7 @@ css::uno::Reference<css::accessibility::XAccessible> return vcl::Window::CreateAccessible (); } css::uno::Reference< css::accessibility::XAccessible > xAcc = GetAccessible(false); - if (xAcc.get()) + if (xAcc) { return xAcc; } diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 3dc5260944a2..a1d6cdc1b30c 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -314,7 +314,7 @@ bool ChangePlaceholderTag::MouseButtonDown( const MouseEvent& /*rMEvt*/, SmartHd { sal_uInt16 nSID = gButtonSlots[nHighlightId]; - if( mxPlaceholderObj.get() ) + if( mxPlaceholderObj ) { // mark placeholder if it is not currently marked (or if also others are marked) if( !mrView.IsObjMarked( mxPlaceholderObj.get() ) || (mrView.GetMarkedObjectList().GetMarkCount() != 1) ) diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 97719c049e32..ca99e3f7a214 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1540,7 +1540,7 @@ bool ViewShell::RelocateToParentWindow (vcl::Window* pParentWindow) void ViewShell::SwitchViewFireFocus(const css::uno::Reference< css::accessibility::XAccessible >& xAcc ) { - if (xAcc.get()) + if (xAcc) { ::accessibility::AccessibleDocumentViewBase* pBase = static_cast< ::accessibility::AccessibleDocumentViewBase* >(xAcc.get()); if (pBase) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7c4f73867d31..e39033880c0e 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2395,7 +2395,7 @@ sal_Int16 FileDialogHelper::GetDialogType() const { return mpImpl ? mpImpl->m_nD bool FileDialogHelper::IsPasswordEnabled() const { - return mpImpl.get() && mpImpl->isPasswordEnabled(); + return mpImpl && mpImpl->isPasswordEnabled(); } OUString FileDialogHelper::GetRealFilter() const diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 86764e760ebe..3bb958246670 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1439,7 +1439,7 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); ScopedVclPtr<VclAbstractDialog> pScriptErrDlg( pFact->CreateScriptErrorDialog( aException ) ); - if ( pScriptErrDlg.get() ) + if ( pScriptErrDlg ) pScriptErrDlg->Execute(); } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 36ec8cb7adc4..4cee94d0d95c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3919,7 +3919,7 @@ OUString SAL_CALL SfxBaseModel::getTitle() SfxModelGuard aGuard( *this ); OUString aResult = impl_getTitleHelper()->getTitle (); - if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell.get() ) + if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell ) { SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); if ( pMedium ) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 5876c468d730..08606a83f9dc 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1218,7 +1218,7 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu, bool) void SidebarController::RequestCloseDeck() { - if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get()) + if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck) { const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); auto pMobileNotifier = SfxViewShell::Current(); @@ -1243,7 +1243,7 @@ void SidebarController::RequestCloseDeck() mbIsDeckRequestedOpen = false; UpdateDeckOpenState(); - if (!mpCurrentDeck.get()) + if (!mpCurrentDeck) mpTabBar->RemoveDeckHighlight(); } diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx index c60be299752a..b9aa8326a438 100644 --- a/slideshow/source/engine/opengl/TransitionerImpl.cxx +++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx @@ -375,7 +375,7 @@ void OGLTransitionerImpl::setSlides( const uno::Reference< rendering::XBitmap >& css::uno::Reference<css::beans::XFastPropertySet> xLeavingFastPropertySet(mxLeavingBitmap, css::uno::UNO_QUERY); css::uno::Sequence<css::uno::Any> aEnteringBitmap; css::uno::Sequence<css::uno::Any> aLeavingBitmap; - if (xEnteringFastPropertySet.get() && xLeavingFastPropertySet.get()) + if (xEnteringFastPropertySet && xLeavingFastPropertySet) { xEnteringFastPropertySet->getFastPropertyValue(1) >>= aEnteringBitmap; xLeavingFastPropertySet->getFastPropertyValue(1) >>= aLeavingBitmap; diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index d2a92580aeef..2d508f8b9c30 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -150,7 +150,7 @@ namespace slideshow::internal if( !pCanvas ) return false; - if( !mpMediaWindow.get() && !mxPlayerWindow.is() ) + if( !mpMediaWindow && !mxPlayerWindow.is() ) { uno::Reference< graphic::XGraphic > xGraphic; uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY ); @@ -235,7 +235,7 @@ namespace slideshow::internal const Size aSizePixel( rRangePix.getMaxX() - rRangePix.getMinX(), rRangePix.getMaxY() - rRangePix.getMinY() ); - if( mpMediaWindow.get() ) + if( mpMediaWindow ) { mpMediaWindow->SetPosSizePixel( aPosPixel, aSizePixel ); mxPlayerWindow->setPosSize( 0, 0, @@ -384,7 +384,7 @@ namespace slideshow::internal const OUString& ) { SAL_INFO("slideshow", "ViewMediaShape::implInitializePlayerWindow" ); - if( mpMediaWindow.get() || rBounds.isEmpty() ) + if( mpMediaWindow || rBounds.isEmpty() ) return; try diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 80fd67f347a8..59a00d31038d 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -76,6 +76,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/simplifybool \ compilerplugins/clang/test/simplifyconstruct \ compilerplugins/clang/test/simplifydynamiccast \ + compilerplugins/clang/test/simplifypointertobool \ compilerplugins/clang/test/singlevalfields \ compilerplugins/clang/test/staticconstfield \ compilerplugins/clang/test/staticvar \ diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 2806dc5a3693..91de98023c48 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -373,7 +373,7 @@ storeError FileLockBytes::readPageAt_Impl (std::shared_ptr<PageData> & rPage, sa if (!m_xAllocator.is()) return store_E_InvalidAccess; - if (!rPage.get()) + if (!rPage) return store_E_OutOfMemory; PageData * pagedata = rPage.get(); @@ -724,7 +724,7 @@ storeError MemoryLockBytes::readPageAt_Impl (std::shared_ptr<PageData> & rPage, if (!m_xAllocator.is()) return store_E_InvalidAccess; - if (!rPage.get()) + if (!rPage) return store_E_OutOfMemory; PageData * pagedata = rPage.get(); diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 09b0e88b2ae5..a5245de7380e 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -570,7 +570,7 @@ public: return store_E_InvalidAccess; std::shared_ptr<PageData> tmp (rxAllocator->construct<U>(), PageData::Deallocate(rxAllocator)); - if (!tmp.get()) + if (!tmp) return store_E_OutOfMemory; m_xPage.swap (tmp); diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx index a7089165309f..ea3efeaeb5f0 100644 --- a/svl/source/items/stylepool.cxx +++ b/svl/source/items/stylepool.cxx @@ -400,8 +400,7 @@ std::shared_ptr<SfxItemSet> StylePoolImpl::insertItemSet( const SfxItemSet& rSet } pItem = aIter.NextItem(); } - if ( xFoundIgnorableItems.get() && - xFoundIgnorableItems->Count() > 0 ) + if ( xFoundIgnorableItems && xFoundIgnorableItems->Count() > 0 ) { SfxItemIter aIgnorableItemsIter( *xFoundIgnorableItems ); pItem = aIgnorableItemsIter.GetCurItem(); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index f1b65e0565b5..e195f195f48d 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -167,7 +167,7 @@ size_t ValueSet::ImplGetItem( const Point& rPos ) const return VALUESET_ITEM_NOTFOUND; } - if (mpNoneItem.get() && maNoneItemRect.IsInside(rPos)) + if (mpNoneItem && maNoneItemRect.IsInside(rPos)) { return VALUESET_ITEM_NONEITEM; } diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index 981cfdf36214..a775d572b254 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -829,7 +829,7 @@ void SAL_CALL AccessibleControlShape::elementInserted( const css::container::Con Reference< XInterface > xNewNormalized( xControl->getModel(), UNO_QUERY ); Reference< XInterface > xMyModelNormalized( m_xControlModel, UNO_QUERY ); - if ( xNewNormalized.get() && xMyModelNormalized.get() ) + if ( xNewNormalized && xMyModelNormalized ) { // now finally the control for the model we're responsible for has been inserted into the container Reference< XInterface > xKeepAlive( *this ); diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 7a8598cc1806..e1426d239c67 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -303,7 +303,7 @@ namespace accessibility const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr ); if( pSdrHint && pSdrHint->GetKind() == SdrHintKind::BeginEdit && - &mrObj == pSdrHint->GetObject() && mpEditSource.get() ) + &mrObj == pSdrHint->GetObject() && mpEditSource ) { // switch edit source, if not yet done. This is necessary // to become a full-fledged EditSource the first time a diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index c96b97282305..6842d7655544 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -365,7 +365,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL //this mxshape is the captioned shape uno::Sequence< uno::Reference< uno::XInterface > > aSequence { mpParent->GetAccessibleCaption(mxShape) }; - if(aSequence[0].get()) + if(aSequence[0]) { pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) ); diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx index 49fdc2552a6f..b6e1387aba50 100644 --- a/svx/source/core/extedit.cxx +++ b/svx/source/core/extedit.cxx @@ -60,7 +60,7 @@ void ExternalToolEdit::HandleCloseEvent(ExternalToolEdit* pData) void ExternalToolEdit::StartListeningEvent() { //Start an event listener implemented via VCL timeout - assert(!m_pChecker.get()); + assert(!m_pChecker); m_pChecker.reset(new FileChangedChecker( m_aFileName, [this] () { return HandleCloseEvent(this); })); } diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 32a6b3d9576e..1e53d7a3ab55 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -437,7 +437,7 @@ void SvxRuler::UpdateFrame() mxRulerImpl->aProtectItem->IsPosProtected() ) ? RulerMarginStyle::NONE : RulerMarginStyle::Sizeable; - if(mxLRSpaceItem.get() && mxPagePosItem.get()) + if(mxLRSpaceItem && mxPagePosItem) { // if no initialization by default app behavior const long nOld = lLogicNullOffset; @@ -462,7 +462,7 @@ void SvxRuler::UpdateFrame() long lRight = 0; // evaluate the table right edge of the table - if(mxColumnItem.get() && mxColumnItem->IsTable()) + if(mxColumnItem && mxColumnItem->IsTable()) lRight = mxColumnItem->GetRight(); else lRight = mxLRSpaceItem->GetRight(); @@ -472,7 +472,7 @@ void SvxRuler::UpdateFrame() SetMargin2(aWidthPixel, nMarginStyle); } - else if(mxULSpaceItem.get() && mxPagePosItem.get()) + else if(mxULSpaceItem && mxPagePosItem) { // relative the upper edge of the surrounding frame const long nOld = lLogicNullOffset; @@ -709,7 +709,7 @@ void SvxRuler::Update( if(!bHorz && !mxRulerImpl->bIsTableRows) mxColumnItem->SetWhich(SID_RULER_BORDERS_VERTICAL); } - else if(mxColumnItem.get() && mxColumnItem->Which() == nSID) + else if(mxColumnItem && mxColumnItem->Which() == nSID) //there are two groups of column items table/frame columns and table rows //both can occur in vertical or horizontal mode //the horizontal ruler handles the SID_RULER_BORDERS and SID_RULER_ROWS_VERTICAL @@ -728,7 +728,7 @@ void SvxRuler::Update( void SvxRuler::UpdateColumns() { /* Update column view */ - if(mxColumnItem.get() && mxColumnItem->Count() > 1) + if(mxColumnItem && mxColumnItem->Count() > 1) { mpBorders.resize(mxColumnItem->Count()); @@ -821,7 +821,7 @@ void SvxRuler::UpdatePara() */ // Dependence on PagePosItem - if (mxParaItem.get() && mxPagePosItem.get() && !mxObjectItem) + if (mxParaItem && mxPagePosItem && !mxObjectItem) { bool bRTLText = mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue(); // First-line indent is negative to the left paragraph margin @@ -997,7 +997,7 @@ void SvxRuler::UpdateTabs() if(IsDrag()) return; - if (mxPagePosItem.get() && mxParaItem.get() && mxTabStopItem.get() && !mxObjectItem) + if (mxPagePosItem && mxParaItem && mxTabStopItem && !mxObjectItem) { // buffer for DefaultTabStop // Distance last Tab <-> Right paragraph margin / DefaultTabDist @@ -1198,7 +1198,7 @@ long SvxRuler::GetLeftFrameMargin() const DBG_ASSERT(!mxColumnItem || mxColumnItem->GetActColumn() < mxColumnItem->Count(), "issue #126721# - invalid current column!"); long nLeft = 0; - if (mxColumnItem.get() && + if (mxColumnItem && mxColumnItem->Count() && mxColumnItem->IsConsistent()) { @@ -1249,11 +1249,11 @@ long SvxRuler::GetRightFrameMargin() const long lResult = lLogicNullOffset; // If possible deduct right table entry - if(mxColumnItem.get() && mxColumnItem->IsTable()) + if(mxColumnItem && mxColumnItem->IsTable()) lResult += mxColumnItem->GetRight(); - else if(bHorz && mxLRSpaceItem.get()) + else if(bHorz && mxLRSpaceItem) lResult += mxLRSpaceItem->GetRight(); - else if(!bHorz && mxULSpaceItem.get()) + else if(!bHorz && mxULSpaceItem) lResult += mxULSpaceItem->GetLower(); if(bHorz) @@ -1266,7 +1266,7 @@ long SvxRuler::GetRightFrameMargin() const #define NEG_FLAG ( (nFlags & SvxRulerSupportFlags::NEGATIVE_MARGINS) == \ SvxRulerSupportFlags::NEGATIVE_MARGINS ) -#define TAB_FLAG ( mxColumnItem.get() && mxColumnItem->IsTable() ) +#define TAB_FLAG ( mxColumnItem && mxColumnItem->IsTable() ) long SvxRuler::GetCorrectedDragPos( bool bLeft, bool bRight ) { @@ -1311,7 +1311,7 @@ void SvxRuler::DragMargin1() return; DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 3 : 7, bHorz); - if (mxColumnItem.get() && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL)) + if (mxColumnItem && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL)) DragBorders(); AdjustMargin1(aDragPosition); } @@ -1336,7 +1336,7 @@ void SvxRuler::AdjustMargin1(long lInputDiff) { SetMargin2( GetMargin2() - lDiff, nMarginStyle ); - if (!mxColumnItem && !mxObjectItem && mxParaItem.get()) + if (!mxColumnItem && !mxObjectItem && mxParaItem) { // Right indent of the old position mpIndents[INDENT_RIGHT_MARGIN].nPos -= lDiff; @@ -1372,7 +1372,7 @@ void SvxRuler::AdjustMargin1(long lInputDiff) SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); } } - if(mxTabStopItem.get() && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL) + if(mxTabStopItem && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL) &&!IsActFirstColumn()) { ModifyTabs_Impl(nTabCount + TAB_GAP, mpTabs.data(), -lDiff); @@ -1391,7 +1391,7 @@ void SvxRuler::AdjustMargin1(long lInputDiff) & (SvxRulerDragFlags::OBJECT_SIZE_LINEAR | SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL))) { - if (!mxColumnItem && !mxObjectItem && mxParaItem.get()) + if (!mxColumnItem && !mxObjectItem && mxParaItem) { // Left indent of the old position mpIndents[INDENT_FIRST_LINE].nPos += lDiff; @@ -1447,7 +1447,7 @@ void SvxRuler::DragMargin2() if( mxRulerImpl->bIsTableRows && !bHorz && - mxColumnItem.get() && + mxColumnItem && (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL)) { DragBorders(); @@ -1462,7 +1462,7 @@ void SvxRuler::DragMargin2() SetMargin2( aDragPosition, nMarginStyle ); // Right indent of the old position - if ((!mxColumnItem || IsActLastColumn()) && mxParaItem.get()) + if ((!mxColumnItem || IsActLastColumn()) && mxParaItem) { mpIndents[INDENT_FIRST_LINE].nPos += lDiff; SetIndents(INDENT_COUNT, mpIndents.data() + INDENT_GAP); @@ -2004,7 +2004,7 @@ void SvxRuler::ApplyIndents() long nLeftMargin = ConvertPosLogic(mpIndents[INDENT_LEFT_MARGIN].nPos); long nRightMargin = ConvertPosLogic(mpIndents[INDENT_RIGHT_MARGIN].nPos); - if(mxColumnItem.get() && ((bRTL && !IsActLastColumn(true)) || (!bRTL && !IsActFirstColumn(true)))) + if(mxColumnItem && ((bRTL && !IsActLastColumn(true)) || (!bRTL && !IsActFirstColumn(true)))) { if(bRTL) { @@ -2038,7 +2038,7 @@ void SvxRuler::ApplyIndents() else nNewFirstLineOffset = nFirstLine - nLeftMargin - lAppNullOffset; - if(mxColumnItem.get() && ((!bRTL && !IsActLastColumn(true)) || (bRTL && !IsActFirstColumn(true)))) + if(mxColumnItem && ((!bRTL && !IsActLastColumn(true)) || (bRTL && !IsActFirstColumn(true)))) { if(bRTL) { @@ -2440,7 +2440,7 @@ void SvxRuler::EvalModifier() ( ( RulerType::Border == eType || RulerType::Margin1 == eType || RulerType::Margin2 == eType ) && - mxColumnItem.get() ) ) + mxColumnItem ) ) { PrepareProportional_Impl(eType); } @@ -2475,7 +2475,7 @@ void SvxRuler::Click() pBindings->Update( SID_ATTR_PARA_LRSPACE_VERTICAL ); } bool bRTL = mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue(); - if(mxTabStopItem.get() && + if(mxTabStopItem && (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) { bool bContentProtected = mxRulerImpl->aProtectItem->IsContentProtected(); @@ -2564,7 +2564,7 @@ void SvxRuler::CalcMinMax() { nMaxRight = ConvertPosPixel( GetPageWidth() - ( - (mxColumnItem->IsTable() && mxLRSpaceItem.get()) + (mxColumnItem->IsTable() && mxLRSpaceItem) ? mxLRSpaceItem->GetRight() : 0)) - GetMargin2() + GetMargin1(); } @@ -2595,7 +2595,7 @@ void SvxRuler::CalcMinMax() nMaxRight += GetRightIndent() - std::max(GetFirstLineIndent(), GetLeftIndent()); } // Do not drag the left table edge over the edge of the page - if(mxLRSpaceItem.get() && mxColumnItem->IsTable()) + if(mxLRSpaceItem && mxColumnItem->IsTable()) { long nTmp=ConvertSizePixel(mxLRSpaceItem->GetLeft()); if(nTmp>nMaxLeft) @@ -2932,7 +2932,7 @@ void SvxRuler::CalcMinMax() { nMaxLeft = lNullPix + GetRightIndent(); - if(mxColumnItem.get() && !mxColumnItem->IsFirstAct()) + if(mxColumnItem && !mxColumnItem->IsFirstAct()) nMaxLeft += mpBorders[mxColumnItem->GetActColumn()-1].nPos + mpBorders[mxColumnItem->GetActColumn()-1].nWidth; nMaxRight = lNullPix + GetMargin2(); @@ -2951,7 +2951,7 @@ void SvxRuler::CalcMinMax() { nMaxLeft = lNullPix; - if(mxColumnItem.get() && !mxColumnItem->IsFirstAct()) + if(mxColumnItem && !mxColumnItem->IsFirstAct()) nMaxLeft += mpBorders[mxColumnItem->GetActColumn()-1].nPos + mpBorders[mxColumnItem->GetActColumn()-1].nWidth; nMaxRight = lNullPix + GetRightIndent() - glMinFrame; @@ -3053,7 +3053,7 @@ bool SvxRuler::StartDrag() { case RulerType::Margin1: // left edge of the surrounding Frame case RulerType::Margin2: // right edge of the surrounding Frame - if((bHorz && mxLRSpaceItem.get()) || (!bHorz && mxULSpaceItem.get())) + if((bHorz && mxLRSpaceItem) || (!bHorz && mxULSpaceItem)) { if (!mxColumnItem) EvalModifier(); @@ -3165,7 +3165,7 @@ void SvxRuler::EndDrag() if (!mxColumnItem || !mxColumnItem->IsTable()) ApplyMargins(); - if(mxColumnItem.get() && + if(mxColumnItem && (mxColumnItem->IsTable() || (nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL))) ApplyBorders(); @@ -3223,7 +3223,7 @@ void SvxRuler::ExtraDown() /* Override SV method, sets the new type for the Default tab. */ // Switch Tab Type - if(mxTabStopItem.get() && + if(mxTabStopItem && (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) { ++nDefTabType; @@ -3261,7 +3261,7 @@ IMPL_LINK( SvxRuler, MenuSelect, Menu *, pMenu, bool ) IMPL_LINK( SvxRuler, TabMenuSelect, Menu *, pMenu, bool ) { /* Handler of the tab menu for setting the type */ - if(mxTabStopItem.get() && mxTabStopItem->Count() > mxRulerImpl->nIdx) + if(mxTabStopItem && mxTabStopItem->Count() > mxRulerImpl->nIdx) { SvxTabStop aTabStop = mxTabStopItem->At(mxRulerImpl->nIdx); aTabStop.GetAdjustment() = ToAttrTab_Impl(pMenu->GetCurItemId() - 1); diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 51501bc5c807..1177e6eb3e9e 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -1111,7 +1111,7 @@ namespace svx ControlFeatures aEmpty; m_aControlFeatures.swap( aEmpty ); - if ( m_aContextMenuObserver.get() ) + if ( m_aContextMenuObserver ) { m_aContextMenuObserver->dispose(); m_aContextMenuObserver = MouseListenerAdapter(); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index c413dea2214d..1ede28ae3409 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -882,7 +882,7 @@ Reference< XFormController > FmXFormView::getFormController( const Reference< XF for (const PFormViewPageWindowAdapter& pAdapter : m_aPageWindowAdapters) { - if ( !pAdapter.get() ) + if ( !pAdapter ) { SAL_WARN( "svx.form", "FmXFormView::getFormController: invalid page window adapter!" ); continue; @@ -914,7 +914,7 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->GetForms() ) : Reference< XIndexAccess >() ); const PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; - const vcl::Window* pWindow = pAdapter.get() ? pAdapter->getWindow() : nullptr; + const vcl::Window* pWindow = pAdapter ? pAdapter->getWindow() : nullptr; ENSURE_OR_RETURN_VOID( xForms.is() && pWindow, "FmXFormView::OnAutoFocus: could not collect all essentials!" ); diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 76eb6c29e845..f83e9bafdebd 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -615,7 +615,7 @@ void AreaPropertyPanelBase::SelectFillAttrHdl_Impl() void AreaPropertyPanelBase::ImpUpdateTransparencies() { - if(mpTransparanceItem.get() || mpFloatTransparenceItem.get()) + if(mpTransparanceItem || mpFloatTransparenceItem) { bool bZeroValue(false); @@ -646,7 +646,7 @@ void AreaPropertyPanelBase::ImpUpdateTransparencies() } } - if(bZeroValue && mpFloatTransparenceItem.get()) + if(bZeroValue && mpFloatTransparenceItem) { if(mpFloatTransparenceItem->IsEnabled()) { diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 4fc4ded76971..40aacd3474fb 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2175,7 +2175,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) // multiple portions exist with multiple formats. If an OutlinerParaObject // really exists and needs to be rescued is evaluated in the undo // implementation itself. - bool bRescueText = mxTextEditObj.get(); + bool bRescueText = mxTextEditObj; AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *mxTextEditObj, false, !bNoEEItems || bRescueText)); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index c30eca131f2b..9fa0c057565e 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -205,7 +205,7 @@ SvxTableController::~SvxTableController() Application::RemoveUserEvent( mnUpdateEvent ); } - if( mxModifyListener.is() && mxTableObj.get() ) + if( mxModifyListener.is() && mxTableObj ) { Reference< XTable > xTable( mxTableObj->getTable() ); if( xTable.is() ) diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index a015d4af8561..9ec7c22f6501 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -176,7 +176,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u sal_Int32 nUserIndex = 1; const OUString aUser(SvxResId(pPrefixResId) + " "); - if( pDefaults.get() ) + if( pDefaults ) { const int nCount = pDefaults->Count(); int nIndex; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index ebe72049816e..fe2c2e1b0426 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2775,7 +2775,7 @@ void SwAccessibleMap::InvalidateFocus() if(GetShell()->IsPreview()) { uno::Reference<XAccessible> xAcc = GetDocumentView_( true ); - if (xAcc.get()) + if (xAcc) { SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview *>(xAcc.get()); if (pAccPreview) diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index e59e285d9334..c76e4417c020 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -651,9 +651,7 @@ namespace sw::mark pMark = std::make_unique<AnnotationMark>( rPaM, rName ); break; } - assert(pMark.get() && - "MarkManager::makeMark(..)" - " - Mark was not created."); + assert(pMark && "MarkManager::makeMark(..) - Mark was not created."); if(pMark->GetMarkPos() != pMark->GetMarkStart()) pMark->Swap(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d59a106f47b8..d0f6ea3d94e5 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3123,7 +3123,7 @@ OUString SwTextNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel, SwRootFrame const*const pLayout) const { - if (GetDoc()->IsClipBoard() && m_pNumStringCache.get()) + if (GetDoc()->IsClipBoard() && m_pNumStringCache) { // #i111677# do not expand number strings in clipboard documents return *m_pNumStringCache; diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 83fbf59f216c..efc6999fb7c4 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -773,7 +773,7 @@ void SwUndoAttr::RedoImpl(::sw::UndoRedoContext & rContext) } } - if ( m_pRedlineData.get() && + if ( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) { RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore ); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 71c54b541fa0..ae2ba60a31c8 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -221,7 +221,7 @@ void SwUndoInsSection::RedoImpl(::sw::UndoRedoContext & rContext) SwSectionNode *const pSectNd = rDoc.GetNodes()[ m_nSectionNodePos ]->GetSectionNode(); - if (m_pRedlData.get() && + if (m_pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags())) { RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index e5d12627ebae..9c55d12654e7 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -289,7 +289,7 @@ SwViewShell::~SwViewShell() // i#9684 Stopping the animated graphics is not // necessary during printing or pdf export, because the animation // has not been started in this case. - if( mxDoc.get() && GetWin() ) + if( mxDoc && GetWin() ) { SwNodes& rNds = mxDoc->GetNodes(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 514a5ec9e3d1..082f778dc984 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -336,12 +336,12 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS xTextMark.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm))); } - if (!xLongName && xShortName.get()) + if (!xLongName && xShortName) { xLongName.reset( new OUString ); *xLongName += *xShortName; } - else if (!xLongName && xTextMark.get()) + else if (!xLongName && xTextMark) xLongName.reset( new OUString ); if (xLongName) diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index dee7e04a6ad1..cfae69f622be 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2761,7 +2761,7 @@ void WW8TabDesc::ParkPaM() void WW8TabDesc::MoveOutsideTable() { - OSL_ENSURE(m_xTmpPos.get() && m_pIo, "I've forgotten where the table is anchored"); + OSL_ENSURE(m_xTmpPos && m_pIo, "I've forgotten where the table is anchored"); if (m_xTmpPos && m_pIo) *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2d7de4556b66..7fd6ed3abc57 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -848,7 +848,7 @@ void wwSectionManager::CreateSep(const long nTextPos) if (!pSep) return; - if (!maSegments.empty() && mrReader.m_pLastAnchorPos.get() && *mrReader.m_pLastAnchorPos == *mrReader.m_pPaM->GetPoint()) + if (!maSegments.empty() && mrReader.m_pLastAnchorPos && *mrReader.m_pLastAnchorPos == *mrReader.m_pPaM->GetPoint()) { bool insert = true; SwPaM pam( *mrReader.m_pLastAnchorPos ); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index e86630a86ece..aeb522be5fc9 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -273,7 +273,7 @@ bool SwDocShell::Save() CalcLayoutForOLEObjects(); // format for OLE objects // #i62875# // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible - if (m_pWrtShell && m_xDoc.get() && + if (m_pWrtShell && m_xDoc && m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) && docfunc::AllDrawObjsOnPage(*m_xDoc)) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 1d21764c7a0c..6886b548ba56 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -309,7 +309,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) false, &pItem )) sParent = static_cast<const SfxStringItem*>(pItem)->GetValue(); - if (sName.isEmpty() && m_xBasePool.get()) + if (sName.isEmpty() && m_xBasePool) sName = SfxStyleDialogController::GenerateUnusedName(*m_xBasePool, nFamily); Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 19ae175bc319..282f726996aa 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1587,7 +1587,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, if( IsMergeOk() && bMT_FILE ) { // save merged document - assert( aTempFile.get() ); + assert( aTempFile ); INetURLObject aTempFileURL; if (sDescriptorPrefix.isEmpty() || !rMergeDescriptor.bPrefixIsFilename) aTempFileURL.SetURL( aTempFile->GetURL() ); diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index a5eee7c4c96f..fae7d9cefc01 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -1238,7 +1238,7 @@ void SwPagePreview::CreateScrollbar( bool bHori ) vcl::Window *pMDI = &GetViewFrame()->GetWindow(); VclPtr<SwScrollbar>& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar; - assert(!ppScrollbar.get()); //check beforehand! + assert(!ppScrollbar); //check beforehand! ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori ); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index dbbfc6112146..12606618f8e2 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -298,7 +298,7 @@ void SwView::CreateScrollbar( bool bHori ) vcl::Window *pMDI = &GetViewFrame()->GetWindow(); VclPtr<SwScrollbar>& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar; - assert(!ppScrollbar.get()); //check beforehand! + assert(!ppScrollbar); //check beforehand! ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori ); UpdateScrollbars(); diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 39315dfd72fe..2a13d735b3bc 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -919,7 +919,7 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR } std::unique_ptr<SwTextBlocks> pBlock(pGlossaries->GetGroupDoc(sGroupName)); - const bool bResult = pBlock.get() && !pBlock->GetError() + const bool bResult = pBlock && !pBlock->GetError() && pDoc->InsertGlossary( *pBlock, sEntryName, InsertPaM); if(!bResult) diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index b5ff7aba5efb..655df73be012 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -252,7 +252,7 @@ sal_Bool VCLXPrinter::start( const OUString& /*rJobName*/, sal_Int16 /*nCopies*/ { ::osl::MutexGuard aGuard( Mutex ); - if (mxPrinter.get()) + if (mxPrinter) { maInitJobSetup = mxPrinter->GetJobSetup(); mxListener = std::make_shared<vcl::OldStylePrintAdaptor>(mxPrinter, nullptr); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 72e7532874ad..fc31507d93ec 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1028,7 +1028,7 @@ double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 ) const void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags ) { - DBG_ASSERT( !mpImplPolygon->mxFlagAry.get(), "Optimizing could fail with beziers!" ); + DBG_ASSERT( !mpImplPolygon->mxFlagAry, "Optimizing could fail with beziers!" ); sal_uInt16 nSize = mpImplPolygon->mnPoints; @@ -1490,7 +1490,7 @@ tools::Rectangle Polygon::GetBoundRect() const bool Polygon::IsInside( const Point& rPoint ) const { - DBG_ASSERT( !mpImplPolygon->mxFlagAry.get(), "IsInside could fail with beziers!" ); + DBG_ASSERT( !mpImplPolygon->mxFlagAry, "IsInside could fail with beziers!" ); const tools::Rectangle aBound( GetBoundRect() ); const Line aLine( rPoint, Point( aBound.Right() + 100, rPoint.Y() ) ); diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 39323337d2de..931195e35f07 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -1448,7 +1448,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { // All properties obtained already? std::vector< OUString > aMissingProps; - if ( !( xProps.get() + if ( !( xProps && xProps->containsAllNames( rProperties, aMissingProps ) ) && !m_bDidGetOrHead ) diff --git a/vcl/inc/unx/gendata.hxx b/vcl/inc/unx/gendata.hxx index 5efb34a8f73f..f06dda35cb2e 100644 --- a/vcl/inc/unx/gendata.hxx +++ b/vcl/inc/unx/gendata.hxx @@ -83,7 +83,7 @@ public: if (!m_pPrintFontManager) InitPrintFontManager(); // PrintFontManager needs the FreetypeManager - assert(m_pFreetypeManager.get()); + assert(m_pFreetypeManager); return m_pPrintFontManager.get(); } diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index ab5333498649..a57add56a292 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -415,7 +415,7 @@ void PdfExportTest::testTdf107868() SvMemoryStream aMemory; aMemory.WriteStream(aFile); DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr)); - if (!pPdfDocument.get()) + if (!pPdfDocument) // Printing to PDF failed in a non-interesting way, e.g. CUPS is not // running, there is no printer defined, etc. return; diff --git a/vcl/qt5/Qt5Bitmap.cxx b/vcl/qt5/Qt5Bitmap.cxx index b698046ae307..01c6ebc4dd2b 100644 --- a/vcl/qt5/Qt5Bitmap.cxx +++ b/vcl/qt5/Qt5Bitmap.cxx @@ -71,7 +71,7 @@ bool Qt5Bitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPale m_aPalette = rPal; auto count = rPal.GetEntryCount(); - if (nBitCount != 4 && count && m_pImage.get()) + if (nBitCount != 4 && count && m_pImage) { QVector<QRgb> aColorTable(count); for (unsigned i = 0; i < count; ++i) @@ -84,7 +84,7 @@ bool Qt5Bitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPale bool Qt5Bitmap::Create(const SalBitmap& rSalBmp) { const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp); - if (pBitmap->m_pImage.get()) + if (pBitmap->m_pImage) { m_pImage.reset(new QImage(*pBitmap->m_pImage)); m_pBuffer.reset(); @@ -124,7 +124,7 @@ bool Qt5Bitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) && "Unsupported BitCount!"); const Qt5Bitmap* pBitmap = static_cast<const Qt5Bitmap*>(&rSalBmp); - if (pBitmap->m_pBuffer.get()) + if (pBitmap->m_pBuffer) { if (nNewBitCount != 32) return false; @@ -188,18 +188,18 @@ void Qt5Bitmap::Destroy() Size Qt5Bitmap::GetSize() const { - if (m_pBuffer.get()) + if (m_pBuffer) return m_aSize; - else if (m_pImage.get()) + else if (m_pImage) return toSize(m_pImage->size()); return Size(); } sal_uInt16 Qt5Bitmap::GetBitCount() const { - if (m_pBuffer.get()) + if (m_pBuffer) return 4; - else if (m_pImage.get()) + else if (m_pImage) return getFormatBits(m_pImage->format()); return 0; } @@ -208,12 +208,12 @@ BitmapBuffer* Qt5Bitmap::AcquireBuffer(BitmapAccessMode /*nMode*/) { static const BitmapPalette aEmptyPalette; - if (!(m_pImage.get() || m_pBuffer.get())) + if (!(m_pImage || m_pBuffer)) return nullptr; BitmapBuffer* pBuffer = new BitmapBuffer; - if (m_pBuffer.get()) + if (m_pBuffer) { pBuffer->mnWidth = m_aSize.Width(); pBuffer->mnHeight = m_aSize.Height(); diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 2d780c7bd4ee..daa930ff6b82 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -308,7 +308,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() if (m_bUseCairo) { - if (!m_pOurSvpGraphics.get() || m_bGraphicsInvalid) + if (!m_pOurSvpGraphics || m_bGraphicsInvalid) { m_pOurSvpGraphics.reset(new Qt5SvpGraphics(this)); InitQt5SvpGraphics(m_pOurSvpGraphics.get()); @@ -318,7 +318,7 @@ SalGraphics* Qt5Frame::AcquireGraphics() } else { - if (!m_pQt5Graphics.get() || m_bGraphicsInvalid) + if (!m_pQt5Graphics || m_bGraphicsInvalid) { m_pQt5Graphics.reset(new Qt5Graphics(this)); m_pQImage.reset( diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index db0a09ddb2db..fe650087d026 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -962,7 +962,7 @@ IMPL_STATIC_LINK( Application, PostEventHandler, void*, pCallData, void ) break; } - if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow.get() && pEventData ) + if( pData->mpWin && pData->mpWin->mpWindowImpl->mpFrameWindow && pEventData ) ImplWindowFrameProc( pData->mpWin->mpWindowImpl->mpFrameWindow.get(), nEvent, pEventData ); // remove this event from list of posted events, watch for destruction of internal data diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index f4add8ef1bb2..cf46607f14a1 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -776,7 +776,7 @@ bool BitmapEx::Create( const css::uno::Reference< css::rendering::XBitmapCanvas const Size &rSize ) { uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY ); - if( xFastPropertySet.get() ) + if( xFastPropertySet ) { // 0 means get BitmapEx uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 ); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 5ed1f4ca33ca..cb326ae9d31a 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -795,7 +795,7 @@ void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter ) bool bSavedSizeOrientation = false; // #tdf 126744 Transfer paper size and orientation settings to newly selected printer - if ( xPrinter.get() ) + if ( xPrinter ) { aPaperSize = xPrinter->GetPaperSize(); eOrientation = xPrinter->GetOrientation(); @@ -835,7 +835,7 @@ void PrinterController::setupPrinter( weld::Window* i_pParent ) // Important to hold printer alive while doing setup etc. VclPtr< Printer > xPrinter = mpImplData->mxPrinter; - if( xPrinter.get() ) + if( xPrinter ) { xPrinter->Push(); xPrinter->SetMapMode(MapMode(MapUnit::Map100thMM)); diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx index 2f99060ac1ea..4f2cd1dfee0c 100644 --- a/vcl/source/treelist/treelist.cxx +++ b/vcl/source/treelist/treelist.cxx @@ -225,7 +225,7 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa // Release the original. std::unique_ptr<SvTreeListEntry> pOriginal(std::move(*itSrcPos)); - assert(pOriginal.get()); + assert(pOriginal); rSrc.erase(itSrcPos); // Determine the insertion position. @@ -247,7 +247,7 @@ sal_uLong SvTreeList::Move(SvTreeListEntry* pSrcEntry,SvTreeListEntry* pTargetPa std::advance(itDstPos, nListPos); } std::unique_ptr<SvTreeListEntry> pOriginal(std::move(*itSrcPos)); - assert(pOriginal.get()); + assert(pOriginal); rSrc.erase(itSrcPos); rDst.insert(itDstPos, std::move(pOriginal)); } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index e2613b3da9ec..2c77f7069456 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1495,7 +1495,7 @@ bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt) pSVData->mpWinData->mpLastWheelWindow = Dispatch(xMouseWindow); - return pSVData->mpWinData->mpLastWheelWindow.get(); + return pSVData->mpWinData->mpLastWheelWindow; } namespace { diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx index 96b437c0ed98..01a5e7637827 100644 --- a/vcl/unx/generic/gdi/salbmp.cxx +++ b/vcl/unx/generic/gdi/salbmp.cxx @@ -703,7 +703,7 @@ bool X11SalBitmap::Create( ) { css::uno::Reference< css::beans::XFastPropertySet > xFastPropertySet( rBitmapCanvas, css::uno::UNO_QUERY ); - if( xFastPropertySet.get() ) { + if( xFastPropertySet ) { sal_Int32 depth; css::uno::Sequence< css::uno::Any > args; diff --git a/vcl/unx/kf5/KF5SalFrame.cxx b/vcl/unx/kf5/KF5SalFrame.cxx index cc08b9c07748..1aa0b9008de7 100644 --- a/vcl/unx/kf5/KF5SalFrame.cxx +++ b/vcl/unx/kf5/KF5SalFrame.cxx @@ -169,7 +169,7 @@ SalGraphics* KF5SalFrame::AcquireGraphics() m_bGraphicsInUse = true; - if (!m_pKF5Graphics.get()) + if (!m_pKF5Graphics) { m_pKF5Graphics.reset(new Qt5SvpGraphics(this)); Qt5Frame::InitQt5SvpGraphics(m_pKF5Graphics.get()); diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index af05d4f5c92b..5769daa5b335 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -130,7 +130,7 @@ void BorderHandler::lcl_sprm(Sprm & rSprm) return; } writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties) { std::vector<beans::PropertyValue> aSavedGrabBag; if (!m_aInteropGrabBagName.isEmpty()) diff --git a/writerfilter/source/dmapper/CellMarginHandler.cxx b/writerfilter/source/dmapper/CellMarginHandler.cxx index 8434092592a7..8b7b5fa77c23 100644 --- a/writerfilter/source/dmapper/CellMarginHandler.cxx +++ b/writerfilter/source/dmapper/CellMarginHandler.cxx @@ -94,7 +94,7 @@ void CellMarginHandler::createGrabBag(const OUString& aName) void CellMarginHandler::lcl_sprm(Sprm & rSprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties) { pProperties->resolve( *this ); const bool rtl = false; // TODO diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 07bd913f6773..e2d497c8a8d4 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -836,7 +836,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) // be a text frame "fixes" it. I'm not sure what "inline" is supposed to mean in practice // anyway, so as long as this doesn't cause trouble elsewhere ... PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); - if( pContext.get() ) + if( pContext ) { ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() ); if (pParaContext) @@ -1162,7 +1162,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_DocPartGallery_val: { const OUString& sGlossaryEntryGallery = sStringValue; - if(m_pImpl->GetTopContext().get()) + if(m_pImpl->GetTopContext()) { OUString sName = sGlossaryEntryGallery + ":" + m_sGlossaryEntryName; // Add glossary entry name as a first paragraph in section @@ -1256,7 +1256,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) } OSL_ENSURE(rContext.get(), "PropertyMap has to be valid!"); - if(!rContext.get()) + if(!rContext) return ; sal_uInt32 nSprmId = rSprm.getId(); @@ -1312,7 +1312,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if (pStyleSheetPropertyMap) pStyleSheetPropertyMap->SetListId( nIntValue ); } - if( pList.get( ) ) + if( pList ) { if( !IsStyleSheetImport() ) { @@ -1375,7 +1375,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_PBdr_between: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); @@ -1430,7 +1430,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { //contains fore color, back color and shadow percentage, results in a brush writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->setOutputFormat( CellColorHandler::Paragraph ); @@ -1827,7 +1827,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { //contains fore color, back color and shadow percentage, results in a brush writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->setOutputFormat( CellColorHandler::Character ); @@ -1930,7 +1930,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_EG_RPrBase_bdr: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); @@ -2052,7 +2052,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if (!m_pImpl->GetSdt()) { PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); - if( pContext.get() ) + if( pContext ) { // If there is a deferred page break applied to this framed paragraph, // create a dummy paragraph without extra properties, @@ -2120,7 +2120,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_EG_SectPrContents_cols: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { tools::SvRef< SectionColumnHandler > pSectHdl( new SectionColumnHandler ); @@ -2181,7 +2181,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_EG_SectPrContents_pgBorders: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( ) && pSectionContext ) + if( pProperties && pSectionContext ) { tools::SvRef< PageBordersHandler > pHandler( new PageBordersHandler ); pProperties->resolve( *pHandler ); @@ -2219,7 +2219,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) // First check if the style exists in the document. StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( )->FindStyleSheetByConvertedStyleName( sConvertedName ); - bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR ); + bool bExists = pEntry && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR ); // Add the property if the style exists, but do not add it elements in TOC: // they will receive later another style references from TOC if ( bExists && m_pImpl->GetTopContext() && !m_pImpl->IsInTOC()) @@ -2239,7 +2239,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_TblCellMar_right: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { MeasureHandlerPtr pMeasureHandler( new MeasureHandler ); pProperties->resolve(*pMeasureHandler); @@ -2280,7 +2280,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) break; writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { GraphicImportType eGraphicType = (NS_ooxml::LN_anchor_anchor == @@ -2323,7 +2323,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_EdnProps_numFmt: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { pProperties->resolve(*this); } @@ -2443,7 +2443,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_object: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( ) ) + if( pProperties ) { auto pOLEHandler = std::make_shared<OLEHandler>(*this); pProperties->resolve(*pOLEHandler); @@ -2623,7 +2623,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_EG_SectPrContents_pgNumType: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*this); } @@ -2702,7 +2702,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if(aPropertyId) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*pTextEffectsHandlerPtr); @@ -2727,7 +2727,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_TblPrBase_tblLook: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { pProperties->resolve(*this); m_pImpl->getTableManager().finishTableLook(); @@ -2868,7 +2868,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SmartTagRun_smartTagPr: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get() && m_pImpl->GetTopContextType() == CONTEXT_PARAGRAPH) + if (pProperties && m_pImpl->GetTopContextType() == CONTEXT_PARAGRAPH) pProperties->resolve(m_pImpl->getSmartTagHandler()); } break; diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index a3548cde909c..dd5a14b732eb 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -341,7 +341,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo // will receive the table style if any TableStyleSheetEntry* pTableStyle = nullptr; - if( m_aTableProperties.get() ) + if( m_aTableProperties ) { //create properties from the table attributes //...pPropMap->Insert( PROP_LEFT_MARGIN, uno::makeAny( m_nLeftMargin - m_nGapHalf )); @@ -674,7 +674,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, uno::makeAny( sal_Int32(0)), false); // if table is only a single row, and row is set as don't split, set the same value for the whole table. - if( m_aRowProperties.size() == 1 && m_aRowProperties[0].get() ) + if( m_aRowProperties.size() == 1 && m_aRowProperties[0] ) { std::optional<PropertyMap::Property> oSplitAllowed = m_aRowProperties[0]->getProperty(PROP_IS_SPLIT_ALLOWED); if( oSplitAllowed ) @@ -1469,7 +1469,7 @@ void DomainMapperTableHandler::startCell(const css::uno::Reference< css::text::X const TablePropertyMapPtr& pProps ) { sal_uInt32 nRow = m_aRowProperties.size(); - if ( pProps.get( ) ) + if ( pProps ) m_aCellProperties[nRow - 1].push_back( pProps.get() ); else { @@ -1484,14 +1484,14 @@ void DomainMapperTableHandler::startCell(const css::uno::Reference< css::text::X TagLogger::getInstance().startElement("table.cell.start"); TagLogger::getInstance().chars(XTextRangeToString(start)); TagLogger::getInstance().endElement(); - if (pProps.get()) + if (pProps) pProps->printProperties(); #endif //add a new 'row' of properties m_aCellRange.clear(); uno::Reference<text::XTextRange> xStart; - if (start.get()) + if (start) xStart = start->getStart(); m_aCellRange.push_back(xStart); } @@ -1506,7 +1506,7 @@ void DomainMapperTableHandler::endCell(const css::uno::Reference< css::text::XTe #endif uno::Reference<text::XTextRange> xEnd; - if (end.get()) + if (end) xEnd = end->getEnd(); m_aCellRange.push_back(xEnd); m_aRowRanges.push_back(comphelper::containerToSequence(m_aCellRange)); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 9e7cf46cca40..915b317d40d5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -135,7 +135,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) { //contains unit and value writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { MeasureHandlerPtr pMeasureHandler( new MeasureHandler ); pProperties->resolve(*pMeasureHandler); @@ -322,7 +322,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) // us, later we'll just distribute these values in a // 0..10000 scale. writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { MeasureHandlerPtr pMeasureHandler(new MeasureHandler()); pProperties->resolve(*pMeasureHandler); @@ -340,7 +340,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); // Ignore <w:tblpPr> in shape text, those tables should be always non-floating ones. - if (!m_bIsInShape && pProperties.get()) + if (!m_bIsInShape && pProperties) { TablePositionHandlerPtr pHandler = m_aTmpPosition.back(); if ( !pHandler ) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index cb298e12a4f2..50d5f2ff25ca 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -104,7 +104,7 @@ public: virtual void cellProps(const TablePropertyMapPtr& pProps) override { - if ( m_pStyleProps.get( ) ) + if ( m_pStyleProps ) m_pStyleProps->InsertProps(pProps.get()); else TableManager::cellProps( pProps ); @@ -112,7 +112,7 @@ public: virtual void insertRowProps(const TablePropertyMapPtr& pProps) override { - if ( m_pStyleProps.get( ) ) + if ( m_pStyleProps ) m_pStyleProps->InsertProps(pProps.get()); else TableManager::insertRowProps( pProps ); @@ -120,7 +120,7 @@ public: virtual void insertTableProps(const TablePropertyMapPtr& pProps) override { - if ( m_pStyleProps.get( ) ) + if ( m_pStyleProps ) m_pStyleProps->InsertProps(pProps.get()); else m_aTmpTableProperties.back()->InsertProps(pProps.get()); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ec77ea4c55fa..3b68ff3f582b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -804,7 +804,7 @@ OUString DomainMapper_Impl::GetDefaultParaStyleName() uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, bool* pIsDocDefault) { - while(pEntry.get( ) ) + while(pEntry) { if(pEntry->pProperties) { @@ -1081,7 +1081,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) return; TextAppendContext& rAppendContext = m_aTextAppendStack.top(); // n#779642: ignore fly frame inside table as it could lead to messy situations - if (!rAppendContext.pLastParagraphProperties.get()) + if (!rAppendContext.pLastParagraphProperties) return; if (!rAppendContext.pLastParagraphProperties->IsFrameMode()) return; @@ -1096,7 +1096,7 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) std::vector<beans::PropertyValue> aFrameProperties; - if ( pParaStyle.get( ) ) + if ( pParaStyle ) { const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() ); if (!pStyleProperties) @@ -1509,7 +1509,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con sal_Int32 nCount = xParaCursor->getString().getLength(); pToBeSavedProperties->SetDropCapLength(nCount > 0 && nCount < 255 ? static_cast<sal_Int8>(nCount) : 1); } - if( rAppendContext.pLastParagraphProperties.get() ) + if( rAppendContext.pLastParagraphProperties ) { if( sal::static_int_cast<Id>(rAppendContext.pLastParagraphProperties->GetDropCap()) != NS_ooxml::LN_Value_doc_ST_DropCap_none) { @@ -1554,12 +1554,12 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } } std::vector<beans::PropertyValue> aProperties; - if (pPropertyMap.get()) + if (pPropertyMap) { aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues()); } // TODO: this *should* work for RTF but there are test failures, maybe rtftok doesn't distinguish between formatting for the paragraph marker and for the paragraph as a whole; needs investigation - if (pPropertyMap.get() && IsOOXMLImport()) + if (pPropertyMap && IsOOXMLImport()) { // tdf#64222 filter out the "paragraph marker" formatting and // set it as a separate paragraph property, not a empty hint at @@ -1600,7 +1600,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con { xTextRange = xTextAppend->finishParagraphInsert( comphelper::containerToSequence(aProperties), rAppendContext.xInsertPosition ); rAppendContext.xCursor->gotoNextParagraph(false); - if (rAppendContext.pLastParagraphProperties.get()) + if (rAppendContext.pLastParagraphProperties) rAppendContext.pLastParagraphProperties->SetEndingRange(xTextRange->getEnd()); } else @@ -1779,7 +1779,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xCur->goLeft( 1 , true ); // Extend the redline ranges for empty paragraphs - if ( !m_bParaChanged && m_previousRedline.get() ) + if ( !m_bParaChanged && m_previousRedline ) CreateRedline( xCur, m_previousRedline ); CheckParaMarkerRedline( xCur ); } @@ -1953,7 +1953,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con SetIsFirstParagraphInSection(false); // count first not deleted paragraph as first paragraph in section to avoid of // its deletion later, resulting loss of the associated page break - if (!m_previousRedline.get()) + if (!m_previousRedline) { SetIsFirstParagraphInSectionAfterRedline(false); SetIsLastParagraphInSection(false); @@ -2075,7 +2075,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper } // reset moveFrom data of non-terminating runs of the paragraph - if ( m_pParaMarkerRedlineMoveFrom.get( ) ) + if ( m_pParaMarkerRedlineMoveFrom ) { m_pParaMarkerRedlineMoveFrom.clear(); } @@ -2514,7 +2514,7 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xRange, const RedlineParamsPtr& pRedline) { - if ( pRedline.get( ) ) + if ( pRedline ) { try { @@ -2569,22 +2569,22 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange > const& xRange ) { - if ( m_pParaMarkerRedline.get( ) ) + if ( m_pParaMarkerRedline ) { CreateRedline( xRange, m_pParaMarkerRedline ); - if ( m_pParaMarkerRedline.get( ) ) + if ( m_pParaMarkerRedline ) { m_pParaMarkerRedline.clear(); m_currentRedline.clear(); } } - else if ( m_pParaMarkerRedlineMoveFrom.get( ) ) + else if ( m_pParaMarkerRedlineMoveFrom ) { // terminating moveFrom redline removes also the paragraph mark m_pParaMarkerRedlineMoveFrom->m_nToken = XML_del; CreateRedline( xRange, m_pParaMarkerRedlineMoveFrom ); } - if ( m_pParaMarkerRedlineMoveFrom.get( ) ) + if ( m_pParaMarkerRedlineMoveFrom ) { m_pParaMarkerRedlineMoveFrom.clear(); } @@ -3860,7 +3860,7 @@ void DomainMapper_Impl::AppendFieldCommand(OUString const & rPartOfCommand) FieldContextPtr pContext = m_aFieldStack.back(); OSL_ENSURE( pContext.get(), "no field context available"); - if( pContext.get() ) + if( pContext ) { pContext->AppendCommand( rPartOfCommand ); } @@ -4128,7 +4128,7 @@ void DomainMapper_Impl::handleRubyEQField( const FieldContextPtr& pContext) PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pRubyContext->GetPropertyValues()); aInfo.sRubyStyle = m_rDMapper.getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false); PropertyMapPtr pCharContext(new PropertyMap()); - if (m_pLastCharacterContext.get()) + if (m_pLastCharacterContext) pCharContext->InsertProps(m_pLastCharacterContext); pCharContext->InsertProps(pContext->getProperties()); pCharContext->Insert(PROP_RUBY_TEXT, uno::makeAny( aInfo.sRubyText ) ); @@ -4832,7 +4832,7 @@ void DomainMapper_Impl::CloseFieldCommand() if(!m_aFieldStack.empty()) pContext = m_aFieldStack.back(); OSL_ENSURE( pContext.get(), "no field context available"); - if( pContext.get() ) + if( pContext ) { m_bSetUserFieldContent = false; m_bSetCitation = false; @@ -4848,7 +4848,7 @@ void DomainMapper_Impl::CloseFieldCommand() OUString const sFirstParam(vArguments.empty() ? OUString() : vArguments.front()); // apply font size to the form control - if ( m_pLastCharacterContext.get() && m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) ) + if ( m_pLastCharacterContext && m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) ) { uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend; if (xTextAppend.is()) @@ -5640,7 +5640,7 @@ bool DomainMapper_Impl::IsFieldResultAsString() OSL_ENSURE( !m_aFieldStack.empty(), "field stack empty?"); FieldContextPtr pContext = m_aFieldStack.back(); OSL_ENSURE( pContext.get(), "no field context available"); - if( pContext.get() ) + if( pContext ) { bRet = pContext->GetTextField().is() || pContext->GetFieldId() == FIELD_FORMDROPDOWN @@ -5666,8 +5666,8 @@ void DomainMapper_Impl::AppendFieldResult(OUString const& rString) { assert(!m_aFieldStack.empty()); FieldContextPtr pContext = m_aFieldStack.back(); - SAL_WARN_IF(!pContext.get(), "writerfilter.dmapper", "no field context"); - if (pContext.get()) + SAL_WARN_IF(!pContext, "writerfilter.dmapper", "no field context"); + if (pContext) { FieldContextPtr pOuter = GetParentFieldContext(m_aFieldStack); if (pOuter) @@ -5732,7 +5732,7 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult) } } - if( pContext.get() ) + if( pContext ) { uno::Reference<text::XTextField> xTextField = pContext->GetTextField(); try @@ -5858,7 +5858,7 @@ void DomainMapper_Impl::SetFieldFFData(const FFDataHandler::Pointer_t& pFFDataHa if (!m_aFieldStack.empty()) { FieldContextPtr pContext = m_aFieldStack.back(); - if (pContext.get()) + if (pContext) { pContext->setFFDataHandler(pFFDataHandler); } @@ -5882,7 +5882,7 @@ void DomainMapper_Impl::PopFieldContext() FieldContextPtr pContext = m_aFieldStack.back(); OSL_ENSURE( pContext.get(), "no field context available"); - if( pContext.get() ) + if( pContext ) { if( !pContext->IsCommandCompleted() ) CloseFieldCommand(); @@ -5947,7 +5947,7 @@ void DomainMapper_Impl::PopFieldContext() // properties from there. // Also merge in the properties from the field context, // e.g. SdtEndBefore. - if (m_pLastCharacterContext.get()) + if (m_pLastCharacterContext) aMap.InsertProps(m_pLastCharacterContext); aMap.InsertProps(m_aFieldStack.back()->getProperties()); appendTextContent(xToInsert, aMap.GetPropertyValues()); @@ -6616,7 +6616,7 @@ void DomainMapper_Impl::SetCurrentRedlineIsRead() sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( ) const { - assert(m_currentRedline.get()); + assert(m_currentRedline); return m_currentRedline->m_nToken; } @@ -6624,7 +6624,7 @@ void DomainMapper_Impl::SetCurrentRedlineAuthor( const OUString& sAuthor ) { if (!m_xAnnotationField.is()) { - if (m_currentRedline.get()) + if (m_currentRedline) m_currentRedline->m_sAuthor = sAuthor; else SAL_INFO("writerfilter.dmapper", "numberingChange not implemented"); @@ -6643,7 +6643,7 @@ void DomainMapper_Impl::SetCurrentRedlineDate( const OUString& sDate ) { if (!m_xAnnotationField.is()) { - if (m_currentRedline.get()) + if (m_currentRedline) m_currentRedline->m_sDate = sDate; else SAL_INFO("writerfilter.dmapper", "numberingChange not implemented"); @@ -6662,20 +6662,20 @@ void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId ) { // This should be an assert, but somebody had the smart idea to reuse this function also for comments and whatnot, // and in some cases the id is actually not handled, which may be in fact a bug. - if( !m_currentRedline.get()) + if( !m_currentRedline) SAL_INFO("writerfilter.dmapper", "no current redline"); } } void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken ) { - assert(m_currentRedline.get()); + assert(m_currentRedline); m_currentRedline->m_nToken = nToken; } void DomainMapper_Impl::SetCurrentRedlineRevertProperties( const uno::Sequence<beans::PropertyValue>& aProperties ) { - assert(m_currentRedline.get()); + assert(m_currentRedline); m_currentRedline->m_aRevertProperties = aProperties; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index ddce87060a6e..334af118500c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -884,7 +884,7 @@ public: void appendTableHandler( ) { - if (m_pTableHandler.get()) + if (m_pTableHandler) m_aTableManagers.top()->setHandler(m_pTableHandler); } diff --git a/writerfilter/source/dmapper/FFDataHandler.cxx b/writerfilter/source/dmapper/FFDataHandler.cxx index 6fcf06cf81f4..507327cf8333 100644 --- a/writerfilter/source/dmapper/FFDataHandler.cxx +++ b/writerfilter/source/dmapper/FFDataHandler.cxx @@ -159,7 +159,7 @@ void FFDataHandler::lcl_sprm(Sprm & r_Sprm) void FFDataHandler::resolveSprm(Sprm & r_Sprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = r_Sprm.getProps(); - if( pProperties.get()) + if( pProperties) pProperties->resolve(*this); } diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx index 4a76c0ac51de..3c74e97d0adc 100644 --- a/writerfilter/source/dmapper/FontTable.cxx +++ b/writerfilter/source/dmapper/FontTable.cxx @@ -113,7 +113,7 @@ void FontTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Font_embedBoldItalic: { writerfilter::Reference< Properties >::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( )) + if( pProperties ) { EmbeddedFontHandler handler( m_pImpl->pCurrentEntry->sFontName, nSprmId == NS_ooxml::LN_CT_Font_embedRegular ? "" @@ -143,7 +143,7 @@ void FontTable::lcl_sprm(Sprm& rSprm) void FontTable::resolveSprm(Sprm & r_Sprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = r_Sprm.getProps(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); } diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 760bb1bb6b3e..74ce96871499 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -510,7 +510,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) case NS_ooxml::LN_blip: //the binary graphic data in a shape { writerfilter::Reference<Properties>::Pointer_t pProperties = rValue.getProperties(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*this); } @@ -519,7 +519,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) case NS_ooxml::LN_payload : { writerfilter::Reference<BinaryObj>::Pointer_t pPictureData = rValue.getBinary(); - if( pPictureData.get()) + if( pPictureData ) pPictureData->resolve(*this); } break; @@ -1067,7 +1067,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_hlinkClick_hlinkClick: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*this); } @@ -1097,7 +1097,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) // Use a special handler for the positioning auto pHandler = std::make_shared<PositionHandler>( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns ); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( ) ) + if( pProperties ) { pProperties->resolve( *pHandler ); if( !m_pImpl->bUseSimplePos ) @@ -1125,7 +1125,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) // Use a special handler for the positioning auto pHandler = std::make_shared<PositionHandler>( m_pImpl->m_rPositionOffsets, m_pImpl->m_rAligns); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( ) ) + if( pProperties ) { pProperties->resolve( *pHandler ); if( !m_pImpl->bUseSimplePos ) @@ -1195,14 +1195,14 @@ void GraphicImport::lcl_sprm(Sprm& rSprm) m_pImpl->bIsGraphic = true; writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); } break; case NS_ooxml::LN_CT_NonVisualDrawingProps_a_hlinkClick: // 90689; { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get( ) ) + if( pProperties ) pProperties->resolve( *this ); } break; diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 63700f23db75..252d543d67b7 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -519,7 +519,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, // Get the char style uno::Sequence< beans::PropertyValue > aAbsCharStyleProps = pAbsLevel->GetCharStyleProperties( ); - if ( pLevel.get( ) ) + if ( pLevel ) { uno::Sequence< beans::PropertyValue >& rAbsCharStyleProps = aAbsCharStyleProps; uno::Sequence< beans::PropertyValue > aCharStyleProps = @@ -543,7 +543,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper, // and add them to the level properties OUString sText = pAbsLevel->GetBulletChar( ); // Inherit <w:lvlText> from the abstract level in case the override would be empty. - if (pLevel.get() && !pLevel->GetBulletChar().isEmpty()) + if (pLevel && !pLevel->GetBulletChar().isEmpty()) sText = pLevel->GetBulletChar( ); if (sText.isEmpty()) @@ -663,14 +663,14 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) if (nName != NS_ooxml::LN_CT_NumPicBullet_numPicBulletId) { OSL_ENSURE( m_pCurrentDefinition.get(), "current entry has to be set here"); - if(!m_pCurrentDefinition.get()) + if(!m_pCurrentDefinition) return ; pCurrentLvl = m_pCurrentDefinition->GetCurrentLevel( ); } else { - SAL_WARN_IF(!m_pCurrentNumPicBullet.get(), "writerfilter", "current entry has to be set here"); - if (!m_pCurrentNumPicBullet.get()) + SAL_WARN_IF(!m_pCurrentNumPicBullet, "writerfilter", "current entry has to be set here"); + if (!m_pCurrentNumPicBullet) return; } int nIntValue = rVal.getInt(); @@ -685,7 +685,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) //these numbers can be mixed randomly together with separators pre- and suffixes //the Writer supports only a number of upper levels to show, separators is always a dot //and each level can have a prefix and a suffix - if(pCurrentLvl.get()) + if(pCurrentLvl) { //if the BulletChar is a soft-hyphen (0xad) //replace it with a hard-hyphen (0x2d) @@ -701,7 +701,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) case NS_ooxml::LN_CT_NumFmt_val: case NS_ooxml::LN_CT_Lvl_isLgl: case NS_ooxml::LN_CT_Lvl_legacy: - if ( pCurrentLvl.get( ) ) + if ( pCurrentLvl ) { if (nName == NS_ooxml::LN_CT_NumFmt_format) { @@ -728,7 +728,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) m_pCurrentDefinition->AddLevel(); writerfilter::Reference<Properties>::Pointer_t pProperties = rVal.getProperties(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -742,17 +742,17 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) break; case NS_ooxml::LN_CT_Ind_start: case NS_ooxml::LN_CT_Ind_left: - if ( pCurrentLvl.get( ) ) + if ( pCurrentLvl ) pCurrentLvl->Insert( PROP_INDENT_AT, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) )); break; case NS_ooxml::LN_CT_Ind_hanging: - if ( pCurrentLvl.get( ) ) + if ( pCurrentLvl ) pCurrentLvl->Insert( PROP_FIRST_LINE_INDENT, uno::makeAny( - ConversionHelper::convertTwipToMM100( nIntValue ) )); break; case NS_ooxml::LN_CT_Ind_firstLine: - if ( pCurrentLvl.get( ) ) + if ( pCurrentLvl ) pCurrentLvl->Insert( PROP_FIRST_LINE_INDENT, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) )); break; @@ -763,7 +763,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal ) case NS_ooxml::LN_CT_TabStop_pos: { //no paragraph attributes in ListTable char style sheets - if ( pCurrentLvl.get( ) ) + if ( pCurrentLvl ) pCurrentLvl->SetValue( nName, ConversionHelper::convertTwipToMM100( nIntValue ) ); } @@ -785,10 +785,10 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) { //fill the attributes of the style sheet sal_uInt32 nSprmId = rSprm.getId(); - if( m_pCurrentDefinition.get() || + if( m_pCurrentDefinition || nSprmId == NS_ooxml::LN_CT_Numbering_abstractNum || nSprmId == NS_ooxml::LN_CT_Numbering_num || - (nSprmId == NS_ooxml::LN_CT_NumPicBullet_pict && m_pCurrentNumPicBullet.get()) || + (nSprmId == NS_ooxml::LN_CT_NumPicBullet_pict && m_pCurrentNumPicBullet) || nSprmId == NS_ooxml::LN_CT_Numbering_numPicBullet) { static bool bIsStartVisited = false; @@ -798,10 +798,10 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Numbering_abstractNum: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) { //create a new Abstract list entry - OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); + OSL_ENSURE( !m_pCurrentDefinition, "current entry has to be NULL here"); m_pCurrentDefinition = new AbstractListDef; pProperties->resolve( *this ); //append it to the table @@ -813,10 +813,10 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Numbering_num: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) { // Create a new list entry - OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); + OSL_ENSURE( !m_pCurrentDefinition, "current entry has to be NULL here"); ListDef::Pointer listDef( new ListDef ); m_pCurrentDefinition = listDef.get(); pProperties->resolve( *this ); @@ -830,7 +830,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Numbering_numPicBullet: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { NumPicBullet::Pointer numPicBullet(new NumPicBullet()); m_pCurrentNumPicBullet = numPicBullet; @@ -920,7 +920,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) { m_pCurrentDefinition->AddLevel(); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -932,7 +932,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Lvl_numFmt: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { pProperties->resolve(*this); } @@ -975,7 +975,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Lvl_rPr : //contains LN_EG_RPrBase_rFonts { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -983,7 +983,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) { // overwrite level writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -1020,7 +1020,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) { //todo: how to handle paragraph properties within numbering levels (except LeftIndent and FirstLineIndent)? writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -1028,7 +1028,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Tabs_tab: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if(pProperties.get()) + if(pProperties) pProperties->resolve(*this); } break; @@ -1046,7 +1046,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_Num_lvlOverride: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) pProperties->resolve(*this); } break; @@ -1094,7 +1094,7 @@ void ListsManager::lcl_entry(writerfilter::Reference<Properties>::Pointer_t ref else { // Create AbstractListDef's - OSL_ENSURE( !m_pCurrentDefinition.get(), "current entry has to be NULL here"); + OSL_ENSURE( !m_pCurrentDefinition, "current entry has to be NULL here"); m_pCurrentDefinition = new AbstractListDef( ); ref->resolve(*this); //append it to the table @@ -1109,7 +1109,7 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId ) int nLen = m_aAbstractLists.size( ); int i = 0; - while ( !pAbstractList.get( ) && i < nLen ) + while ( !pAbstractList && i < nLen ) { if ( m_aAbstractLists[i]->GetId( ) == nId ) { @@ -1151,7 +1151,7 @@ ListDef::Pointer ListsManager::GetList( sal_Int32 nId ) int nLen = m_aLists.size( ); int i = 0; - while ( !pList.get( ) && i < nLen ) + while ( !pList && i < nLen ) { if ( m_aLists[i]->GetId( ) == nId ) pList = m_aLists[i]; diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 1c437f8d2819..dd7b13137754 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -139,7 +139,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_OLEObject_OLEObject: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*this); } @@ -148,7 +148,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_wrap_wrap: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if ( pProperties.get( ) ) + if ( pProperties ) { tools::SvRef<WrapHandler> pHandler( new WrapHandler ); pProperties->resolve( *pHandler ); diff --git a/writerfilter/source/dmapper/PageBordersHandler.cxx b/writerfilter/source/dmapper/PageBordersHandler.cxx index 7f97faf320ee..d6a0fdd1f502 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.cxx +++ b/writerfilter/source/dmapper/PageBordersHandler.cxx @@ -92,7 +92,7 @@ void PageBordersHandler::lcl_sprm( Sprm& rSprm ) case NS_ooxml::LN_CT_PageBorders_right: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pBorderHandler = std::make_shared<BorderHandler>( true ); pProperties->resolve(*pBorderHandler); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index e10b82daed0a..44127d0d7f86 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1615,7 +1615,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) sal_Int32 nCharWidth = 423; //240 twip/ 12 pt const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( "Standard" ); - if ( pEntry.get() ) + if ( pEntry ) { std::optional< PropertyMap::Property > pPropHeight = pEntry->pProperties->getProperty( PROP_CHAR_HEIGHT_ASIAN ); if ( pPropHeight ) diff --git a/writerfilter/source/dmapper/SectionColumnHandler.cxx b/writerfilter/source/dmapper/SectionColumnHandler.cxx index 8d5be18a1cf1..9ce0cdc85ad6 100644 --- a/writerfilter/source/dmapper/SectionColumnHandler.cxx +++ b/writerfilter/source/dmapper/SectionColumnHandler.cxx @@ -77,7 +77,7 @@ void SectionColumnHandler::lcl_sprm(Sprm & rSprm) { m_aTempColumn.nWidth = m_aTempColumn.nSpace = 0; writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { pProperties->resolve(*this); m_aCols.push_back(m_aTempColumn); diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 81fadad6ac40..93bc03b60f75 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -521,7 +521,7 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_mailMerge: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) pProperties->resolve(*this); } break; @@ -544,7 +544,7 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Compat_compatSetting: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { pProperties->resolve(*this); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index f0524e71ed32..e6704b068ff1 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -538,8 +538,8 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) { sal_uInt32 nSprmId = rSprm.getId(); Value::Pointer_t pValue = rSprm.getValue(); - sal_Int32 nIntValue = pValue.get() ? pValue->getInt() : 0; - OUString sStringValue = pValue.get() ? pValue->getString() : OUString(); + sal_Int32 nIntValue = pValue ? pValue->getInt() : 0; + OUString sStringValue = pValue ? pValue->getString() : OUString(); switch(nSprmId) { @@ -581,7 +581,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_Style_tcPr: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get() && m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) + if( pProperties && m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) { auto pTblStylePrHandler = std::make_shared<TblStylePrHandler>(m_pImpl->m_rDMapper); pProperties->resolve(*pTblStylePrHandler); @@ -655,7 +655,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_EG_RPrBase_rFonts: //table fonts { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pTblStylePrHandler = std::make_shared<TblStylePrHandler>( m_pImpl->m_rDMapper ); pProperties->resolve( *pTblStylePrHandler ); @@ -694,7 +694,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_DocDefaults_pPrDefault: m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultParaProps ); resolveSprmProps( m_pImpl->m_rDMapper, rSprm ); - if ( nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault && m_pImpl->m_pDefaultParaProps.get() && + if ( nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault && m_pImpl->m_pDefaultParaProps && !m_pImpl->m_pDefaultParaProps->isSet( PROP_PARA_TOP_MARGIN ) ) { SetDefaultParaProps( PROP_PARA_TOP_MARGIN, uno::makeAny( sal_Int32(0) ) ); @@ -719,7 +719,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pBorderHandler = std::make_shared<BorderHandler>(m_pImpl->m_rDMapper.IsOOXMLImport()); pProperties->resolve(*pBorderHandler); @@ -737,7 +737,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_LatentStyles_lsdException: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { tools::SvRef<LatentStyleHandler> pLatentStyleHandler(new LatentStyleHandler()); pProperties->resolve(*pLatentStyleHandler); @@ -1529,7 +1529,7 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } // WARNING: these defaults only take effect IF there is a DocDefaults style section. Normally there is, but not always. - if( bParaProperties && m_pImpl->m_pDefaultParaProps.get()) + if( bParaProperties && m_pImpl->m_pDefaultParaProps) { // tdf#87533 LO will have different defaults here, depending on the locale. Import with documented defaults SetDefaultParaProps(PROP_WRITING_MODE, uno::makeAny(sal_Int16(text::WritingMode_LR_TB))); @@ -1561,7 +1561,7 @@ void StyleSheetTable::applyDefaults(bool bParaProperties) } } } - if( !bParaProperties && m_pImpl->m_pDefaultCharProps.get()) + if( !bParaProperties && m_pImpl->m_pDefaultCharProps ) { // tdf#108350: Earlier in DomainMapper for DOCX, Calibri/11pt was set to match MSWord 2007+, // but that is valid only if DocDefaults_rPrDefault is omitted. diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx index 3b9bd40282bf..acd29d5ac274 100644 --- a/writerfilter/source/dmapper/TDefTableHandler.cxx +++ b/writerfilter/source/dmapper/TDefTableHandler.cxx @@ -310,7 +310,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal) void TDefTableHandler::localResolve(Id rName, const writerfilter::Reference<Properties>::Pointer_t& pProperties) { - if( pProperties.get()) + if( pProperties ) { m_nLineWidth = m_nLineType = m_nLineColor = 0; std::vector<beans::PropertyValue> aSavedGrabBag; diff --git a/writerfilter/source/dmapper/TableData.hxx b/writerfilter/source/dmapper/TableData.hxx index 16be82444505..3140a00d71aa 100644 --- a/writerfilter/source/dmapper/TableData.hxx +++ b/writerfilter/source/dmapper/TableData.hxx @@ -75,7 +75,7 @@ public: */ void insertProperties(TablePropertyMapPtr pProps) { - if( mpProps.get() ) + if( mpProps ) mpProps->InsertProps(pProps.get()); else mpProps = pProps; @@ -164,9 +164,9 @@ public: */ void insertProperties(TablePropertyMapPtr pProperties) { - if( pProperties.get() ) + if( pProperties ) { - if( !mpProperties.get() ) + if( !mpProperties ) mpProperties = pProperties; else mpProperties->InsertProps(pProperties.get()); diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx index 7dd05c51a090..d7c5b9322dee 100644 --- a/writerfilter/source/dmapper/TableManager.cxx +++ b/writerfilter/source/dmapper/TableManager.cxx @@ -68,7 +68,7 @@ void TableManager::insertTableProps(const TablePropertyMapPtr& pProps) TagLogger::getInstance().startElement("tablemanager.insertTableProps"); #endif - if (getTableProps().get() && getTableProps() != pProps) + if (getTableProps() && getTableProps() != pProps) getTableProps()->InsertProps(pProps.get()); else mState.setTableProps(pProps); @@ -84,7 +84,7 @@ void TableManager::insertRowProps(const TablePropertyMapPtr& pProps) TagLogger::getInstance().startElement("tablemanager.insertRowProps"); #endif - if (getRowProps().get()) + if (getRowProps()) getRowProps()->InsertProps(pProps.get()); else mState.setRowProps(pProps); @@ -100,7 +100,7 @@ void TableManager::cellProps(const TablePropertyMapPtr& pProps) TagLogger::getInstance().startElement("tablemanager.cellProps"); #endif - if (getCellProps().get()) + if (getCellProps()) getCellProps()->InsertProps(pProps.get()); else mState.setCellProps(pProps); diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index bd8fde34d36d..abce3a1e6b14 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -70,7 +70,7 @@ namespace writerfilter::dmapper { { //contains unit and value writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft) MeasureHandlerPtr pMeasureHandler( new MeasureHandler ); pProperties->resolve(*pMeasureHandler); @@ -87,7 +87,7 @@ namespace writerfilter::dmapper { case NS_ooxml::LN_CT_TrPr_del: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { sal_Int32 nToken = sal_Int32(); switch( nSprmId ) @@ -115,7 +115,7 @@ namespace writerfilter::dmapper { case NS_ooxml::LN_CT_TcPrBase_cellDel: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { sal_Int32 nToken; switch( nSprmId ) @@ -186,7 +186,7 @@ namespace writerfilter::dmapper { case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pBorderHandler = std::make_shared<BorderHandler>(true); if (m_pCurrentInteropGrabBag) @@ -214,7 +214,7 @@ namespace writerfilter::dmapper { case NS_ooxml::LN_CT_TblPrEx_tblBorders: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties) { auto pBorderHandler = std::make_shared<BorderHandler>(true); pProperties->resolve(*pBorderHandler); @@ -234,7 +234,7 @@ namespace writerfilter::dmapper { //contains CT_TcBorders_left, right, top, bottom { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { //in OOXML there's one set of borders at each cell (if there is any) tools::SvRef< TDefTableHandler > pTDefTableHandler( new TDefTableHandler()); @@ -253,7 +253,7 @@ namespace writerfilter::dmapper { { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); if (m_pCurrentInteropGrabBag) @@ -293,7 +293,7 @@ namespace writerfilter::dmapper { // each color sprm contains as much colors as cells are in a row //LN_CT_TcPrBase_shd: cell shading contains: LN_CT_Shd_val, LN_CT_Shd_fill, LN_CT_Shd_color writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pCellColorHandler = std::make_shared<CellColorHandler>(); pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag @@ -313,7 +313,7 @@ namespace writerfilter::dmapper { //contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right // LN_CT_TblCellMar_start, LN_CT_TblCellMar_end writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); if (m_pCurrentInteropGrabBag) @@ -337,7 +337,7 @@ namespace writerfilter::dmapper { case NS_ooxml::LN_CT_TblPrBase_tblInd: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties) { MeasureHandlerPtr pHandler(new MeasureHandler); if (m_pCurrentInteropGrabBag) diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx index 21dd6f619894..001cecbd9f86 100644 --- a/writerfilter/source/dmapper/TblStylePrHandler.cxx +++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx @@ -174,7 +174,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) { //contains unit and value writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) { MeasureHandlerPtr pMeasureHandler( new MeasureHandler ); pProperties->resolve(*pMeasureHandler); @@ -187,7 +187,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_TblPrBase_tblCellMar: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if ( pProperties.get() ) + if ( pProperties ) { auto pCellMarginHandler = std::make_shared<CellMarginHandler>(); pCellMarginHandler->enableInteropGrabBag("tblCellMar"); @@ -233,7 +233,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) void TblStylePrHandler::resolveSprmProps(Sprm & rSprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); } diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx index afd69d0281e4..13fed5237051 100644 --- a/writerfilter/source/dmapper/TextEffectsHandler.cxx +++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx @@ -732,7 +732,7 @@ void TextEffectsHandler::lcl_sprm(Sprm& rSprm) mpGrabBagStack->push(aElementName); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( !pProperties.get()) + if( !pProperties ) return; pProperties->resolve( *this ); diff --git a/writerfilter/source/dmapper/ThemeTable.cxx b/writerfilter/source/dmapper/ThemeTable.cxx index 255dba1e0b1e..ffa2262cdecc 100644 --- a/writerfilter/source/dmapper/ThemeTable.cxx +++ b/writerfilter/source/dmapper/ThemeTable.cxx @@ -110,7 +110,7 @@ void ThemeTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_BaseStyles_fontScheme: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); } break; @@ -119,7 +119,7 @@ void ThemeTable::lcl_sprm(Sprm& rSprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); m_pImpl->m_currentFontThemeEntry = std::map<sal_uInt32, OUString>(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); m_pImpl->m_themeFontMap[nSprmId] = m_pImpl->m_currentFontThemeEntry; } @@ -130,14 +130,14 @@ void ThemeTable::lcl_sprm(Sprm& rSprm) { m_pImpl->m_currentThemeFontId = nSprmId; writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties ) pProperties->resolve(*this); } break; case NS_ooxml::LN_CT_FontCollection_font: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get()) + if (pProperties ) pProperties->resolve(*this); } break; diff --git a/writerfilter/source/dmapper/util.cxx b/writerfilter/source/dmapper/util.cxx index de1e2c9db24e..d4389fce7571 100644 --- a/writerfilter/source/dmapper/util.cxx +++ b/writerfilter/source/dmapper/util.cxx @@ -29,7 +29,7 @@ std::string XTextRangeToString(uno::Reference< text::XTextRange > const & textRa std::string result; #ifdef DBG_UTIL - if (textRange.get()) + if (textRange) { OUString aOUStr; @@ -62,7 +62,7 @@ std::string XTextRangeToString(uno::Reference< text::XTextRange > const & textRa void resolveSprmProps(Properties & rHandler, Sprm & rSprm) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if( pProperties.get()) + if( pProperties) pProperties->resolve(rHandler); } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 4cb719818012..e425025fbbe0 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -1235,7 +1235,7 @@ void OOXMLFastContextHandlerValue::setDefaultStringValue() void OOXMLFastContextHandlerValue::pushBiDiEmbedLevel() { const bool bRtl - = mpValue.get() && mpValue->getInt() == NS_ooxml::LN_Value_ST_Direction_rtl; + = mpValue && mpValue->getInt() == NS_ooxml::LN_Value_ST_Direction_rtl; OOXMLFactory::characters(this, bRtl ? u"\u202B" : u"\u202A"); // RLE / LRE } diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 54886fb81d9e..ff13dedcf5fa 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -331,7 +331,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) if (pCols) { RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num); - if (pNum.get() && pNum->getInt() > 1) + if (pNum && pNum->getInt() > 1) bColumns = true; } checkFirstRun(); @@ -365,11 +365,11 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) // Unless we're on a title page. RTFValue::Pointer_t pTitlePg = m_aStates.top().getSectionSprms().find(NS_ooxml::LN_EG_SectPrContents_titlePg); - if (((pBreak.get() + if (((pBreak && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous)) || m_nResetBreakOnSectBreak == RTF_SBKNONE) - && !(pTitlePg.get() && pTitlePg->getInt())) + && !(pTitlePg && pTitlePg->getInt())) { if (m_bWasInFrame) { diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 227fba3c24fa..2738e96b403f 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -390,11 +390,11 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) // If there is a negative left margin, then the first cellx is relative to that. RTFValue::Pointer_t pTblInd = m_aStates.top().getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblInd); - if (rCurrentCellX == 0 && pTblInd.get()) + if (rCurrentCellX == 0 && pTblInd) { RTFValue::Pointer_t pWidth = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w); - if (pWidth.get() && pWidth->getInt() < 0) + if (pWidth && pWidth->getInt() < 0) nCellX = -1 * (pWidth->getInt() - nParam); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3de574e75c12..e174a0973bd8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -89,7 +89,7 @@ void putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, const RTFValue::Po RTFOverwrite eOverwrite, bool bAttribute) { RTFValue::Pointer_t pParent = rSprms.find(nParent, /*bFirst=*/true, /*bForWrite=*/true); - if (!pParent.get()) + if (!pParent) { RTFSprms aAttributes; if (nParent == NS_ooxml::LN_CT_TcPrBase_shd) @@ -133,7 +133,7 @@ RTFValue::Pointer_t getNestedSprm(RTFSprms& rSprms, Id nParent, Id nId) bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId) { RTFValue::Pointer_t pParent = rSprms.find(nParent); - if (!pParent.get()) + if (!pParent) // It doesn't even have a parent, we're done. return false; RTFSprms& rAttributes = pParent->getAttributes(); @@ -143,7 +143,7 @@ bool eraseNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId) RTFSprms& getLastAttributes(RTFSprms& rSprms, Id nId) { RTFValue::Pointer_t p = rSprms.find(nId); - if (p.get() && !p->getSprms().empty()) + if (p && !p->getSprms().empty()) return p->getSprms().back().second->getAttributes(); SAL_WARN("writerfilter.rtf", "trying to set property when no type is defined"); @@ -555,10 +555,8 @@ void RTFDocumentImpl::checkNeedPap() // Writer will ignore a page break before a text frame, so guard it with empty paragraphs bool hasBreakBeforeFrame = m_aStates.top().getFrame().hasProperties() - && m_aStates.top() - .getParagraphSprms() - .find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore) - .get(); + && m_aStates.top().getParagraphSprms().find( + NS_ooxml::LN_CT_PPrBase_pageBreakBefore); if (hasBreakBeforeFrame) { dispatchSymbol(RTF_PAR); @@ -649,7 +647,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal) RTFValue::Pointer_t pBreak = m_aStates.top().getSectionSprms().find(NS_ooxml::LN_EG_SectPrContents_type); bool bContinuous - = pBreak.get() + = pBreak && pBreak->getInt() == static_cast<sal_Int32>(NS_ooxml::LN_Value_ST_SectionMark_continuous); // If there is no paragraph in this section, then insert a dummy one, as required by Writer, @@ -1483,7 +1481,7 @@ void RTFDocumentImpl::text(OUString& rString) } // Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.) - if (m_aStates.top().getTableCellSprms().find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() + if (m_aStates.top().getTableCellSprms().find(NS_ooxml::LN_CT_TcPrBase_vAlign) && m_nTopLevelCells == 0) { m_aTableBufferStack.back().emplace_back( @@ -1553,7 +1551,7 @@ void RTFDocumentImpl::prepareProperties( // Table width. RTFValue::Pointer_t const pTableWidthProps = rState.getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblW); - if (!pTableWidthProps.get()) + if (!pTableWidthProps) { auto pUnitValue = new RTFValue(3); putNestedAttribute(rState.getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblW, @@ -1568,7 +1566,7 @@ void RTFDocumentImpl::prepareProperties( RTFValue::Pointer_t const pCellMar = rState.getTableRowSprms().find(NS_ooxml::LN_CT_TblPrBase_tblCellMar); - if (!pCellMar.get()) + if (!pCellMar) { // If no cell margins are defined, the default left/right margin is 0 in Word, but not in Writer. RTFSprms aAttributes; @@ -3182,7 +3180,7 @@ void RTFDocumentImpl::afterPopState(RTFParserState& rState) { RTFValue::Pointer_t pIdValue = rState.getTableAttributes().find(NS_ooxml::LN_CT_AbstractNum_nsid); - if (pIdValue.get() && !m_aStates.empty()) + if (pIdValue && !m_aStates.empty()) { // Abstract numbering RTFSprms aLeveltextAttributes; diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index caa11f84939e..5f99693d204c 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -450,7 +450,7 @@ namespace xmloff // let the factory provide the concrete handler. Note that caching, if desired, is the task // of the factory PPropertyHandler handler = (*propDescription->factory)( propDescription->propertyId ); - if ( !handler.get() ) + if ( !handler ) { SAL_WARN( "xmloff.forms", "OControlExport::exportGenericHandlerAttributes: invalid property handler provided by the factory!" ); continue; diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 8693cc355bf1..622d71018633 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -489,7 +489,7 @@ namespace xmloff } const PPropertyHandler handler = (*first->factory)( first->propertyId ); - if ( !handler.get() ) + if ( !handler ) { SAL_WARN( "xmloff.forms", "OElementImport::handleAttribute: invalid property handler!" ); break; diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 01221de09fbf..99548a92887b 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2720,7 +2720,7 @@ void XMLTextImportHelper::ConnectFrameChains( m_xImpl->m_xNextFrmNames->push_back(sNextFrmName); } } - if (m_xImpl->m_xPrevFrmNames.get() && !m_xImpl->m_xPrevFrmNames->empty()) + if (m_xImpl->m_xPrevFrmNames && !m_xImpl->m_xPrevFrmNames->empty()) { for(std::vector<OUString>::iterator i = m_xImpl->m_xPrevFrmNames->begin(), j = m_xImpl->m_xNextFrmNames->begin(); i != m_xImpl->m_xPrevFrmNames->end() && j != m_xImpl->m_xNextFrmNames->end(); ++i, ++j) { diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx index 5bdc679c4726..3d001966f3b0 100644 --- a/xmlsecurity/inc/documentsignaturemanager.hxx +++ b/xmlsecurity/inc/documentsignaturemanager.hxx @@ -120,7 +120,7 @@ public: css::uno::Reference<css::xml::crypto::XXMLSecurityContext> const& getGpgSecurityContext() const; void setStore(const css::uno::Reference<css::embed::XStorage>& xStore) { mxStore = xStore; } XMLSignatureHelper& getSignatureHelper() { return maSignatureHelper; } - bool hasPDFSignatureHelper() const { return mpPDFSignatureHelper.get(); } + bool hasPDFSignatureHelper() const { return bool(mpPDFSignatureHelper); } void setSignatureStream(const css::uno::Reference<css::io::XStream>& xSignatureStream) { mxSignatureStream = xSignatureStream; |