Where is a Shape’s alignment stored?

Creating a macro - Writing a Script - Using the API

Where is a Shape’s alignment stored?

Postby _savage » Thu May 09, 2019 12:57 am


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?
Mac 10.11 using LO, Gentoo Linux using LO headless.
Posts: 165
Joined: Sun Apr 21, 2013 12:55 am

Re: Where is a Shape’s alignment stored?

Postby Zizi64 » Thu May 09, 2019 6:47 am

Please upload your ODF type sample file here with the embedded macro code.
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.4; AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Posts: 7987
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Where is a Shape’s alignment stored?

Postby Lupp » Thu May 09, 2019 1:00 pm

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)

https://api.libreoffice.org/docs/idl/re ... Shape.html
On Windows 10: LibreOffice 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
Lupp from München
User avatar
Posts: 2489
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests