Two New Methods for SvTreeListBox

Eike Rathke erack at redhat.com
Mon Jun 19 16:19:14 UTC 2017


Hi Muhammet,

On Friday, 2017-06-16 14:24:50 +0300, Muhammet Kara wrote:

> >      bool Remove( const SvTreeListEntry* pEntry );
> Seems so. This is the method I mentioned in the previous post. It is a
> member of the SvTreeList class, and can be accessed after calling GetModel()
> on an SvTreeListBox object, and using the returned pointer to the related
> SvTreeList object. This method is called separately for each child in the
> RemoveSelected() method, so I assumed it might leave some (all?) children
> orphan.

Take a look at the implementation SvTreeList::Remove() in
svtools/source/contnr/treelist.cxx  From a short glance to me it looks
like it also removes all children.

> > > RemoveSingleEntry(SvTreeListEntry* pEntry) //Don't check for children
> > You'd likely end up with orphans then.
> Yep. It should be called only when you are sure that there is no children. I
> want to use it that way at least (to get rid of extra call to
> HasChildren()).

Why? If there are no children then the already existing Remove()'s
internal call to SvTreeList::GetChildCount() shouldn't be expensive. You
don't need to call HasChildren() in advance, from what I grasped, and
even that wouldn't be expensive.

> And I will explain this in its comment. Do you think we
> shouldn't have such a method because it can be misused?

I don't see it would be necessary.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170619/d3c1c5ba/attachment.sig>


More information about the LibreOffice mailing list