That's quite the way I made it. But I couldn't change the title than. My code:
Code: Select all
XToolkit xtoolkit =(XToolkit)UnoRuntime.queryInterface(XToolkit.class,mxServiceManager.createInstance("com.sun.star.awt.Toolkit") );
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = com.sun.star.awt.WindowClass.TOP;
aDescriptor.WindowServiceName = "window";
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = null;
aDescriptor.Bounds = new com.sun.star.awt.Rectangle(0,0,0,0);
aDescriptor.WindowAttributes = WindowAttribute.CLOSEABLE |
WindowAttribute.BORDER |
WindowAttribute.MOVEABLE |
WindowAttribute.SIZEABLE ;
XWindowPeer xpeer = xtoolkit.createWindow( aDescriptor );
xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class,xpeer);
xFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class, mxServiceManager.createInstance("com.sun.star.frame.Frame"));
xFrame.initialize(xWindow);
XFramesSupplier xTreeRoot = (XFramesSupplier)UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
xTreeRoot.getFrames().append(xFrame);
xFrame.setName("PMOpenOfficeFrame" + System.currentTimeMillis());
But it's fine now, when I create a new frame via loading a template and get the frame from the model:
Code: Select all
PropertyValue[] loadProps = new PropertyValue[3];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "AsTemplate";
loadProps[0].Value = new Boolean(true);
loadProps[1] = new PropertyValue();
loadProps[1].Name = "Hidden";
loadProps[1].Value = new Boolean(false);
loadProps[2] = new PropertyValue();
loadProps[2].Name = "ReadOnly";
loadProps[2].Value = new Boolean(true);
xcomponent = xcomponentloader.loadComponentFromURL("file:///" + destination,"_blank", FrameSearchFlag.ALL, loadProps);
XModel xModel = (XModel) UnoRuntime.queryInterface (XModel.class, xcomponent);
xFrame = xModel.getCurrentController().getFrame();
xWindow = xFrame.getComponentWindow();
But it's still interesting why I can't change the frame title if I create the frame by my self.
Cheers, Ingo