|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
XPresentation2 returns a null XSlideShowControllerI'm very new to the api, but have figured out how to get a slide show
to open and query a few things about it such as the number of pages, etc. However, when I obtain the XPresentation2 reference and query it for the XSlideShowController, it is returning null. How do I get a reference to the XSlideShowController? Here's my existing Java code (I'm sure it could be more compact, but I haven't made it work yet, let alone clean it up!): XComponentContext xContext = Bootstrap.bootstrap(); XMultiComponentFactory xMCF = xContext.getServiceManager(); Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,desktop); XComponent xDocument = xComponentLoader.loadComponentFromURL("file:///Users/dbreese/Documents/test.odp", "_default", 0, new PropertyValue[0]); XPresentationSupplier supplier = (XPresentationSupplier) UnoRuntime.queryInterface(XPresentationSupplier.class, xDocument); XPresentation pres = supplier.getPresentation(); XPresentation2 pres2 = (XPresentation2) UnoRuntime.queryInterface(XPresentation2.class, pres); // if I do "pres2.start();" or even "pres.start();", my slideshow does go full screen and stars here XSlideShowController slideController = pres2.getController(); System.err.println("slideController = " + slideController); Always produces: slideController = null Thanks, Dustin --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: XPresentation2 returns a null XSlideShowControllerHello Dustin,
On Tuesday 13 October 2009, 16:13, Dustin Breese wrote: > I'm very new to the api, but have figured out how to get a slide show > to open and query a few things about it such as the number of pages, > etc. However, when I obtain the XPresentation2 reference and query it > for the XSlideShowController, it is returning null. How do I get a > reference to the XSlideShowController? you don't have a SlideShow controller if there is no slide show to control, that is: start the slide show to get a controller, something like: XPresentationSupplier xPresentationSupplier = (XPresentationSupplier) UnoRuntime.queryInterface( XPresentationSupplier.class, xComponent); XPresentation xPresentation_ = xPresentationSupplier.getPresentation(); XPresentation2 xPresentation = (XPresentation2) UnoRuntime.queryInterface( XPresentation2.class, xPresentation_); 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.FALSE; aPresentationArgs[2] = new PropertyValue(); aPresentationArgs[2].Name = "IsAutomatic"; aPresentationArgs[2].Value = Boolean.TRUE; xPresentation.startWithArguments(aPresentationArgs); // maybe put the thread to sleep a little...? if (xPresentation.isRunning()) { xSlideShowController = xPresentation.getController(); if (xSlideShowController != null) { xSlideShowController.addSlideShowListener(this); m_bIsListening = true; } } Regards -- Ariel Constenla-Haile La Plata, Argentina --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: XPresentation2 returns a null XSlideShowControllerOn Tue, Oct 13, 2009 at 1:45 PM, Ariel Constenla-Haile
<ariel.constenla.haile@...> wrote: > Hello Dustin, > > On Tuesday 13 October 2009, 16:13, Dustin Breese wrote: >> I'm very new to the api, but have figured out how to get a slide show >> to open and query a few things about it such as the number of pages, >> etc. However, when I obtain the XPresentation2 reference and query it >> for the XSlideShowController, it is returning null. How do I get a >> reference to the XSlideShowController? > > you don't have a SlideShow controller if there is no slide show to control, > that is: start the slide show to get a controller, something like: > > > XPresentationSupplier xPresentationSupplier = > (XPresentationSupplier) UnoRuntime.queryInterface( > XPresentationSupplier.class, xComponent); > > XPresentation xPresentation_ = > xPresentationSupplier.getPresentation(); > XPresentation2 xPresentation = (XPresentation2) > UnoRuntime.queryInterface( > XPresentation2.class, xPresentation_); > > 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.FALSE; > > aPresentationArgs[2] = new PropertyValue(); > aPresentationArgs[2].Name = "IsAutomatic"; > aPresentationArgs[2].Value = Boolean.TRUE; > > xPresentation.startWithArguments(aPresentationArgs); > > // maybe put the thread to sleep a little...? > if (xPresentation.isRunning()) { > xSlideShowController = xPresentation.getController(); > > if (xSlideShowController != null) { > xSlideShowController.addSlideShowListener(this); > m_bIsListening = true; > } > } > > > > Regards > -- > Ariel Constenla-Haile > La Plata, Argentina > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > That was the missing link -- pausing after the "start()". I'm now able to control the slide show properly and get the reference to the XSlideShowController. Muchas Gracias! Dustin --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |