summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-10 13:23:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-11 07:57:56 +0100
commit14cb12bde07b8becf69b648ecc6642bdccf8a7cd (patch)
treee616a44bdeb412b518e8f4fcee20f9aaeb8574e9 /sc
parent5128bf29d5febceaec51854595f23ae487a0cdec (diff)
loplugin:refcounting generalise type checking
Change-Id: Ia013878ac9c2918d8eaf9aab16b291d8211e708f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110700 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx4
-rw-r--r--sc/source/ui/unoobj/PivotTableDataProvider.cxx20
-rw-r--r--sc/source/ui/unoobj/PivotTableDataSequence.cxx5
-rw-r--r--sc/source/ui/unoobj/TablePivotCharts.cxx4
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx4
5 files changed, 16 insertions, 21 deletions
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 <embed::XEmbeddedObject>& xObj, ScViewDa
uno::Reference<chart2::data::XDataProvider> xDataProvider;
if (bRangeIsPivotTable)
{
- std::unique_ptr<sc::PivotTableDataProvider> pPivotTableDataProvider(new sc::PivotTableDataProvider(rScDoc));
+ rtl::Reference<sc::PivotTableDataProvider> 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<ValueAndFormat> const & rCategories : rCategoriesVector)
{
uno::Reference<chart2::data::XLabeledDataSequence> xResult = newLabeledDataSequence();
- std::unique_ptr<PivotTableDataSequence> pSequence;
- pSequence.reset(new PivotTableDataSequence(m_pDocument,
+ rtl::Reference<PivotTableDataSequence> pSequence(new PivotTableDataSequence(m_pDocument,
lcl_identifierForCategories(), rCategories));
pSequence->setRole("categories");
- xResult->setValues(uno::Reference<chart2::data::XDataSequence>(pSequence.release()));
+ xResult->setValues(uno::Reference<chart2::data::XDataSequence>(pSequence.get()));
aLabeledSequences.push_back(xResult);
}
@@ -585,10 +584,9 @@ PivotTableDataProvider::assignValuesToDataSequence(size_t nIndex)
OUString sDataID = lcl_identifierForData(nIndex);
std::vector<ValueAndFormat> const & rRowOfData = m_aDataRowVector[nIndex];
- std::unique_ptr<PivotTableDataSequence> pSequence;
- pSequence.reset(new PivotTableDataSequence(m_pDocument, sDataID, rRowOfData));
+ rtl::Reference<PivotTableDataSequence> 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<ValueAndFormat> aLabelVector { ValueAndFormat(aLabel.makeStringAndClear()) };
- std::unique_ptr<PivotTableDataSequence> pSequence;
- pSequence.reset(new PivotTableDataSequence(m_pDocument,
+ rtl::Reference<PivotTableDataSequence> 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<css::chart2::data::XDataSequence>
std::vector<ValueAndFormat> const & rCategories = m_aCategoriesColumnOrientation.back();
- std::unique_ptr<PivotTableDataSequence> pSequence;
- pSequence.reset(new PivotTableDataSequence(m_pDocument,
+ rtl::Reference<PivotTableDataSequence> pSequence(new PivotTableDataSequence(m_pDocument,
lcl_identifierForCategories(), rCategories));
pSequence->setRole("categories");
- xDataSequence.set(uno::Reference<chart2::data::XDataSequence>(pSequence.release()));
+ xDataSequence.set(uno::Reference<chart2::data::XDataSequence>(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<util::XCloneable> SAL_CALL PivotTableDataSequence::createClone()
{
SolarMutexGuard aGuard;
- std::unique_ptr<PivotTableDataSequence> pClone;
- pClone.reset(new PivotTableDataSequence(m_pDocument, m_aID, m_aData));
+ rtl::Reference<PivotTableDataSequence> pClone(new PivotTableDataSequence(m_pDocument, m_aID, m_aData));
pClone->setRole(m_aRole);
- uno::Reference<util::XCloneable> xClone(pClone.release());
+ uno::Reference<util::XCloneable> 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<sc::PivotTableDataProvider> pPivotTableDataProvider(new sc::PivotTableDataProvider(rDoc));
+ rtl::Reference<sc::PivotTableDataProvider> pPivotTableDataProvider(new sc::PivotTableDataProvider(rDoc));
pPivotTableDataProvider->setPivotTableName(rDataPilotName);
- uno::Reference<chart2::data::XDataProvider> xDataProvider(pPivotTableDataProvider.release());
+ uno::Reference<chart2::data::XDataProvider> xDataProvider(pPivotTableDataProvider.get());
uno::Reference<chart2::data::XDataReceiver> 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<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil
//! check if xObject is in the same document
- std::unique_ptr<ScFilterDescriptor> pNew(new ScFilterDescriptor(pDocSh)); //! instead from object?
+ rtl::Reference<ScFilterDescriptor> pNew(new ScFilterDescriptor(pDocSh)); //! instead from object?
ScQueryParam aParam = pNew->GetParam();
aParam.bHasHeader = true;
@@ -5524,7 +5524,7 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil
}
pNew->SetParam( aParam );
- return pNew.release();
+ return pNew.get();
}
// XSubTotalSource