I'm trying to develop a external Java application that interacts with OpenOffice. Basically I want to show the main toolbar buttons (new, save, ...) hints (when mouseover) in a other way, externally. I've been reading, trying and learning a lot OO SDK and UNO API last couple of days, developing a app that intercepts which button from toolbar would you moving the mouse, but until now I couldn't get this up.
Main code until now:
Code: Select all
XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
XMultiComponentFactory xServiceManager = xContext.getServiceManager();
Object desktop = xServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xContext );
XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, desktop);
XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop );
// load a spreadsheet document
String loadURL = "private:factory/scalc"; PropertyValue[] loadProps = new PropertyValue[0];
XComponent document = xComponentLoader.loadComponentFromURL(loadURL, "_blank", 0, loadProps);
xFAL xFAL0 = new xFAL();
XDocumentEventBroadcaster xDEB = (XDocumentEventBroadcaster)UnoRuntime.queryInterface(XDocumentEventBroadcaster.class, document );
xDEL xDEL0 = new xDEL();
xDEB.addDocumentEventListener(xDEL0);
xEL xEL0 = new xEL(); xEL xEL1 = new xEL();
xML xML0 = new xML(); xML xML1 = new xML();
xMM xMM0 = new xMM(); xMM xMM1 = new xMM();
xKL xKL0 = new xKL(); xKL xKL1 = new xKL();
XFrame frame = xDesktop.getCurrentFrame();
frame.getCreator().getActiveFrame().getContainerWindow().addMouseListener(xML0);
frame.getCreator().getActiveFrame().getContainerWindow().addMouseMotionListener(xMM0);
frame.getCreator().getActiveFrame().getContainerWindow().addKeyListener(xKL0);
frame.getCreator().getActiveFrame().getComponentWindow().addMouseListener(xML1);
frame.getCreator().getActiveFrame().getComponentWindow().addMouseMotionListener(xMM1);
frame.getCreator().getActiveFrame().getComponentWindow().addKeyListener(xKL1);
frame.getCreator().getActiveFrame().addFrameActionListener(xFAL0);
xWL xWL0 = new xWL();
frame.getCreator().getActiveFrame().getContainerWindow().addWindowListener(xWL0);
Can anyone help me with that code? Or suggest me a other way to go?
I'll appreciate any help.