SDUtil.java (f0480a3d) SDUtil.java (3908dc91)
1/**
2 *
3 */
4package testlib.uno;
5
6import com.sun.star.container.XIndexAccess;
7import com.sun.star.drawing.XDrawPage;
8import com.sun.star.drawing.XDrawPagesSupplier;
9import com.sun.star.drawing.XShapes;
1/**
2 *
3 */
4package testlib.uno;
5
6import com.sun.star.container.XIndexAccess;
7import com.sun.star.drawing.XDrawPage;
8import com.sun.star.drawing.XDrawPagesSupplier;
9import com.sun.star.drawing.XShapes;
10import com.sun.star.lang.IndexOutOfBoundsException;
11import com.sun.star.lang.WrappedTargetException;
12import com.sun.star.lang.XComponent;
10import com.sun.star.lang.XComponent;
13import com.sun.star.text.XText;
14import com.sun.star.uno.UnoRuntime;
15
16/**
17 *
18 *
19 */
20public class SDUtil {
21
11import com.sun.star.uno.UnoRuntime;
12
13/**
14 *
15 *
16 */
17public class SDUtil {
18
22 /**
23 * @throws WrappedTargetException
24 * @throws
25 * @throws java.lang.Exception
26 */
27 public SDUtil(){
28
19 private SDUtil() {
20
29 }
21 }
30
31 public Object getPageByIndex(XComponent doc, int index) throws Exception{
32 XDrawPagesSupplier xDrawPagesSupplier =
33 (XDrawPagesSupplier)UnoRuntime.queryInterface(
34 XDrawPagesSupplier.class, doc);
35
22
36 Object drawPages = xDrawPagesSupplier.getDrawPages();
37 XIndexAccess xIndexedDrawPages = (XIndexAccess)UnoRuntime.queryInterface(
38 XIndexAccess.class, drawPages);
39 return xIndexedDrawPages.getByIndex(index);
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);
40 }
28 }
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);
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);
46 }
47
48}
34 }
35
36}