sw/inc/formatcontentcontrol.hxx | 4 ++++ sw/source/core/txtnode/attrcontentcontrol.cxx | 4 ++-- sw/source/core/unocore/unocontentcontrol.cxx | 2 +- sw/source/ui/misc/contentcontroldlg.cxx | 2 +- sw/source/ui/vba/vbacontentcontrollistentry.cxx | 8 ++++---- 5 files changed, 12 insertions(+), 8 deletions(-)
New commits: commit 126f65b97d42cac400e9d8ff781488c44ef65fba Author: Noel Grandin <[email protected]> AuthorDate: Thu Jan 8 09:10:55 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Jan 9 22:15:17 2026 +0100 can move rather than copy this data Change-Id: Ifa0124e1da72371b766fb89da9e823fbe21e3ca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196902 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx index 72383d76710d..91efffd11e28 100644 --- a/sw/inc/formatcontentcontrol.hxx +++ b/sw/inc/formatcontentcontrol.hxx @@ -259,6 +259,10 @@ public: { m_aListItems = rListItems; } + void SetListItems(std::vector<SwContentControlListItem>&& rListItems) + { + m_aListItems = std::move(rListItems); + } bool AddListItem(size_t nZIndex, const OUString& rDisplayText, const OUString& rValue); void DeleteListItem(size_t nZIndex); diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx b/sw/source/core/txtnode/attrcontentcontrol.cxx index 901fa17013a3..c99b25b8b4f8 100644 --- a/sw/source/core/txtnode/attrcontentcontrol.cxx +++ b/sw/source/core/txtnode/attrcontentcontrol.cxx @@ -333,7 +333,7 @@ bool SwContentControl::AddListItem(size_t nZIndex, const OUString& rDisplayText, } std::vector<SwContentControlListItem> vListItems = GetListItems(); vListItems.insert(vListItems.begin() + nZIndex, aListItem); - SetListItems(vListItems); + SetListItems(std::move(vListItems)); return true; } @@ -357,7 +357,7 @@ void SwContentControl::DeleteListItem(size_t nZIndex) std::vector<SwContentControlListItem> vListItems = GetListItems(); vListItems.erase(vListItems.begin() + nZIndex); - SetListItems(vListItems); + SetListItems(std::move(vListItems)); return; } diff --git a/sw/source/core/unocore/unocontentcontrol.cxx b/sw/source/core/unocore/unocontentcontrol.cxx index d0b4708a1d1b..1cb7256ac46b 100644 --- a/sw/source/core/unocore/unocontentcontrol.cxx +++ b/sw/source/core/unocore/unocontentcontrol.cxx @@ -715,7 +715,7 @@ void SAL_CALL SwXContentControl::setPropertyValue(const OUString& rPropertyName, } else { - m_pImpl->m_pContentControl->SetListItems(aItems); + m_pImpl->m_pContentControl->SetListItems(std::move(aItems)); if (!m_pImpl->m_pContentControl->GetComboBox() && !m_pImpl->m_pContentControl->GetDropDown()) diff --git a/sw/source/ui/misc/contentcontroldlg.cxx b/sw/source/ui/misc/contentcontroldlg.cxx index 08b846891f10..3d7f7dd9ec50 100644 --- a/sw/source/ui/misc/contentcontroldlg.cxx +++ b/sw/source/ui/misc/contentcontroldlg.cxx @@ -263,7 +263,7 @@ IMPL_LINK_NOARG(SwContentControlDlg, OkHdl, weld::Button&, void) } if (aItems != m_aSavedListItems) { - m_pContentControl->SetListItems(aItems); + m_pContentControl->SetListItems(std::move(aItems)); bChanged = true; } diff --git a/sw/source/ui/vba/vbacontentcontrollistentry.cxx b/sw/source/ui/vba/vbacontentcontrollistentry.cxx index 311ab513c2f5..8b609f095518 100644 --- a/sw/source/ui/vba/vbacontentcontrollistentry.cxx +++ b/sw/source/ui/vba/vbacontentcontrollistentry.cxx @@ -64,7 +64,7 @@ void SwVbaContentControlListEntry::setText(const OUString& rSet) const bool bNeedsInvalidation = m_pCC->GetDropDown() && oSel && *oSel == m_nZIndex; vListItems[m_nZIndex].m_aDisplayText = rSet; - m_pCC->SetListItems(vListItems); + m_pCC->SetListItems(std::move(vListItems)); if (bNeedsInvalidation) { @@ -92,7 +92,7 @@ void SwVbaContentControlListEntry::setValue(const OUString& rSet) vListItems[m_nZIndex].m_aDisplayText = vListItems[m_nZIndex].ToString(); vListItems[m_nZIndex].m_aValue = rSet; - m_pCC->SetListItems(vListItems); + m_pCC->SetListItems(std::move(vListItems)); } void SwVbaContentControlListEntry::Delete() { m_pCC->DeleteListItem(m_nZIndex); } @@ -113,7 +113,7 @@ void SwVbaContentControlListEntry::MoveDown() } std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems(); std::swap(vListItems[m_nZIndex], vListItems[m_nZIndex + 1]); - m_pCC->SetListItems(vListItems); + m_pCC->SetListItems(std::move(vListItems)); ++m_nZIndex; } @@ -133,7 +133,7 @@ void SwVbaContentControlListEntry::MoveUp() } std::vector<SwContentControlListItem> vListItems = m_pCC->GetListItems(); std::swap(vListItems[m_nZIndex], vListItems[m_nZIndex - 1]); - m_pCC->SetListItems(vListItems); + m_pCC->SetListItems(std::move(vListItems)); --m_nZIndex; }
