/*XComponent xComponent = (XComponent) UnoRuntime.queryInterface(
XComponent.class, bridge);*/
// get the remote instance
x = bridge.getInstance("StarOffice.ServiceManager");
// Query the initial object for its main factory interface
XMultiComponentFactory xMultiComponentFactory = (XMultiComponentFactory) UnoRuntime
.queryInterface(XMultiComponentFactory.class, x);
XPropertySet xProperySet = (XPropertySet) UnoRuntime
.queryInterface(XPropertySet.class, xMultiComponentFactory);
// Get the default context from the office server.
Object oDefaultContext = xProperySet
.getPropertyValue("DefaultContext");
// Query for the interface XComponentContext.
xComponentContext = (XComponentContext) UnoRuntime.queryInterface(
XComponentContext.class, oDefaultContext);
while (xcomponentloader == null) {
try {
xcomponentloader = (XComponentLoader) UnoRuntime
.queryInterface(
XComponentLoader.class,
xMultiComponentFactory
.createInstanceWithContext(
"com.sun.star.frame.Desktop",
xComponentContext));
//System.out.println("Loading document "+url);
FTPClient ftp = new FTPClient();
if(!host.equals("localhost")){
//ftp connexion
ftp.setRemoteHost(host);
ftp.connect();
ftp.login(ftpuser, ftpPasswd);
ftp.setConnectMode(FTPConnectMode.PASV);
ftp.setType(FTPTransferType.BINARY);
try{
ftp.mkdir(remoteFolder);
}catch(Exception e){}
ftp.chdir(remoteFolder);
ftp.put(url,"presentation.ppt");
url = remoteFolderFullPath+"/"+remoteFolder+"/presentation.ppt";
}
PropertyValue[] loadProps = new PropertyValue[2];
loadProps[0] = new PropertyValue();
loadProps[0].Name = "Hidden";
loadProps[0].Value = new Boolean(true);
// open the document
XComponent component = xcomponentloader
.loadComponentFromURL(url,
"_blank", 0, loadProps);
//System.out.println("Document Opened");
// filter
loadProps = new PropertyValue[4];
// type of image
loadProps[0] = new PropertyValue();
loadProps[0].Name = "MediaType";
loadProps[0].Value = "image/png";
// Height and width
PropertyValue[] filterDatas = new PropertyValue[4];
for(int i = 0; i<4 ; i++){
filterDatas[i] = new PropertyValue();
}
filterDatas[0].Name = "PixelWidth";
filterDatas[0].Value = new Integer(width);
filterDatas[1].Name = "PixelHeight";
filterDatas[1].Value = new Integer(height);
filterDatas[2].Name = "LogicalWidth";
filterDatas[2].Value = new Integer(2000);
filterDatas[3].Name = "LogicalHeight";
filterDatas[3].Value = new Integer(2000);
XDrawPagesSupplier pagesSupplier = (XDrawPagesSupplier) UnoRuntime
.queryInterface(XDrawPagesSupplier.class, component);
//System.out.println(pagesSupplier.toString());
XDrawPages pages = pagesSupplier.getDrawPages();
int nbPages = pages.getCount();
for (int i = 0; i < nbPages; i++) {
XDrawPage page = (XDrawPage) UnoRuntime.queryInterface(
com.sun.star.drawing.XDrawPage.class, pages
.getByIndex(i));
XNamed xPageName = (XNamed)UnoRuntime.queryInterface(XNamed.class,page);
xPageName.setName("slide"+(i+1));
//if(!xPageName.getName().equals("slide"+(i+1)) && !xPageName.getName().equals("page"+(i+1)))
//xPageName.setName((i+1)+"-"+xPageName.getName());
Object GraphicExportFilter = xMultiComponentFactory
.createInstanceWithContext(
"com.sun.star.drawing.GraphicExportFilter",
xComponentContext);
XExporter xExporter = (XExporter) UnoRuntime
.queryInterface(XExporter.class,