java api get image position

asked 2016-05-31 10:59:09 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

image.getPosition().X gives: com.sun.star.uno.RuntimeException: position cannot be determined with this method. So, with which method can it be determined? My code:

        XModel xModel = UnoRuntime.queryInterface(XModel.class, xDoc);
        XDrawPageSupplier xDPS = UnoRuntime.queryInterface(XDrawPageSupplier.class, xModel);
        XDrawPage xDrawPage = xDPS.getDrawPage();
        XShapes xShapes = UnoRuntime.queryInterface(XShapes.class, xDrawPage);
        for (int s = 0; s < xDrawPage.getCount(); s++) {
            XShape xShape = UnoRuntime.queryInterface(XShape.class, xShapes.getByIndex(s));
            int x = xShape.getPosition().X; // ERROR HERE
        }
edit retag flag offensive close merge delete