tdf#151548 ContentControls: improve ListEntry::setValue
The LO implementation pulls the display text from the value in case there is no display text provided. This is the opposite from VBA. So when we set the Value, make sure that we aren't unintentionally changing the display as well. Change-Id: I699bfc1c2e9fbab6574a3c1363fe1dc21c7354e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143416 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
@@ -81,6 +81,11 @@ void SwVbaContentControlListEntry::setValue(const OUString& rSet)
|
||||
const std::shared_ptr<SwContentControl> pCC = m_rCC.GetContentControl().GetContentControl();
|
||||
assert(m_nZIndex < pCC->GetListItems().size());
|
||||
std::vector<SwContentControlListItem> vListItems = pCC->GetListItems();
|
||||
|
||||
// LO may pull the display text from Value. Ensure changing Value doesn't alter display text.
|
||||
if (vListItems[m_nZIndex].m_aDisplayText.isEmpty())
|
||||
vListItems[m_nZIndex].m_aDisplayText = vListItems[m_nZIndex].ToString();
|
||||
|
||||
vListItems[m_nZIndex].m_aValue = rSet;
|
||||
pCC->SetListItems(vListItems);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user