1

After moving pictures in VBA using Shape.IncrementLeft and Shape.IncrementTop I would like to move pictures in openoffice.org BASIC code. After searching internet with these keywords "move picture" and "openoffice.org" or "open BASIC" or "OOo BASIC" I did not find the answer.

I have found how to move pictures in Java, c++, android, but not in OpenOffice.org BASIC, I read trough these guides https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide http://www.pitonyak.org/OOME_3_0.pdf I tried to find the answer through LIBRE OFFICE also, but without success. I tried to record a macro, insert a picture, move it with the mouse and stop the macro. When looking into the code, the answer of my question take me to the dispatcher and one of the UNO methods, I believe is has something to do with these keywords: Properties in the com.sun.star.awt.UnoControlImageControlModel service com.sun.star.drawing.GraphicObjectShape BorderBottom BorderLeft BorderRight BorderTop oPoint = oShape.Position getPosition() setPosition(Point) but I cannot find a clear answer and I do not know how to combine them to make the image (or it can be a shape inserted also) to move.

can anybody guide me how to find the answer?

1 Answers1

0

first of all: https://wiki.openoffice.org/wiki/Extensions_development_basic is a good starting point. In particular the XRAY tool is very helpfully.

The following Code changes the position of a selected Image on a Calc Worksheet:

Sub Test

 dim aNewPosition as new com.sun.star.awt.Point

 oDoc = thisComponent
 oSelection = oDoc.CurrentSelection(0)

 if oSelection.supportsService("com.sun.star.drawing.Shape") then
  aPosition = oSelection.Position
  x = aPosition.X
  y = aPosition.Y
  aNewPosition.X = x + 100
  aNewPosition.Y = y + 100
  oSelection.setPosition(aNewPosition)
 endif

End Sub

Greetings

Axel

Axel Richter
  • 56,077
  • 6
  • 60
  • 87