summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-09 14:35:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-10 08:43:28 +0200
commit3edfbb0885f8f9b18074d42e16539436077631ef (patch)
tree52bf30674423997e7a1ceb98f015ac5d571c8986
parente8cb751f3bf816dc721115a5dc27da9eefaeb886 (diff)
loplugin:useuniqueptr in ScAccessibleSpreadsheet
Change-Id: Ia3df85292aba5a506a60b2ae5345e4e78c676c93 Reviewed-on: https://gerrit.libreoffice.org/52650 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx21
-rw-r--r--sc/source/ui/inc/AccessibleSpreadsheet.hxx2
2 files changed, 11 insertions, 12 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index 09b7f6153865..380da8fc4505 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -269,7 +269,7 @@ ScAccessibleSpreadsheet::ScAccessibleSpreadsheet(
ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet()
{
- delete mpMarkedRanges;
+ mpMarkedRanges.reset();
if (mpViewShell)
mpViewShell->RemoveAccessibilityObject(*this);
}
@@ -323,8 +323,7 @@ void ScAccessibleSpreadsheet::CompleteSelectionChanged(bool bNewState)
{
return ;
}
- if (mpMarkedRanges)
- DELETEZ(mpMarkedRanges);
+ mpMarkedRanges.reset();
AccessibleEventObject aEvent;
aEvent.EventId = AccessibleEventId::STATE_CHANGED;
@@ -534,9 +533,9 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
}
if (!mpMarkedRanges)
{
- mpMarkedRanges = new ScRangeList();
+ mpMarkedRanges.reset(new ScRangeList());
}
- refScMarkData.FillRangeListWithMarks(mpMarkedRanges, true);
+ refScMarkData.FillRangeListWithMarks(mpMarkedRanges.get(), true);
//For Whole Col Row
bool bWholeRow = ::labs(aMarkRange.aStart.Row() - aMarkRange.aEnd.Row()) == MAXROW ;
@@ -615,7 +614,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
CommitFocusCell(aNewCell);
}
VEC_MYADDR vecNew;
- if(CalcScRangeListDifferenceMax(mpMarkedRanges,&m_LastMarkedRanges,10,vecNew))
+ if(CalcScRangeListDifferenceMax(mpMarkedRanges.get(), &m_LastMarkedRanges,10,vecNew))
{
aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
aEvent.NewValue.clear();
@@ -1113,9 +1112,9 @@ sal_Int32 SAL_CALL
{
if (!mpMarkedRanges)
{
- mpMarkedRanges = new ScRangeList();
+ mpMarkedRanges.reset(new ScRangeList());
ScMarkData aMarkData(mpViewShell->GetViewData().GetMarkData());
- aMarkData.FillRangeListWithMarks(mpMarkedRanges, false);
+ aMarkData.FillRangeListWithMarks(mpMarkedRanges.get(), false);
}
// is possible, because there shouldn't be overlapped ranges in it
if (mpMarkedRanges)
@@ -1144,8 +1143,8 @@ uno::Reference<XAccessible > SAL_CALL
{
if (!mpMarkedRanges)
{
- mpMarkedRanges = new ScRangeList();
- mpViewShell->GetViewData().GetMarkData().FillRangeListWithMarks(mpMarkedRanges, false);
+ mpMarkedRanges.reset(new ScRangeList());
+ mpViewShell->GetViewData().GetMarkData().FillRangeListWithMarks(mpMarkedRanges.get(), false);
}
if (mpMarkedRanges)
{
@@ -1154,7 +1153,7 @@ uno::Reference<XAccessible > SAL_CALL
{
throw lang::IndexOutOfBoundsException();
}
- ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges,nSelectedChildIndex);
+ ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges.get(),nSelectedChildIndex);
if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() )
xAccessible = m_mapSelectionSend[addr];
else
diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index ade94b07a24b..613d749f3376 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -214,7 +214,7 @@ private:
virtual tools::Rectangle GetBoundingBox() const override;
ScTabViewShell* mpViewShell;
- ScRangeList* mpMarkedRanges;
+ std::unique_ptr<ScRangeList> mpMarkedRanges;
ScAccessibleDocument* mpAccDoc;
rtl::Reference<ScAccessibleCell> mpAccCell;
tools::Rectangle maVisCells;