Added 'parent is/was in tree' param to bind_to_tree/unbind_from_tree

According to a talk with Ms2ger, both bind_to_tree / unbind_from_tree should be called regardless if the tree is part of a Document. This information is now passed as a parameter to their respective virtual methods.