Ask Your Question

getDrawPage fails in Impress document

asked 2019-08-29 06:16:52 +0200

Jshbtmn gravatar image

updated 2019-08-29 06:20:14 +0200

Ratslinger gravatar image

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`
edit retag flag offensive close merge delete


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

Ratslinger gravatar imageRatslinger ( 2019-08-29 06:21:17 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-08-29 06:53:37 +0200

Ratslinger gravatar image

updated 2019-08-29 07:27:25 +0200


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:

image description

edit flag offensive delete link more


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.

Ratslinger gravatar imageRatslinger ( 2019-08-29 07:36:26 +0200 )edit

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

Jshbtmn gravatar imageJshbtmn ( 2019-08-29 16:57:49 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-08-29 06:16:52 +0200

Seen: 19 times

Last updated: Aug 29