SDUtil.java (43a102b2) SDUtil.java (28725c19)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 14 unchanged lines hidden (view full) ---

23import java.util.HashMap;
24
25import org.openoffice.test.common.Testspace;
26
27import com.sun.star.beans.PropertyValue;
28import com.sun.star.container.XIndexAccess;
29import com.sun.star.drawing.XDrawPage;
30import com.sun.star.drawing.XDrawPagesSupplier;
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 14 unchanged lines hidden (view full) ---

23import java.util.HashMap;
24
25import org.openoffice.test.common.Testspace;
26
27import com.sun.star.beans.PropertyValue;
28import com.sun.star.container.XIndexAccess;
29import com.sun.star.drawing.XDrawPage;
30import com.sun.star.drawing.XDrawPagesSupplier;
31import com.sun.star.drawing.XShape;
31import com.sun.star.drawing.XShapes;
32import com.sun.star.frame.XStorable;
33import com.sun.star.lang.XComponent;
32import com.sun.star.drawing.XShapes;
33import com.sun.star.frame.XStorable;
34import com.sun.star.lang.XComponent;
35import com.sun.star.uno.Exception;
34import com.sun.star.uno.UnoRuntime;
35
36/**
37 *
38 *
39 */
40public class SDUtil {
41

--- 11 unchanged lines hidden (view full) ---

53 }
54
55 public static Object getShapeOfPageByIndex(Object page, int index) throws Exception {
56 XDrawPage xDrawPage = (XDrawPage) UnoRuntime.queryInterface(XDrawPage.class, page);
57 XShapes m_xdrawShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, xDrawPage);
58 return m_xdrawShapes.getByIndex(index);
59 }
60
36import com.sun.star.uno.UnoRuntime;
37
38/**
39 *
40 *
41 */
42public class SDUtil {
43

--- 11 unchanged lines hidden (view full) ---

55 }
56
57 public static Object getShapeOfPageByIndex(Object page, int index) throws Exception {
58 XDrawPage xDrawPage = (XDrawPage) UnoRuntime.queryInterface(XDrawPage.class, page);
59 XShapes m_xdrawShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, xDrawPage);
60 return m_xdrawShapes.getByIndex(index);
61 }
62
63 public static Object[] getShapesOfPageByType(XDrawPage xDrawPage, String shapeType) throws Exception {
64 XShapes m_xdrawShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, xDrawPage);
65 int count = m_xdrawShapes.getCount();
66 Object[] temp = new Object[count];
67 int shapeNum=0;
68 for(int i=0;i<count; i++)
69 {
70 Object shape = m_xdrawShapes.getByIndex(i);
71 XShape xshape = (XShape)UnoRuntime.queryInterface(XShape.class, shape);
72 String type = xshape.getShapeType();
73 if(type.equals(shapeType))
74 {
75 temp[shapeNum] = shape;
76 shapeNum++;
77 }
78 }
79
80 Object[] shapes = new Object[shapeNum];
81 System.arraycopy(temp, 0, shapes, 0, shapeNum);
82 return shapes;
83 }
84
61 public static void saveFileAs(XComponent sdComponent, String fileName, String extName) throws Exception {
62
63 initFilterName();
64
65 String storeUrl = Testspace.getUrl("temp/" + fileName + "." + extName);
66
67 PropertyValue[] storeProps = new PropertyValue[2];
68 storeProps[0] = new PropertyValue();

--- 21 unchanged lines hidden ---
85 public static void saveFileAs(XComponent sdComponent, String fileName, String extName) throws Exception {
86
87 initFilterName();
88
89 String storeUrl = Testspace.getUrl("temp/" + fileName + "." + extName);
90
91 PropertyValue[] storeProps = new PropertyValue[2];
92 storeProps[0] = new PropertyValue();

--- 21 unchanged lines hidden ---