Package com.sun.star.uno

Examples of com.sun.star.uno.Any


        XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
        XInterface oObj = null;
        final String exportStr = "XMLExporter test." ;

        FilterChecker filter = new FilterChecker(log);
        Any arg = new Any(new Type(XDocumentHandler.class),filter);

        try {
            oObj = (XInterface) xMSF.createInstanceWithArguments(
                "com.sun.star.comp.Chart.XMLExporter", new Object[] {arg});
            XExporter xEx = (XExporter)
View Full Code Here


                        .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{
View Full Code Here

                {
                    result = editor.execute();

                    if (result == null)
                    {
                        return new Any(new Type(), null);
                    }
                    return result;
                }

                metaData.loadSource()
                source = metaData.getSource();

                if ( source == null || source.length() == 0 )
                {
                  throw new ScriptFrameworkErrorException(
                        "Failed to read script", null,
                      metaData.getLanguageName(), metaData.getLanguage(),
                      ScriptFrameworkErrorType.NO_SUCH_SCRIPT );
                }
                result = interpreter.eval( source );

                if (result == null)
                {
                    return new Any(new Type(), null);
                }
                return result;
            }
            catch ( bsh.ParseException pe )
            {
View Full Code Here

    Object result = null;

    Object face = UnoRuntime.queryInterface(zInterface, _object);
    // the hell knows why, but empty interfaces a given back as void anys
    if(face != null)
      result = new Any(type, face);
    return result;
  }
View Full Code Here

        // Initialise the out paramters - not used but prevents error in
        // UNO bridge
        aOutParamIndex[0] = new short[0];
        aOutParam[0] = new Object[0];

        Any result = new Any(new Type(Boolean.class), Boolean.TRUE);

        if (aFunctionName.equals("Editable"))
        {
            if (!editable)
            {
                NoSupportException nse = new NoSupportException(
                    aFunctionName + " is not editable " );

                throw new InvocationTargetException(
                    "Scripting framework error editing script", null, nse );
            }

            XScriptContext ctxt =  provider.getScriptingContext();
            ScriptMetaData data = null;
            try
            {
                data = (ScriptMetaData)parent.getByName( name );
            }
            catch ( NoSuchElementException nse )
            {
                throw new com.sun.star.lang.IllegalArgumentException(
                    name + " does not exist or can't be found " );
            }
            catch com.sun.star.lang.WrappedTargetException wte )
            {
                // rethrow
                throw new InvocationTargetException(
                    "Scripting framework editing script ",
                        null, wte.TargetException );
            }

            provider.getScriptEditor().edit(ctxt, data);
        }
        else if (aFunctionName.equals("Deletable"))
        {
            if (!deletable)
            {
                NoSupportException nse = new NoSupportException(
                    aFunctionName + " is not supported for this node" );

                throw new InvocationTargetException(
                      "Scripting framework error deleting script", null, nse );
            }
            try
            {
                parent.removeByName( name );
                result = new Any(new Type(Boolean.class), Boolean.TRUE);
            }
            catch ( NoSuchElementException nse )
            {
                throw new com.sun.star.lang.IllegalArgumentException(
                    name + " does not exist or can't be found " );
            }
            catch ( WrappedTargetException wte )
            {
                // rethrow
                throw new InvocationTargetException(
                    "Scripting framework deleting script ",
                        null, wte.TargetException );
            }

        }
        else if (aFunctionName.equals("Renamable"))
        {
            result = new Any(new Type(XBrowseNode.class), new XBrowseNode[0]);
            if (!renamable)
            {
                NoSupportException nse = new NoSupportException(
                    aFunctionName + " is not supported for this node" );

                throw new InvocationTargetException(
                    "Scripting framework error renaming script", null, nse );
            }

            try
            {
                String newName = (String) AnyConverter.toString(aParams[0]);
                ScriptMetaData oldData = (ScriptMetaData)parent.getByName( name );
                oldData.loadSource();
                String oldSource = oldData.getSource();

                LogUtils.DEBUG("Create renamed script");
                String languageName =
                    newName + "." + provider.getScriptEditor().getExtension();
                String language = provider.getName();

                ScriptEntry entry = new ScriptEntry(
                    language, languageName, languageName, "", new HashMap() );

                ScriptMetaData data = new ScriptMetaData(
                    parent, entry, oldSource );

                parent.insertByName( languageName, data );

                LogUtils.DEBUG("Now remove old script");
                parent.removeByName( name );

                uri = data.getShortFormScriptURL();
                name = languageName;
                result = new Any(new Type(XBrowseNode.class), this);
            }
            catch ( NoSuchElementException nse )
            {
                throw new com.sun.star.lang.IllegalArgumentException(
                    name + " does not exist or can't be found " );
View Full Code Here

        // Initialise the out paramters - not used but prevents error in
        // UNO bridge
        aOutParamIndex[0] = new short[0];
        aOutParam[0] = new Object[0];

        Any result = new Any(new Type(Boolean.class), Boolean.TRUE);

        if (aFunctionName.equals("Creatable"))
        {
            try
            {
                String name;

                if (aParams == null || aParams.length < 1 ||
                    AnyConverter.isString(aParams[0]) == false)
                {
                    String prompt = "Enter name for new Parcel";
                    String title = "Create Parcel";
                                                                               
                    // try to get a DialogFactory instance, if it fails
                    // just use a Swing JOptionPane to prompt for the name
                    try
                    {
                        DialogFactory dialogFactory =
                            DialogFactory.getDialogFactory();
                                                                               
                        name = dialogFactory.showInputDialog(title, prompt);
                    }
                    catch (Exception e)
                    {
                        name = JOptionPane.showInputDialog(null, prompt, title,
                            JOptionPane.QUESTION_MESSAGE);
                    }
                }
                else {
                    name = (String) AnyConverter.toString(aParams[0]);
                }

                if (name == null || name.equals(""))
                {
                    result =  new Any(new Type(Boolean.class), Boolean.FALSE);
                }
                else
                {
                   
                    Object newParcel  = container.createParcel( name );
                    LogUtils.DEBUG("Parcel created " + name + " " + newParcel );
                    if ( newParcel == null )
                    {
                        result =  new Any(new Type(Boolean.class), Boolean.FALSE);
                    }
                    else
                    {
                        ParcelBrowseNode parcel = new ParcelBrowseNode( provider, container, name );
                        LogUtils.DEBUG("created parcel node ");
                        if ( browsenodes == null )
                        {
                            browsenodes = new ArrayList( 5 );
                        }
                       
                        browsenodes.add(parcel);
                      
                                                                               
                        result = new Any(new Type(XBrowseNode.class), parcel);
                    }
                }
            }
            catch (Exception e)
            {
    LogUtils.DEBUG("ProviderBrowseNode[create] failed with: " + e );
                LogUtils.DEBUG( LogUtils.getTrace( e ) );
                result = new Any(new Type(Boolean.class), Boolean.FALSE);

                // throw new com.sun.star.reflection.InvocationTargetException(
                //     "Error creating script: " + e.getMessage());
            }
        }
View Full Code Here

        // Initialise the out paramters - not used but prevents error in
        // UNO bridge
        aOutParamIndex[0] = new short[0];
        aOutParam[0] = new Object[0];

        Any result = new Any(new Type(Boolean.class), Boolean.TRUE);

        if (aFunctionName.equals("Creatable"))
        {
            try
            {
                String newName;

                if (aParams == null || aParams.length < 1 ||
                    AnyConverter.isString(aParams[0]) == false)
                {
                    String prompt = "Enter name for new Script";
                    String title = "Create Script";
                                                                               
                    // try to get a DialogFactory instance, if it fails
                    // just use a Swing JOptionPane to prompt for the name
                    try
                    {
                        DialogFactory dialogFactory =
                            DialogFactory.getDialogFactory();
                                                                               
                        newName = dialogFactory.showInputDialog(title, prompt);
                    }
                    catch (Exception e)
                    {
                        newName = JOptionPane.showInputDialog(null, prompt, title,
                            JOptionPane.QUESTION_MESSAGE);
                    }
                }
                else {
                    newName = (String) AnyConverter.toString(aParams[0]);
                }

                if ( newName == null || newName.equals(""))
                {
                    result =  new Any(new Type(Boolean.class), Boolean.FALSE);
                }
                else
                {
                    String source = new String(provider.getScriptEditor().getTemplate().getBytes());
                    String languageName = newName + "." + provider.getScriptEditor().getExtension();
                    String language = container.getLanguage();

                    ScriptEntry entry = new ScriptEntry( language, languageName, languageName, "", new HashMap() );

                    Parcel parcel = (Parcel)container.getByName( getName() );
                    ScriptMetaData data = new ScriptMetaData( parcel, entry, source );
                    parcel.insertByName( languageName, data );

                    ScriptBrowseNode sbn = new ScriptBrowseNode( provider, parcel, languageName );

          if(browsenodes==null)
          {
              LogUtils.DEBUG("browsenodes null!!");
              browsenodes = new ArrayList(4);
          }
                    browsenodes.add(sbn);
                                                                               
                    result = new Any(new Type(XBrowseNode.class), sbn);
                }
            }
            catch (Exception e)
            {
    LogUtils.DEBUG("ParcelBrowseNode[create] failed with: " + e );
                LogUtils.DEBUG( LogUtils.getTrace( e ) );
                result = new Any(new Type(Boolean.class), Boolean.FALSE);

                // throw new com.sun.star.reflection.InvocationTargetException(
                //     "Error creating script: " + e.getMessage());
            }
        }
        else if (aFunctionName.equals("Deletable"))
        {
            try
            {
                if ( container.deleteParcel(getName()) )
                {
                    result = new Any(new Type(Boolean.class), Boolean.TRUE);
                }
                else
                {
                    result = new Any(new Type(Boolean.class), Boolean.FALSE);
                }
            }
            catch (Exception e)
            {
                result =  new Any(new Type(Boolean.class), Boolean.FALSE);
                                                                               
                // throw new com.sun.star.reflection.InvocationTargetException(
                //     "Error deleting parcel: " + e.getMessage());
            }
        }
        else if (aFunctionName.equals("Renamable"))
        {
            String newName = null;
            try
            {

                if (aParams == null || aParams.length < 1 ||
                    AnyConverter.isString(aParams[0]) == false)
                {
                    String prompt = "Enter new name for Library";
                    String title = "Rename Library";
                                                                               
                    // try to get a DialogFactory instance, if it fails
                    // just use a Swing JOptionPane to prompt for the name
                    try
                    {
                        DialogFactory dialogFactory =
                            DialogFactory.getDialogFactory();
                                                                               
                        newName = dialogFactory.showInputDialog(title, prompt);
                    }
                    catch (Exception e)
                    {
                        newName = JOptionPane.showInputDialog(null, prompt, title,
                            JOptionPane.QUESTION_MESSAGE);
                    }
                }
                else {
                    newName = (String) AnyConverter.toString(aParams[0]);
                }
                container.renameParcel( getName(), newName );
                Parcel p = (Parcel)container.getByName( newName );
                if(browsenodes == null )
                {
                    getChildNodes();
                }
                ScriptBrowseNode[] childNodes = (ScriptBrowseNode[])browsenodes.toArray(new ScriptBrowseNode[0]);

                for ( int index = 0; index < childNodes.length; index++ )
                {
                    childNodes[ index ].updateURI( p );
                }
                result = new Any(new Type(XBrowseNode.class), this);
            }
            catch (Exception e)
            {
                result =  new Any(new Type(Boolean.class), Boolean.FALSE);

                // throw new com.sun.star.reflection.InvocationTargetException(
                //     "Error renaming parcel: " + e.getMessage());
            }
        }
View Full Code Here

            XIndexAccess params = req.Parameters;
            int count = params.getCount();
            try {
                for(int i=0; i<count; i++) {
                    Object aObject = params.getByIndex(i);
                    Any any = (Any)aObject;
                    log.println("### _XCompletedExecution.InteractionHandlerImpl: Parameter "+i+": "+params.getByIndex(i));
                    XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
                    log.println("### _XCompletedExecution.InteractionHandlerImpl: Parameter Name: '"+xProp.getPropertyValue("Name") + "' is set to Value '1'");
                    xProp.setPropertyValue("Value", new Integer(1));
                    handlerWasUsed = true;
View Full Code Here

                    }
                    else
                    {
                        formulaToken = new FormulaToken();
                        formulaToken.OpCode = opCodePush.Token.OpCode;
                        formulaToken.Data = new Any(Type.STRING, token.image);
                    }

                    tokens.add(formulaToken);
                    token = tokenParser.getNextToken();
                }
                if ( brackets > 0 )
                {
                    final FormulaOpCodeMapEntry opCode = (FormulaOpCodeMapEntry) parserNames.get(")");
                    while ( brackets-- != 0 )
                    {
                        formula = formula.concat(")");
                        images.add(")");
                        tokens.add(opCode.Token);
                    }

                }

                parser.parse(formula);
            } catch ( ParseException ex )
            {
                boolean found = false;
                // error occured so all token must be bad
                for (int i = 0; i < tokens.size(); i++)
                {
                    if ( !found && ex.currentToken != null && images.get(i).equals(ex.currentToken.image) )
                        found = true;
                    if ( found )
                    {
                        final FormulaToken dest = new FormulaToken();
                        dest.OpCode = ((FormulaOpCodeMapEntry) specialOpCodes.get(FormulaMapGroupSpecialOffset.BAD)).Token.OpCode;
                        dest.Data = new Any(Type.STRING, images.get(i));
                        tokens.remove(i);
                        tokens.add(i, dest);
                    }
                }
            } catch ( java.lang.Exception e )
View Full Code Here

        aOutParamIndex[0][0] = nInParamCount;
        aOutParam[0] = new Object[1];
        aOutParam[0][0] = aScoreArray;
      }

      Any aRetAny = new Any( new Type( String[].class ), aRet );
      return aRetAny;
    }
View Full Code Here

TOP

Related Classes of com.sun.star.uno.Any

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.