Package com.sun.star.beans

Examples of com.sun.star.beans.PropertyValue


        if (oldValue.equals(BT6)) newValue = BT6;
        if (oldValue.equals(BT6)) newValue = BT7;
        if (oldValue.equals(BT7)) newValue = BT1;
   } else
    if (oldValue instanceof PropertyValue){
        PropertyValue newVal = new PropertyValue();
        newVal.Name = ((PropertyValue)oldValue).Name;
        newVal.Value = changePValue(((PropertyValue)oldValue).Value);
        newValue = newVal;
    } else  
   if (oldValue instanceof com.sun.star.sheet.ValidationAlertStyle){
        com.sun.star.sheet.ValidationAlertStyle VAS1 = com.sun.star.sheet.ValidationAlertStyle.INFO;
        com.sun.star.sheet.ValidationAlertStyle VAS2 = com.sun.star.sheet.ValidationAlertStyle.MACRO;
        com.sun.star.sheet.ValidationAlertStyle VAS3 = com.sun.star.sheet.ValidationAlertStyle.STOP;
        com.sun.star.sheet.ValidationAlertStyle VAS4 = com.sun.star.sheet.ValidationAlertStyle.WARNING;

        if (oldValue.equals(VAS1)) newValue = VAS2;
        if (oldValue.equals(VAS2)) newValue = VAS3;
        if (oldValue.equals(VAS3)) newValue = VAS4;
        if (oldValue.equals(VAS4)) newValue = VAS1;

   } else
    if (oldValue instanceof com.sun.star.sheet.ValidationType){
        com.sun.star.sheet.ValidationType VT1 = com.sun.star.sheet.ValidationType.ANY;
        com.sun.star.sheet.ValidationType VT2 = com.sun.star.sheet.ValidationType.CUSTOM;
        com.sun.star.sheet.ValidationType VT3 = com.sun.star.sheet.ValidationType.DATE;
        com.sun.star.sheet.ValidationType VT4 = com.sun.star.sheet.ValidationType.DECIMAL;
        com.sun.star.sheet.ValidationType VT5 = com.sun.star.sheet.ValidationType.LIST;
        com.sun.star.sheet.ValidationType VT6 = com.sun.star.sheet.ValidationType.TEXT_LEN;
        com.sun.star.sheet.ValidationType VT7 = com.sun.star.sheet.ValidationType.TIME;
        com.sun.star.sheet.ValidationType VT8 = com.sun.star.sheet.ValidationType.WHOLE;

        if (oldValue.equals(VT1)) newValue = VT2;
        if (oldValue.equals(VT2)) newValue = VT3;
        if (oldValue.equals(VT3)) newValue = VT4;
        if (oldValue.equals(VT4)) newValue = VT5;
        if (oldValue.equals(VT5)) newValue = VT6;
        if (oldValue.equals(VT6)) newValue = VT7;
        if (oldValue.equals(VT7)) newValue = VT8;
        if (oldValue.equals(VT8)) newValue = VT1;

    } else
    if (oldValue instanceof com.sun.star.text.WritingMode){
        if (oldValue.equals(com.sun.star.text.WritingMode.LR_TB)) {
            newValue = com.sun.star.text.WritingMode.TB_RL;
        } else {
            newValue = com.sun.star.text.WritingMode.LR_TB;
        }
    } else
    if (oldValue instanceof com.sun.star.uno.Enum) {
        // universal changer for Enumerations
        try {
            Class enumClass = oldValue.getClass() ;
            Field[] flds = enumClass.getFields() ;

            newValue = null ;

            for (int i = 0; i < flds.length; i++) {
                if (Enum.class.equals(flds[i].getType().getSuperclass())) {

                    Enum value = (Enum) flds[i].get(null) ;
                    if (newValue == null && !value.equals(oldValue)) {
                        newValue = value ;
                        break ;
                    }
                }
            }
        } catch (Exception e) {
            System.err.println("Exception occured while changing Enumeration value:") ;
            e.printStackTrace(System.err) ;
        }
        if (newValue == null) newValue = oldValue ;

    } else
    if (oldValue instanceof com.sun.star.style.TabStop[]){
        com.sun.star.style.TabStop[] _newValue = (com.sun.star.style.TabStop[]) oldValue;
        if (_newValue.length == 0) {
            _newValue = new com.sun.star.style.TabStop[1];
        }
        com.sun.star.style.TabStop sep = new com.sun.star.style.TabStop();
        sep.Position += 1;
        _newValue[0] = sep;
        newValue = _newValue;
    } else
    if (oldValue instanceof short[]){
        short[] oldArr = (short[])oldValue;
        int len = oldArr.length;
        short[] newArr = new short[len + 1];
        for (int i = 0; i < len; i++) {
            newArr[i] = (short)(oldArr[i] + 1);
        }
        newArr[len] = 5;
        newValue = newArr;
    } else
    if (oldValue instanceof String[]){
        String[] oldArr = (String[])oldValue;
        int len = oldArr.length;
        String[] newArr = new String[len + 1];
        for (int i = 0; i < len; i++) {
            newArr[i] = "_" + oldArr[i];
        }
        newArr[len] = "_dummy";
        newValue = newArr;
    } else
    if (oldValue instanceof PropertyValue){
        PropertyValue newVal = new PropertyValue();
        newVal.Name = ((PropertyValue)oldValue).Name;
        newVal.Value = changePValue(((PropertyValue)oldValue).Value);
        newValue = newVal;
    } else
    if (oldValue instanceof com.sun.star.util.DateTime) {
View Full Code Here


    public static PropertyValue[] createMediaDescriptor(String[] propNames, Object[] values) {
        PropertyValue[] props = new PropertyValue[propNames.length] ;

        for (int i = 0; i < props.length; i++) {
            props[i] = new PropertyValue() ;
            props[i].Name = propNames[i] ;
            if (values != null && i < values.length) {
                props[i].Value = values[i] ;
            }
        }
View Full Code Here

    }

    public void run() {
  try {
            PropertyValue[] args = new PropertyValue[1];
            args[0] = new PropertyValue();
            args[0].Name = "InteractionHandler";
            args[0].Value = myMSF.createInstance(
                "com.sun.star.comp.uui.UUIInteractionHandler");

      String testUrl= utils.getFullTestURL(url);
View Full Code Here

    public PropertyValue[] getPropertyValues() {
        PropertyValue[] pVal = null;
        java.net.URL url = this.getClass().getResource("/objdsc");
        if (url == null) {
           pVal = new PropertyValue[1];
           pVal[0] = new PropertyValue();
           pVal[0].Name = "Error";
           pVal[0].Value = "OOoRunner.jar file doesn't contain object " +
                           "descriptions: don't know what to test.";
           return pVal;
        }

        Vector v = new Vector(600);
        try {
            // open connection to  Jar
            java.net.JarURLConnection con =
                                (java.net.JarURLConnection)url.openConnection();
            // get Jar file from connection
            java.util.jar.JarFile f = con.getJarFile();
            // Enumerate over all entries
            java.util.Enumeration aEnum = f.entries();

            while (aEnum.hasMoreElements()) {
                String entry = aEnum.nextElement().toString();
                if (entry.endsWith(".csv")) {

                    String module = null;
                    String object = null;
                   
                    int startIndex = entry.indexOf("objdsc/") + 7;
                    int endIndex = entry.lastIndexOf('/');
/*                    int endIndex = entry.indexOf('.');
                    module = entry.substring(startIndex, endIndex);
                    startIndex = 0;
                    endIndex = module.lastIndexOf('/'); */
                    module = entry.substring(startIndex, endIndex);
                   
                    // special cases
                    if (entry.indexOf("/file/") != -1 || entry.indexOf("/xmloff/") != -1) {
                        endIndex = entry.indexOf(".csv");
                        object = entry.substring(0, endIndex);
                        endIndex = object.lastIndexOf('.');
                        startIndex = object.indexOf('.');
                        while (startIndex != endIndex) {
                            object = object.substring(startIndex+1);
                            startIndex = object.indexOf('.');
                            endIndex = object.lastIndexOf('.');
                        }
                    }
/*                    else if (entry.indexOf("/xmloff/") != -1) {
                        endIndex = entry.indexOf(".csv");
                        object = entry.substring(0, endIndex);
                        endIndex = entry.lastIndexOf('.');
                        while (object.indexOf('.') != endIndex) {
                            object = object.substring(object.indexOf('.')+1);
                        }
                    } */
                    else {
                        startIndex = 0;
                        endIndex = entry.indexOf(".csv");
                        object = entry.substring(startIndex, endIndex);
                        startIndex = object.lastIndexOf('.');
                        object = object.substring(startIndex+1);
                    }
                    v.add(module+"."+object);
                }
            }
        }
        catch(java.io.IOException e) {
           e.printStackTrace();
        }

        int size = v.size();
       
        String[] sTestCases = new String[size];
        v.toArray(sTestCases);
        java.util.Arrays.sort(sTestCases);

        pVal = new PropertyValue[size];
        for (int i=0; i<size; i++) {
            pVal[i] = new PropertyValue();
            pVal[i].Name = "TestCase"+i;
            pVal[i].Value = sTestCases[i];
        }
        return pVal;
   }
View Full Code Here

            Object oldInfo = oObj.getPropertyValue("Info") ;

            testProperty("Info", new PropertyTester() {
                protected Object getNewValue(String propName, Object oldValue) {

                    PropertyValue propUsr = new PropertyValue(),
                                  propPass = new PropertyValue() ;

                    propUsr.Name = "user" ;
                    propUsr.Value = "API_QA_Tester" ;
                    propPass.Name = "password" ;
                    propPass.Value = "guest" ;
View Full Code Here

            result = mxMenuBarSettings != null;
            for (int i=0; i<mxMenuBarSettings.getCount(); i++) {
                Object[] o = (Object[])mxMenuBarSettings.getByIndex(i);
                log.println("+++++++++ i = " + i);
                for (int j=0; j<o.length; j++) {
                    PropertyValue prop = (PropertyValue)o[j];
                    log.println("Property" + j + ": " + prop.Name + "   " + prop.Value.toString());
                }
            }
        }
        catch(com.sun.star.container.NoSuchElementException e) {
View Full Code Here

     * @param xMenuBarSettings The existing menu bar settings, used for creating the new entry.
     * @return An array of properties of the new entry.
     */
    public static PropertyValue[] createMenuBarEntry(String sLabelName, XIndexAccess xMenuBarSettings, XMultiServiceFactory xMSF, PrintWriter log) {
        PropertyValue[] prop = new PropertyValue[4];
        prop[0] = new PropertyValue();
        prop[0].Name = "CommandURL";
        prop[0].Value = "vnd.openoffice.org:MyMenu";
        prop[1] = new PropertyValue();
        prop[1].Name = "Label";
        prop[1].Value = sLabelName;
        prop[2] = new PropertyValue();
        prop[2].Name = "Type";
        prop[2].Value = new Short((short)0);
        prop[3] = new PropertyValue();
        prop[3].Name = "ItemDescriptorContainer";
       
        XSingleComponentFactory xFactory = (XSingleComponentFactory)UnoRuntime.queryInterface(
                                XSingleComponentFactory.class, xMenuBarSettings);
        try {
View Full Code Here

        String filterName = filterNames[0];
        Object[] instance = null;;
        for (int i = 0; i < filterNames.length; i++) {
            log.println("------------------------------------------------");
            try{
                PropertyValue instanceProp = new PropertyValue();
                filterName = filterNames[i];
                log.println(filterName);
               
                // testobject must new created for every test.
                // We change in a loop the container and try to flush this changes.
View Full Code Here

     * <code>lib.TestParameters</code>
     */
    public static boolean setHTTPProxy(TestParameters param){
        XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF();
        PropertyValue[] ProvArgs = new PropertyValue[1];
        PropertyValue Arg = new PropertyValue();
        Arg.Name = "nodepath";
        Arg.Value = "/org.openoffice.Inet/Settings";
        ProvArgs[0] = Arg;

        try {
View Full Code Here

                UnoRuntime.queryInterface( XComponentLoader.class,
                                           xmulticomponentfactory.createInstanceWithContext(
                                               "com.sun.star.frame.Desktop", xcomponentcontext ) );
           
            // Preparing properties for loading the document
            PropertyValue propertyvalue[] = new PropertyValue[ 1 ];
            // Setting the flag for hidding the open document
            propertyvalue[ 0 ] = new PropertyValue();
            propertyvalue[ 0 ].Name = "Hidden";
            propertyvalue[ 0 ].Value = new Boolean(true);
           
            // Loading the wanted document
            Object objectDocumentToStore =
                xcomponentloader.loadComponentFromURL(
                    stringUrl, "_blank", 0, propertyvalue );
           
            // Getting an object that will offer a simple way to store a document to a URL.
            XStorable xstorable =
                ( XStorable ) UnoRuntime.queryInterface( XStorable.class,
                                                         objectDocumentToStore );
     
            // Preparing properties for converting the document
            propertyvalue = new PropertyValue[ 2 ];
            // Setting the flag for overwriting
            propertyvalue[ 0 ] = new PropertyValue();
            propertyvalue[ 0 ].Name = "Overwrite";
            propertyvalue[ 0 ].Value = new Boolean(true);
            // Setting the filter name
            propertyvalue[ 1 ] = new PropertyValue();
            propertyvalue[ 1 ].Name = "FilterName";
            propertyvalue[ 1 ].Value = stringConvertType;
           
            // Appending the favoured extension to the origin document name
            int index = stringUrl.lastIndexOf('.');
View Full Code Here

TOP

Related Classes of com.sun.star.beans.PropertyValue

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.