Package com.sun.star.container

Examples of com.sun.star.container.XNameContainer



    protected static XNameContainer GetConfigNameContainer( XComponentContext xContext, String sNodepath )
        throws com.sun.star.uno.Exception
    {
        XNameContainer xContainer = ( XNameContainer ) UnoRuntime.queryInterface( XNameContainer.class, GetConfig( xContext, sNodepath, true ) );
        if ( xContainer == null )
            throw new com.sun.star.uno.RuntimeException();
       
        return xContainer;
    }
View Full Code Here


        xPSetButton.setPropertyValue( "Name", _doNotRunButtonName );
        xPSetButton.setPropertyValue( "TabIndex", new Short( (short)0 ) );
        xPSetButton.setPropertyValue( "Label", _doNotRunMacro );
     
        // insert the control models into the dialog model
        XNameContainer xNameCont = ( XNameContainer )UnoRuntime.queryInterface(
            XNameContainer.class, dialogModel );
        xNameCont.insertByName( _runButtonName, runButtonModel );
        xNameCont.insertByName( _doNotRunButtonName, doNotRunButtonModel );

        if ( checkBoxDialog )
        {
            LogUtils.DEBUG("creating label & checkbox");
            // create the label model and set the properties
            Object label2Model = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlFixedTextModel" );
            XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, label2Model );
            xPSetLabel.setPropertyValue( "PositionX", new Integer( label2X ));
            xPSetLabel.setPropertyValue( "PositionY", new Integer( label2Y ));
            xPSetLabel.setPropertyValue( "Width", new Integer( label2W ));
            xPSetLabel.setPropertyValue( "Height", new Integer( label2H ));
            xPSetLabel.setPropertyValue( "Name", _label2Name );
            xPSetLabel.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetLabel.setPropertyValue( "Label", _label2String );

            // create the label model and set the properties
            Object label3Model = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlFixedTextModel" );
            XPropertySet xPSetLabel3 = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, label3Model );
            xPSetLabel3.setPropertyValue( "PositionX", new Integer( label3X ));
            xPSetLabel3.setPropertyValue( "PositionY", new Integer( label3Y ));
            xPSetLabel3.setPropertyValue( "Width", new Integer( label3W ));
            xPSetLabel3.setPropertyValue( "Height", new Integer( label3H ));
            xPSetLabel3.setPropertyValue( "Name", _label3Name );
            xPSetLabel3.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetLabel3.setPropertyValue( "Label", _label3String );

            // create the label model and set the properties
            Object label4Model = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlFixedTextModel" );
            XPropertySet xPSetLabel4 = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, label4Model );
            xPSetLabel4.setPropertyValue( "PositionX", new Integer( label4X ));
            xPSetLabel4.setPropertyValue( "PositionY", new Integer( label4Y ));
            xPSetLabel4.setPropertyValue( "Width", new Integer( label4W ));
            xPSetLabel4.setPropertyValue( "Height", new Integer( label4H ));
            xPSetLabel4.setPropertyValue( "Name", _label4Name );
            xPSetLabel4.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetLabel4.setPropertyValue( "Label", _label4String );

            // create the checkbox model and set the properties
            Object checkBoxModel = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlCheckBoxModel" );
            XPropertySet xPSetCheckBox = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, checkBoxModel );
            xPSetCheckBox.setPropertyValue( "PositionX", new Integer( checkBoxX ));
            xPSetCheckBox.setPropertyValue( "PositionY", new Integer( checkBoxY ));
            xPSetCheckBox.setPropertyValue( "Width", new Integer( checkBoxW ));
            xPSetCheckBox.setPropertyValue( "Height", new Integer( checkBoxH ));
            xPSetCheckBox.setPropertyValue( "State", new Short((short)0) );
            xPSetCheckBox.setPropertyValue( "Name", _checkBoxName );
            xPSetCheckBox.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetCheckBox.setPropertyValue( "Label", new String(_checkBoxString +checkBoxPath) );

            // insert the control models into the dialog model
            xNameCont.insertByName( _label2Name, label2Model );
            xNameCont.insertByName( _label3Name, label3Model );
            xNameCont.insertByName( _label4Name, label4Model );
            xNameCont.insertByName( _checkBoxName, checkBoxModel );

            if ( extraPathLine == true )
            {
            // create the label model and set the properties
            Object label5Model = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlFixedTextModel" );
            XPropertySet xPSetLabel5 = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, label5Model );
            xPSetLabel5.setPropertyValue( "PositionX", new Integer( label5X ));
            xPSetLabel5.setPropertyValue( "PositionY", new Integer( label5Y ));
            xPSetLabel5.setPropertyValue( "Width", new Integer( label5W ));
            xPSetLabel5.setPropertyValue( "Height", new Integer( label5H ));
            xPSetLabel5.setPropertyValue( "Name", _label5Name );
            xPSetLabel5.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetLabel5.setPropertyValue( "Label", checkBoxPath2 );
            xNameCont.insertByName( _label5Name, label5Model );
            }
        }
        else
        {
            // create the label model and set the properties
            Object labelModel = xMultiServiceFactory.createInstance(
                "com.sun.star.awt.UnoControlFixedTextModel" );
            XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface(
                XPropertySet.class, labelModel );
            xPSetLabel.setPropertyValue( "PositionX", new Integer( label1X ));
            xPSetLabel.setPropertyValue( "PositionY", new Integer( label1Y ));
            xPSetLabel.setPropertyValue( "Width", new Integer( label1W ));
            xPSetLabel.setPropertyValue( "Height", new Integer( label1H ));
            xPSetLabel.setPropertyValue( "Name", _label1Name );
            xPSetLabel.setPropertyValue( "TabIndex", new Short( (short)1 ) );
            xPSetLabel.setPropertyValue( "Label", _label1String );

            // insert the control models into the dialog model
            xNameCont.insertByName( _label1Name, labelModel );
        }
     
        // create the dialog control and set the model
        Object dialog = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialog", _xComponentContext );
View Full Code Here

       
        tRes.tested("NumberingRules", result);       
    }

    public void _ParaUserDefinedAttributes() {
        XNameContainer uda = null;
        boolean res = false;

        try {
            try{
                uda = (XNameContainer) AnyConverter.toObject(
                          new Type(XNameContainer.class),
                          oObj.getPropertyValue("ParaUserDefinedAttributes"));
            } catch (com.sun.star.lang.IllegalArgumentException e){
                log.println("ParaUserDefinedAttributes is empty.");
                uda = new _ParagraphProperties.OwnUserDefinedAttributes();
            }
            AttributeData attr = new AttributeData();
            attr.Namespace = "http://www.sun.com/staroffice/apitest/Cellprop";
            attr.Type = "CDATA";
            attr.Value = "true";
            uda.insertByName("Cellprop:has-first-alien-attribute", attr);

            String[] els = uda.getElementNames();
            oObj.setPropertyValue("ParaUserDefinedAttributes", uda);
            uda = (XNameContainer) AnyConverter.toObject(
                          new Type(XNameContainer.class),
                          oObj.getPropertyValue("ParaUserDefinedAttributes"));
            els = uda.getElementNames();

            Object obj = uda.getByName("Cellprop:has-first-alien-attribute");
            res = true;
        } catch (com.sun.star.beans.UnknownPropertyException upe) {
            if (isOptional("ParaUserDefinedAttributes")) {
                log.println("Property is optional and not supported");
                res = true;
View Full Code Here

        importReportData(xMSF, this, CurReportDocument);
    }

    public boolean reconnectToDatabase(XMultiServiceFactory xMSF) {
        try {
            XNameContainer xNamedForms = CurReportDocument.oFormHandler.getDocumentForms();
            Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
            boolean bgetConnection;
            String sQueryName = "";
            if (oDBForm != null) {
                String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
View Full Code Here

            // Some exception occures.FAILED
            log.println("!!! Couldn't create instance : " + e);
            throw new StatusException("Can't create column instances.", e);
        }

        XNameContainer aContainer = (XNameContainer) UnoRuntime.queryInterface(
                                            XNameContainer.class, oObj);

        try {
            aContainer.insertByName("First", aControl);
            aContainer.insertByName("Second", aControl2);
        } catch (com.sun.star.lang.WrappedTargetException e) {
            log.println("!!! Could't insert column Instance");
            e.printStackTrace(log);
            throw new StatusException("Can't insert columns", e);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
View Full Code Here

        XInterface ctrl = SOF.createControl(xDrawDoc, objName);

        try {
            XDrawPage oDP = DrawTools.getDrawPage(xDrawDoc, 0);

            XNameContainer nc = FormTools.getForms(oDP);
            FormTools.insertForm(xDrawDoc, nc, "OHiddenModelForm");

            Object frm = nc.getByName("OHiddenModelForm");

            XNameContainer frmNC = (XNameContainer) UnoRuntime.queryInterface(
                                           XNameContainer.class, frm);

            frmNC.insertByName("OHiddenModel", ctrl);
            oObj = (XInterface) AnyConverter.toObject(
                           new Type(XInterface.class),
                           frmNC.getByName("OHiddenModel"));
        } catch (com.sun.star.lang.WrappedTargetException e) {
            e.printStackTrace(log);
            throw new StatusException("Can't create and add control", e);
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
View Full Code Here

        // 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 : ");
        formNames = forms.getElementNames();

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

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

    XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class,xSingleFac.createInstance());
    xProp.setPropertyValue("Command","SELECT * FROM biblio");
    xProp.setPropertyValue("EscapeProcessing",new Boolean(true));

    XNameContainer xCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQDefs);
        try
        {
            xCont.removeByName("Query1");
        }
        catch(com.sun.star.uno.Exception e)
        {}
    xCont.insertByName("Query1",xProp);
  }
View Full Code Here

                    // actual style families
                    XNameAccess xFamilies = ( XNameAccess ) UnoRuntime.queryInterface (
                            XNameAccess.class, xSupplier.getStyleFamilies() );

                    // Access the 'ParagraphStyles' Family
                    XNameContainer xFamily = (XNameContainer ) UnoRuntime.queryInterface (
                            XNameContainer.class, xFamilies.getByName ( "ParagraphStyles" ) );

                    // Insert the newly created style into the ParagraphStyles family
                    xFamily.insertByName ( "All-Singing All-Dancing Style", xStyle );

                    // Get the XParagraphCursor interface of the document cursor
                    XParagraphCursor xParaCursor = (XParagraphCursor)
                            UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor );
View Full Code Here

           
            // get the NameAccess interface from the Style family collection
            XNameAccess xNameAccess = xSupplier.getStyleFamilies();
           
            // select the Paragraph styles, you get the Paragraph style collection
            XNameContainer xParaStyleCollection = (XNameContainer) UnoRuntime.queryInterface(
                XNameContainer.class, xNameAccess.getByName( "ParagraphStyles" ));
           
            // create a PropertySet to set the properties for the new Paragraphstyle
            XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, xInterface );
            System.out.println( "create a PropertySet to set the properties for the new Paragraphstyle" );
           
            // set some properties from the Paragraph style
            xPropertySet.setPropertyValue("CharFontName", new String( "Helvetica" ) );
            System.out.println( "set name of the font to 'Helvetica'" );
           
            xPropertySet.setPropertyValue("CharHeight", new Float( 36 ) );
            System.out.println( "Change the height of th font to 36" );
           
            xPropertySet.setPropertyValue("CharWeight", new Float( com.sun.star.awt.FontWeight.BOLD ) );
            System.out.println( "set the font attribute 'Bold'" );
           
            xPropertySet.setPropertyValue("CharAutoKerning", new Boolean( true ) );
            System.out.println( "set the paragraph attribute 'AutoKerning'" );
           
            xPropertySet.setPropertyValue("ParaAdjust", new Integer( com.sun.star.style.ParagraphAdjust.CENTER_value ) );
            System.out.println( "set the paragraph adjust to LEFT" );
           
            xPropertySet.setPropertyValue("ParaFirstLineIndent", new Integer( 0 ) );
            System.out.println( "set the first line indent to 0 cm" );
           
            xPropertySet.setPropertyValue("BreakType", com.sun.star.style.BreakType.PAGE_AFTER );
            System.out.println( "set the paragraph attribute Breaktype to PageAfter" );
           
            // insert the new Paragraph style in the Paragraph style collection
            xParaStyleCollection.insertByName( "myheading", xPropertySet );
            System.out.println( "create new paragraph style, with the values from the Propertyset");
           
            // get the Textrange from the document
            XTextRange xTextRange = xTextDocument.getText().getStart();
           
View Full Code Here

TOP

Related Classes of com.sun.star.container.XNameContainer

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.