java - Save XDrawPage, Get Fullscreen presentation -


i'm trying control simpress presentation java program. can next effect of presentation when it's not fullscreen. if put propertyvalue "isfullscreen" "true", presentation.isrunning() return false, , xslideshowcontroller null.

   public static void lancerpresentation(string url) throws indexoutofboundsexception, com.sun.star.io.ioexception, interruptedexception{     //we open file "~/documents/testuno.odp"     xcomponent xcomponent=null;     xpresentation2 presentation2 =null;     try {         // remote office component context         xcomponentcontext xcontext = com.sun.star.comp.helper.bootstrap.bootstrap();         xcomponent = openpresentation(xcontext, url);         xpresentationsupplier presentationsupplier = unoruntime.queryinterface(xpresentationsupplier.class, xcomponent);         xpresentation presentation = presentationsupplier.getpresentation();         presentation2 = unoruntime.queryinterface(xpresentation2.class, presentation);         propertyvalue[] apresentationargs = new propertyvalue[3];              apresentationargs[0] = new propertyvalue();             apresentationargs[0].name = "isalwaysontop";             apresentationargs[0].value = boolean.true;              apresentationargs[1] = new propertyvalue();             apresentationargs[1].name = "isfullscreen";             apresentationargs[1].value = boolean.true;              apresentationargs[2] = new propertyvalue();             apresentationargs[2].name = "isautomatic";             apresentationargs[2].value = boolean.true;           presentation2.startwitharguments(apresentationargs);         system.out.println(presentation2.isrunning()); ==> false         if(presentation2==null)system.out.println("presentation2 null");        }     catch( exception e) {         e.printstacktrace(system.err);         system.exit(1);     }     if (presentation2.isrunning()) {        xslideshowcontroller = presentation2.getcontroller();        if(xslideshowcontroller==null)system.out.println("xslideshowcontroller null"); ==> null    }  

i save in file next slide. tried xstorable null.

xslideshowcontroller.gotofirstslide();    xdrawpage slidepreview = xslideshowcontroller.getslidebyindex(xslideshowcontroller.getcurrentslideindex()+1);     if(slidepreview==null)system.out.println("slidepreview null");    string filepath = "home/bastien/documents/slideshowtest.jpg";        propertyvalue[] astoreproperties = new propertyvalue[2];        astoreproperties[0] = new propertyvalue();        astoreproperties[1] = new propertyvalue();        astoreproperties[0].name = "override";        astoreproperties[0].value = true;        astoreproperties[1].name = "filtername";        astoreproperties[1].value = "slideshowtest";        xcomponent previewcomponent =unoruntime.queryinterface(                        xcomponent.class, slidepreview);        if(previewcomponent==null)system.out.println("previewcomponent null");        xstorable xstorable = (xstorable) unoruntime.queryinterface(                        xstorable.class, previewcomponent);        if(xstorable==null)system.out.println("xstorable null"); ==> null        xstorable.storeasurl(filepath, astoreproperties); 

i tried xstorable null too.

xstorable xstorable = (xstorable)      unoruntime.queryinterface(xstorable.class, slidepreview); 

thanks

ok, found how save next slide picture :

public static boolean save(string filename) throws indexoutofboundsexception, ioexception, com.sun.star.uno.exception {     if(xslideshowcontroller.getcurrentslideindex() + 1>xslideshowcontroller.getslidecount())return false;     xdrawpage slidepreview = xslideshowcontroller.getslidebyindex(xslideshowcontroller.getcurrentslideindex() + 1);     java.io.file sourcefile = new java.io.file(filename);     if(sourcefile.createnewfile())return false;     stringbuffer stemplatefileurl = new stringbuffer("file:///");     stemplatefileurl.append(sourcefile.getcanonicalpath().replace('\\', '/'));     propertyvalue afilterdata_thumb[] = new propertyvalue[2];     afilterdata_thumb[0] = new propertyvalue();     afilterdata_thumb[0].name = "pixelwidth";     afilterdata_thumb[0].value = 1241;      afilterdata_thumb[1] = new propertyvalue();     afilterdata_thumb[1].name = "pixelheight";     afilterdata_thumb[1].value = 1753;      propertyvalue aprops_thumb[] = new propertyvalue[3];     aprops_thumb[0] = new propertyvalue();     aprops_thumb[0].name = "mediatype";     aprops_thumb[0].value = "image/jpeg";      aprops_thumb[1] = new propertyvalue();     aprops_thumb[1].name = "url";     aprops_thumb[1].value = stemplatefileurl.tostring();      aprops_thumb[2] = new propertyvalue();     aprops_thumb[2].name = "filterdata";     aprops_thumb[2].value = afilterdata_thumb;      xcomponent xcomp = unoruntime.queryinterface(xcomponent.class, slidepreview);     xmulticomponentfactory xmcf             = xcontext.getservicemanager();     object exportfilter = xmcf.createinstancewithcontext("com.sun.star.drawing.graphicexportfilter", xcontext);     xexporter xexporter = unoruntime.queryinterface(xexporter.class, exportfilter);     xexporter.setsourcedocument(xcomp);     xfilter xfilter = unoruntime.queryinterface(xfilter.class, xexporter);     xfilter.filter(aprops_thumb);     return true;  } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -