Hi all,
on a open document I change the content of some macros by the API with
java. I can see the changes if I open the document macros with the
basic-IDE, but I need to click and insert a white space somewhere
before the changed macro content is noticed by the Basic-Engine.
Here is the snipped of the relevant part.
protected void updateScripts(XComponent doc) {
try {
XPropertySet docProperties = (XPropertySet)
UnoRuntime .queryInterface(XPropertySet.class,doc);
Object obj = docProperties.getPropertyValue("BasicLibraries");
XLibraryContainer2 libraryContainer = (XLibraryContainer2)
UnoRuntime .queryInterface(XLibraryContainer2.class, obj);
String[] libs = libraryContainer.getElementNames();
for (int i = 0; i < libs.length; i++) {
Object libObject = libraryContainer.getByName(libs[i]);
//first remove
libraryContainer.removeLibrary(libs[i]); //create new
//update this library
XNameAccess libraryContainer = (XNameAccess) UnoRuntime
.queryInterface(XNameAccess.class,obj);
// edit the content here
.....
//re-create the library
XNameContainer con =libraryContainer.createLibrary(libs[i]);
//add all modules again to this container
con.insertByName(.....
}
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace();
}
}
So I need to force a refresh or a reload of the script-part of the
document, that the basic-engine notice the updated content. I found a
solution for reloading a document on the list-archive:
XModel.attachResource(String url,PropertyValue[] mediaDescriptor);
and then dispatch ".uno:Reload", but does not work, but there was
announced a reloading mechanism for OpenOffice 2.0.
Will this help or are there other solution?
Best Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]