Package com.sun.star.drawing

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


       
        // 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

      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

            // Access the XDrawPageSupplier interface of the document
            XDrawPageSupplier xDrawPageSupplier = (XDrawPageSupplier)
                UnoRuntime.queryInterface (XDrawPageSupplier.class, mxDoc );

            // Get the XShapes interface of the draw page
            XShapes xShapes = ( XShapes ) UnoRuntime.queryInterface (
                XShapes.class, xDrawPageSupplier.getDrawPage () );
           
            // Add both shapes
            xShapes.add ( xEllipse );
            xShapes.add ( xRect );

            /*
              This doesn't work, I am assured that FME and AMA are fixing it.
             
              XShapes xGrouper = (XShapes) UnoRuntime.queryInterface(
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.setControl( xModel );

        // add the shape to the shapes collection of the document
        XDrawPage pageWhereToInsert = ( m_page != null ) ? m_page : m_document.getMainDrawPage();

        XShapes xDocShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert );
        xDocShapes.add( xShape );

        // and outta here with the XPropertySet interface of the model
        XPropertySet xModelProps = dbfTools.queryPropertySet( xModel );
        return xModelProps;
    }
View Full Code Here

        int  nRndObjPosX = aRndGen.nextInt( nHalfWidth - nRndObjWidth );
        int nRndObjPosY = aRndGen.nextInt( nHalfHeight - nRndObjHeight )
                    + nHalfHeight;

        XShapes xShapes = (XShapes)
          UnoRuntime.queryInterface( XShapes.class, pPages[ i ] );
        ShapeHelper.createAndInsertShape( xDrawDoc, xShapes,
          new Point( nRndObjPosX, nRndObjPosY ),
            new Size( nRndObjWidth, nRndObjHeight ),
              "com.sun.star.drawing.RectangleShape" );
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.