Examples of XShapes


Examples of com.sun.star.drawing.XShapes

        SpreadsheetDocument spreadsheetDoc = (SpreadsheetDocument)m_currentDocument;
        final XDrawPageSupplier suppDrawPage = UnoRuntime.queryInterface( XDrawPageSupplier.class,
            spreadsheetDoc.getSheet( 0 ) );
        final XDrawPage insertIntoPage = suppDrawPage.getDrawPage();

        final XShapes sheetShapes = UnoRuntime.queryInterface( XShapes.class, insertIntoPage );
        sheetShapes.add( xShape );

        return UnoRuntime.queryInterface( XPropertySet.class, controlModel );
    }
View Full Code Here

Examples of com.sun.star.drawing.XShapes

     */
    public synchronized TestEnvironment createTestEnvironment
            (TestParameters Param, PrintWriter log ) {

        XInterface oObj = null;
        XShapes oShapes = null;

        // creation of testobject here
        // first we write what we are intend to do to log file
        log.println( "creating a test environment" );

        SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());

        // get the drawpage of drawing here
        try {
            log.println( "getting Drawpage" );
            XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
                UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDrawDoc);
            XDrawPages oDPn = oDPS.getDrawPages();
            XIndexAccess oDPi = (XIndexAccess)
                UnoRuntime.queryInterface(XIndexAccess.class,oDPn);
            oObj = (XDrawPage) AnyConverter.toObject(
                new Type(XDrawPage.class),oDPi.getByIndex(0));
        } catch ( Exception e ) {
            // Some exception occures.FAILED
            e.printStackTrace( log );
            throw new StatusException( "Couldn't get DrawPage", e );
        }

        if (oObj == null) {
            System.out.println("**************************");
            System.out.println("    XDrawPage is NULL");
            System.out.println("**************************");
        }

        //put something on the drawpage
        log.println( "inserting some Shapes" );
        oShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class,oObj);
        XShape Shape1 = SOF.createShape(xDrawDoc,
            3000,4500,15000,1000,"Ellipse");
        oShapes.add(SOF.createShape(xDrawDoc,
            2000,1500,1000,1000,"Line"));
        oShapes.add(Shape1);
        XShape Shape2 = SOF.createShape(xDrawDoc,
            5000,3500,7500,5000,"Rectangle");
        oShapes.add(Shape2);

        log.println( "adding two style as ObjRelation for ShapeDescriptor" );
        XPropertySet oShapeProps = (XPropertySet)
            UnoRuntime.queryInterface(XPropertySet.class,Shape1);
        XStyle aStyle1 = null;
        try {
            aStyle1 = (XStyle) AnyConverter.toObject(
                new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
        } catch (Exception e) {}
        oShapeProps = (XPropertySet)
            UnoRuntime.queryInterface(XPropertySet.class,Shape2);
        XStyle aStyle2 = null;
        try {
            aStyle2 = (XStyle) AnyConverter.toObject(
                new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
        } catch (Exception e) {}


       //get the XShapeGrouper
       try{
            log.println("get XShapeGroup");
            XShapeGrouper oSG = (XShapeGrouper)UnoRuntime.queryInterface
                (XShapeGrouper.class, oObj);
            oObj = oSG.group(oShapes);
        } catch ( Exception e) {
                e.printStackTrace( log );
                throw new StatusException(" Couldn't get XShapeGroup: ", e);
        }

        log.println( "creating a new environment for drawpage object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );

        ShapeDsc sDsc = new ShapeDsc(5000,3500,7500,10000,"Rectangle");
          log.println( "adding Shape as mod relation to environment" );
        tEnv.addObjRelation("Shape", new InstCreator( xDrawDoc, sDsc));
        //tEnv.addObjRelation("DrawPage", oObj);
        //tEnv.addObjRelation("MasterPageSupplier",oGroup);

        tEnv.addObjRelation("Style1",aStyle1);
        tEnv.addObjRelation("Style2",aStyle2);
        for (int i=0;i<6;i++) {
            Shape2 = SOF.createShape(xDrawDoc,
                5000+100*i,3500+100*i,7500+100*i,5000+100*i,"Rectangle");
            oShapes.add(Shape2);
        }
        return tEnv;
    } // finish method createTestEnvironment
View Full Code Here

Examples of com.sun.star.drawing.XShapes

        try {
            // adding some shapes for testing.
            SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
            Object col = ((XMultiServiceFactory)tParam.getMSF()).createInstance
                ("com.sun.star.drawing.ShapeCollection");
            XShapes shapes = (XShapes) UnoRuntime.queryInterface
                (XShapes.class,col);

            oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse");
            DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape);
            shapes.add(oShape);

            oShape = SOF.createShape(xDrawDoc,5000,3500,7500,5000,"Rectangle");
            DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ;
            shapes.add(oShape);

            oObj = (XInterface) col ;

        }
        catch (Exception e) {
View Full Code Here

Examples of com.sun.star.drawing.XShapes

                throw new StatusException(Status.failed("Couldn't " + "register mysql driver"));
            }
        }

        XInterface oObj = null;
        XShapes oShapes = null;
        XInterface oInstance = null;
        XConnection connection = null;


        // creation of testobject here
        // first we write what we are intend to do to log file
        log.println("creating a test environment");

        XNameContainer forms = FormTools.getForms(WriterTools.getDrawPage(
                                                          xTextDoc));

        try {
            String[] formNames = forms.getElementNames();

            for (int i = 0; i < formNames.length; i++) {
                log.println("Removing form '" + formNames[i] + "' ...");
                forms.removeByName(formNames[i]);
            }
        } catch (com.sun.star.lang.WrappedTargetException e) {
            e.printStackTrace(log);
        } catch (com.sun.star.container.NoSuchElementException e) {
            e.printStackTrace(log);
        }

        String[] formNames = forms.getElementNames();
        FormTools.insertForm(xTextDoc, forms, "MyForm");
        formNames = forms.getElementNames();

        XLoadable formLoader = null;

        try {
            formLoader = FormTools.bindForm(xTextDoc, "MyForm", dbSourceName,
                                            tableName);
        } catch (com.sun.star.uno.Exception e) {
            log.println("Cann't bind the form to source '" + dbSourceName +
                        "', table '" + tableName + "' :");
            e.printStackTrace(log);
            throw new StatusException("Cann't bind a form", e);
        }


        // DEBUG
        log.println("Forms before adding controls : ");
        formNames = forms.getElementNames();

        for (int i = 0; i < formNames.length; i++) {
            log.println("    '" + formNames[i] + "'");
        }

        XControlShape shape1 = null;
        XControlShape shape2 = null;

        try {

            log.println("Elements in the 'MyForm' :");

            XIndexAccess formElements1 = (XIndexAccess) UnoRuntime.queryInterface(
                                                 XIndexAccess.class,
                                                 forms.getByName("MyForm"));

            for (int i = 0; i < formElements1.getCount(); i++) {
                XNamed elemName = (XNamed) UnoRuntime.queryInterface(
                                          XNamed.class,
                                          formElements1.getByIndex(i));
                log.println("   '" + elemName.getName() + "'");
            }


            // END DEBUG
            //put something on the drawpage
            log.println("inserting some ControlShapes");
            oShapes = DrawTools.getShapes(WriterTools.getDrawPage(xTextDoc));
            shape1 = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
                                                  1000, "CommandButton");
            shape2 = FormTools.createControlShape(xTextDoc, 5000, 3500, 7500,
                                                  5000, "TextField");

            XControlShape shape3 = FormTools.createControlShape(xTextDoc, 2000,
                                                                1500, 1000,
                                                                1000,
                                                                "CheckBox");
            oShapes.add((XShape) shape1);
            oShapes.add((XShape) shape2);
            oShapes.add(shape3);
        } catch (Exception e) {
            e.printStackTrace(log);
        }

        log.println("Forms after adding controls : ");
View Full Code Here

Examples of com.sun.star.drawing.XShapes

            throw new StatusException( "Couldn't get DrawPage", e );
        }

        //put something on the drawpage
        log.println( "inserting some Shapes" );
        XShapes oShapes = (XShapes) UnoRuntime.queryInterface
            (XShapes.class,oObj);
        oShapes.add(SOF.createShape
            (xDrawDoc, 2000, 1500, 1000, 1000, "Line"));
        oShapes.add(SOF.createShape
            (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse"));
        oShapes.add(SOF.createShape
            (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle"));

        //get the XMasterPagesSupplier
        log.println("get XMasterPagesSupplier");
        XMasterPagesSupplier oMPS = (XMasterPagesSupplier)
            UnoRuntime.queryInterface(XMasterPagesSupplier.class, xDrawDoc);
        XDrawPages oGroup = oMPS.getMasterPages();

        log.println( "creating a new environment for drawpage object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );

        XControlShape aShape = FormTools.createControlShape(
                                xDrawDoc,3000,4500,15000,10000,"CommandButton");

        oShapes.add((XShape) aShape);

        ShapeDsc sDsc = new ShapeDsc(5000, 3500, 7500, 10000, "Rectangle");
        log.println( "adding Shape as mod relation to environment" );
        tEnv.addObjRelation("Shape", new InstCreator( xDrawDoc, sDsc));
        tEnv.addObjRelation("DrawPage", oObj);
View Full Code Here

Examples of com.sun.star.drawing.XShapes

            throw new StatusException("Couldn't get DrawPage", e);
        }

        //put something on the drawpage
        log.println( "inserting some Shapes" );
        XShapes oShapes = (XShapes)
            UnoRuntime.queryInterface(XShapes.class, oDrawPage);
        XShape shape1 = SOF.createShape(
            xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
        XShape shape2 = SOF.createShape(
            xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
        XShape shape3 = SOF.createShape(
            xDrawDoc, 3000, 500, 5000, 1000, "Line");
        oShapes.add(shape1);
        oShapes.add(shape2);
        oShapes.add(shape3);
        shortWait();

        XModel aModel = (XModel)
            UnoRuntime.queryInterface(XModel.class, xDrawDoc);
View Full Code Here

Examples of com.sun.star.drawing.XShapes

    }

    public void initializeDocument() throws com.sun.star.uno.Exception
    {
        // remove all shapes - Impress has two default shapes in a new doc; just get rid of them
        final XShapes firstPageShapes = getFirstPageShapes();
        while ( firstPageShapes.getCount() > 0 )
            firstPageShapes.remove( UnoRuntime.queryInterface( XShape.class, firstPageShapes.getByIndex( 0 ) ) );
    }
View Full Code Here

Examples of com.sun.star.drawing.XShapes

        );
    }

    public void verifyInitialDocumentState() throws com.sun.star.uno.Exception
    {
        final XShapes firstPageShapes = getFirstPageShapes();
        assertEquals( "there should be no shapes at all", 0, firstPageShapes.getCount() );
    }
View Full Code Here

Examples of com.sun.star.drawing.XShapes

        assertEquals( "there should be no shapes at all", 0, firstPageShapes.getCount() );
    }

    public void verifySingleModificationDocumentState() throws com.sun.star.uno.Exception
    {
        final XShapes firstPageShapes = getFirstPageShapes();
        assertEquals( "there should be one shape, not more, not less", 1, firstPageShapes.getCount() );

        final Object shape = firstPageShapes.getByIndex(0);
        verifyShapeGeometry( shape, BIG_CIRCLE_SIZE, BIG_CIRCLE_SIZE );
        final XPropertySet shapeProps = UnoRuntime.queryInterface( XPropertySet.class, shape );
        assertEquals( "wrong circle tpye", CIRCLE_TYPE.getValue(), ((CircleKind)shapeProps.getPropertyValue( "CircleKind" )).getValue() );
        //assertEquals( "wrong circle fill color", FILL_COLOR, ((Integer)shapeProps.getPropertyValue( "FillColor" )).intValue() );
            // disable this particular check: A bug in the drawing layer API restores the FillColor to its
View Full Code Here

Examples of com.sun.star.drawing.XShapes

        final Size shapeSize = new Size( i_size, i_size );
        shape.setSize( shapeSize );
        final Point shapePos = new Point( i_x, i_y );
        shape.setPosition( shapePos );

        final XShapes pageShapes = UnoRuntime.queryInterface( XShapes.class, getFirstPageShapes() );
        pageShapes.add( shape );

        // Sadly, Draw/Impress currently do not create Undo actions for programmatic changes to the document.
        // Which renders the test here slightly useless ... unless we fake the Undo actions ourself.
        final XUndoManagerSupplier suppUndoManager = UnoRuntime.queryInterface( XUndoManagerSupplier.class, getDocument().getDocument() );
        final XUndoManager undoManager = suppUndoManager.getUndoManager();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.