protected XDrawPagesSupplier UseDraw() { try { //create new draw document and insert rectangle shape XComponent xDrawComponent = NewDocComponent("sdraw"); XDrawPagesSupplier xDrawPagesSupplier = xDrawComponent as XDrawPagesSupplier; Object drawPages = xDrawPagesSupplier.getDrawPages(); XIndexAccess xIndexedDrawPages = drawPages as XIndexAccess; Object drawPage = xIndexedDrawPages.getByIndex(0).Value; System.Diagnostics.Debug.WriteLine(xIndexedDrawPages.getCount()); if (drawPage is XDrawPage) { XDrawPage xDrawPage = (XDrawPage)drawPage; if (xDrawPage is XComponent) { (xDrawPage as XComponent).addEventListener(new TestOOoEventListerner()); } // get internal service factory of the document XMultiServiceFactory xDrawFactory = xDrawComponent as XMultiServiceFactory; Object drawShape = xDrawFactory.createInstance( "com.sun.star.drawing.RectangleShape"); XShape xDrawShape = drawShape as XShape; xDrawShape.setSize(new Size(10000, 20000)); xDrawShape.setPosition(new Point(5000, 5000)); xDrawPage.add(xDrawShape); // XText xShapeText = (XText)drawShape // COMMENTED BY CODEIT.RIGHT; XPropertySet xShapeProps = (XPropertySet)drawShape; // wrap text inside shape xShapeProps.setPropertyValue("TextContourFrame", new uno.Any(true)); return(xDrawPagesSupplier); } else { //TODO: handle if no drwapage was found System.Diagnostics.Debug.WriteLine("no XDrawPage found"); System.Diagnostics.Debug.WriteLine(drawPage); } } catch (unoidl.com.sun.star.lang.DisposedException e) { //works from Patch 1 MXContext = null; throw e; } return(null); }
protected static List<XDrawPage> GetAllDrawPages(XDrawPagesSupplier xDrawPagesSupplier) { return GetAllObjectsFromXIndexAccess<XDrawPage>(xDrawPagesSupplier != null ? xDrawPagesSupplier.getDrawPages() as XIndexAccess : null) as List<XDrawPage>; }
protected static List <XDrawPage> GetAllDrawPages(XDrawPagesSupplier xDrawPagesSupplier) { return(GetAllObjectsFromXIndexAccess <XDrawPage>(xDrawPagesSupplier != null ? xDrawPagesSupplier.getDrawPages() as XIndexAccess : null) as List <XDrawPage>); }