Package com.sun.star.drawing

Examples of com.sun.star.drawing.XControlShape


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

        //get GridControlModel
        String objName = "Grid";
        XControlShape shape = FormTools.insertControlShape(xDrawDoc, 5000,
                                                           7000, 2000, 2000,
                                                           "GridControl");
        oObj = shape.getControl();

        log.println("creating a new environment for drawpage object");

        TestEnvironment tEnv = new TestEnvironment(oObj);
View Full Code Here


        log.println("creating a test environment");

        //get FileControlModel
        String objName = "FileControl";

        XControlShape aShape = null;

        Size size = new Size();
        Point position = new Point();
        XControlModel aControl = null;

        //get MSF
        XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(
                                               XMultiServiceFactory.class,
                                               xDrawDoc);

        try {
            Object oInt = oDocMSF.createInstance(
                                  "com.sun.star.drawing.ControlShape");
            Object aCon = oDocMSF.createInstance(
                                  "com.sun.star.form.component." + objName);
            aControl = (XControlModel) UnoRuntime.queryInterface(
                               XControlModel.class, aCon);
            aShape = (XControlShape) UnoRuntime.queryInterface(
                             XControlShape.class, oInt);
            size.Height = 1500;
            size.Width = 3000;
            position.X = 1000;
            position.Y = 1000;
            aShape.setSize(size);
            aShape.setPosition(position);
        } catch (com.sun.star.uno.Exception e) {
            // Some exception occures.FAILED
            log.println("Couldn't create a component " + e);
            throw new StatusException(Status.failed("Can't create component"));
        }

        aShape.setControl(aControl);

        DrawTools.getDrawPage(xDrawDoc, 0).add((XShape) aShape);
        oObj = aShape.getControl();

        log.println("creating a new environment for drawpage object");

        TestEnvironment tEnv = new TestEnvironment(oObj);
View Full Code Here

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

        XInterface oObj = null;

        XControlShape aShape = FormTools.createControlShape(
                                xTextDoc,3000,4500,15000,10000,"NavigationToolBar");

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
        oObj = aShape.getControl();
        log.println( "creating a new environment for ONavigationBarModel object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
        tEnv.addObjRelation("OBJNAME", "com.sun.star.form.component.NavigationToolBar");
        //adding ObjRelation for XPersistObject
        tEnv.addObjRelation("PSEUDOPERSISTENT", new Boolean(true));
View Full Code Here

     * @return a test environment
     */
    protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
                                                                 PrintWriter log) {
        XInterface oObj = null;
        XControlShape aShape = null;
        XMultiServiceFactory xMSF = (XMultiServiceFactory) Param.getMSF();
       
        try{
            log.println("adding contol shape '" + m_kindOfControl + "'");
            aShape = FormTools.createControlShape(m_xTextDoc, 3000,
                                                            4500, 15000, 10000,
                                                            m_kindOfControl);
        } catch (Exception e){
            e.printStackTrace(log);
            throw new StatusException("Couldn't create following control shape (m_kindOfControl): '" +
                                        m_kindOfControl + "': ", e);
           
        }

        WriterTools.getDrawPage(m_xTextDoc).add((XShape) aShape);
        oObj = aShape.getControl();
       
        log.println("Implementation name: " + util.utils.getImplName(oObj));

        try {
            String sourceTestDB = utils.getFullURL(utils.getFullTestDocName("TestDB/testDB.dbf"));
            String destTestDB = utils.getOfficeTemp(xMSF);
            destTestDB = utils.getFullURL(destTestDB + "testDB.dbf");
           
            log.println("copy '"+sourceTestDB + "' -> '" + destTestDB + "'");
            utils.copyFile(xMSF, sourceTestDB, destTestDB);
           
            m_dbTools = new DBTools((xMSF));
            String tmpDir = utils.getOfficeTemp((xMSF));
       
            m_srcInf = m_dbTools.newDataSourceInfo();
            m_srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir);
            log.println("data source: " + m_srcInf.URL);

            m_dbSrc = m_srcInf.getDataSourceService();
            m_dbTools.reRegisterDB(m_dbSourceName, m_dbSrc);

            m_XFormLoader = FormTools.bindForm(m_xTextDoc, m_dbSourceName,
                                            m_TestDB);
        } catch (com.sun.star.uno.Exception e) {
            log.println("!!! Can't access TestDB !!!");
            e.printStackTrace(log);
            throw new StatusException("Can't access TestDB", e);
        }

        log.println("creating a new environment for object");

        TestEnvironment tEnv = new TestEnvironment(oObj);
       
        tEnv.addObjRelation("OBJNAME", m_ObjectName);
       
        log.println("adding shape '" + m_LCShape_Type +"' for DataAwareControlModel test");
        aShape = FormTools.createControlShape(m_xTextDoc, 6000, 4500, 15000,
                                              10000, m_LCShape_Type);
        WriterTools.getDrawPage(m_xTextDoc).add((XShape) aShape);

        m_XPS = (XPropertySet) UnoRuntime.queryInterface(
                                        XPropertySet.class, oObj);
                                       
        int i = 0;
        NamedValue prop = null;
        try {
            for (i = 0; i < m_propertiesToSet.size(); i++){
                prop = (NamedValue) m_propertiesToSet.get(i);
               
                log.println("stting property: '"+prop.Name+"' to value '"+prop.Value.toString()+"'");
               
                m_XPS.setPropertyValue(prop.Name, prop.Value);
            }
        } catch (com.sun.star.lang.WrappedTargetException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
        } catch (com.sun.star.beans.PropertyVetoException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
        } catch (com.sun.star.beans.UnknownPropertyException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
        } catch (java.lang.ClassCastException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get property on index '" + i + "': ", e);
        }


        // added LabelControl for 'DataAwareControlModel'
        tEnv.addObjRelation("LC", aShape.getControl());


        // added FormLoader for 'DataAwareControlModel'
        tEnv.addObjRelation("FL", m_XFormLoader);

View Full Code Here

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

        XInterface oObj = null;

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

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
        oObj = aShape.getControl();
        log.println( "creating a new environment for OButtonModel object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
        String objName = "CommandButton";
        tEnv.addObjRelation("OBJNAME", "stardiv.one.form.component." + objName);
        //adding ObjRelation for XPersistObject
View Full Code Here

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

        XInterface oObj = null;

        XControlShape aShape = FormTools.createControlShape(
                                xTextDoc,3000,4500,15000,10000,"ScrollBar");

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
        oObj = aShape.getControl();
        log.println( "creating a new environment for OScrollBarModel object" );
        TestEnvironment tEnv = new TestEnvironment( oObj );
       
        System.out.println("Implementation Name: "+util.utils.getImplName(oObj));
       
View Full Code Here

        XInterface oObj = null;
        XWindowPeer the_win = null;
        XWindow win = null;

        //Insert a ControlShape and get the ControlModel
        XControlShape aShape = FormTools.createControlShape(xTextDoc, 3000,
                                                            4500, 15000, 10000,
                                                            "CommandButton");

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);

        XControlModel the_Model = aShape.getControl();

        //Try to query XControlAccess
        XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
                                            XControlAccess.class,
                                            xTextDoc.getCurrentController());
View Full Code Here

        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);
View Full Code Here

        int nYPos, int nWidth, int nHeight, XIndexContainer xParentForm ) throws java.lang.Exception
    {
        // let the document create a shape
        XMultiServiceFactory xDocAsFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
            XMultiServiceFactory.class, m_document.getDocument() );
        XControlShape xShape = (XControlShape)UnoRuntime.queryInterface( XControlShape.class,
            xDocAsFactory.createInstance( "com.sun.star.drawing.ControlShape" ) );

        // position and size of the shape
        xShape.setSize( new Size( nWidth * 100, nHeight * 100 ) );
        xShape.setPosition( new Point( nXPos * 100, nYPos * 100 ) );

        // adjust the anchor so that the control is tied to the page
        XPropertySet xShapeProps = dbfTools.queryPropertySet( xShape );
        TextContentAnchorType eAnchorType = TextContentAnchorType.AT_PARAGRAPH;
        xShapeProps.setPropertyValue( "AnchorType", eAnchorType );

        // create the form component (the model of a form control)
        String sQualifiedComponentName = "com.sun.star.form.component." + sFormComponentService;
        XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class,
            m_document.getOrb().createInstance( sQualifiedComponentName ) );

        // insert the model into the form component hierarchy, if the caller gave us a location
        if ( null != xParentForm )
        {
            xParentForm.insertByIndex( xParentForm.getCount(), xModel );
        }

        // knitt them
        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 );
View Full Code Here

        XToolkit the_kit = null;
        XDevice aDevice = null;
        XGraphics aGraphic = null;

        //Insert a ControlShape and get the ControlModel
        XControlShape aShape = FormTools.createControlShape(xTextDoc, 5000,
                                                            7000, 2000, 2000,
                                                            "GroupBox");

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);

        XControlModel the_Model = aShape.getControl();

        XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000,
                                                             4500, 5000, 10000,
                                                             "TextField");

        WriterTools.getDrawPage(xTextDoc).add((XShape) aShape2);

        XControlModel the_Model2 = aShape2.getControl();

        //Try to query XControlAccess
        XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
                                            XControlAccess.class,
                                            xTextDoc.getCurrentController());
View Full Code Here

TOP

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

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.