vcl/source/treelist/svtabbx.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit fe38553aef2121f358fb58e450ec69314aad851e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jul 22 16:19:02 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Jul 22 21:04:34 2022 +0200

    vcl: allow editing a column other than the first one in SvTabListBox
    
    There are 2 members mvTabList and aTabs in SvTabListBox and
    SvTreeListBox, and only aTabs is evaluated to determine which column
    should be edited when calling start_editing().
    
    This solution is probably not ideal; it would be better to have a
    parameter to select the column because one might want multiple editable
    columns with multiple buttons...
    
    Also, the native GTK implementation has the same bug (but there
    double-clicking the column works).
    
    Change-Id: I727792e635d3b610a2132ee5f4155e3ee610aaf2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137362
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index d4fb5db37c39..f1277eafd41a 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -153,6 +153,16 @@ void SvTabListBox::SetTabs()
     }
     */
 
+    // the 1st column (index 1 or 2 depending on button flags) is always set
+    // editable by SvTreeListBox::SetTabs(),
+    // which prevents setting a different column to editable as the first
+    // one with the flag is picked in SvTreeListBox::ImplEditEntry()
+    assert(aTabs.back()->nFlags & SvLBoxTabFlags::EDITABLE);
+    if (!(mvTabList[0].nFlags & SvLBoxTabFlags::EDITABLE))
+    {
+        aTabs.back()->nFlags &= ~SvLBoxTabFlags::EDITABLE;
+    }
+
     // append all other tabs to the list
     for( sal_uInt16 nCurTab = 1; nCurTab < sal_uInt16(mvTabList.size()); 
nCurTab++ )
     {

Reply via email to