Page 1 of 1

Where is a Shape’s alignment stored?

PostPosted: Thu May 09, 2019 12:57 am
by _savage
Hello,

Suppose I have a document and iterate over its DrawPage objects like so:

Code: Select all   Expand viewCollapse view
shapeobjenum = document.DrawPage.createEnumeration()
while shapeobjenum.hasMoreElements():
    shapeobj = shapeobjenum.nextElement()
    # shapeobj.Size, shapeobj.ActualSize give me the object’s size on the page in 100th/mm

Some of these XShape objects are implemented by SwXTextGraphicObject (a simple jpg image dropped into the document) and others by SwXShape or SvxShapeCollection (a hand-drawn shape, for example). Can there be other implementations for shapes?

As I iterate over these shape objects, I can get their size but I am at a loss as for their alignment. The XShapeAligner is deprecated (and I did not see it used in MRI) but the drawing module has an Alignment enum whose values I can not find when I browse the shape objects in MRI.

Can somebody please point me into the right direction? How can I find the alignment of a shape?

Re: Where is a Shape’s alignment stored?

PostPosted: Thu May 09, 2019 6:47 am
by Zizi64
Please upload your ODF type sample file here with the embedded macro code.

Re: Where is a Shape’s alignment stored?

PostPosted: Thu May 09, 2019 1:00 pm
by Lupp
To get it clear:
The (deprecated) XShapeAligner isn't a property like .Size (which you mention). Were you aware of this?
It should allow to handle the relative alignment of a selection of shapes.

The alignment of a shape is controlled by the properties
HoriOrient, if HoriOrient=0 then HoriOrientPosition in 1E-2 mm,
VertOrient, if VertOrient=0 then VertOrientPosition in 1E-2 mm.
(Also see https://api.libreoffice.org/docs/idl/re ... _8idl.html)

Shapes:
https://api.libreoffice.org/docs/idl/re ... Shape.html