summaryrefslogtreecommitdiff
path: root/reportdesign
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
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')
-rw-r--r--reportdesign/inc/RptModel.hxx4
-rw-r--r--reportdesign/inc/RptPage.hxx2
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx12
-rw-r--r--reportdesign/source/core/sdr/RptPage.cxx4
4 files changed, 11 insertions, 11 deletions
diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx
index 260e40f4c978..3f17073ac741 100644
--- a/reportdesign/inc/RptModel.hxx
+++ b/reportdesign/inc/RptModel.hxx
@@ -58,8 +58,8 @@ public:
virtual ~OReportModel() override;
virtual void SetChanged(bool bFlg = true) override;
- virtual SdrPage* AllocPage(bool bMasterPage) override;
- virtual SdrPage* RemovePage(sal_uInt16 nPgNum) override;
+ virtual rtl::Reference<SdrPage> AllocPage(bool bMasterPage) override;
+ virtual rtl::Reference<SdrPage> RemovePage(sal_uInt16 nPgNum) override;
/** @returns the numbering type that is used to format page fields in drawing shapes */
virtual SvxNumType GetPageNumType() const override;
diff --git a/reportdesign/inc/RptPage.hxx b/reportdesign/inc/RptPage.hxx
index 1c0f77b0adeb..637687ad9a04 100644
--- a/reportdesign/inc/RptPage.hxx
+++ b/reportdesign/inc/RptPage.hxx
@@ -54,7 +54,7 @@ public:
OReportPage( OReportModel& rModel
,const css::uno::Reference< css::report::XSection >& _xSection );
- virtual SdrPage* CloneSdrPage(SdrModel& rTargetModel) const override;
+ virtual rtl::Reference<SdrPage> CloneSdrPage(SdrModel& rTargetModel) const override;
virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override;
virtual SdrObject* RemoveObject(size_t nObjNum) override;
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));