sw/source/ui/misc/contentcontroldlg.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit e9a7ed53260feef439b7b046286352b23a69668b
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Jun 8 08:24:02 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jun 8 11:07:35 2022 +0200

    sw content controls: update the cursor at SwContentControlDlg end
    
    Once a dropdown content control is inserted, the properties dialog can
    modify list items. The desktop case updates these list items when
    SfxViewFrame::Enable() calls SwView::ShowCursor(), but for some reason
    the same implicit update doesn't happen in the LOK case.
    
    This means adding new list items requires leaving the content control &
    entering again, then the dropdown shows the new list items, which is
    confusing. And also the update (when it works) is implicit, so it can
    break without us noticing.
    
    Fix the problem by explicitly updating the cursor before ending the
    properties dialog: this will scroll to the cursor position, but that's
    not a problem since the properties dialog is always editing the content
    control at the current position anyway.
    
    Show / hide is used because that's an easy way to call
    SwCursorShell::UpdateCursor(), which is private to us.
    
    Change-Id: I43aca24c2961ef6c4cc14f895edd6f3f22980148
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135483
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/ui/misc/contentcontroldlg.cxx 
b/sw/source/ui/misc/contentcontroldlg.cxx
index 84f440a6fa8f..95c86120e497 100644
--- a/sw/source/ui/misc/contentcontroldlg.cxx
+++ b/sw/source/ui/misc/contentcontroldlg.cxx
@@ -224,6 +224,10 @@ IMPL_LINK_NOARG(SwContentControlDlg, OkHdl, weld::Button&, 
void)
     if (bChanged)
     {
         m_rWrtShell.GetDoc()->getIDocumentState().SetModified();
+
+        // Make sure that the cursor gets updated with the new list items.
+        m_rWrtShell.HideCursor();
+        m_rWrtShell.ShowCursor();
     }
 
     m_xDialog->response(RET_OK);

Reply via email to