Package com.sun.star.drawing

Examples of com.sun.star.drawing.XShapes


    */
    protected 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" );
        // get a soffice factory object
        SOfficeFactory SOF = SOfficeFactory.getFactory(
                                    (XMultiServiceFactory)Param.getMSF());

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

        //put something on the drawpage
        log.println( "inserting some Shapes" );
        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"));

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

View Full Code Here


            failed("Couldn't create test environment");
        }

        //get a Shape
        log.println( "getting Shape" );
        XShapes oShapes = (XShapes) UnoRuntime.queryInterface
            (XShapes.class, oDP);
        XInterface oObj = SOF.createShape
            (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
        for (int i=0; i < 10; i++) {
            oShapes.add(
                SOF.createShape(xDrawDoc,
                    5000, 3500, 7510 + 10 * i, 5010 + 10 * i, "Rectangle"));
        }
        XShape oShape = SOF.createShape
            (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
        oShapes.add((XShape) oObj);
        oShapes.add((XShape) oShape);


        XPropertySet oShapeProps = (XPropertySet)
            UnoRuntime.queryInterface(XPropertySet.class, oObj);
        XStyle aStyle = null;
View Full Code Here

      xDrawDoc = Helper.createDocument( xOfficeContext,
        "private:factory/simpress", "_blank", 0, pPropValues );


      XDrawPage   xPage;
      XShapes     xShapes;
      XPropertySet xShapePropSet;

      // create pages, so that three are available
        while ( PageHelper.getDrawPageCount( xDrawDoc ) < 3 )
        PageHelper.insertNewDrawPageByIndex( xDrawDoc, 0 );


      // set the slide transition for the first page
      xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
      xShapes = (XShapes)
        UnoRuntime.queryInterface( XShapes.class, xPage );
      // set slide transition effect
      setSlideTransition( xPage,
        com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT,
          com.sun.star.presentation.AnimationSpeed.FAST,
            1, 0 ); // automatic object and slide transition
     
      // create a rectangle that is placed on the top left of the page
      xShapePropSet = ShapeHelper.createAndInsertShape( xDrawDoc,
        xShapes,new Point( 1000, 1000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );
      xShapePropSet.setPropertyValue("Effect",
                com.sun.star.presentation.AnimationEffect.WAVYLINE_FROM_BOTTOM );

      /* the following three properties provokes that the shape is dimmed
         to red
         after the animation has been finished */
      xShapePropSet.setPropertyValue( "DimHide", new Boolean( false ) );
      xShapePropSet.setPropertyValue( "DimPrevious", new Boolean( true ) );
      xShapePropSet.setPropertyValue( "DimColor", new Integer( 0xff0000 ) );


      // set the slide transition for the second page
      xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 1 );
      xShapes = (XShapes)
        UnoRuntime.queryInterface( XShapes.class, xPage );
      setSlideTransition( xPage,
        com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT,
          com.sun.star.presentation.AnimationSpeed.SLOW,
            1, 0 ); // automatic object and slide transition

      // create an ellipse that is placed on the bottom right of second page
      xShapePropSet = ShapeHelper.createAndInsertShape( xDrawDoc,
        xShapes, new Point( 21000, 15000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.EllipseShape" );
      xShapePropSet.setPropertyValue(
        "Effect", com.sun.star.presentation.AnimationEffect.HIDE );


      // create two objects for the third page
      // clicking the first object lets the presentation jump
      // to page one by using ClickAction.FIRSTPAGE,
      // the second object lets the presentation jump to page two
      // by using a ClickAction.BOOKMARK;
      xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 2 );
      xShapes = (XShapes)
        UnoRuntime.queryInterface( XShapes.class, xPage );
      setSlideTransition( xPage,
        com.sun.star.presentation.FadeEffect.ROLL_FROM_LEFT,
          com.sun.star.presentation.AnimationSpeed.MEDIUM,
            2, 0 );
      XShape xShape = ShapeHelper.createShape( xDrawDoc,
          new Point( 1000, 8000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.EllipseShape" );
      xShapes.add( xShape );
      ShapeHelper.addPortion( xShape, "click to go", false );
      ShapeHelper.addPortion( xShape, "to first page", true );
      xShapePropSet = (XPropertySet)
        UnoRuntime.queryInterface( XPropertySet.class, xShape );
      xShapePropSet.setPropertyValue("Effect",
                com.sun.star.presentation.AnimationEffect.FADE_FROM_BOTTOM );
      xShapePropSet.setPropertyValue(
        "OnClick", com.sun.star.presentation.ClickAction.FIRSTPAGE );


      xShape = ShapeHelper.createShape( xDrawDoc,
        new Point( 22000, 8000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );
      xShapes.add( xShape );
      ShapeHelper.addPortion( xShape, "click to go", false );
      ShapeHelper.addPortion( xShape, "to the second page", true );
      xShapePropSet = (XPropertySet)
        UnoRuntime.queryInterface( XPropertySet.class, xShape );
      xShapePropSet.setPropertyValue("Effect",
View Full Code Here

        "private:factory/sdraw", "_blank", 0, pPropValues );


      // create two rectangles
      XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
      XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, xPage );

      XShape xRect1 = ShapeHelper.createShape( xDrawDoc,
        new Point( 1000, 1000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );

      XShape xRect2 = ShapeHelper.createShape( xDrawDoc,
        new Point( 1000, 7000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );

      xShapes.add( xRect1 );
      xShapes.add( xRect2 );
      XPropertySet xTextProp = ShapeHelper.addPortion( xRect2,
                                                             "this shape is locked",
                                                             false );
      xTextProp.setPropertyValue( "ParaAdjust", ParagraphAdjust.CENTER );
      ShapeHelper.addPortion( xRect2, "and the shape above is not visible",
View Full Code Here

       
        // now we will create and insert the text object
        XShape xTextObj = ShapeHelper.createShape( xDrawDoc, new Point( 10000, 9000 ),
          new Size( 10000, 5000 ),
            "com.sun.star.drawing.TextShape" );
        XShapes xShapes = (XShapes)
            UnoRuntime.queryInterface( XShapes.class, xDrawPage );
        xShapes.add( xTextObj );
        ShapeHelper.addPortion( xTextObj, aNameArray[ i ], true );
      }

      /* create two custom shows, one will play slide 6 to 10 and is named "ShortVersion"
         the other one will play slide 2 til 10 and is named "LongVersion" */
 
View Full Code Here

      xDrawDoc = Helper.createDocument( xOfficeContext,
        "private:factory/sdraw", "_blank", 0, pPropValues );

      XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );     
      XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, xPage );


      XShape     xRectangle;
      XPropertySet xTextPropSet, xShapePropSet;
      LineSpacing  aLineSpacing = new LineSpacing();
      aLineSpacing.Mode = LineSpacingMode.PROP;



      // first shape
      xRectangle = ShapeHelper.createShape( xDrawDoc,
        new Point( 0, 0 ),
          new Size( 15000, 7500 ),
            "com.sun.star.drawing.RectangleShape" );
      xShapes.add( xRectangle );
      xShapePropSet = (XPropertySet)
          UnoRuntime.queryInterface( XPropertySet.class, xRectangle );


      // first paragraph
      xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion1", false );
      xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff0000 ) );
      xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion2", false );
      xTextPropSet.setPropertyValue( "CharColor", new Integer( 0x8080ff ) );
      aLineSpacing.Height = 100;
      ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing",
                                                     aLineSpacing );

      // second paragraph
      xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion3", true );
      xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff ) );
      aLineSpacing.Height = 200;
      ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing",
                                                     aLineSpacing );



      // second shape
      xRectangle = ShapeHelper.createShape( xDrawDoc,
        new Point( 0, 10000 ),
          new Size( 21000, 12500 ),
            "com.sun.star.drawing.RectangleShape" );     
      xShapes.add( xRectangle );
      xShapePropSet = (XPropertySet)
          UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
      xShapePropSet.setPropertyValue( "TextFitToSize",
                                            TextFitToSizeType.PROPORTIONAL );
      xShapePropSet.setPropertyValue( "TextLeftDistance"new Integer(2500));
View Full Code Here

      xDrawDoc = Helper.createDocument( xOfficeContext,
        "private:factory/sdraw", "_blank", 0, pPropValues );

      // create two rectangles
      XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
      XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, xPage );

      XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
        new Point( 1000, 1000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );

      XShape xShape2 = ShapeHelper.createShape( xDrawDoc,
        new Point( 2000, 2000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.EllipseShape" );
           
      xShapes.add( xShape1 );
      ShapeHelper.addPortion( xShape1, "     this shape was inserted first", false );
      ShapeHelper.addPortion( xShape1, "by changing the ZOrder it lie now on top", true );
      xShapes.add( xShape2 );
 
      XPropertySet xPropSet1 = (XPropertySet)
          UnoRuntime.queryInterface( XPropertySet.class, xShape1 );
      XPropertySet xPropSet2 = (XPropertySet)
          UnoRuntime.queryInterface( XPropertySet.class, xShape2 );
View Full Code Here

      xDrawDoc = Helper.createDocument( xOfficeContext,
        "private:factory/sdraw", "_blank", 0, pPropValues );


      XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
      XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, xPage );

      // create two rectangles
      XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
        new Point( 15000, 1000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.RectangleShape" );

      XShape xShape2 = ShapeHelper.createShape( xDrawDoc,
        new Point( 2000, 15000 ), new Size( 5000, 5000 ),
          "com.sun.star.drawing.EllipseShape" );

      // and a connector
      XShape xConnector = ShapeHelper.createShape( xDrawDoc,
        new Point( 0, 0 ),
          new Size( 0, 0 ),
            "com.sun.star.drawing.ConnectorShape" );

      xShapes.add( xShape1 );
      xShapes.add( xShape2 );
      xShapes.add( xConnector );
 
      XPropertySet xConnectorPropSet = (XPropertySet)
        UnoRuntime.queryInterface( XPropertySet.class, xConnector );

//      Index value of 0 : the shape is connected at the top
//      Index value of 1 : the shape is connected at the left
//      Index value of 2 : the shape is connected at the bottom
//      Index value of 3 : the shape is connected at the right
     
      int nStartIndex = 3;
      int nEndIndex   = 1;

      // the "StartPosition" or "EndPosition" property needs not to be set
      // if there is a shape to connect
      xConnectorPropSet.setPropertyValue( "StartShape", xShape1 );
      xConnectorPropSet.setPropertyValue( "StartGluePointIndex",
                                                new Integer( nStartIndex ) );

      xConnectorPropSet.setPropertyValue( "EndShape", xShape2 );
      xConnectorPropSet.setPropertyValue( "EndGluePointIndex",
                                                new Integer( nEndIndex ) );

      XGluePointsSupplier  xGluePointsSupplier;
      XIndexContainer     xIndexContainer;
      XIdentifierContainer xIdentifierContainer;

      GluePoint2 aGluePoint = new GluePoint2();
      aGluePoint.IsRelative = false;
      aGluePoint.PositionAlignment = Alignment.CENTER;
      aGluePoint.Escape = EscapeDirection.SMART;
      aGluePoint.IsUserDefined = true;
      aGluePoint.Position.X = 0;
      aGluePoint.Position.Y = 0;

      // create and insert a glue point at shape1
      xGluePointsSupplier = (XGluePointsSupplier)
        UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape1 );
      xIndexContainer = xGluePointsSupplier.getGluePoints();
      xIdentifierContainer = (XIdentifierContainer)
        UnoRuntime.queryInterface( XIdentifierContainer.class,
                                           xIndexContainer );
      int nIndexOfGluePoint1 = xIdentifierContainer.insert( aGluePoint );

      // create and insert a glue point at shape2
      xGluePointsSupplier = (XGluePointsSupplier)
        UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape2 );
      xIndexContainer = xGluePointsSupplier.getGluePoints();
      xIdentifierContainer = (XIdentifierContainer)
        UnoRuntime.queryInterface( XIdentifierContainer.class,
                                           xIndexContainer );
      int nIndexOfGluePoint2 = xIdentifierContainer.insert( aGluePoint );

      // create and add a connector
      XShape xConnector2 = ShapeHelper.createShape( xDrawDoc,
        new Point( 0, 0 ),
          new Size( 0, 0 ),
            "com.sun.star.drawing.ConnectorShape" );
      xShapes.add( xConnector2 );

      XPropertySet xConnector2PropSet = (XPropertySet)
        UnoRuntime.queryInterface( XPropertySet.class, xConnector2 );

      xConnector2PropSet.setPropertyValue( "StartShape", xShape1 );
View Full Code Here

      XShape xRectangle = ShapeHelper.createShape( xDrawDoc,
        new Point( 0, 0 ),
          new Size( 15000, 12000 ),
            "com.sun.star.drawing.RectangleShape" );
     
      XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, xPage );
      xShapes.add( xRectangle );

      XPropertySet xPropSet = (XPropertySet)
        UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
     
      /* apply a gradient fill style that goes from top left to bottom
View Full Code Here

        (XDrawPagesSupplier)UnoRuntime.queryInterface(
          XDrawPagesSupplier.class, xComponent );
      XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
      XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
                XDrawPage.class, xDrawPages.getByIndex( 0 ));
      XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
                                                                 xDrawPage );


      // create and insert the ControlShape
      Object xObj = xFactory.createInstance(
                "com.sun.star.drawing.ControlShape" );
      XShape xShape = (XShape)UnoRuntime.queryInterface( XShape.class, xObj );
      xShape.setPosition( new Point( 1000, 1000 ) );
      xShape.setSize( new Size( 2000, 2000 ) );
      xShapes.add( xShape );

      // create and set the control
      XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
                XControlModel.class,
        xFactory.createInstance( "com.sun.star.form.component.GroupBox" ) );
      XControlShape xControlShape = (XControlShape)UnoRuntime.queryInterface(
                XControlShape.class, xShape );
      xControlShape.setControl( xControlModel );


      // the following code will demonstrate how to
      // make a selection that contains our new created ControlShape
      XModel xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
                                                               xComponent );
      XController xController = xModel.getCurrentController();
      XSelectionSupplier xSelectionSupplier =(XSelectionSupplier)
        UnoRuntime.queryInterface( XSelectionSupplier.class, xController );
      // take care to use the global service factory only and not the one
      // that is provided by the component if you create the ShapeColletion
      XShapes xSelection = (XShapes)UnoRuntime.queryInterface( XShapes.class,
        xOfficeContext.getServiceManager().createInstanceWithContext(
                    "com.sun.star.drawing.ShapeCollection", xOfficeContext ) );
      xSelection.add( xShape );
      xSelectionSupplier.select( xSelection );
    }
    catch( java.lang.Exception ex )
    {
      System.out.println( ex );
View Full Code Here

TOP

Related Classes of com.sun.star.drawing.XShapes

Copyright © 2018 www.massapicom. 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.