Package com.sun.star.drawing

Examples of com.sun.star.drawing.XShape


        // create testobject here

        XEnumerationAccess xEA = null ;
        try {
            SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory)tParam.getMSF()) ;
            XShape oShape = SOF.createShape
                (xDrawDoc,5000,3500,7500,5000,"Text");
            DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape) ;

            XSimpleText text = (XSimpleText) UnoRuntime.queryInterface
                (XSimpleText.class, oShape) ;
View Full Code Here


     */
    protected TestEnvironment createTestEnvironment
            (TestParameters tParam, PrintWriter log) {

        XInterface oObj = null;
        XShape oShape = null;

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

        try {
            // adding some shapes for testing.
            //SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
            //oShape = SOF.createShape(xDrawDoc,6000,6000,5000,5000,"PolyPolygon");
            XMultiServiceFactory xMSF = (XMultiServiceFactory)
                UnoRuntime.queryInterface(XMultiServiceFactory.class, xDrawDoc) ;
            XInterface oInst = (XInterface) xMSF.createInstance
                ("com.sun.star.drawing.PolyPolygonShape") ;
            oShape = (XShape) UnoRuntime.queryInterface
                (XShape.class, oInst) ;

            oShape.setSize(new Size(0,0)) ;
            oShape.setPosition(new Point(0,0)) ;

            DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape);

            Point[] square1 = new Point[] {
                new Point(5000, 5000),
View Full Code Here

        int top = 0;
        String slidename = "";
        String slidebody = "";
        String shapetext = "";
        for (int j = 0; j < xShapes.getCount(); j++) {
          XShape firstXshape = (XShape)UnoRuntime.queryInterface(XShape.class, xShapes.getByIndex(j));
          Point pos = firstXshape.getPosition();

          XText xText = (XText)UnoRuntime.queryInterface( XText.class, firstXshape );
          if(xText!=null && xText.getString().length()>0)
          {
            shapetext = xText.getString();
View Full Code Here

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

        // get the Title
        log.println( "getting Title" );
        XShape oObj = (XShape) xChartDoc.getTitle();

        log.println( "creating a new environment for chartdocument object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
        tEnv.addObjRelation("NoSetSize","sch.ChartTitle");
        return tEnv;
View Full Code Here

    * @see com.sun.star.chart.ChartAxis
    */
    protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {

        XPropertySet oObj = null;
        XShape oDiagram = null;

        // create testobject here
        // get the Diagram
        log.println( "getting Diagram" );
        oDiagram = (XDiagram) xChartDoc.getDiagram();
View Full Code Here

                        XMultiServiceFactory.class, xChartDoc);
                aDiagram = (XDiagram) UnoRuntime.queryInterface(
                    XDiagram.class,
                    chartMSF.createInstance("com.sun.star.chart.XYDiagram"));
                // if x or y values are not dimensionless, then set titles
                XShape yTitleShape = ((XAxisYSupplier) UnoRuntime.queryInterface(XAxisYSupplier.class, aDiagram))
                        .getYAxisTitle();
                XShape xTitleShape = ((XAxisXSupplier) UnoRuntime.queryInterface(XAxisXSupplier.class, aDiagram))
                        .getXAxisTitle();
                if (xEvalUnit.getName()!=null){
                    ((XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aDiagram))
                            .setPropertyValue("HasXAxisTitle", true);
                    ((XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTitleShape))
                            .setPropertyValue("String", "["+xEvalUnit.getName()+"]");
                }
                if (yEvalUnit.getName()!=null){
                    ((XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aDiagram))
                            .setPropertyValue("HasYAxisTitle", true);
                    ((XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, yTitleShape))
                            .setPropertyValue("String", "["+yEvalUnit.getName()+"]");
                }

                /* Default to no points */
                XPropertySet chartXPS = (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class,aDiagram);
                /* Fix formatting so it looks good (X and Y Grid,
                 * no markers by default) */
                chartXPS.setPropertyValue("SymbolType", ChartSymbolType.NONE);
                chartXPS.setPropertyValue("HasYAxisGrid",false);
                xChartDoc.setDiagram(aDiagram);
                // set xaxis to cross y-axis at minimum value
                ((XAxisXSupplier) UnoRuntime.queryInterface(XAxisXSupplier.class, aDiagram))
                        .getXAxis()
                        .setPropertyValue("CrossoverPosition",ChartAxisPosition.START );
                // set xaxis to cross y-axis at minimum value
                ((XAxisYSupplier) UnoRuntime.queryInterface(XAxisYSupplier.class, aDiagram))
                        .getYAxis()
                        .setPropertyValue("CrossoverPosition",ChartAxisPosition.START );
                long legendWidth = xChartDoc.getLegend().getSize().Width
                        + yTitleShape.getSize().Width
                        + yTitleShape.getPosition().X + 6000;
                // Must convert Long to Any to do setProperty
                xFrameProps.setPropertyValue("Width", new Any(Type.LONG,legendWidth));
                Integer xTitleHeight;
                if (xTitleShape.getPosition().Y==0){
                    xTitleHeight = 0;
                }
                else{
                    // I think Y position will be distance to the top corner,
                    // so I do not also need the height of the XTitleShape.
                    xTitleHeight = (Integer)xFrameProps.getPropertyValue("Height")
                            - xTitleShape.getPosition().Y;
                }
                xFrameProps.setPropertyValue("Height",
                        xTitleHeight+ 6000);

            }
View Full Code Here

        XPropertySet pageSet = unoCast(XPropertySet.class, page);
        Short pageNumber = (Short) pageSet.getPropertyValue("Number");

        // Shapes de titre
        XShape shape = findShapeByType(page, SHAPE_TYPE_TITLETEXT);

        if (shape != null) {
          XSimpleText xSimpleText = unoCast(XSimpleText.class, shape);

          // Recherche du nom de la page maitresse (= style de
View Full Code Here

    XDrawPage notesPage = findNotesPageByIndex(sommaireIndex);

    // Suppression du shape principal
    notesPage.remove(findShapeByType(notesPage, SHAPE_TYPE_PAGE));
    // Mise en forme du shape de notes
    XShape notesShape = findShapeByType(notesPage, SHAPE_TYPE_NOTES);
    int xmargin = bundle.getTocXMargin() * 100;
    int ymargin = bundle.getTocYMargin() * 100;
    try {
      notesShape.setPosition(new Point(xmargin, ymargin));
      notesShape.setSize(new Size(21000 - 2 * xmargin,
          29700 - 2 * ymargin));
      XPropertySet xNotesShapeProps = unoCast(XPropertySet.class,
          notesShape);
      xNotesShapeProps.setPropertyValue("FillStyle", StyleHelper
          .getFillStyle(bundle.getTocFillStyle()));
View Full Code Here

      BundleHelper bundle = BundleHelper.getInstance();

      XDrawPage planPage = findPageByIndex(planIndex);

      // Shape de titre
      XShape titleShape = findShapeByType(planPage, SHAPE_TYPE_TITLETEXT);
      if (titleShape != null) {
        XSimpleText titleText = unoCast(XSimpleText.class, titleShape);
        titleText.setString(bundle.getShortTocTitle());
      }

      // Shape principal
      XShape mainShape = findShapeByType(planPage, SHAPE_TYPE_OUTLINER);
      if (mainShape != null) {
        XSimpleText mainText = unoCast(XSimpleText.class, mainShape);

        XTextCursor cursor = mainText.createTextCursor();
        cursor.getStart();

        XPropertySet xCursorProps = unoCast(XPropertySet.class, cursor);
        TabStop[] tabStops = new TabStop[1];
        tabStops[0] = new TabStop(bundle.getShortTocTabulation(),
            TabAlign.RIGHT, ',', '.');
        xCursorProps.setPropertyValue("ParaTabStops", tabStops);

        StringBuilder planBuilder = new StringBuilder();
        String newLine = "";
        for (SlideDesc slide : toc.getAllSlides()) {
          if (slide.getLevel() == 1) {
            planBuilder.append(newLine);
            planBuilder.append(slide.getTitle());
            planBuilder.append("\t");
            planBuilder.append(slide.getPage());
            newLine = "\n";
          }
        }
        mainText.setString(planBuilder.toString());

      }

      // Shape de notes
      XPresentationPage xPresentationPage = unoCast(
          XPresentationPage.class, planPage);
      XDrawPage planNotesPage = xPresentationPage.getNotesPage();
      XShape notesShape = findShapeByType(planNotesPage, SHAPE_TYPE_NOTES);
      if (notesShape != null) {
        XSimpleText notesText = unoCast(XSimpleText.class, notesShape);
        notesText.setString(bundle.getShortTocNotesText());
      }
View Full Code Here

   */
  private XShape findShapeByType(XDrawPage page, String shapeType)
      throws ImpressException {
    try {
      for (int i = 0; i < page.getCount(); i++) {
        XShape shape = unoCast(XShape.class, page.getByIndex(i));
        if (shapeType.equals(shape.getShapeType())) {
          return shape;
        }
      }
      return null;
    } catch (Exception e) {
View Full Code Here

TOP

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

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.