[Libreoffice-commits] core.git: 2 commits - sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Apr 10 06:43:12 UTC 2018
sc/source/ui/Accessibility/AccessibleText.cxx | 38 +++++++++++++-------------
sc/source/ui/inc/AccessibleText.hxx | 8 ++---
2 files changed, 23 insertions(+), 23 deletions(-)
New commits:
commit 45e1b44247c6b8af449fbf078068939140bd9dbb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Apr 9 14:04:22 2018 +0200
loplugin:useuniqueptr in ScAccessiblePreviewCellTextData
Change-Id: I06e211f69cafd88080680a22919f1c16eef2aaa9
Reviewed-on: https://gerrit.libreoffice.org/52648
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 489e2c62ebba..3ca075385213 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1142,7 +1142,7 @@ ScAccessiblePreviewCellTextData::~ScAccessiblePreviewCellTextData()
{
if (pEditEngine)
pEditEngine->SetNotifyHdl(Link<EENotify&,void>());
- delete mpViewForwarder;
+ mpViewForwarder.reset();
}
void ScAccessiblePreviewCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
@@ -1185,8 +1185,8 @@ SvxTextForwarder* ScAccessiblePreviewCellTextData::GetTextForwarder()
SvxViewForwarder* ScAccessiblePreviewCellTextData::GetViewForwarder()
{
if (!mpViewForwarder)
- mpViewForwarder = new ScPreviewCellViewForwarder(mpViewShell, aCellPos);
- return mpViewForwarder;
+ mpViewForwarder.reset(new ScPreviewCellViewForwarder(mpViewShell, aCellPos));
+ return mpViewForwarder.get();
}
ScDocShell* ScAccessiblePreviewCellTextData::GetDocShell(ScPreviewShell* pViewShell)
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index bcb8c3fff01c..860534504c85 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -164,7 +164,7 @@ public:
virtual SvxEditViewForwarder* GetEditViewForwarder( bool /* bCreate */ ) override { return nullptr; }
private:
- ScPreviewViewForwarder* mpViewForwarder;
+ std::unique_ptr<ScPreviewViewForwarder> mpViewForwarder;
ScPreviewShell* mpViewShell;
using ScAccessibleCellBaseTextData::GetDocShell;
commit 015fc77362e4c0f2c213cc793e8e692ba3c7bc05
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Apr 9 14:00:28 2018 +0200
loplugin:useuniqueptr in ScAccessibleEditObjectTextData
Change-Id: I72305ce2f235efb42055f71fe2ee3c59ba99c9d3
Reviewed-on: https://gerrit.libreoffice.org/52647
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 30369d73077a..489e2c62ebba 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -883,9 +883,9 @@ ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData()
// If the object is cloned, do NOT set notify hdl.
if (mpEditEngine && !mbIsCloned)
mpEditEngine->SetNotifyHdl(Link<EENotify&,void>());
- delete mpViewForwarder;
- delete mpEditViewForwarder;
- delete mpForwarder;
+ mpViewForwarder.reset();
+ mpEditViewForwarder.reset();
+ mpForwarder.reset();
}
void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
@@ -895,7 +895,7 @@ void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint&
mpWindow = nullptr;
mpEditView = nullptr;
mpEditEngine = nullptr;
- DELETEZ(mpForwarder);
+ mpForwarder.reset();
if (mpViewForwarder)
mpViewForwarder->SetInvalid();
if (mpEditViewForwarder)
@@ -920,9 +920,9 @@ SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()&&!mbIsCloned)
mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
if(!mpForwarder)
- mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
+ mpForwarder.reset(new SvxEditEngineForwarder(*mpEditEngine));
}
- return mpForwarder;
+ return mpForwarder.get();
}
SvxViewForwarder* ScAccessibleEditObjectTextData::GetViewForwarder()
@@ -930,23 +930,23 @@ SvxViewForwarder* ScAccessibleEditObjectTextData::GetViewForwarder()
if (!mpViewForwarder)
{
// i#49561 Get right-aligned cell content to be read by screenreader.
- mpViewForwarder = new ScEditObjectViewForwarder( mpWindow, mpEditView );
+ mpViewForwarder.reset(new ScEditObjectViewForwarder( mpWindow, mpEditView ));
}
- return mpViewForwarder;
+ return mpViewForwarder.get();
}
SvxEditViewForwarder* ScAccessibleEditObjectTextData::GetEditViewForwarder( bool bCreate )
{
if (!mpEditViewForwarder && mpEditView)
- mpEditViewForwarder = new ScEditViewForwarder(mpEditView, mpWindow);
+ mpEditViewForwarder.reset(new ScEditViewForwarder(mpEditView, mpWindow));
if (bCreate)
{
if (!mpEditView && mpEditViewForwarder)
{
- DELETEZ(mpEditViewForwarder);
+ mpEditViewForwarder.reset();
}
}
- return mpEditViewForwarder;
+ return mpEditViewForwarder.get();
}
IMPL_LINK(ScAccessibleEditObjectTextData, NotifyHdl, EENotify&, rNotify, void)
@@ -1043,7 +1043,7 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder()
mbEditEngineCreated = true;
mpEditEngine->EnableUndo( false );
mpEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
- mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
+ mpForwarder.reset(new SvxEditEngineForwarder(*mpEditEngine));
mpEditEngine->SetText(pTxtWnd->GetTextString());
@@ -1057,7 +1057,7 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder()
}
}
}
- return mpForwarder;
+ return mpForwarder.get();
}
SvxEditViewForwarder* ScAccessibleEditLineTextData::GetEditViewForwarder( bool bCreate )
@@ -1091,9 +1091,9 @@ void ScAccessibleEditLineTextData::ResetEditMode()
pTxtWnd->GetEditView()->GetEditEngine()->SetNotifyHdl(Link<EENotify&,void>());
mpEditEngine = nullptr;
- DELETEZ(mpForwarder);
- DELETEZ(mpEditViewForwarder);
- DELETEZ(mpViewForwarder);
+ mpForwarder.reset();
+ mpEditViewForwarder.reset();
+ mpViewForwarder.reset();
mbEditEngineCreated = false;
}
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index fcf14945a80c..bcb8c3fff01c 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -118,11 +118,11 @@ public:
DECL_LINK( NotifyHdl, EENotify&, void );
protected:
- ScEditObjectViewForwarder* mpViewForwarder;
- ScEditViewForwarder* mpEditViewForwarder;
+ std::unique_ptr<ScEditObjectViewForwarder> mpViewForwarder;
+ std::unique_ptr<ScEditViewForwarder> mpEditViewForwarder;
EditView* mpEditView;
EditEngine* mpEditEngine;
- SvxEditEngineForwarder* mpForwarder;
+ std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
VclPtr<vcl::Window> mpWindow;
bool mbIsCloned;
};
More information about the Libreoffice-commits
mailing list