OpenNewView view window new window Vincenzo Giuliano How can I open a new view for a document already loaded?

I have to use the OpenNewView property.

Mathias Bauer wrote: I think that OOo currently does not treat "OpenNewView" correctly, means: it looks like a bug. I think that this method can be useful until we get the bug fixed.

/**return the new view XController if the document exists * return null if the document does not exist */ private static XController createView(String url)throws java.lang.Exception{ /**Bootstrap- Service Manager*/ com.sun.star.uno.XComponentContext remoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); com.sun.star.lang.XMultiComponentFactory serviceManager = remoteContext.getServiceManager(); String available = (serviceManager != null ? "available" : "not available"); System.out.println( "remote ServiceManager is " + available ); /***/ /**I create the instance of desktop service*/ XInterface desktop = (XInterface)serviceManager.createInstanceWithContext("com.sun.star.frame.Desktop",remoteContext); /**I Search the Components*/ XDesktop xd = (XDesktop)UnoRuntime.queryInterface(XDesktop.class,desktop); XEnumerationAccess xea = xd.getComponents(); XEnumeration xe = xea.createEnumeration(); /**I search the model affiliated to url*/ XModel currentModel = null; boolean found = false; while(xe.hasMoreElements() && found==false){ currentModel = (XModel)UnoRuntime.queryInterface(XModel.class,xe.nextElement()); if(currentModel!=null){ found = currentModel.getURL().trim().toLowerCase().equals(url.trim().toLowerCase()); } else{ } } /**If the model exists I create the new view*/ if(found){ XDispatchHelper xdh = (XDispatchHelper)UnoRuntime.queryInterface(XDispatchHelper.class, serviceManager.createInstanceWithContext("com.sun.star.frame.DispatchHelper",remoteContext)); XDispatchProvider xdp = (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, currentModel.getCurrentController().getFrame()); DispatchResultEvent dre = (DispatchResultEvent)AnyConverter.toObject(DispatchResultEvent.class, xdh.executeDispatch(xdp,".uno:NewWindow","",FrameSearchFlag.AUTO,new PropertyValue[0])); return currentModel.getCurrentController(); } else{ return null; } }
Initial version