diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-12-01 15:19:04 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-12-01 18:26:01 +0100 |
commit | 56d97cdd0af15c90c744d2ac66e879818c073ec6 (patch) | |
tree | 98278957d27659cfa9fe5e9b1a4e2e550637fd73 /sfx2/source/dialog/infobar.cxx | |
parent | fff501a3393b459c512ec155e2d2cd935e7885a2 (diff) |
Simplify containers iterations in sfx2, shell
Use range-based loop or replace with STL functions
Change-Id: I42361d6a73d201db8eb6dca09d79768e2d62051d
Reviewed-on: https://gerrit.libreoffice.org/64389
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/dialog/infobar.cxx')
-rw-r--r-- | sfx2/source/dialog/infobar.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index 349d09cf405f..d1f753c8da71 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -222,8 +222,8 @@ void SfxInfoBarWindow::SetForeAndBackgroundColors(InfoBarType eType) void SfxInfoBarWindow::dispose() { - for ( auto it = m_aActionBtns.begin( ); it != m_aActionBtns.end( ); ++it ) - it->disposeAndClear(); + for ( auto& rxBtn : m_aActionBtns ) + rxBtn.disposeAndClear(); m_pImage.disposeAndClear(); m_pMessage.disposeAndClear(); @@ -382,14 +382,11 @@ bool SfxInfoBarContainerWindow::hasInfoBarWithID( const OUString &sId ) void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const & pInfoBar) { // Remove - for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it) + auto it = std::find(m_pInfoBars.begin(), m_pInfoBars.end(), pInfoBar); + if (it != m_pInfoBars.end()) { - if (pInfoBar == *it) - { - it->disposeAndClear(); - m_pInfoBars.erase(it); - break; - } + it->disposeAndClear(); + m_pInfoBars.erase(it); } // Resize @@ -412,12 +409,12 @@ void SfxInfoBarContainerWindow::Resize() // Only need to change the width of the infobars long nWidth = GetSizePixel().getWidth(); - for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it) + for (auto& rxInfoBar : m_pInfoBars) { - Size aSize = (*it)->GetSizePixel(); + Size aSize = rxInfoBar->GetSizePixel(); aSize.setWidth(nWidth); - (*it)->SetSizePixel(aSize); - (*it)->Resize(); + rxInfoBar->SetSizePixel(aSize); + rxInfoBar->Resize(); } } |