Adding slide UNO API
Im creating an add-on for impress, in which one of the feature is to add a slide. I could manage to add a blank slide by using XDrawPages for the current Componenet. How can i add a slide with someo开发者_高级运维ther layout(predefined layouts in impress) ? Thanks in advance ..
So far I had no luck in setting the master's layout to a new slide. However I'm using this workaround:
model = desktop.getCurrentComponent()
model.duplicate(model.getDrawPages().getByIndex(0))
I basically duplicate the first slide (which I keep empty and delete as last step). This copies everything: master, layout, content.
I dont know whether this really links it to the master slide but at least we can get some descent (standard) layout:
Sub Main
pages = ThisComponent.getDrawPages()
pages.insertNewByIndex(pages.getCount() - 1)
newSlide = pages.getByIndex(pages.getCount() - 1)
newSlide.layout = 1
End Sub
精彩评论