Hi Tobias,

Great thanks, I'll give it a try.

Mirko

On 11/16/06, Tobias Krais <[EMAIL PROTECTED]> wrote:
Hi Mirko,

> does anybody know if the following Java code does *exactly* the same
> thing as invoking Tools / Update / Update All from the Writer menu?

you have to dispatch the .uno:UpdateAll CommandURL.

Here is an example, how I dispatch the .uno:SaveAs CommandURL:
-----%<----
// Setting the SaveTo properties
PropertyValue[] saveProperties = new PropertyValue[1];
saveProperties[0] = new PropertyValue();
saveProperties[0].Name = "SaveTo";
saveProperties[0].Value = new Boolean(true);

// Getting the frame the loaded document resides in
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
        this.xComponent);
XController xController = xModel.getCurrentController();

// Getting the Dispatch Provider
XDispatchProvider xDispatchProvider = (XDispatchProvider)
        UnoRuntime.queryInterface (XDispatchProvider.class,
                                xController.getFrame());

// Getting the Dispatch Helper
XMultiServiceFactory xMultiServiceManager = (XMultiServiceFactory)
        UnoRuntime.queryInterface(XMultiServiceFactory.class,
                OOWorkbench.getXComponentContext().getServiceManager());
Object oDispatchHelper = null;
try{
        oDispatchHelper = xMultiServiceManager.createInstance(
                    "com.sun.star.frame.DispatchHelper");
}
catch(com.sun.star.uno.Exception e){}
XDispatchHelper xDispatchHelper = (XDispatchHelper)
        UnoRuntime.queryInterface(XDispatchHelper.class,
                oDispatchHelper);
// Executing the commandURL
xDispatchHelper.executeDispatch(xDispatchProvider,
                ".uno:SaveAs",
                "_self",
                0,
                saveProperties);
-----%<-----

Greetins, Tobias

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



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

Reply via email to