Designing GUIs for Extensions

Rob Barry rob+libreoffice at
Sat Jul 13 09:51:48 UTC 2019


I'm wondering if someone can give me a hand. I'm developing an
extension which makes use of the sidebar functionality. I want to use
a GUI tool to develop the UI and since I didn't find anything
suggesting that the glade ui tools can be used with extensions, I've
been following the path of using '.xdg' dialogs which can be generated
inside LibreOffice (calc/base). I've been able to successfully use
these to generate standalone dialogs but I'd like to populate a sidebar
panel using the '.xdg' method. Anyone know if it's possible? 

My approach: I end up with an instance of XUnoControlDialog but haven't
been able to find a way to take the GUI elements and place them in a
different window. I thought that XControl.createPeer(toolkit,
windowPeer) (see below code) would be sufficient to link the primary
control from the dialog to the location that I want it to be output. Is
there something I'm missing or am I being hopelessly optimistic that
this will work?

I have struggled through the many UNO interfaces and haven't been able
to find any overlap that would allow me to take the populated view from
the (hidden) dialog and stick it in the sidebar panel. 

Perhaps this isn't the best approach and I'm willing to hear any other
suggestions you guys have!



My attempt to take the controls from the XUnoControlDialog and attach
them to a different window in the Sidebar:

XUnoControlDialog dialog = MwnciDialog.getDialog(dialogXdgRelativeUrl,
componentContext, uiHandler);

XToolkit toolkit = this.m_parentWindowPeer.getToolkit();

WindowDescriptor windowDescriptor = new WindowDescriptor();
windowDescriptor.Type = WindowClass.CONTAINER;
windowDescriptor.WindowServiceName = "";
windowDescriptor.Parent = m_parentWindowPeer;
windowDescriptor.ParentIndex = -1;
windowDescriptor.Bounds = new Rectangle(0, 0, 200, 200);
windowDescriptor.WindowAttributes =
        WindowAttribute.SIZEABLE | WindowAttribute.MOVEABLE
                | WindowAttribute.NODECORATION;

this.m_windowPeer = toolkit.createWindow(windowDescriptor);
this.m_window = UnoRuntime.queryInterface(XWindow.class,

dialog.createPeer(toolkit, this.m_windowPeer);



this.m_window.setPosSize(0, 0, 200, 200, (short)(PosSize.Y |
PosSize.WIDTH)) ;
dialog.setPosSize(0, 0, 200, 200, (short)(PosSize.Y | PosSize.WIDTH)) ;

More information about the LibreOffice mailing list