sw/source/ui/vba/vbacontentcontrollistentry.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 330194d164be6f5ac33a3d7a229f9ace8d54d68d
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Nov 28 14:21:17 2022 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Nov 28 22:00:58 2022 +0100

    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 <jl...@mail.com>

diff --git a/sw/source/ui/vba/vbacontentcontrollistentry.cxx 
b/sw/source/ui/vba/vbacontentcontrollistentry.cxx
index 20bcff0bdcb3..e666bbf0bcd7 100644
--- a/sw/source/ui/vba/vbacontentcontrollistentry.cxx
+++ b/sw/source/ui/vba/vbacontentcontrollistentry.cxx
@@ -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);
 }

Reply via email to