Hi Rony, On Thu, Nov 08, 2012 at 02:02:08PM +0100, Rony G. Flatscher wrote: > O.K., it is at the end of this e-mail. Correction: the kudos for > finding it goes to Christoph *Jopp* still from Munich and a great AOO > hacker! :) > > > > Wish I was there! > Yes, that would have been nice to meet in person! > > --- > > The following was created yesterday and added to todays presentation > "Scripting Apache OpenOffice", which should be uploaded by ASF (no URL > yet). > > The programming language is ooRexx (http://www.ooRexx.org) which is > powerful yet its syntax is very easy and looks like pseudo code. It > has a proper message operator (tilde: ~), left of it is the receiving > object right of it is the message name (sometimes with arguments in > round parenthesis). > > The logic needed can be found in the routine addItem(), dumpItem() > demonstrates how to iterate over an impress XText and learn the > outline level in addition: > > xDesktop=uno.createDesktop() -- bootstrap & get access to > XDesktop xcl=xDesktop~XComponentLoader -- get > XComponentLoader interface > > uri="private:factory/simpress" -- new simpress document > doc=xcl~loadComponentFromURL(uri,"_blank",0,.uno~noProps) > > xDrawPages = doc~XDrawPagesSupplier~getDrawPages -- get > DrawPages > > xDrawPage=xDrawPages~getByIndex(0) -- get first (empty) page > xDrawPage~XPropertySet~setPropertyValue("Layout", box("short",0)) > -- "Title Slide" xShapes=xDrawPage~XShapes -- get access > to its shapes xShapes~getByIndex(0)~XText~setString("ApacheCon > Europe 2012") xShapes~getByIndex(1)~XText~setString("Scripting > Apache OpenOffice") > > xDrawPage=xDrawPages~~insertNewByIndex(1)~getByIndex(1) -- insert > at end, get access > xDrawPage~XPropertySet~setPropertyValue("Layout", box("short",1)) > -- "Title Content" xShapes=xDrawPage~XShapes -- get > access to its shapes > xShapes~getByIndex(0)~XText~setString("Scripting Apache > OpenOffice") > > xText=xShapes~getByIndex(1)~XText -- content's XText call > addItem xText, "First", 0 -- add string, determine > level call addItem xText, "Explored by many", 0 call addItem > xText, "Kudos! go to", 1 call addItem xText, "Christoph > Jopp!", 1 call addItem xText, "On 2012-11-07", 0, .false > > doc~XModifiable~setModified(.false) > doc~XPresentationSupplier~getPresentation~~bsf.dispatch("start") > -- start presentation > > say "now dumping infos about second page's content XText:" call > dumpItems xText > > ::requires UNO.CLS -- get UNO support > > ::routine addItem -- adds string at the given > (0-based outline) level use arg xText, string, level, > bNewParagraph=.true > > xTR=xText~XTextRange~getEnd -- get end, a XTextRange > xTR~XPropertySet~setPropertyValue("NumberingLevel",level) -- set > XTextRange level > > xTR~setString(string) -- set string > > if bNewParagraph=.true then -- add new paragraph > xTR~getEnd~setString("0a"x) -- add linefeed character -> new > paragraph > > > ::routine dumpItems -- show level and string from > XText use arg xText > > enum=xText~XEnumerationAccess~createEnumeration -- enumerate > paragraphs do i=1 while enum~hasMoreElements > xtr=enum~nextElement~XTextRange -- we need XTextRange's string > & properties > nl=xtr~XPropertySet~getPropertyValue("NumberingLevel") say > " item #" i": NumberingLevel="pp(nl) pp(xtr~getString) end > > Should anyone have questions, please come forward!
I was digging into this the other days, to give a sample, but I've found it somehow broken. Could you insert more than one paragraph in the same shape, and set each paragraph to a different numbering level? In my test, only the first paragraph gets the numbering level, it does not work for subsequent paragraphs (added by inserting a para. break control character). And, the numbering level inserted via API is not reflected on the Outline view. Another issue: how to set an animation for each paragraph? Yet another one, setting the draw page Layout has effect, but is not reflected in the UI: when you select a page with a specific layout, the "Layout" taks pane should reflect this by selecting the respective level; that's not the case. Impress API seems broken at several levels. Regards -- Ariel Constenla-Haile La Plata, Argentina
pgpsmYXV8EKej.pgp
Description: PGP signature
