Tom Schindl wrote:
Hi Tom,Sorry Vincenzo, but how are you creating the snippet, I suppose not with Paolos snippet-creator ;-) All those <p> shouldn't be there, there's no operation-system and oo-version information.Would you mind downloading and installing Paolo's snippet-creator from his homepage and repost the snippet? http://www.paolo-mantovani.org/ Tom I took your advice and I used the snippet-creator. This is its result. Let me know if there are problems. Best Regards, Vincenzo. <?xml version="1.0"?> <!-- $RCSfile: $ last change: $Revision: $ $Author: $ $Date: $ (c)2003 by the copyright holders listed with the author-tags. If no explicit copyright holder is mentioned with a certain author, the author him-/herself is the copyright holder. All rights reserved. Public Documentation License Notice: The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the "License"); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html The Original Documentation can be found in the CVS archives of openoffice.org at the place specified by RCSfile: in this header. The Initial Writer(s) of the Original Documentation are listed with the author-tags below. The Contributor(s) are listed with the author-tags below without the marker for being an initial author. All Rights Reserved. --> <snippet language="Java" application="Office"> <keywords> <keyword>OpenNewView</keyword> <keyword>view</keyword> <keyword>window</keyword> <keyword>new window</keyword> </keywords> <authors> <author id="[EMAIL PROTECTED]" email="[EMAIL PROTECTED]">Vincenzo Giuliano</author> </authors> <question heading="Open new view on OpenOffice document">How can I open a new view for a document already loaded? </question> <answer> <p>I have to use the OpenNewView property.</p> <p>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.</p> <listing> /**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; } }</listing> </answer> <versions> </versions> <operating-systems> <operating-system name="All"/> </operating-systems> <changelog> <change author-id="[EMAIL PROTECTED]" date="2006-02-21">Initial version</change> </changelog> </snippet> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] |
- [api-dev] Re: Re: Re: Re: OpenNewView snippet code Vincenzo Giuliano
- Re: [api-dev] Re: Re: Re: Re: OpenNewView snippet ... Tom Schindl
- [api-dev] Re:Re: Re: Re: Re: OpenNewView snipp... Vincenzo Giuliano