diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-25 16:23:17 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-18 00:45:43 +0100 |
commit | 390e951b78288e082361c386ff5c6618d917c333 (patch) | |
tree | de4f00b80ba6183f2678d6582d98d65a94b93aa7 /reportdesign | |
parent | 599719217423e8468cc54cc74e7850b8a867120b (diff) |
loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result
of VclPtr<T>::Create to a raw pointer.
As a consequence, we also need to change various methods that were
returning newly created Window subclasses via raw pointer, to
instead return those via VclPtr
Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b
Reviewed-on: https://gerrit.libreoffice.org/31318
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit e6ffb539ee232ea0c679928ff456c1cf97429f63)
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/ui/dlg/CondFormat.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 34 |
2 files changed, 14 insertions, 22 deletions
diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index 5f398ffceaf1..32d81f7fa689 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -284,7 +284,7 @@ namespace rptui m_xCopy->removeByIndex( (sal_Int32)nOldConditionIndex ); Conditions::iterator aRemovePos( m_aConditions.begin() + nOldConditionIndex ); - pMovedCondition = *aRemovePos; + pMovedCondition = aRemovePos->get(); m_aConditions.erase( aRemovePos ); } catch( const Exception& ) diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 33f9669f6562..c1a4d5e8db91 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -219,11 +219,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow) { bool bSet = false; Point aStartPoint; - TSectionsMap::const_iterator aIter = m_aSections.begin(); - TSectionsMap::const_iterator aEnd = m_aSections.end(); - for (;aIter != aEnd ; ++aIter) + for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections) { - OSectionWindow* pSectionWindow = (*aIter); if ( pSectionWindow == &_rSectionWindow ) { aStartPoint = pSectionWindow->GetPosPixel(); @@ -248,11 +245,8 @@ void OViewsWindow::Resize() { const Point aOffset(m_pParent->getThumbPos()); Point aStartPoint(0,-aOffset.Y()); - TSectionsMap::const_iterator aIter = m_aSections.begin(); - TSectionsMap::const_iterator aEnd = m_aSections.end(); - for (;aIter != aEnd ; ++aIter) + for (VclPtr<OSectionWindow> const & pSectionWindow : m_aSections) { - OSectionWindow* pSectionWindow = (*aIter); impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true); } } @@ -420,13 +414,11 @@ OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSe OSL_ENSURE(_xSection.is(),"Section is NULL!"); OSectionWindow* pSectionWindow = nullptr; - TSectionsMap::const_iterator aIter = m_aSections.begin(); - TSectionsMap::const_iterator aEnd = m_aSections.end(); - for (; aIter != aEnd ; ++aIter) + for (VclPtr<OSectionWindow> const & p : m_aSections) { - if ((*aIter)->getReportSection().getSection() == _xSection) + if (p->getReportSection().getSection() == _xSection) { - pSectionWindow = (*aIter); + pSectionWindow = p.get(); break; } } @@ -447,23 +439,23 @@ OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const { if (nsa == CURRENT) { - pRet = (*aIter); + pRet = aIter->get(); break; } else if ( nsa == PREVIOUS ) { if (nCurrentPosition > 0) { - pRet = (*(--aIter)); + pRet = (--aIter)->get(); if (pRet == nullptr) { - pRet = (*m_aSections.begin()); + pRet = m_aSections.begin()->get(); } } else { // if we are out of bounds return the first one - pRet = (*m_aSections.begin()); + pRet = m_aSections.begin()->get(); } break; } @@ -472,16 +464,16 @@ OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const sal_uInt32 nSize = m_aSections.size(); if ((nCurrentPosition + 1) < nSize) { - pRet = *(++aIter); + pRet = (++aIter)->get(); if (pRet == nullptr) { - pRet = (*(--aEnd)); + pRet = (--aEnd)->get(); } } else { // if we are out of bounds return the last one - pRet = (*(--aEnd)); + pRet = (--aEnd)->get(); } break; } @@ -946,7 +938,7 @@ OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const OSectionWindow* aReturn = nullptr; if ( _nPos < m_aSections.size() ) - aReturn = m_aSections[_nPos]; + aReturn = m_aSections[_nPos].get(); return aReturn; } |