Designing GUIs for Extensions

Rob Barry rob+libreoffice at muishkin.co.uk
Sat Jul 13 09:51:48 UTC 2019


Hi, 

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!

Thanks,

Rob



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,
this.m_windowPeer);

dialog.createPeer(toolkit, this.m_windowPeer);

m_parentWindow.setVisible(true);
m_parentWindow.setEnable(true);

this.m_window.setVisible(true);
this.m_window.setEnable(true);

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