diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-09-19 17:46:22 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-19 13:06:19 +0200 |
commit | f83b97f7ae5597462c3b22fc273ca477b2e6fa35 (patch) | |
tree | 00b805ec8d229bd71b051272d1055e65a55af23f /svx | |
parent | a1eecccadd558e585794182920f945862ef34c0c (diff) |
svx: Simplify FmSearchEngine's code with std::unique_ptr
Change-Id: Ibda0f912c940091676889529224488846c91b50f
Reviewed-on: https://gerrit.libreoffice.org/42456
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/form/fmsrcimp.cxx | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index eb05a3676639..596e942f2348 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -281,7 +281,7 @@ void FmSearchEngine::BuildAndInsertFieldInfo(const Reference< css::container::XI OUString FmSearchEngine::FormatField(sal_Int32 nWhich) { DBG_ASSERT((sal_uInt32)nWhich < m_aControlTexts.size(), "FmSearchEngine::FormatField(sal_Int32) : invalid position !"); - DBG_ASSERT(m_aControlTexts[nWhich] != nullptr, "FmSearchEngine::FormatField(sal_Int32) : invalid object in array !"); + DBG_ASSERT(m_aControlTexts[nWhich], "FmSearchEngine::FormatField(sal_Int32) : invalid object in array !"); DBG_ASSERT(m_aControlTexts[nWhich]->getControl().is(), "FmSearchEngine::FormatField : invalid control !"); if (m_nCurrentFieldIndex != -1) @@ -592,13 +592,6 @@ FmSearchEngine::FmSearchEngine(const Reference< XComponentContext >& _rxContext, } -FmSearchEngine::~FmSearchEngine() -{ - clearControlTexts(); - -} - - void FmSearchEngine::SetIgnoreWidthCJK(bool bSet) { if (bSet) @@ -631,14 +624,6 @@ bool FmSearchEngine::GetCaseSensitive() const void FmSearchEngine::clearControlTexts() { - ControlTextSuppliers::const_iterator aEnd = m_aControlTexts.end(); - for ( ControlTextSuppliers::iterator aIter = m_aControlTexts.begin(); - aIter != aEnd; - ++aIter - ) - { - delete *aIter; - } m_aControlTexts.clear(); } @@ -655,21 +640,21 @@ void FmSearchEngine::fillControlTexts(const InterfaceArray& arrFields) Reference< css::awt::XTextComponent > xAsText(xCurrent, UNO_QUERY); if (xAsText.is()) { - m_aControlTexts.insert(m_aControlTexts.end(), new SimpleTextWrapper(xAsText)); + m_aControlTexts.emplace_back(new SimpleTextWrapper(xAsText)); continue; } Reference< css::awt::XListBox > xAsListBox(xCurrent, UNO_QUERY); if (xAsListBox.is()) { - m_aControlTexts.insert(m_aControlTexts.end(), new ListBoxWrapper(xAsListBox)); + m_aControlTexts.emplace_back(new ListBoxWrapper(xAsListBox)); continue; } Reference< css::awt::XCheckBox > xAsCheckBox(xCurrent, UNO_QUERY); DBG_ASSERT(xAsCheckBox.is(), "FmSearchEngine::fillControlTexts : invalid field interface (no supported type) !"); // we don't have any more options ... - m_aControlTexts.insert(m_aControlTexts.end(), new CheckBoxWrapper(xAsCheckBox)); + m_aControlTexts.emplace_back(new CheckBoxWrapper(xAsCheckBox)); } } |