Export impress selection in macro

I am trying to teach myself how to write macros for LO, and I am stuck with my first task which turns out to be harder than I expected. Here is what I have so far http://pastebin.com/AEgVx1T3
Please forgive the messy disorganised nature of the script it is the result of a lot of experimentation and also a lot of Frankensteinian copy pasting from sources online.

The issue is I can’t figure out how to check the “Selection Only” Box on the dispatcher. I know this function works in impress (unlike in writer: https://bugs.documentfoundation.org/show_bug.cgi?id=89077) because it can be done manually. I tried a series of different arguments based on various scripts for calc that I found and also the results of a record macro in writer, but none of them worked. The entire page is exported each time.

I tried the api documentation and also the source but I have no idea what to even look for without learning the entire architecture of the program.