[Solved] Impress macro to move selected slide to last

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
Tommy
Posts: 251
Joined: Sun Dec 23, 2007 2:44 pm

[Solved] Impress macro to move selected slide to last

Post by Tommy »

is there any way to accomplish that?
having to manually drag a selected slide to the last position can be annoying if you have a very long presentation

a macro to directly move that slide to the last position would be a time-saver.
Last edited by Tommy on Sat Jun 28, 2014 7:36 am, edited 1 time in total.
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
F3K Total
Volunteer
Posts: 1040
Joined: Fri Dec 16, 2011 8:20 pm

Re: [REQ] Impress macro to move selected slide to last

Post by F3K Total »

Nearly:
This code copies the current slide to last, and then deletes it and jumps to the next.

Code: Select all

Sub S_move_selected_page_to_last
      oDoc = ThisComponent
      opages = oDoc.drawpages
      oController = oDoc.CurrentController
      oCurrentPage = oController.CurrentPage
      nIndex = oCurrentPage.Number - 1
      oDispatch = createUnoService( "com.sun.star.frame.DispatchHelper")
      oProvider = oController.Frame
      oDispatch.executeDispatch(oProvider, ".uno:Copy","", 0, Array())
      oPage = opages.getByIndex(opages.Count() - 1)
      oController.setCurrentPage(oPage)
      oDispatch.executeDispatch(oProvider, ".uno:Paste", "", 0, Array())
      opages.remove(oCurrentPage)
      oController.setCurrentPage(opages(nIndex))
End Sub
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
User avatar
Tommy
Posts: 251
Joined: Sun Dec 23, 2007 2:44 pm

Re: [SOLVED] Impress macro to move selected slide to last

Post by Tommy »

@ F3K Total
sorry for late reply.
your macro is perfect. thanks!!!
-----
using latest X-LibreOffice release, made portable by winPenPack.com
http://www.winpenpack.com/main/download.php?view.1354
Post Reply