From 14cb12bde07b8becf69b648ecc6642bdccf8a7cd Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 10 Feb 2021 13:23:28 +0200 Subject: loplugin:refcounting generalise type checking Change-Id: Ia013878ac9c2918d8eaf9aab16b291d8211e708f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110700 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/drawfunc/fuins2.cxx | 4 ++-- sc/source/ui/unoobj/PivotTableDataProvider.cxx | 20 ++++++++------------ sc/source/ui/unoobj/PivotTableDataSequence.cxx | 5 ++--- sc/source/ui/unoobj/TablePivotCharts.cxx | 4 ++-- sc/source/ui/unoobj/cellsuno.cxx | 4 ++-- 5 files changed, 16 insertions(+), 21 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 9aee4d0ecec6..1502539ddae1 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -129,9 +129,9 @@ void lcl_ChartInit(const uno::Reference & xObj, ScViewDa uno::Reference xDataProvider; if (bRangeIsPivotTable) { - std::unique_ptr pPivotTableDataProvider(new sc::PivotTableDataProvider(rScDoc)); + rtl::Reference pPivotTableDataProvider(new sc::PivotTableDataProvider(rScDoc)); pPivotTableDataProvider->setPivotTableName(aRangeString); - xDataProvider.set(pPivotTableDataProvider.release()); + xDataProvider.set(pPivotTableDataProvider.get()); } else { diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index 4a459f06437e..1e244f07c37a 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -253,11 +253,10 @@ PivotTableDataProvider::createCategoriesDataSource(bool bOrientationIsColumn) for (std::vector const & rCategories : rCategoriesVector) { uno::Reference xResult = newLabeledDataSequence(); - std::unique_ptr pSequence; - pSequence.reset(new PivotTableDataSequence(m_pDocument, + rtl::Reference pSequence(new PivotTableDataSequence(m_pDocument, lcl_identifierForCategories(), rCategories)); pSequence->setRole("categories"); - xResult->setValues(uno::Reference(pSequence.release())); + xResult->setValues(uno::Reference(pSequence.get())); aLabeledSequences.push_back(xResult); } @@ -585,10 +584,9 @@ PivotTableDataProvider::assignValuesToDataSequence(size_t nIndex) OUString sDataID = lcl_identifierForData(nIndex); std::vector const & rRowOfData = m_aDataRowVector[nIndex]; - std::unique_ptr pSequence; - pSequence.reset(new PivotTableDataSequence(m_pDocument, sDataID, rRowOfData)); + rtl::Reference pSequence(new PivotTableDataSequence(m_pDocument, sDataID, rRowOfData)); pSequence->setRole("values-y"); - xDataSequence.set(pSequence.release()); + xDataSequence.set(pSequence.get()); return xDataSequence; } @@ -624,11 +622,10 @@ PivotTableDataProvider::assignLabelsToDataSequence(size_t nIndex) std::vector aLabelVector { ValueAndFormat(aLabel.makeStringAndClear()) }; - std::unique_ptr pSequence; - pSequence.reset(new PivotTableDataSequence(m_pDocument, + rtl::Reference pSequence(new PivotTableDataSequence(m_pDocument, sLabelID, aLabelVector)); pSequence->setRole("values-y"); - xDataSequence.set(pSequence.release()); + xDataSequence.set(pSequence.get()); return xDataSequence; } @@ -642,11 +639,10 @@ css::uno::Reference std::vector const & rCategories = m_aCategoriesColumnOrientation.back(); - std::unique_ptr pSequence; - pSequence.reset(new PivotTableDataSequence(m_pDocument, + rtl::Reference pSequence(new PivotTableDataSequence(m_pDocument, lcl_identifierForCategories(), rCategories)); pSequence->setRole("categories"); - xDataSequence.set(uno::Reference(pSequence.release())); + xDataSequence.set(uno::Reference(pSequence.get())); return xDataSequence; } diff --git a/sc/source/ui/unoobj/PivotTableDataSequence.cxx b/sc/source/ui/unoobj/PivotTableDataSequence.cxx index 1ec42754c889..1ac8d9339a47 100644 --- a/sc/source/ui/unoobj/PivotTableDataSequence.cxx +++ b/sc/source/ui/unoobj/PivotTableDataSequence.cxx @@ -165,11 +165,10 @@ uno::Reference SAL_CALL PivotTableDataSequence::createClone() { SolarMutexGuard aGuard; - std::unique_ptr pClone; - pClone.reset(new PivotTableDataSequence(m_pDocument, m_aID, m_aData)); + rtl::Reference pClone(new PivotTableDataSequence(m_pDocument, m_aID, m_aData)); pClone->setRole(m_aRole); - uno::Reference xClone(pClone.release()); + uno::Reference xClone(pClone.get()); return xClone; } diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx index 3356125df9fb..78d1918b3aba 100644 --- a/sc/source/ui/unoobj/TablePivotCharts.cxx +++ b/sc/source/ui/unoobj/TablePivotCharts.cxx @@ -125,10 +125,10 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName, aAwtSize.Width = aSize.Width(); aAwtSize.Height = aSize.Height(); - std::unique_ptr pPivotTableDataProvider(new sc::PivotTableDataProvider(rDoc)); + rtl::Reference pPivotTableDataProvider(new sc::PivotTableDataProvider(rDoc)); pPivotTableDataProvider->setPivotTableName(rDataPilotName); - uno::Reference xDataProvider(pPivotTableDataProvider.release()); + uno::Reference xDataProvider(pPivotTableDataProvider.get()); uno::Reference xReceiver; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 5f22480879e3..e9eba14c9061 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5495,7 +5495,7 @@ uno::Reference SAL_CALL ScCellRangeObj::createFil //! check if xObject is in the same document - std::unique_ptr pNew(new ScFilterDescriptor(pDocSh)); //! instead from object? + rtl::Reference pNew(new ScFilterDescriptor(pDocSh)); //! instead from object? ScQueryParam aParam = pNew->GetParam(); aParam.bHasHeader = true; @@ -5524,7 +5524,7 @@ uno::Reference SAL_CALL ScCellRangeObj::createFil } pNew->SetParam( aParam ); - return pNew.release(); + return pNew.get(); } // XSubTotalSource -- cgit v1.2.3