diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-16 15:23:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-17 08:25:47 +0200 |
commit | ccb2a1f650bc505f8a4f1abebf8ce4f9396562a8 (patch) | |
tree | 2ee2fd4f300ae95cf23bade1f242e02f9b276c07 /chart2 | |
parent | da5c3a1ee43dd1a07cbd1b8005488bf05432593d (diff) |
clang-tidy readability-redundant-smartptr-get
redundant get() call on smart pointer
Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd
Reviewed-on: https://gerrit.libreoffice.org/61837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
17 files changed, 55 insertions, 52 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 9f82483f5e66..b828828a546f 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -558,7 +558,7 @@ void DataBrowser::clearHeaders() void DataBrowser::RenewTable() { - if( ! m_apDataBrowserModel.get()) + if (!m_apDataBrowserModel) return; long nOldRow = GetCurRow(); @@ -636,7 +636,7 @@ void DataBrowser::RenewTable() OUString DataBrowser::GetColString( sal_Int32 nColumnId ) const { - OSL_ASSERT( m_apDataBrowserModel.get()); + OSL_ASSERT(m_apDataBrowserModel); if( nColumnId > 0 ) return m_apDataBrowserModel->getRoleOfColumn( nColumnId - 1 ); return OUString(); @@ -1119,14 +1119,14 @@ void DataBrowser::InitController( bool DataBrowser::CellContainsNumbers( sal_uInt16 nCol ) const { - if( ! m_apDataBrowserModel.get()) + if (!m_apDataBrowserModel) return false; return m_apDataBrowserModel->getCellType( lcl_getColumnInData( nCol )) == DataBrowserModel::NUMBER; } sal_uInt32 DataBrowser::GetNumberFormatKey( sal_uInt16 nCol ) const { - if( ! m_apDataBrowserModel.get()) + if (!m_apDataBrowserModel) return 0; return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ) ); } diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 10af6e5cbf4c..15e1d00c307b 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -279,7 +279,7 @@ private: void DataBrowserModel::insertDataSeries( sal_Int32 nAfterColumnIndex ) { - OSL_ASSERT( m_apDialogModel.get()); + OSL_ASSERT(m_apDialogModel); Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); @@ -400,7 +400,7 @@ void DataBrowserModel::insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex ) { //create a new text column for complex categories - OSL_ASSERT( m_apDialogModel.get()); + OSL_ASSERT(m_apDialogModel); Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); if (!xDataProvider.is()) return; @@ -438,7 +438,7 @@ void DataBrowserModel::removeComplexCategoryLevel( sal_Int32 nAtColumnIndex ) void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex ) { - OSL_ASSERT( m_apDialogModel.get()); + OSL_ASSERT(m_apDialogModel); if (nAtColumnIndex < 0 || static_cast<size_t>(nAtColumnIndex) >= m_aColumns.size()) // Out of bound. return; @@ -507,7 +507,7 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex ) { - OSL_ASSERT( m_apDialogModel.get()); + OSL_ASSERT(m_apDialogModel); if( static_cast< tDataColumnVector::size_type >( nFirstColumnIndex ) < m_aColumns.size() - 1 ) { Reference< chart2::XDataSeries > xSeries( m_aColumns[nFirstColumnIndex].m_xDataSeries ); @@ -521,7 +521,7 @@ void DataBrowserModel::swapDataSeries( sal_Int32 nFirstColumnIndex ) void DataBrowserModel::swapDataPointForAllSeries( sal_Int32 nFirstIndex ) { - OSL_ASSERT( m_apDialogModel.get()); + OSL_ASSERT(m_apDialogModel); Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); // lockControllers diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx index 639fd1afe55c..55273a76fd3c 100644 --- a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx +++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx @@ -42,7 +42,7 @@ TimerTriggeredControllerLock::~TimerTriggeredControllerLock() void TimerTriggeredControllerLock::startTimer() { - if(!m_apControllerLockGuard.get()) + if (!m_apControllerLockGuard) m_apControllerLockGuard.reset( new ControllerLockGuardUNO(m_xModel) ); m_aTimer.Start(); } diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index ea7f55413225..9d958a582e86 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -192,7 +192,7 @@ void ErrorBarResources::SetChartDocumentForRangeChoosing( m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument )); // has internal data provider => rename "cell range" to "from data" - OSL_ASSERT( m_apRangeSelectionHelper.get()); + OSL_ASSERT(m_apRangeSelectionHelper); if( m_bHasInternalDataProvider ) { m_xRbRange->set_label(m_xUIStringRbRange->get_label()); @@ -435,8 +435,8 @@ IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged, weld::ToggleButton&, void) IMPL_LINK(ErrorBarResources, ChooseRange, weld::Button&, rButton, void) { - OSL_ASSERT( m_apRangeSelectionHelper.get()); - if( ! m_apRangeSelectionHelper.get()) + OSL_ASSERT(m_apRangeSelectionHelper); + if (!m_apRangeSelectionHelper) return; OSL_ASSERT( m_pCurrentRangeChoosingField == nullptr ); @@ -665,8 +665,8 @@ void ErrorBarResources::FillValueSets() void ErrorBarResources::listeningFinished( const OUString & rNewRange ) { - OSL_ASSERT( m_apRangeSelectionHelper.get()); - if( ! m_apRangeSelectionHelper.get()) + OSL_ASSERT(m_apRangeSelectionHelper); + if (!m_apRangeSelectionHelper) return; // rNewRange becomes invalid after removing the listener @@ -697,8 +697,8 @@ void ErrorBarResources::listeningFinished( void ErrorBarResources::disposingRangeSelection() { - OSL_ASSERT( m_apRangeSelectionHelper.get()); - if( m_apRangeSelectionHelper.get()) + OSL_ASSERT(m_apRangeSelectionHelper); + if (m_apRangeSelectionHelper) m_apRangeSelectionHelper->stopRangeListening( false ); } diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index 268c46dd5cf8..75f8a76ff5f8 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -432,7 +432,7 @@ SplineResourceGroup::SplineResourceGroup(weld::Builder* pBuilder, TabPageParent SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog() { - if( !m_xSplinePropertiesDialog.get() ) + if (!m_xSplinePropertiesDialog) { m_xSplinePropertiesDialog.reset(new SplinePropertiesDialog(m_pParent.GetFrameWeld())); } diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 6f151d647956..5f2a688cc64f 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -167,7 +167,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co SdrPage* pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage, 0 ); - std::unique_ptr<SdrView> pView( new SdrView( *pModel.get(), pVDev ) ); + std::unique_ptr<SdrView> pView(new SdrView(*pModel, pVDev)); pView->hideMarkHandles(); SdrPageView* pPageView = pView->ShowSdrPage(pPage); diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index ef1df6ae35d2..0a9669626fcb 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -59,7 +59,8 @@ void ChartController::StartTextEdit( const Point* pMousePixel ) if(!pTextObj) return; - OSL_PRECOND( !m_pTextActionUndoGuard.get(), "ChartController::StartTextEdit: already have a TextUndoGuard!?" ); + OSL_PRECOND(!m_pTextActionUndoGuard, + "ChartController::StartTextEdit: already have a TextUndoGuard!?"); m_pTextActionUndoGuard.reset( new UndoGuard( SchResId( STR_ACTION_EDIT_TEXT ), m_xUndoManager ) ); SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner(); @@ -135,8 +136,8 @@ bool ChartController::EndTextEdit() TitleHelper::setCompleteString( aString, uno::Reference< css::chart2::XTitle >::query( xPropSet ), m_xCC ); - OSL_ENSURE( m_pTextActionUndoGuard.get(), "ChartController::EndTextEdit: no TextUndoGuard!" ); - if ( m_pTextActionUndoGuard.get() ) + OSL_ENSURE(m_pTextActionUndoGuard, "ChartController::EndTextEdit: no TextUndoGuard!"); + if (m_pTextActionUndoGuard) m_pTextActionUndoGuard->commit(); } m_pTextActionUndoGuard.reset(); diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index e552656f1da6..d59ae46fb52e 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -246,7 +246,7 @@ void ChartController::executeDispatch_ScaleText() ControllerLockGuardUNO aCtlLockGuard( getModel() ); std::unique_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider()); - OSL_ASSERT( pRefSizeProv.get()); + OSL_ASSERT(pRefSizeProv); if (pRefSizeProv) pRefSizeProv->toggleAutoResizeState(); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index e7f656337507..7e006d5f2cc1 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1315,11 +1315,11 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) return bReturn; // handle accelerators - if( ! m_apAccelExecute.get() && m_xFrame.is() && m_xCC.is() ) + if (!m_apAccelExecute && m_xFrame.is() && m_xCC.is()) { m_apAccelExecute = ::svt::AcceleratorExecute::createAcceleratorHelper(); - OSL_ASSERT( m_apAccelExecute.get()); - if( m_apAccelExecute.get() ) + OSL_ASSERT(m_apAccelExecute); + if (m_apAccelExecute) m_apAccelExecute->init( m_xCC, m_xFrame ); } @@ -1328,7 +1328,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) bool bAlternate = aKeyCode.IsMod2(); bool bCtrl = aKeyCode.IsMod1(); - if( m_apAccelExecute.get() ) + if (m_apAccelExecute) bReturn = m_apAccelExecute->execute( aKeyCode ); if( bReturn ) return bReturn; diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index a8f39ee5c989..d920a4a8c988 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -522,8 +522,8 @@ void ControllerCommandDispatch::fireStatusEventForURLImpl( void ControllerCommandDispatch::updateCommandAvailability() { - bool bModelStateIsValid = ( m_apModelState.get() != nullptr ); - bool bControllerStateIsValid = ( m_apControllerState.get() != nullptr ); + bool bModelStateIsValid = (m_apModelState != nullptr); + bool bControllerStateIsValid = (m_apControllerState != nullptr); // Model and controller states exist. OSL_ASSERT( bModelStateIsValid ); OSL_ASSERT( bControllerStateIsValid ); diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index dcf867eede57..1d0e0f014ba9 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -614,13 +614,11 @@ void ChartModel::impl_loadGraphics( ::utl::UcbStreamHelper::CreateStream( xElementStream, true ) ); - if( apIStm.get() ) + if (apIStm) { Graphic aGraphic; - if( !GraphicConverter::Import( - *apIStm.get(), - aGraphic ) ) + if (!GraphicConverter::Import(*apIStm, aGraphic)) { m_aGraphicObjectVector.emplace_back(aGraphic ); } diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx index 4484beadd204..84cf07235ddf 100644 --- a/chart2/source/tools/ConfigColorScheme.cxx +++ b/chart2/source/tools/ConfigColorScheme.cxx @@ -118,14 +118,14 @@ void ConfigColorScheme::retrieveConfigColors() return; // create config item if necessary - if( ! m_apChartConfigItem.get()) + if (!m_apChartConfigItem) { m_apChartConfigItem.reset( new impl::ChartConfigItem( *this )); m_apChartConfigItem->addPropertyNotification( aSeriesPropName ); } - OSL_ASSERT( m_apChartConfigItem.get()); - if( ! m_apChartConfigItem.get()) + OSL_ASSERT(m_apChartConfigItem); + if (!m_apChartConfigItem) return; // retrieve colors diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx index 0c45241d96f0..b18653887969 100644 --- a/chart2/source/tools/OPropertySet.cxx +++ b/chart2/source/tools/OPropertySet.cxx @@ -56,8 +56,8 @@ OPropertySet::OPropertySet( const OPropertySet & rOther, ::osl::Mutex & par_rMut m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault(false) { MutexGuard aGuard( m_rMutex ); - if( rOther.m_pImplProperties.get()) - m_pImplProperties.reset( new impl::ImplOPropertySet( * rOther.m_pImplProperties.get())); + if (rOther.m_pImplProperties) + m_pImplProperties.reset(new impl::ImplOPropertySet(*rOther.m_pImplProperties)); } void OPropertySet::SetNewValuesExplicitlyEvenIfTheyEqualDefault() diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index c6f59216593e..85da43f53daf 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -1557,12 +1557,12 @@ void VCartesianAxis::doStaggeringOfLabels( const AxisLabelProperties& rAxisLabel double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; if( nTextLevel>0 ) { - lcl_shiftLabels( *apTickIter.get(), aCummulatedLabelsDistance ); + lcl_shiftLabels(*apTickIter, aCummulatedLabelsDistance); fRotationAngleDegree = 0.0; } - aCummulatedLabelsDistance += lcl_getLabelsDistance( *apTickIter.get() - , pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties ) - , fRotationAngleDegree ); + aCummulatedLabelsDistance += lcl_getLabelsDistance( + *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), + fRotationAngleDegree); } } } @@ -1611,7 +1611,7 @@ void VCartesianAxis::createLabels() { if(nTextLevel==0) { - nScreenDistanceBetweenTicks = TickFactory2D::getTickScreenDistance( *apTickIter.get() ); + nScreenDistanceBetweenTicks = TickFactory2D::getTickScreenDistance(*apTickIter); if( nTextLevelCount>1 ) nScreenDistanceBetweenTicks*=2; //the above used tick iter does contain also the sub ticks -> thus the given distance is only the half } @@ -1624,7 +1624,8 @@ void VCartesianAxis::createLabels() } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; - while( !createTextShapes( m_xTextTarget, *apTickIter.get(), rAxisLabelProperties, pTickFactory2D, nScreenDistanceBetweenTicks ) ) + while (!createTextShapes(m_xTextTarget, *apTickIter, rAxisLabelProperties, + pTickFactory2D, nScreenDistanceBetweenTicks)) { }; } @@ -1666,7 +1667,8 @@ void VCartesianAxis::createMaximumLabels() std::unique_ptr< TickIter > apTickIter(createMaximumLabelTickIterator( nTextLevel )); if(apTickIter) { - while( !createTextShapes( m_xTextTarget, *apTickIter.get(), aAxisLabelProperties, pTickFactory2D, -1 ) ) + while (!createTextShapes(m_xTextTarget, *apTickIter, aAxisLabelProperties, + pTickFactory2D, -1)) { }; } @@ -1802,7 +1804,9 @@ void VCartesianAxis::createShapes() if( apTickIter ) { double fRotationAngleDegree = m_aAxisLabelProperties.fRotationAngleDegree; - B2DVector aLabelsDistance( lcl_getLabelsDistance( *apTickIter.get(), pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties ), fRotationAngleDegree ) ); + B2DVector aLabelsDistance(lcl_getLabelsDistance( + *apTickIter, pTickFactory2D->getDistanceAxisTickToText(m_aAxisProperties), + fRotationAngleDegree)); sal_Int32 nCurrentLength = static_cast<sal_Int32>(aLabelsDistance.getLength()); aTickmarkPropertiesList.push_back( m_aAxisProperties.makeTickmarkPropertiesForComplexCategories( nOffset + nCurrentLength, 0 ) ); nOffset += nCurrentLength; diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index df74eeeaf05d..da6eca3acf0c 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -212,7 +212,7 @@ void VCartesianGrid::createShapes() //create all scaled tickmark values std::unique_ptr< TickFactory > apTickFactory( createTickFactory() ); - TickFactory& aTickFactory = *apTickFactory.get(); + TickFactory& aTickFactory = *apTickFactory; TickInfoArraysType aAllTickInfos; aTickFactory.getAllTicks( aAllTickInfos ); diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index d978310f4986..0a3716df0f98 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -364,7 +364,7 @@ OUString VSeriesPlotter::getLabelTextForValue( VDataSeries const & rDataSeries { OUString aNumber; - if( m_apNumberFormatterWrapper.get()) + if (m_apNumberFormatterWrapper) { sal_Int32 nNumberFormatKey = 0; if( rDataSeries.hasExplicitNumberFormat(nPointIndex,bAsPercentage) ) @@ -1334,7 +1334,7 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( bResizeEquation = false; if( bShowEquation ) { - if( m_apNumberFormatterWrapper.get()) + if (m_apNumberFormatterWrapper) { // iteration 0: default representation (no wrap) // iteration 1: expected width (nFormulaWidth) is calculated aFormula = xRegressionCurveCalculator->getFormattedRepresentation( @@ -1356,7 +1356,7 @@ void VSeriesPlotter::createRegressionCurveEquationShapes( { aFormula.append( "R" ).append( OUStringLiteral1( aSuperscriptFigures[2] ) ).append( " = " ); double fR( xRegressionCurveCalculator->getCorrelationCoefficient()); - if( m_apNumberFormatterWrapper.get()) + if (m_apNumberFormatterWrapper) { Color nLabelCol; bool bColChanged; @@ -1459,7 +1459,7 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() { const std::vector< double >& rDateCategories = m_pExplicitCategoriesProvider->getDateCategories(); Date aNullDate(30,12,1899); - if( m_apNumberFormatterWrapper.get() ) + if (m_apNumberFormatterWrapper) aNullDate = m_apNumberFormatterWrapper->getNullDate(); if( !rDateCategories.empty() ) { diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 20d7ab778ee9..5d54a7e32444 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -945,7 +945,7 @@ DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const if( isAttributedDataPoint( index ) ) { adaptPointCache( index ); - if( !m_apLabel_AttributedPoint.get() ) + if (!m_apLabel_AttributedPoint) m_apLabel_AttributedPoint = getDataPointLabelFromPropertySet(getPropertiesOfPoint(index)); pRet = m_apLabel_AttributedPoint.get(); |