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.IndexOutOfBoundsException; 11 import com.sun.star.lang.WrappedTargetException; 12 import com.sun.star.lang.XComponent; 13 import com.sun.star.text.XText; 14 import com.sun.star.uno.UnoRuntime; 15 16 /** 17 * 18 * 19 */ 20 public class SDUtil { 21 22 /** 23 * @throws WrappedTargetException 24 * @throws 25 * @throws java.lang.Exception 26 */ 27 public SDUtil(){ 28 29 } 30 31 public Object getPageByIndex(XComponent doc, int index) throws Exception{ 32 XDrawPagesSupplier xDrawPagesSupplier = 33 (XDrawPagesSupplier)UnoRuntime.queryInterface( 34 XDrawPagesSupplier.class, doc); 35 36 Object drawPages = xDrawPagesSupplier.getDrawPages(); 37 XIndexAccess xIndexedDrawPages = (XIndexAccess)UnoRuntime.queryInterface( 38 XIndexAccess.class, drawPages); 39 return xIndexedDrawPages.getByIndex(index); 40 } 41 42 public Object getShapeOfPageByIndex(Object page, int index) throws Exception{ 43 XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(XDrawPage.class, page); 44 XShapes m_xdrawShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class, xDrawPage); 45 return m_xdrawShapes.getByIndex(index); 46 } 47 48 } 49