Symphony Thursday: Developer 101
1. Introduction to UNO Development and Documents/Writer "Hello World"
2. Spreadsheets"Hello World"
3. Presentations "Hello World"
Last time, I covered the basics of UNO Development and walked you thru a "Hello World" application for OpenOffice.org Writer and Lotus Symphony Documents. This blog entry will cover an introduction to OpenOffice.org Impress and Lotus Symphony Presentations.
Introduction to Lotus Symphony Presentations
In both Impress and Symphony Presentations, you work with presentations. From there, you work with slides / pages. On each of those slides / pages, you have shapes. The shapes contain text, graphics, or the other data on your slides. Once you navigate to the shape, you get a text handle to the text object and everything else is much like working with text in Symphony Documents or Writer.
Let’s Start Lotus Symphony Presentations
To create the instance of Impress / Lotus SYmphony Presentations, call its URL
Set ImpressApplication=Desktop.loadComponentFromURL("private:factory/simpress","_blank",0,args)
Next, call the getDrawPages function to create the default presentation
Set Presentation=ImpressApplication.getDrawPages()
To get the first slide, use the getByIndex method
Set Slide=Presentation.getByIndex(0)
Each layout type has its own number. To create a title page, enter the following:
Slide.layout=1
Finally, we need to get the title and handle it like it’s a Lotus Symphony Documents text object
Set title=Slide.getbyindex(0)
Set TitleText=title.getText()
Set Cursor=TitleText.createTextCursor()
Call TitleText.insertString(Cursor,"Hello World!",False)
The Results
Results in OpenOffice.org Impress
Results in Lotus Symphony Presentations
Conclusion
To try this yourself, create a new button in a Notes document in Notes 8.0.1, 8.0.2, or 8.5. 8.0.0 will not work as it does not properly register the components in the registry. With 8.0.0 or Notes 6, 6.5, or 7.X, you can use this code with OpenOffice.org 1.1.6 or higher, 2.x, or 3.x. Try it and see it work for yourself:
Dim SM As Variant
Dim Desktop As Variant
Dim ImpressApplication As Variant
Dim Presentation As Variant
Dim Slide As Variant
Dim Title As Variant
Dim TitleText As Variant
Dim Cursor As Variant
Dim args()
Set SM=CreateObject("com.sun.star.ServiceManager")
Set Desktop=SM.createInstance("com.sun.star.frame.Desktop")
Set ImpressApplication=Desktop.loadComponentFromURL("private:factory/simpress","_blank",0,args)
Set Presentation=ImpressApplication.getDrawPages()
Set Slide=Presentation.getByIndex(0)
Slide.layout=1'this layout has a title and an outline
Set title=Slide.getbyindex(0)'the first shape is the title
Set TitleText=title.getText()'this bit is like talking to writer
Set Cursor=TitleText.createTextCursor()
Call TitleText.insertString(Cursor,"Hello World!",False)
Next time, we will look at working with bookmarks in Lotus Symphony Documents / Writer.