getDrawPage fails in Impress document

Hi all,

I’m not a programmer, I’m a pro A/V tech who works primarily on Broadway style musicals. I’m trying to write a macro that will find my current cursor position and attach a small blue circle, labelled with a number that relates to a fader on my sound console. I’m having trouble getting the document to find the current drawpage, but only not in text documents. I need this to work in Impress, as scripts generally come to me in PDF form. It’s currently set for a hard position (aposition), once I can get the current page figured out, I’ll take a crack at relating it to cursor position. Thanks in advance!

`Sub InsertProcessShape
Dim oDoc As Object
 Dim oDrawPage As Object
Dim oShape As Object
 Dim shapeGeometry(0) as new
Dim oSize As new
   oSize.width = 1200
   oSize.height = 1200
   oDoc = Stardesktop.getCurrentComponent()
   MsgBox oDoc.getImplementationName()
   oDrawPage = oDoc.getDrawPage()
   oShape = oDoc.createInstance("")
   shapeGeometry(0).Name = "Type"
   shapeGeometry(0).Value = "Circle"
   oShape.Size = oSize
   oShape.FillStyle =
   oShape.LineWidth = 170
   oShape.LineColor = 220
   Dim aPosition As New

  aPosition.X = 8000
  aPosition.Y = 8000
   oShape.Text.String = "1"
   oShape.Text.CharHeight = 20
   oShape.Text.CharFontName = "Alef"

End Sub`

Code set to preformatted text (on toolbar) for clarity.


Know very little about Impress. Do know that access to Draw page is different during the slide show and when editing.

From your code you appear to be in edit mode.

Edit (old code deleted):

Sorry, went back to notes. Easier method to get access to current Draw Page:

oDoc = Stardesktop.getCurrentComponent()
oCurrentController = oDoc.getCurrentController()
oDrawPage = oCurrentController.CurrentPage

Edit #2:

With your code & above change, produced this:

Please note: Have had various problems on Ubuntu 18.04 using LO v6.3.0.4.

Various times have lost all editing capabilities with Impress slides. Presentation still worked. Had this happen when exploring with MRI & with running various macros (this one and others). No rhyme or reason thus far. Could be problem in this version.

Advise to always make a backup copy before running any macro.

Appears to function, thanks so much. Backing up now.