summaryrefslogtreecommitdiff
path: root/reportdesign/source
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-05 10:47:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-07 13:24:51 +0100
commit1d2773807f6d2deb1181ef4b14fbdd49ca1d5c14 (patch)
tree788ef3ef220549c9785bcf1f5b35becc176300d4 /reportdesign/source
parente4e80ed313882f9ea1b309054e5aa3e839586516 (diff)
ref-count SdrPage
which simplifies ownership handling, particularly with regard to undo/redo Change-Id: Ie8f300ebfdae6db3c06f78a87e35a07497d6b825 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign/source')
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx12
-rw-r--r--reportdesign/source/core/sdr/RptPage.cxx4
2 files changed, 8 insertions, 8 deletions
diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx
index 0a636fa2f93a..3ac79aa42beb 100644
--- a/reportdesign/source/core/sdr/RptModel.cxx
+++ b/reportdesign/source/core/sdr/RptModel.cxx
@@ -66,7 +66,7 @@ void OReportModel::detachController()
m_xUndoEnv->Clear(OXUndoEnvironment::Accessor());
}
-SdrPage* OReportModel::AllocPage(bool /*bMasterPage*/)
+rtl::Reference<SdrPage> OReportModel::AllocPage(bool /*bMasterPage*/)
{
OSL_FAIL("Who called me!");
return nullptr;
@@ -86,19 +86,19 @@ void OReportModel::SetModified(bool _bModified)
m_pController->setModified(_bModified);
}
-SdrPage* OReportModel::RemovePage(sal_uInt16 nPgNum)
+rtl::Reference<SdrPage> OReportModel::RemovePage(sal_uInt16 nPgNum)
{
- OReportPage* pPage = dynamic_cast<OReportPage*>(SdrModel::RemovePage(nPgNum));
+ rtl::Reference<OReportPage> pPage = dynamic_cast<OReportPage*>(SdrModel::RemovePage(nPgNum).get());
return pPage;
}
OReportPage* OReportModel::createNewPage(const uno::Reference< report::XSection >& _xSection)
{
SolarMutexGuard aSolarGuard;
- OReportPage* pPage = new OReportPage( *this ,_xSection);
- InsertPage(pPage);
+ rtl::Reference<OReportPage> pPage = new OReportPage( *this ,_xSection);
+ InsertPage(pPage.get());
m_xUndoEnv->AddSection(_xSection);
- return pPage;
+ return pPage.get();
}
OReportPage* OReportModel::getPage(const uno::Reference< report::XSection >& _xSection)
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
index 4c1fcba02f43..0b856322796c 100644
--- a/reportdesign/source/core/sdr/RptPage.cxx
+++ b/reportdesign/source/core/sdr/RptPage.cxx
@@ -41,10 +41,10 @@ OReportPage::~OReportPage()
{
}
-SdrPage* OReportPage::CloneSdrPage(SdrModel& rTargetModel) const
+rtl::Reference<SdrPage> OReportPage::CloneSdrPage(SdrModel& rTargetModel) const
{
OReportModel& rOReportModel(static_cast< OReportModel& >(rTargetModel));
- OReportPage* pClonedOReportPage(
+ rtl::Reference<OReportPage> pClonedOReportPage(
new OReportPage(
rOReportModel,
m_xSection));