Expanding Nodes in TreeControl, yields Error: "unsatisfied query for interface…

jan dittrich.c.jan at gmail.com
Sun Jul 9 10:51:06 UTC 2017


Hello Libreoffice Devs,

I’m writing on an extension [0] that uses a Tree Control in its user
interface. I want the nodes of the tree all expanded (Currently they are
collapsed, seemingly by default), but when I try to I get a
"unsatisfied query for interface…-Error.

DESCRIPTION OF USED OBJECTS/METHODS: The function to expand is
implemented in XTreeControl [1], expandNode
It takes an XTreeNode as argument. To implement the tree I use the
mutableTreeDataModel [2], I create nodes on this, attach the tree to the
control’s data model and then pass the DataModel’s root node and
TreeControl to a helper that recursively should traverse the tree and
expand all nodes.

ERROR: However, when I call treeControl.expandNode(someNode), (someNode
being a [3])I get the following error:

com.sun.star.uno.RuntimeException: unsatisfied query for interface of
type com.sun.star.awt.tree.XTreeControl! (Error during invoking function
[… callstack…]

I assumed, since the TreeControl has the method, the data model in the
one that is set for the TreeControl and XMutableTreeNode inherits from
XTreeNode, I should be able to do what I tried above.

CONTEXT: In the implementation, the critical part would be here:
("would" since I did not commit the code, but I can put it on a branch
if it helps)

https://github.com/jdittrich/Office-QDA-TagTree/blob/master/src/pythonpath/ui_logic/qdaTreePanel.py#L110

from where I would call
expandAllNodesGuiTree(treeControl.Model.DataModel.Root, treeControl)

which calls

def expandAllNodesGuiTree(root,treeControl):
    for count in range(0,root.ChildCount):
        child = root.getChildAt(count)
        treeControl.expandNode(child)
        if child.ChildCount > 0:
            expandAllNodesGuiTree(child, treeControl)

Is this problem known? I assume I messed up the types somewhere, but I
was unable to find the source of the problem.

Kind Regards,
 Jan


LINKS:
[0]: https://github.com/jdittrich/Office-QDA-TagTree
[1]:
http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1tree_1_1XTreeControl.html#ab31fac529713c7b31a0758f42d54dcc4
[2]:
http://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1awt_1_1tree_1_1MutableTreeDataModel.html
[3]
http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1awt_1_1tree_1_1XMutableTreeNode.html


More information about the LibreOffice mailing list