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

Vincenzo Giuliano wrote:
> Abstract
> 
> Vincenzo Giuliano wrote:
> I could publish it as snippet code, what do you think of it?
> 
> Mathias Bauer wrote:
> Yes, it can be useful until we get the bug fixed.
> 
> 
> Hi ALL,
> this is the snippet code.
> Sorry but I did not add links to IDL-Docs, imports,...
> Best Regards,
> Vincenzo.
> 
> 
> /<!-- ===============================================================/
> /$RCSfile: index.html,v $/
> 
> /last change: $Revision: 1.15 $ $Author: jsc $ $Date: 2005/05/17 13:41:48 $/
> 
> /(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"*>*
> *<p>*How can I open a new view for a document already loaded?*</p>*
> *</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>*
> 
>       *<p>*/**return the new view XController if the document exists*</p>*
>       *<p>** return null if the document does not exist */*</p>*
>       *<p>*public static XController createView(String url)throws 
> java.lang.Exception{*</p>*
>       *<p>*   /**Bootstrap- Service Manager*/*</p>*
>       *<p>*   com.sun.star.uno.XComponentContext remoteContext = 
> com.sun.star.comp.helper.Bootstrap.bootstrap();*</p>*
>         *<p>* System.out.println("Connected to a running office ...");*</p>*
>         *<p>* com.sun.star.lang.XMultiComponentFactory serviceManager = 
> remoteContext.getServiceManager();*</p>*
>         *<p>* String available = (serviceManager != null ? "available" : "not 
> available");*</p>*
>         *<p>* System.out.println( "remote ServiceManager is " + available 
> );*</p>*
>       *<p>*   /***/*</p>*
>         *<p>* /**I create the instance of desktop service*/*</p>*
>         *<p>* XInterface desktop      = 
> (XInterface)serviceManager.createInstanceWithContext("com.sun.star.frame.Desktop",remoteContext);*</p>*
>         *<p>* /**I Search the Components*/*</p>*
>         *<p>* XDesktop xd = 
> (XDesktop)UnoRuntime.queryInterface(XDesktop.class,desktop);*</p>*
>         *<p>* XEnumerationAccess xea = xd.getComponents();*</p>*
>         *<p>* XEnumeration xe = xea.createEnumeration();*</p>*
>         *<p>* /**I search the model affiliated to url*/*</p>*
>         *<p>* XModel currentModel = null;*</p>*
>         *<p>* boolean found = false;*</p>*
>         *<p>* while(xe.hasMoreElements() && found==false){*</p>*
>         *<p>*         currentModel = 
> (XModel)UnoRuntime.queryInterface(XModel.class,xe.nextElement());*</p>*
>         *<p>*         if(currentModel!=null){*</p>*
>         *<p>*                 found = 
> currentModel.getURL().trim().toLowerCase().equals(url.trim().toLowerCase());*</p>*
>         *<p>*         }*</p>*
>         *<p>*         else{*</p>*
>         *<p>*         }*</p>*
>         *<p>* }*</p>*
>         *<p>* /**If the model exists I create the new view*/*</p>*
>         *<p>* if(found){*</p>*
>         *<p>*         XDispatchHelper xdh = 
> (XDispatchHelper)UnoRuntime.queryInterface(XDispatchHelper.class,*</p>*
>       *<p>*                   
> serviceManager.createInstanceWithContext("com.sun.star.frame.DispatchHelper",remoteContext));*</p>*
>         *<p>*         XDispatchProvider xdp = 
> (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class,*</p>*
>       *<p>*                   
> currentModel.getCurrentController().getFrame());*</p>*
>         *<p>*         DispatchResultEvent dre =               
> (DispatchResultEvent)AnyConverter.toObject(DispatchResultEvent.class,*</p>*
>       *<p>*                   
> xdh.executeDispatch(xdp,".uno:NewWindow","",FrameSearchFlag.AUTO,new 
> PropertyValue[0]));*</p>*
>         *<p>*         return currentModel.getCurrentController();*</p>*
>         *<p>* }*</p>*
>         *<p>* else{*</p>*
>         *<p>*         return null;*</p>*
>         *<p>* }*</p>*
>       *<p>*}*</p>*
> *</listing>*
> *</answer>*
> 
> *<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]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to