Examples of XNameContainer


Examples of com.sun.star.container.XNameContainer

        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create instance", e);
        }

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

        if (aContainer.hasByName("FirstPresentation")) {
            try {
                aContainer.removeByName("FirstPresentation");
            } catch (com.sun.star.lang.WrappedTargetException e) {
                e.printStackTrace(log);
                throw new StatusException("Exception while removing instance", e);
            } catch (com.sun.star.container.NoSuchElementException e) {
                e.printStackTrace(log);
                throw new StatusException("Exception while removing instance", e);
            }
        }

        try {
            aContainer.insertByName("FirstPresentation",oInstance);
        } catch (com.sun.star.lang.WrappedTargetException e){
            e.printStackTrace(log);
            throw new StatusException("Could't insert Instance", e);
        } catch (com.sun.star.container.ElementExistException e){
            e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.container.XNameContainer

            }
        }) ;
    }
   
    public void _UserDefinedAttributes() {
        XNameContainer uda = null;
        boolean res = false;
        try {
            uda = (XNameContainer) AnyConverter.toObject(
                new Type(XNameContainer.class),
                    oObj.getPropertyValue("UserDefinedAttributes"));
            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("UserDefinedAttributes",uda);
            uda = (XNameContainer) AnyConverter.toObject(
                new Type(XNameContainer.class),
                    oObj.getPropertyValue("UserDefinedAttributes"));
            els = uda.getElementNames();
            Object obj = uda.getByName("Cellprop:has-first-alien-attribute");
            res = true;
        } catch (com.sun.star.beans.UnknownPropertyException upe) {
            log.println("Don't know the Property 'UserDefinedAttributes'");
        } catch (com.sun.star.lang.WrappedTargetException wte) {
            log.println("WrappedTargetException while getting Property 'UserDefinedAttributes'");
View Full Code Here

Examples of com.sun.star.container.XNameContainer

        catch( com.sun.star.uno.Exception e )
        {
            e.printStackTrace( System.err );
        }

        XNameContainer queryDefsContainer = (XNameContainer)UnoRuntime.queryInterface(
            XNameContainer.class, getQueryDefinitions() );
        queryDefsContainer.insertByName( _name, queryDef );
    }
View Full Code Here

Examples of com.sun.star.container.XNameContainer

               oObj.replaceByIndex(999, oInstance);
               result = false;
            log.println("1. replaceByIndex(): Exception expected! - FAILED");


            XNameContainer xNC = (XNameContainer)
                UnoRuntime.queryInterface(XNameContainer.class, oObj) ;
            String[] names = xNC.getElementNames() ;
            log.println("Element names :") ;
            for (int i = 0; i<names.length; i++) {
                 log.println("  '" + names[i] + "'") ;
            }
           } catch (IndexOutOfBoundsException e) {
            log.println("1. replaceByIndex(): Expected exception - OK");
            result &= true;
        } catch (com.sun.star.lang.IllegalArgumentException e) {
            result = false;
            log.println("1. replaceByIndex(): Unexpected exception! - " +
                 e + " - FAILED");
        } catch (com.sun.star.lang.WrappedTargetException e) {
            result = false;
            log.println("1. replaceByIndex(): Unexpected exception! - " +
                e + " - FAILED");
        }

        log.println("replace with a wrong Object occurs Exceptions ...");
        try {
               oObj.replaceByIndex(0, null);
               result = false;
            log.println("2. replaceByIndex(): Exception expected! - FAILED");


            XNameContainer xNC = (XNameContainer)
                UnoRuntime.queryInterface(XNameContainer.class, oObj) ;
            String[] names = xNC.getElementNames() ;
            log.println("Element names :") ;
            for (int i = 0; i<names.length; i++) {
                 log.println("  '" + names[i] + "'") ;
            }
           } catch (IllegalArgumentException e) {
View Full Code Here

Examples of com.sun.star.container.XNameContainer

    */
    public void _UserDefinedAttributes() {
        log.println("Testing with custom property tester");
        testProperty("UserDefinedAttributes", new PropertyTester() {
            protected Object getNewValue(String propName, Object oldValue) {
                XNameContainer NC = null;
                try {
                    NC = (XNameContainer)
                    AnyConverter.toObject(new Type(XNameContainer.class),oldValue);
                    NC.insertByName("MyAttribute",
                        new AttributeData("","CDATA","Value"));
                } catch ( com.sun.star.lang.IllegalArgumentException e ) {
                    log.println("Failed to check 'UserDefinedAttributes'");
                    e.printStackTrace(log);
                } catch ( com.sun.star.lang.WrappedTargetException e ) {
View Full Code Here

Examples of com.sun.star.container.XNameContainer

        return curControlData;
    }


    public XNameContainer getDocumentForms() {
        XNameContainer xNamedForms = xFormsSupplier.getForms();
        return xNamedForms;
    }
View Full Code Here

Examples of com.sun.star.container.XNameContainer

        return insertFormbyName(_FormName, getDocumentForms());
    }


    public XNameContainer getFormByName(String _sname){
    XNameContainer xNamedForm = null;
    try {
        if (xNamedForms.hasByName(_sname)) {
            Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname));
            xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
        }
View Full Code Here

Examples of com.sun.star.container.XNameContainer

            UnoRuntime.queryInterface (XIndexAccess.class, oSheets);
        XSpreadsheet oSheet = null;
        try {
            oSheet = (XSpreadsheet) AnyConverter.toObject(
                    new Type(XSpreadsheet.class),oIndSheets.getByIndex(0));
            XNameContainer oRanges = (XNameContainer)
                UnoRuntime.queryInterface(XNameContainer.class, oObj);

            oRange = oSheet.getCellRangeByName("C1:D4");
            oRanges.insertByName("Range1", oRange);
            oRange = oSheet.getCellRangeByName("E2:F5");
            oRanges.insertByName("Range2", oRange);
            oRange = oSheet.getCellRangeByName("G2:H3");
            oRanges.insertByName("Range3", oRange);
            oRange = oSheet.getCellRangeByName("I7:J8");
            oRanges.insertByName("Range4", oRange);
        } catch(com.sun.star.lang.WrappedTargetException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't create test object", e);
        } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
            e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.container.XNameContainer

        XInterface oInstance = (XInterface)
            SOF.createInstance(xComp,"com.sun.star.style.CellStyle");

        // insert a Style which can be replaced by name
        XNameContainer oContainer = (XNameContainer)
            UnoRuntime.queryInterface(
                XNameContainer.class, oStyleFamilyNameAccess);
        try {
            oContainer.insertByName("ScStyleFamilyObj", oInstance);
        } catch (com.sun.star.lang.WrappedTargetException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't insert new style family", e);
        } catch (com.sun.star.container.ElementExistException e) {
            e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.container.XNameContainer

            if (oDrawPage == null)
                log.println("ERROR: could not get DrawPage: null");
           
            oDrawPage.add(aShape);
            log.println("getting XForm");
            XNameContainer xForm = FormTools.getForms(oDrawPage);
            try {
                myForm = (XForm) AnyConverter.toObject(new Type(XForm.class),xForm.getByName("Standard"));
            } catch (WrappedTargetException ex) {
                log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
            } catch (com.sun.star.lang.IllegalArgumentException ex) {
                log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
            } catch (NoSuchElementException ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.