[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Apr 25 15:51:09 UTC 2020


 include/vcl/viewdataentry.hxx         |    1 +
 vcl/source/app/salvtables.cxx         |   14 +++++++++++---
 vcl/source/treelist/viewdataentry.cxx |    5 +++++
 3 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 2e20bf9c6ce56596477f661b33524ac00bd6dcd5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 24 15:14:00 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Apr 25 17:50:31 2020 +0200

    Resolves: tdf#132143 make placeholder nodes unselectable
    
    Change-Id: I13bcb43122f6b82114f287f13da20a584bf5f349
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92862
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/viewdataentry.hxx b/include/vcl/viewdataentry.hxx
index 85f4d32ed118..74d7d22b98de 100644
--- a/include/vcl/viewdataentry.hxx
+++ b/include/vcl/viewdataentry.hxx
@@ -72,6 +72,7 @@ public:
     void SetFocus( bool bFocus );
     void SetSelected( bool bSelected );
     void SetExpanded( bool bExpanded );
+    void SetSelectable( bool bSelectable );
     void SetDragTarget( bool bDragTarget )
     {
         mbDragTarget = bDragTarget;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 5313ae39d01f..ebf0b499f86c 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3492,7 +3492,9 @@ public:
 
         if (bChildrenOnDemand)
         {
-            m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+            SvTreeListEntry* pPlaceHolder = m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pPlaceHolder);
+            pViewData->SetSelectable(false);
         }
         enable_notify_events();
     }
@@ -4259,7 +4261,11 @@ public:
         SvTreeListEntry* pPlaceHolder = GetPlaceHolderChild(rVclIter.iter);
 
         if (bChildrenOnDemand && !pPlaceHolder)
-            m_xTreeView->InsertEntry("<dummy>", rVclIter.iter, false, 0, nullptr);
+        {
+            pPlaceHolder = m_xTreeView->InsertEntry("<dummy>", rVclIter.iter, false, 0, nullptr);
+            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pPlaceHolder);
+            pViewData->SetSelectable(false);
+        }
         else if (!bChildrenOnDemand && pPlaceHolder)
             m_xTreeView->RemoveEntry(pPlaceHolder);
 
@@ -4801,7 +4807,9 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, SvTreeListBox*, bool)
         //expand disallowed, restore placeholder
         if (!bRet)
         {
-            m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+            pPlaceHolder = m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pPlaceHolder);
+            pViewData->SetSelectable(false);
         }
         m_aExpandingPlaceHolderParents.erase(pEntry);
     }
diff --git a/vcl/source/treelist/viewdataentry.cxx b/vcl/source/treelist/viewdataentry.cxx
index bde20c337c60..76a3fc7e3c7e 100644
--- a/vcl/source/treelist/viewdataentry.cxx
+++ b/vcl/source/treelist/viewdataentry.cxx
@@ -66,6 +66,11 @@ void SvViewDataEntry::SetExpanded( bool bExpanded )
     mbExpanded = bExpanded;
 }
 
+void SvViewDataEntry::SetSelectable( bool bSelectable )
+{
+    mbSelectable = bSelectable;
+}
+
 void SvViewDataEntry::Init(size_t nSize)
 {
     maItems.resize(nSize);


More information about the Libreoffice-commits mailing list