How get list shapes on page in draw?

I know how to get one shape

oController = ThisComponent.getCurrentController()
oDrawPage = ThisComponent.getDrawPages().getByIndex(0)

for each oShape in oDrawPage.getshapes()
oShape = oDrawPage.getByIndex(0)

How to get the number of shapes on page?

Install one of the excellent Object inspection tools: XrayTool or MRI.
Then you will able to examine the existing properties and methods of the programming ocjects.
In this case the property “.count”

1 Like

What do you expect this statement to do? A DrawPage already is a container (service) for shapes.
In addition to what @Zizi64 already told you, you will need to study contents of LibreOffice: Namespace List in many cases.

There still are many users, among them extremely experienced ones, pursuing the very old tradition to prefix single letters to names of variables trying to indicate the type. In current versions of object-oriented programming, however, the system of types is very complicated and can’t actually be mapped to such prefixes.
Different # but similar it is with the so-called get methods (and with set also).
To be clear: I don’t explicitly object, but the actual value of the mentioned prefixes is minor. To expect them to do something relevant only leads to cargo-cult programming, imho.

#: There are cases where the get/set is indispensable! There also are cases where we might expect get/set methods to exist under the respective names, and to work, but fail with the expectation.

Any DrawPage (just one in a TextDocument, one per sheet in Calc, one per page/slide in Draw)
is implemented as a service acting as a kind of container for shapes. Not only primarily graphical objects are shapes. Shapes also are hosting FormControl objects, OLE ojects, donno what else…
Shapes, on the other hand can have rather complicated properties, but they also have unstructured (simple) ones. How this all is working and interacting even few developers know in detail.
To see an example for what I mean, you may play with the attached Draw document which is containing a macro. (If it doesn’t run for you read about “macro security”. Never set it to “Low”, however.) Don’t miss to study the macro itself (including the remarks).

myFancyShapeStyle.odg (26.6 KB)