summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/helpinterceptor.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-16 15:28:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-23 07:44:53 +0100
commit1f75cda1d842717248c6dc926a9d2cd06f39d85b (patch)
tree566fa56bd91fc2033931a73c8692cb9bec5a2b96 /sfx2/source/appl/helpinterceptor.cxx
parent6ada5c93080b4a377ba4f7bb4f8677949cfa2e94 (diff)
loplugin:useuniqueptr in HelpInterceptor_Impl
Change-Id: I75c1ca2d6b0e03604bb6c96d2613261a1a05b988 Reviewed-on: https://gerrit.libreoffice.org/48297 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/appl/helpinterceptor.cxx')
-rw-r--r--sfx2/source/appl/helpinterceptor.cxx20
1 files changed, 5 insertions, 15 deletions
diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx
index 03f81a25e358..a41fc472a02b 100644
--- a/sfx2/source/appl/helpinterceptor.cxx
+++ b/sfx2/source/appl/helpinterceptor.cxx
@@ -47,29 +47,20 @@ HelpInterceptor_Impl::HelpInterceptor_Impl() :
HelpInterceptor_Impl::~HelpInterceptor_Impl()
{
- if ( m_pHistory )
- {
- for (HelpHistoryEntry_Impl* p : *m_pHistory)
- delete p;
- delete m_pHistory;
- }
}
void HelpInterceptor_Impl::addURL( const OUString& rURL )
{
if ( !m_pHistory )
- m_pHistory = new HelpHistoryList_Impl;
+ m_pHistory.reset( new std::vector<std::unique_ptr<HelpHistoryEntry_Impl>> );
size_t nCount = m_pHistory->size();
if ( nCount && m_nCurPos < ( nCount - 1 ) )
{
for ( size_t i = nCount - 1; i > m_nCurPos; i-- )
{
- delete m_pHistory->at( i );
- HelpHistoryList_Impl::iterator it = m_pHistory->begin();
- ::std::advance( it, i );
- m_pHistory->erase( it );
+ m_pHistory->erase( m_pHistory->begin() + i );
}
}
Reference<XFrame> xFrame(m_xIntercepted, UNO_QUERY);
@@ -83,7 +74,7 @@ void HelpInterceptor_Impl::addURL( const OUString& rURL )
m_aCurrentURL = rURL;
Any aEmptyViewData;
- m_pHistory->push_back( new HelpHistoryEntry_Impl( rURL, aEmptyViewData ) );
+ m_pHistory->emplace_back( new HelpHistoryEntry_Impl( rURL, aEmptyViewData ) );
m_nCurPos = m_pHistory->size() - 1;
// TODO ?
if ( m_xListener.is() )
@@ -229,9 +220,8 @@ void SAL_CALL HelpInterceptor_Impl::dispatch(
if ( nPos < ULONG_MAX )
{
- HelpHistoryEntry_Impl* pEntry = m_pHistory->at( nPos );
- if ( pEntry )
- m_pWindow->loadHelpContent(pEntry->aURL, false); // false => don't add item to history again!
+ HelpHistoryEntry_Impl* pEntry = m_pHistory->at( nPos ).get();
+ m_pWindow->loadHelpContent(pEntry->aURL, false); // false => don't add item to history again!
}
m_pWindow->UpdateToolbox();