1 /** 2 * 3 */ 4 package testlib.uno; 5 6 import com.sun.star.container.XIndexAccess; 7 import com.sun.star.drawing.XDrawPage; 8 import com.sun.star.drawing.XDrawPagesSupplier; 9 import com.sun.star.drawing.XShapes; 10 import com.sun.star.lang.XComponent; 11 import com.sun.star.uno.UnoRuntime; 12 13 /** 14 * 15 * 16 */ 17 public class SDUtil { 18 19 private SDUtil() { 20 21 } 22 23 public static Object getPageByIndex(XComponent doc, int index) throws Exception { 24 XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, doc); 25 Object drawPages = xDrawPagesSupplier.getDrawPages(); 26 XIndexAccess xIndexedDrawPages = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, drawPages); 27 return xIndexedDrawPages.getByIndex(index); 28 } 29 30 public static Object getShapeOfPageByIndex(Object page, int index) throws Exception { 31 XDrawPage xDrawPage = (XDrawPage) UnoRuntime.queryInterface(XDrawPage.class, page); 32 XShapes m_xdrawShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, xDrawPage); 33 return m_xdrawShapes.getByIndex(index); 34 } 35 36 } 37