diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-08-15 21:32:27 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-20 17:12:11 +0200 |
commit | 0787ce8814e37972a0c968f60008d4e8722b6e27 (patch) | |
tree | 9d2803ebda8813e6b3f2bc2e6f8a74953b2931c1 /sw/source/ui/index | |
parent | d2c9c60fefb9687adbde4be61ed66a5123a2587f (diff) |
Simplify containers iterations, tdf#96099 follow-up
Use range-based loop or replace with std::any_of, std::find and
std::find_if where applicable.
Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6
Reviewed-on: https://gerrit.libreoffice.org/59143
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/index')
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index b3030f87d711..d5187dae1b0c 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2811,11 +2811,11 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL) if(m_pForm) { - for (auto iter = m_aControlList.begin(); iter != m_aControlList.end(); ++iter) - iter->disposeAndClear(); + for (auto& aControl : m_aControlList) + aControl.disposeAndClear(); //apply current level settings to the form - for (auto it = m_aControlList.begin(); it != m_aControlList.end(); ++it) - it->disposeAndClear(); + for (auto& aControl : m_aControlList) + aControl.disposeAndClear(); m_aControlList.clear(); } @@ -3395,10 +3395,8 @@ OUString SwTokenWindow::GetPattern() const { OUStringBuffer sRet; - for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it) + for (const Control* pCtrl : m_aControlList) { - const Control *pCtrl = *it; - const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pCtrl))->GetFormToken() : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken(); @@ -3415,10 +3413,8 @@ bool SwTokenWindow::Contains(FormTokenType eSearchFor) const { bool bRet = false; - for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it) + for (const Control* pCtrl : m_aControlList) { - const Control *pCtrl = *it; - const SwFormToken &rNewToken = pCtrl->GetType() == WindowType::EDIT ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pCtrl))->GetFormToken() : static_cast<const SwTOXButton*>(pCtrl)->GetFormToken(); @@ -3555,9 +3551,9 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void ) IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, Control&, rControl, void ) { SwTOXButton* pBtn = static_cast<SwTOXButton*>(&rControl); - for (auto it = m_aControlList.begin(); it != m_aControlList.end(); ++it) + for (auto& aControl : m_aControlList) { - Control *pControl = it->get(); + Control *pControl = aControl.get(); if (pControl && WindowType::EDIT != pControl->GetType()) static_cast<SwTOXButton*>(pControl)->Check(pBtn == pControl); @@ -3602,9 +3598,8 @@ sal_uInt32 SwTokenWindow::GetControlIndex(FormTokenType eType) const } sal_uInt32 nIndex = 0; - for (auto it = m_aControlList.cbegin(); it != m_aControlList.cend(); ++it) + for (const Control* pControl : m_aControlList) { - const Control* pControl = *it; const SwFormToken& rNewToken = WindowType::EDIT == pControl->GetType() ? const_cast<SwTOXEdit*>(static_cast<const SwTOXEdit*>(pControl))->GetFormToken() : static_cast<const SwTOXButton*>(pControl)->GetFormToken(); |