basctl/source/basicide/moduldlg.cxx | 2 basic/source/classes/sbxmod.cxx | 2 basic/source/sbx/sbxarray.cxx | 2 canvas/source/tools/canvascustomspritehelper.cxx | 10 canvas/source/vcl/canvascustomsprite.cxx | 2 canvas/source/vcl/spritehelper.cxx | 2 chart2/source/controller/dialogs/DataBrowser.cxx | 36 +- chart2/source/controller/dialogs/res_ErrorBar.cxx | 4 chart2/source/controller/main/ControllerCommandDispatch.cxx | 10 chart2/source/controller/main/ElementSelector.cxx | 6 chart2/source/view/main/VDataSeries.cxx | 2 comphelper/source/container/enumerablemap.cxx | 2 compilerplugins/clang/plugin.cxx | 38 +++ compilerplugins/clang/plugin.hxx | 3 compilerplugins/clang/redundantpointerops.cxx | 39 --- compilerplugins/clang/simplifypointertobool.cxx | 121 ++++++++++ compilerplugins/clang/test/simplifypointertobool.cxx | 21 + cppcanvas/source/mtfrenderer/transparencygroupaction.cxx | 2 cppcanvas/source/uno/uno_mtfrenderer.cxx | 2 cui/source/dialogs/screenshotannotationdlg.cxx | 6 dbaccess/source/core/api/RowSet.cxx | 2 dbaccess/source/core/api/RowSetCache.cxx | 2 dbaccess/source/filter/xml/xmlExport.cxx | 2 dbaccess/source/ui/browser/dataview.cxx | 2 dbaccess/source/ui/uno/copytablewizard.cxx | 2 desktop/source/deployment/registry/configuration/dp_configuration.cxx | 4 drawinglayer/source/tools/emfphelperdata.cxx | 2 editeng/source/uno/unoedprx.cxx | 12 extensions/source/propctrlr/cellbindinghandler.cxx | 6 extensions/source/propctrlr/eventhandler.cxx | 2 extensions/source/propctrlr/propcontroller.cxx | 2 filter/source/svg/svgwriter.cxx | 2 forms/source/xforms/propertysetbase.cxx | 2 i18npool/source/localedata/localedata.cxx | 2 include/tools/weakbase.h | 3 linguistic/source/convdic.cxx | 2 lotuswordpro/source/filter/lwplayout.cxx | 2 lotuswordpro/source/filter/lwpstory.cxx | 4 lotuswordpro/source/filter/xfilter/xftable.cxx | 2 oox/source/vml/vmlshapecontext.cxx | 2 package/source/xstor/xstorage.cxx | 2 reportdesign/source/ui/report/DesignView.cxx | 2 reportdesign/source/ui/report/ReportSection.cxx | 2 reportdesign/source/ui/report/propbrw.cxx | 2 sc/inc/document.hxx | 2 sc/source/core/data/documen3.cxx | 4 sc/source/core/data/dptabsrc.cxx | 2 sc/source/core/data/postit.cxx | 2 sc/source/core/data/table5.cxx | 2 sc/source/core/tool/chartlis.cxx | 4 sc/source/filter/excel/excdoc.cxx | 4 sc/source/filter/excel/xecontent.cxx | 4 sc/source/filter/excel/xeescher.cxx | 2 sc/source/filter/excel/xepage.cxx | 2 sc/source/filter/excel/xicontent.cxx | 10 sc/source/filter/excel/xiescher.cxx | 2 sc/source/filter/excel/xilink.cxx | 4 sc/source/filter/excel/xipage.cxx | 2 sc/source/filter/excel/xistyle.cxx | 2 sc/source/filter/ftools/fprogressbar.cxx | 6 sc/source/filter/html/htmlpars.cxx | 22 - sc/source/filter/oox/connectionsbuffer.cxx | 10 sc/source/filter/oox/drawingfragment.cxx | 12 sc/source/filter/oox/stylesbuffer.cxx | 2 sc/source/filter/oox/workbookhelper.cxx | 2 sc/source/filter/xml/xmlcelli.cxx | 4 sc/source/ui/Accessibility/AccessibleDocument.cxx | 2 sc/source/ui/Accessibility/AccessibleText.cxx | 6 sc/source/ui/cctrl/checklistmenu.cxx | 2 sc/source/ui/miscdlgs/anyrefdg.cxx | 2 sc/source/ui/pagedlg/scuitphfedit.cxx | 2 sc/source/ui/unoobj/chart2uno.cxx | 16 - sc/source/ui/vba/vbaeventshelper.cxx | 2 sc/source/ui/view/spelldialog.cxx | 6 sc/source/ui/view/tabvwsh4.cxx | 2 sc/source/ui/view/viewdata.cxx | 12 sc/source/ui/view/viewfun3.cxx | 4 sd/source/filter/html/htmlex.cxx | 2 sd/source/ui/annotations/annotationtag.cxx | 6 sd/source/ui/func/fupage.cxx | 2 sd/source/ui/slideshow/showwin.cxx | 2 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 2 sd/source/ui/view/outlview.cxx | 2 sd/source/ui/view/sdwindow.cxx | 2 sd/source/ui/view/viewoverlaymanager.cxx | 2 sd/source/ui/view/viewshel.cxx | 2 sfx2/source/dialog/filedlghelper.cxx | 2 sfx2/source/doc/objmisc.cxx | 2 sfx2/source/doc/sfxbasemodel.cxx | 2 sfx2/source/sidebar/SidebarController.cxx | 4 slideshow/source/engine/opengl/TransitionerImpl.cxx | 2 slideshow/source/engine/shapes/viewmediashape.cxx | 6 solenv/CompilerTest_compilerplugins_clang.mk | 1 store/source/lockbyte.cxx | 4 store/source/storbase.hxx | 2 svl/source/items/stylepool.cxx | 3 svtools/source/control/valueset.cxx | 2 svx/source/accessibility/AccessibleControlShape.cxx | 2 svx/source/accessibility/AccessibleEmptyEditSource.cxx | 2 svx/source/accessibility/AccessibleShape.cxx | 2 svx/source/core/extedit.cxx | 2 svx/source/dialog/svxruler.cxx | 60 ++-- svx/source/form/fmtextcontrolshell.cxx | 2 svx/source/form/fmvwimp.cxx | 4 svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 4 svx/source/svdraw/svdedxv.cxx | 2 svx/source/table/tablecontroller.cxx | 2 svx/source/xoutdev/xattr.cxx | 2 sw/source/core/access/accmap.cxx | 2 sw/source/core/doc/docbm.cxx | 4 sw/source/core/txtnode/ndtxt.cxx | 2 sw/source/core/undo/unattr.cxx | 2 sw/source/core/undo/unsect.cxx | 2 sw/source/core/view/vnew.cxx | 2 sw/source/filter/ww8/ww8par.cxx | 4 sw/source/filter/ww8/ww8par2.cxx | 2 sw/source/filter/ww8/ww8par6.cxx | 2 sw/source/uibase/app/docsh.cxx | 2 sw/source/uibase/app/docst.cxx | 2 sw/source/uibase/dbui/dbmgr.cxx | 2 sw/source/uibase/uiview/pview.cxx | 2 sw/source/uibase/uiview/viewmdi.cxx | 2 sw/source/uibase/uno/unoatxt.cxx | 2 toolkit/source/awt/vclxprinter.cxx | 2 tools/source/generic/poly.cxx | 4 ucb/source/ucp/webdav-neon/webdavcontent.cxx | 2 vcl/inc/unx/gendata.hxx | 2 vcl/qa/cppunit/pdfexport/pdfexport.cxx | 2 vcl/qt5/Qt5Bitmap.cxx | 18 - vcl/qt5/Qt5Frame.cxx | 4 vcl/source/app/svapp.cxx | 2 vcl/source/gdi/bitmapex.cxx | 2 vcl/source/gdi/print3.cxx | 4 vcl/source/treelist/treelist.cxx | 4 vcl/source/window/winproc.cxx | 2 vcl/unx/generic/gdi/salbmp.cxx | 2 vcl/unx/kf5/KF5SalFrame.cxx | 2 writerfilter/source/dmapper/BorderHandler.cxx | 2 writerfilter/source/dmapper/CellMarginHandler.cxx | 2 writerfilter/source/dmapper/DomainMapper.cxx | 40 +-- writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 writerfilter/source/dmapper/DomainMapperTableManager.cxx | 6 writerfilter/source/dmapper/DomainMapperTableManager.hxx | 6 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 64 ++--- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 writerfilter/source/dmapper/FFDataHandler.cxx | 2 writerfilter/source/dmapper/FontTable.cxx | 4 writerfilter/source/dmapper/GraphicImport.cxx | 14 - writerfilter/source/dmapper/NumberingManager.cxx | 58 ++-- writerfilter/source/dmapper/OLEHandler.cxx | 4 writerfilter/source/dmapper/PageBordersHandler.cxx | 2 writerfilter/source/dmapper/PropertyMap.cxx | 2 writerfilter/source/dmapper/SectionColumnHandler.cxx | 2 writerfilter/source/dmapper/SettingsTable.cxx | 4 writerfilter/source/dmapper/StyleSheetTable.cxx | 18 - writerfilter/source/dmapper/TDefTableHandler.cxx | 2 writerfilter/source/dmapper/TableData.hxx | 6 writerfilter/source/dmapper/TableManager.cxx | 6 writerfilter/source/dmapper/TablePropertiesHandler.cxx | 20 - writerfilter/source/dmapper/TblStylePrHandler.cxx | 6 writerfilter/source/dmapper/TextEffectsHandler.cxx | 2 writerfilter/source/dmapper/ThemeTable.cxx | 8 writerfilter/source/dmapper/util.cxx | 4 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 2 writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 6 writerfilter/source/rtftok/rtfdispatchvalue.cxx | 4 writerfilter/source/rtftok/rtfdocumentimpl.cxx | 22 - xmloff/source/forms/elementexport.cxx | 2 xmloff/source/forms/elementimport.cxx | 2 xmloff/source/text/txtimp.cxx | 2 xmlsecurity/inc/documentsignaturemanager.hxx | 2 171 files changed, 620 insertions(+), 483 deletions(-)
New commits: commit 366d08f2f6d4de922f6099c62bb81b49d89e0a68 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Apr 8 12:36:53 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun May 10 12:02:44 2020 +0200 new loplugin:simplifypointertobool Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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 ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits