com.sun.star.frame.XFrame Java Examples
The following examples show how to use
com.sun.star.frame.XFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalOfficeConnection.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Returns OpenOffice.org frame integrated into the submitted Java AWT container. * * @param container java AWT container * * @return OpenOffice.org frame integrated into the submitted Java AWT container * * @author Andreas Bröker */ public XFrame getOfficeFrame(final Container container) { if(officeConnection != null) { try { //TODO needs to be changed in later version as the dispose listener can be used. if(!isConnected()) openConnection(); if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating local office window."); final NativeView nativeView = new NativeView(System.getProperty("user.dir")+"/lib"); container.add(nativeView); return getOfficeFrame(nativeView); } catch(Exception exception) { LOGGER.throwing(this.getClass().getName(), "getOfficeFrame", exception); //exception.printStackTrace(); return null; } } else { return null; } }
Example #2
Source File: DocumentLoader.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Loads document from the submitted URL into the OpenOffice.org frame. * * @param serviceProvider the service provider to be used * @param xFrame frame to used for document * @param URL URL of the document * @param searchFlags search flags for the target frame * @param properties properties for OpenOffice.org * * @return loaded document * * @throws Exception if an OpenOffice.org communication error occurs * @throws IOException if document can not be found */ public static IDocument loadDocument(IServiceProvider serviceProvider, XFrame xFrame, String URL, int searchFlags, PropertyValue[] properties) throws Exception, IOException { if (xFrame != null) { if (properties == null) { properties = new PropertyValue[0]; } XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xFrame); return loadDocument(serviceProvider, xComponentLoader, URL, xFrame.getName(), searchFlags, properties); } return null; }
Example #3
Source File: DocumentHelper.java From libreoffice-starter-extension with MIT License | 4 votes |
/** Returns the current frame */ public static XFrame getCurrentFrame(XComponentContext xContext) { XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, getCurrentComponent(xContext)); return xModel.getCurrentController().getFrame(); }
Example #4
Source File: LocalOfficeConnection.java From noa-libre with GNU Lesser General Public License v2.1 | 4 votes |
/** * Returns OpenOffice.org frame integrated into the submitted Java SWT container. * * @param container java SWT container * * @return OpenOffice.org frame integrated into the submitted Java SWT container * * @author Thorsten Behrens */ public XFrame getOfficeFrame(final Composite container) { if(officeConnection != null) { try { //TODO needs to be changed in later version as the dispose listener can be used. if(!isConnected()) openConnection(); if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating local office window."); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface( XToolkit.class, getXMultiServiceFactory().createInstance( "com.sun.star.awt.Toolkit")); // initialise le xChildFactory XSystemChildFactory xChildFactory = (XSystemChildFactory) UnoRuntime .queryInterface(XSystemChildFactory.class, xToolkit); long handle = container.handle; byte[] procID = new byte[0]; XWindowPeer xWindowPeer = xChildFactory.createSystemChild( (Object) handle, procID, SystemDependent.SYSTEM_WIN32); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); Object object = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Task"); //$NON-NLS-1$ if(object == null) object = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Frame"); //$NON-NLS-1$ if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating UNO XFrame interface."); XFrame xFrame = (XFrame) UnoRuntime .queryInterface(XFrame.class, object); xFrame.getContainerWindow(); xFrame.initialize(xWindow); xFrame.setName(xFrame.toString()); if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating desktop service."); Object desktop = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop"); //$NON-NLS-1$ com.sun.star.frame.XFrames xFrames = ((com.sun.star.frame.XFramesSupplier) UnoRuntime .queryInterface(com.sun.star.frame.XFramesSupplier.class, desktop)) .getFrames(); xFrames.append(xFrame); return xFrame; } catch(Exception exception) { LOGGER.throwing(this.getClass().getName(), "getOfficeFrame", exception); //exception.printStackTrace(); return null; } } else { return null; } }
Example #5
Source File: LocalOfficeConnection.java From noa-libre with GNU Lesser General Public License v2.1 | 4 votes |
/** * Returns OpenOffice.org frame integrated into the submitted native view. * * @param nativeView native view * * @return OpenOffice.org frame integrated into the submitted Java AWT container * * @author Markus Krüger * @date 08.12.2006 */ public XFrame getOfficeFrame(NativeView nativeView) { if(officeConnection != null) { try { //TODO needs to be changed in later version as the dispose listener can be used. if(!isConnected()) openConnection(); if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating local office window."); XComponentContext xComponentContext = getXComponentContext(); Object object = null; // Create the document frame from UNO window. (<= 6.0 => Task, >= 6.1 => Frame) if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating UNO XWindow interface."); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface( XToolkit.class, getXMultiServiceFactory().createInstance( "com.sun.star.awt.Toolkit")); // initialise le xChildFactory XSystemChildFactory xChildFactory = (XSystemChildFactory) UnoRuntime .queryInterface(XSystemChildFactory.class, xToolkit); Integer handle = nativeView.getHWND(); short systeme = (short) nativeView.getNativeWindowSystemType(); byte[] procID = new byte[0]; XWindowPeer xWindowPeer = xChildFactory.createSystemChild( (Object) handle, procID, systeme); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); object = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Task"); //$NON-NLS-1$ if(object == null) object = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Frame"); //$NON-NLS-1$ if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating UNO XFrame interface."); XFrame xFrame = (XFrame) UnoRuntime .queryInterface(XFrame.class, object); xFrame.getContainerWindow(); xFrame.initialize(xWindow); xFrame.setName(xFrame.toString()); if(LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("Creating desktop service."); Object desktop = getXMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop"); //$NON-NLS-1$ com.sun.star.frame.XFrames xFrames = ((com.sun.star.frame.XFramesSupplier) UnoRuntime .queryInterface(com.sun.star.frame.XFramesSupplier.class, desktop)) .getFrames(); xFrames.append(xFrame); return xFrame; } catch(Exception exception) { LOGGER.throwing(this.getClass().getName(), "getOfficeFrame", exception); //exception.printStackTrace(); return null; } } else { return null; } }
Example #6
Source File: DesktopService.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Constructs new OpenOffice.org frame which is integrated into the * submitted AWT container. This method works only on local OpenOffice.org * applications. * * @param container AWT container to be used * * @return new OpenOffice.org frame which is integrated into the * submitted AWT container * * @throws DesktopException if the frame can not be constructed * * @author Andreas Bröker */ public IFrame constructNewOfficeFrame(Container container) throws DesktopException { if(officeConnection instanceof LocalOfficeConnection) { XFrame xFrame = ((LocalOfficeConnection)officeConnection).getOfficeFrame(container); Frame frame = new Frame(xFrame, officeConnection); return frame; } throw new DesktopException("New frames can only constructed for local OpenOffice.org applications."); }
Example #7
Source File: DesktopService.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Constructs new OpenOffice.org frame which is integrated into the * submitted SWT container. This method works only on local OpenOffice.org * applications. * * @param container SWT container to be used * * @return new OpenOffice.org frame which is integrated into the * submitted SWT container * * @throws DesktopException if the frame can not be constructed * * @author Thorsten Behrens */ public IFrame constructNewOfficeFrame(Composite composite) throws DesktopException { if(officeConnection instanceof LocalOfficeConnection) { XFrame xFrame = ((LocalOfficeConnection)officeConnection).getOfficeFrame(composite); Frame frame = new Frame(xFrame, officeConnection); return frame; } throw new DesktopException("New frames can only constructed for local OpenOffice.org applications."); }
Example #8
Source File: DesktopService.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Constructs new OpenOffice.org frame which uses the submitted native view. * This method works only on local OpenOffice.org applications. * * @param nativeView native view to be used * * @return new OpenOffice.org frame which uses the submitted native view * * @throws DesktopException if the frame can not be constructed * * @author Markus Krüger * @date 08.12.2006 */ public IFrame constructNewOfficeFrame(NativeView nativeView) throws DesktopException { if(officeConnection instanceof LocalOfficeConnection) { XFrame xFrame = ((LocalOfficeConnection)officeConnection).getOfficeFrame(nativeView); Frame frame = new Frame(xFrame, officeConnection); return frame; } throw new DesktopException("New frames can only constructed for local OpenOffice.org applications."); }
Example #9
Source File: Frame.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Constructs new Frame. * * @param xFrame OpenOffice.org XFrame interface to be used * @param officeConnection office connection to be used * * @author Andreas Bröker */ public Frame(XFrame xFrame, IOfficeConnection officeConnection) { Assert.isNotNull(xFrame, XFrame.class, this); Assert.isNotNull(officeConnection, IOfficeConnection.class, this); this.xFrame = xFrame; this.officeConnection = officeConnection; }
Example #10
Source File: Frame.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Constructs new Frame. * * @param xFrame OpenOffice.org XFrame interface to be used * @param serviceProvider service provider to be used * * @author Markus Krüger * @date 01.08.2007 */ public Frame(XFrame xFrame, IServiceProvider serviceProvider) { Assert.isNotNull(xFrame, XFrame.class, this); Assert.isNotNull(serviceProvider, IServiceProvider.class, this); this.xFrame = xFrame; this.serviceProvider = serviceProvider; }
Example #11
Source File: AbstractDocument.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Returns OpenOffice.org XFrame interface. * * @return OpenOffice.org XFrame interface * * @author Markus Krüger * @date 01.08.2007 */ public XFrame getXFrame() { XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, getXComponent()); XController xController = xModel.getCurrentController(); return xController.getFrame(); }
Example #12
Source File: AbstractDocument.java From noa-libre with GNU Lesser General Public License v2.1 | 3 votes |
/** * Returns Frame of the document. * * @return Frame of the document * * @author Markus Krüger * @date 01.08.2007 */ public IFrame getFrame() { XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, getXComponent()); XController xController = xModel.getCurrentController(); XFrame xFrame = xController.getFrame(); return new Frame(xFrame, getServiceProvider()); }
Example #13
Source File: Frame.java From noa-libre with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns OpenOffice.org XFrame interface. This method * is not part of the public API. * * @return OpenOffice.org XFrame interface * * @author Andreas Bröker */ public XFrame getXFrame() { return xFrame; }
Example #14
Source File: IFrame.java From noa-libre with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns OpenOffice.org XFrame interface. This method * is not part of the public API. * * @return OpenOffice.org XFrame interface * * @author Andreas Bröker */ public XFrame getXFrame();