Hi Mathias,

>>-----%<-----
>>public void saveTo()
>>{
>>    PropertyValue[] saveProperties = new PropertyValue[1];
>>    saveProperties[0] = new PropertyValue();
>>    saveProperties[0].Name = "SaveTo";
>>    saveProperties[0].Value = true;
>>
>>    XMultiServiceFactory xMultiServiceManager = (XMultiServiceFactory)
>>            UnoRuntime.queryInterface( XMultiServiceFactory.class,
>>                        xRemoteServiceManager);
>>    Object oDispatchHandler = null;
>>    try{
>>        oDispatchHandler = xMultiServiceManager.createInstance(
>>                "com.sun.star.frame.DispatchHelper");
>>    }
>>    catch(Exception e)
>>    {
>>        System.out.println("Can't get the Protocol Handler Object...");
>                                           ^^^^^^^^^^^^^^^^
> I assume you copied this from somewhere else... :-)

OOps... Yes, I copied it and fixed it. Thanks for the hint.

>>    }
>>    XModel xModel = (XModel) UnoRuntime.queryInterface (
>>            XModel.class, openDocument);
>>    XController xController = xModel.getCurrentController();
> 
> 
> Theoretically it is possible that you don't get a "current Controller"
> in case the document was loaded without creating a view, but I assume
> that you know where you got it from. "loadComponentFromURL" always
> creates a view so it is safe to rely on a "current Controller".

This will be a component. I won't be able to call it until a document is
opened.

>>    XFrame xFrame = xController.getFrame();
>>    XDispatchProvider xDispatchProvider = (XDispatchProvider)
>>            UnoRuntime.queryInterface (XDispatchProvider.class, xFrame);
>>    XDispatchHelper xDispatchHelper = (XDispatchHelper)
>>            UnoRuntime.queryInterface(XDispatchHelper.class,
>>              oDispatchHandler);
>>    xDispatchHelper.executeDispatch(xDispatchProvider,
>>            ".uno:SaveAs",
>>            "_self",
>>            0,
>>            saveProperties);
>>}
> 
> 
> Looks fine to me.
> 
> 
>>I will post it soon as a snippet. Please review it and add
>>comments/corrections.

> Done. :-)

Thanks Matthias. I'll post it Monday as a snippet.

Greetings and nice weekend,

Tobias

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to