OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Problem with invocation of Java Addin method from Calc
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Ted
Newbie
Newbie


Joined: 01 Oct 2004
Posts: 1

PostPosted: Fri Oct 01, 2004 3:22 am    Post subject: Problem with invocation of Java Addin method from Calc Reply with quote

I have succesfuly built Calc Add-In using Java. The function i have added shows up properly in the AutoPilot Functions dialog.

The problem is that the function return nothing ;( When i use it as Formula, i have this: #VALUE! in cell.

When i use it in a Basic Macros, i got an error message:
Code:
oFunc = CreateUnoService("com.sun.star.sheet.addin.MyAddin")
MsgBox oFunc.dbg_methods  REM [color=green]works OK[/color]
MsgBox oFunc.getMyFunction() REM [color=red]ERROR ![/color]


Error is :
Code:
Runtime error BASIC
Exception
Type: Unknown
Message: illegal object given!


For info, my IDL looks like this:
Code:
interface XMyAddin : com::sun::star::uno::XInterface
{
     string getMyFunction() (
                 [in] com::sun::star::beans::XPropertySet xOptions
     );
};

service MyAddin
{
     interface XMyAddin;
};


My implementation of XMyAddin is declared like this:
Code:
MyAddin extends WeakBase implements
                                            XMyAddin,
                                            XAddIn,
                                            XServiceName,
                                            XServiceInfo


Where is the problem? I wonder if "MyAddin.java" should implements the interface "::com::sun::star::script:: .XInvocation".

If it can help, i've used this commands to build my project (not in oOo dir):
Code:

idlc -C -I C:\OpenOffice.org1.1_SDK\idl MyAddin.idl

regmerge MyAddin.rdb /UCR XMyAddin.urd

javamaker -nD -Tcom.sun.star.sheet.addin.XMyAddin -BUCR MyAddin.rdb file:///C:/Program%20Files/OpenOffice.org1.1.2/program/types.rdb

javac -g com\sun\star\sheet\addin\*.java

jar cvfm MyAddin.jar MANIFEST com\sun\star\sheet\addin\*.class

**Zip of MyAddin.jar and MyAddin.rdb files in MyAddin.zip **

pkgchk MyAddin.zip


If someone has managed to build a Calc Addin in Java, i would really appreciate a complete example with source. It's getting on my nerves.
Back to top
View user's profile Send private message Send e-mail
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Oct 01, 2004 5:37 am    Post subject: Reply with quote

I have recently managed to build Calc add in's in Java.
http://www.oooforum.org/forum/viewtopic.php?t=12589
http://www.oooforum.org/forum/viewtopic.php?t=12537
I have not yet posted source code. If necessary, I can send you some. I am using NetBeans.org version 3.6.

One thing I see wrong in what you describe.

Code:
     string getMyFunction() (
                 [in] com::sun::star::beans::XPropertySet xOptions
     );

Note two sets of parenthesis. One empty set right after getMyFunction. Another set, containing the xOptions parameter.

Quote:
I wonder if "MyAddin.java" should implements the interface "::com::sun::star::script:: .XInvocation".

I didn't.

Quote:
i've used this commands to build my project

I use a batch file
DoAllIDLs.bat
Code:
call SetupOOo.bat
cd %SDKTools%
call DoIDL.bat name.DannyBrewer.misc.XCommand
call DoIdl.bat name.DannyBrewer.test.DannysCalcFunctions1



In this next one, please note how I give the "real" pathname as a comment, and then use the ugly nasty 8.3 pathname as the actual pathname in order to accomodate deficiencies in the SDK command line tools.
SetupOOo.bat
Code:
@ECHO OFF

rem set SDKTools=C:\Danny\Danny's Java NetBeans\Projects\OOo DannysCalcFunctions1\SDKTools
SET SDKTools=C:\Danny\Danny'~4\Projects\OOoDan~1\SDKTools


rem SET OFFICE_HOME=C:\Program Files\OpenOffice.org1.1.3
SET OFFICE_HOME=C:\Progra~1\OpenOffice.org1.1.3

rem SET OO_SDK_HOME=C:\Danny\Docs\OpenOffice Docs\OpenOffice API\OOo_1.1rc4_Win32Intel_sdk\OpenOffice.org1.1_SDK
SET OO_SDK_HOME=C:\Danny\Docs\OpenOf~1\OpenOf~1\OOo_1.1rc4_Win32Intel_sdk\OpenOffice.org1.1_SDK

rem SET OO_SDK_JAVA_HOME=C:\Program Files\Java\j2sdk1.4.2_04
SET OO_SDK_JAVA_HOME=C:\Progra~1\Java\j2sdk1.4.2_04

REM SET OO_SDK_CPP_HOME=

SET OO_SDK_MAKE_HOME=C:\Danny\downloads\UnixTools\GnuMake-2003-02\make
SET SDK_AUTO_DEPLOYMENT=YES


SET OFFICE_PROGRAM_PATH=%OFFICE_HOME%\program

SET PATH=%OO_SDK_HOME%\windows\bin;%PATH%
SET PATH=%OO_SDK_MAKE_HOME%;%PATH%
REM PATH=%OO_SDK_CPP_HOME%;%PATH%
SET PATH=%OO_SDK_JAVA_HOME%\bin;%PATH%
SET PATH=%OO_SDK_JAVA_HOME%\jre\bin;%PATH%
SET PATH=%OFFICE_PROGRAM_PATH%;%PATH%

SET LIB=%OO_SDK_HOME%\windows\lib;%LIB%

DoIDL.bat
Code:
@ECHO OFF

rem idlc.exe -I%OO_SDK_HOME%\idl %1 %2 %3 %4

SET name=%1

SET TEMP=C:\TEMP
SET TMP=C:\TEMP

idlc -C -I%OO_SDK_HOME%\idl %name%.idl

regmerge %name%.rdb /UCR %name%.urd

javamaker -BUCR %name%.rdb %OFFICE_PROGRAM_PATH%\types.rdb
rem cppumaker -BUCR %name%.rdb %OFFICE_PROGRAM_PATH%\types.rdb


I use two IDL files....
name.DannyBrewer.misc.XCommand.idl
Code:
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/beans/PropertyValue.idl>

module name {
   module DannyBrewer {
      module misc {
         interface XCommand : com::sun::star::uno::XInterface
         {
            any doCommand(
               [in] string cCommand,
               [in] sequence< com::sun::star::beans::PropertyValue > aParams
            );
         };
         
      };
   };
};


name.DannyBrewer.test.DannysCalcFunctions1.idl
Code:
/* Provides lifetime control by reference counting and the possibility of
    querying for other interfaces of the same logical object.
 */
#include <com/sun/star/uno/XInterface.idl>

/* Provides information about and access to the properties from an
    implementation.
 */
#include <com/sun/star/beans/XPropertySet.idl>

#include <com/sun/star/sheet/AddIn.idl>


module name {
  module DannyBrewer {
    module test {
        /** Interface with your additional methods.
       
          You may declare several methods. Each method may have
          any number of arguments after xOptions.
          Furthermore, you could replace the name of the service and
          the interface, but only if you want to replace this name in all
          your project files. This example will work with the default
          names.
          All interfaces specified in UNOIDL must be derived from
          com.sun.star.uno.XInterface .
          Interface names should start with an X prefix.
        */
        interface XDannysCalcFunctions1 : com::sun::star::uno::XInterface
        {
            long addFive(
                [in] long intDummy
            );
           
            long addSix(
                [in] long intDummy
            );
           
            sequence< sequence< any > >
            matMultiply(
                [in] sequence< sequence< double > > mat1,
                [in] sequence< sequence< double > > mat2,
                [in] com::sun::star::beans::XPropertySet oSpreadsheetDocument
            );
           
            sequence< sequence< any > >
            arrayOfRows(
                [in] sequence< any > aArgs
            );
           
            sequence< sequence< any > >
            arrayOfColumns(
                [in] sequence< any > aArgs
            );
           
            sequence< sequence< any > >
            array2DRowMajor(
                [in] long numColumns,
                [in] sequence< any > aArgs
            );
           
            sequence< sequence< any > >
            array2DColumnMajor(
                [in] long numRows,
                [in] sequence< any > aArgs
            );
        };

        service DannysCalcFunctions1
        {
            /** Exported interfaces:
                This is where you put all interfaces that this service exports. The service
                supports its main interface only.
             */
            interface XDannysCalcFunctions1;
        };
      
    };
  };
};


If this doesn't help enough, I'll give you a complete example, hopefully tomorrow when I (hopefully) have all day to play.

As you can see, the arrayOfRows, and matMultiply, and addFive, etc. functions are described over in the "Seeking Ideas..." thread I linked earlier.
_________________
Want to make OOo Drawings like the colored flower design to the left?


Last edited by DannyB on Fri Oct 01, 2004 6:53 am; edited 1 time in total
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Oct 01, 2004 5:53 am    Post subject: Reply with quote

Just for your amusement, here is additional source code to the above example. No elaboration or explanation provided.

I use the XCommand interface for debugging. So don't pay too much attention to that one. The purpose of XCommand is so that from Basic, I can do stuff like...

Code:
oObj = createUnoService( "name.DannyBrewer.test.DannysCalcFunctions1" )
oObj.doCommand( "SomePrivateCommand", _
   Array(_
      MakePropertyValue( "Param1", 1234 ),_
      MakePropertyValue( "DooDah", True ),_
      MakePropertyValue( "FooBar", "MeowMix" ) ) )

To have a private way to communicate with my components whether they are written in Java or Python.


There is more source code than this. (All the Prime Number junk I talked about in the other thread.) But I think the following is most relevant.


name.DannyBrewer.misc.XCommand.java
Generated from IDL...
Code:
package name.DannyBrewer.misc;

public interface XCommand extends com.sun.star.uno.XInterface
{
    // Methods
    public java.lang.Object doCommand( /*IN*/String cCommand, /*IN*/com.sun.star.beans.PropertyValue[] aParams );

    // static Member
    public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = {
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "doCommand", 0, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY )
     };
}




name.DannyBrewer.test.XDannysCalcFunctions1.java
Generated from IDL...
Code:
package name.DannyBrewer.test;

public interface XDannysCalcFunctions1 extends com.sun.star.uno.XInterface
{
    // Methods
    public int addFive( /*IN*/int intDummy );
    public int addSix( /*IN*/int intDummy );
    public java.lang.Object[][] matMultiply( /*IN*/double[][] mat1, /*IN*/double[][] mat2, /*IN*/com.sun.star.beans.XPropertySet oSpreadsheetDocument );
    public java.lang.Object[][] arrayOfRows( /*IN*/java.lang.Object[] aArgs );
    public java.lang.Object[][] arrayOfColumns( /*IN*/java.lang.Object[] aArgs );
    public java.lang.Object[][] array2DRowMajor( /*IN*/int numColumns, /*IN*/java.lang.Object[] aArgs );
    public java.lang.Object[][] array2DColumnMajor( /*IN*/int numRows, /*IN*/java.lang.Object[] aArgs );

    // static Member
    public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = {
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "addFive", 0, 0 ),
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "addSix", 1, 0 ),
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "matMultiply", 2, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.ParameterTypeInfo( "oSpreadsheetDocument", "matMultiply", 2, com.sun.star.lib.uno.typeinfo.TypeInfo.INTERFACE ),
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "arrayOfRows", 3, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.ParameterTypeInfo( "aArgs", "arrayOfRows", 0, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),

        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "arrayOfColumns", 4, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.ParameterTypeInfo( "aArgs", "arrayOfColumns", 0, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "array2DRowMajor", 5, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.ParameterTypeInfo( "aArgs", "array2DRowMajor", 1, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.MethodTypeInfo( "array2DColumnMajor", 6, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY ),
        new com.sun.star.lib.uno.typeinfo.ParameterTypeInfo( "aArgs", "array2DColumnMajor", 1, com.sun.star.lib.uno.typeinfo.TypeInfo.ANY )
     };
}




name.DannyBrewer.test.DannysCalcFunctions1.java
Code:
package name.DannyBrewer.test;

/** You can find more
 * information on the following web page:
 * http://api.openoffice.org/common/ref/com/sun/star/index.html
 */
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.lang.XInitialization;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XServiceName;
import com.sun.star.sheet.XAddIn;
import com.sun.star.lang.Locale;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.uno.Type;


/** This outer class provides an inner class to implement the service
 * description, a method to instantiate the
 * component on demand (__getServiceFactory()), and a method to give
 * information about the component (__writeRegistryServiceInfo()).
 */
public class DannysCalcFunctions1
{
    //######################################################################
    /** This inner class provides the component as a concrete implementation
     * of the service description. It implements the needed interfaces.
     * @implements XDannysCalcFunctions1, XAddIn, name.DannyBrewer.misc.XCommand, XServiceName, XServiceInfo, XTypeProvider
     */
    static public class _DannysCalcFunctions1 extends WeakBase
                    implements
                        XDannysCalcFunctions1,
                        XAddIn,
                        name.DannyBrewer.misc.XCommand,
                        XServiceName,
                        XServiceInfo
    {
       
        //------------------------------------------------------------
        //  Component support machinery.
        //
            /** The component will be registered under this name.
             */
            static private final String __serviceName = "name.DannyBrewer.test.DannysCalcFunctions1";

            static private final String ADDIN_SERVICE = "com.sun.star.sheet.AddIn";

            static private final String[] supportedServiceNames = {
                ADDIN_SERVICE,
                __serviceName
            };

            //----------------------------------------
            //  Interface: com.sun.star.lang.XServiceName
            //----------------------------------------

            // string
            // getServiceName();
            public String getServiceName() {
                return( __serviceName );
            }

            //----------------------------------------
            //  Interface: com.sun.star.lang.XServiceInfo
            //----------------------------------------

            // string
            // getImplementationName();
            public String getImplementationName() {
                return( _DannysCalcFunctions1.class.getName() );
            }

            public String[] getSupportedServiceNames() {
                return supportedServiceNames;
            }

            // Implement methods from interface XServiceInfo
            public boolean supportsService( String serviceName ) {
                String[] supportedServiceNames = getSupportedServiceNames();
                for( int i = 0; i < supportedServiceNames.length; ++i ) {
                    if( supportedServiceNames[i].equals( serviceName ) ) {
                        return true;
                    }
                }
                return false;
            }
        //
        //  Component support machinery.
        //------------------------------------------------------------

       
       
        //----------------------------------------
        //   Interface: name.DannyBrewer.misc.XCommand
        //----------------------------------------
        // This interface is so that Basic macros can make private calls to
        //  the doCommand function for debugging and testing.
        // An array of PropertyValue can be passed to doCommand as a
        //  group of "parameters" to the chosen command.

        // any
        // doCommand( [in] string cCommand,
        //            [in] sequence< com.sun.star.beans.PropertyValue > aParams );
        public Object doCommand( String cCommand, com.sun.star.beans.PropertyValue[] aParams ) {
            return null;
        }
           

       
        //----------------------------------------
        //   Interface: com.sun.star.sheet.XAddIn
        //   Inherits from...
        //       com.sun.star.lang.XLocalizable
        //----------------------------------------
           
        // string
       // getProgrammaticFuntionName( [in] string aDisplayName );
       // Note: the method name spelling error is in the API!
        public String getProgrammaticFuntionName( String displayFnName ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].displayName.equals( displayFnName ) ) {
                    return functionInfo[i].internalName;
                }
            }
            return "";
        }
        // string
       // getDisplayFunctionName( [in] string aDisplayName );
        public String getDisplayFunctionName( String programmaticFnName ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].displayName;
                }
            }
            return "";
        }
       
        // string
        // getFunctionDescription( [in] string aProgrammaticName );
        public String getFunctionDescription( String programmaticFnName ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].description;
                }
            }
            return "";
        }
       
        // string
        // getDisplayArgumentName( [in] string cProgrammaticName
        //                         [in] long   nArgument );
        public String getDisplayArgumentName( String programmaticFnName, int argNum ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].argNames[ argNum ];
                }
            }
            return "";
        }
       
        // string
        // getArgumentDescription( [in] string aProgrammaticName
        //                         [in] long   nArgument );
        public String getArgumentDescription( String programmaticFnName, int argNum ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].argDescriptions[ argNum ];
                }
            }
            return "";
        }
       
        // string
        // getProgrammaticCategoryName( [in] string aProgrammaticName );
        public String getProgrammaticCategoryName( String programmaticFnName ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].internalCategory;
                }
            }
            return "Add-In";
        }
       
        // string
        // getDisplayCategoryName( [in] string aProgrammaticName );
        public String getDisplayCategoryName( String programmaticFnName ) {
            for( int i = 0; i < functionInfo.length; ++i ) {
                if( functionInfo[i].internalName.equals( programmaticFnName ) ) {
                    return functionInfo[i].displayCategory;
                }
            }
            return "Add-In";
        }

       
        //----------------------------------------
        //   Interface: com.sun.star.lang.XLocalizable
        //   Inherited by...
        //      com.sun.star.sheet.XAddIn
        //----------------------------------------

        private Locale theLocale;
       
        // void

        // setLocale( [in] Locale eLocale );
        public Locale getLocale() {
            return theLocale ;
        }
       
        // void
        // setLocale( [in] Locale eLocale );
        public void setLocale( Locale p1 ) {
            theLocale = p1;
        }

       
       
       
       
           
        //----------------------------------------
        //  A mechanism to define the Add-In function information.
       
        static class FuncInfo {
            String internalName, displayName, description;
            String[] argNames, argDescriptions;
            String internalCategory, displayCategory;
            FuncInfo( String internalName, String displayName, String description,
                        String[] argNames, String[] argDescriptions,
                        String internalCategory, String displayCategory ) {
                this.internalName = internalName;
                this.displayName = displayName;
                this.description = description;
                this.argNames = argNames;
                this.argDescriptions = argDescriptions;
                this.internalCategory= internalCategory;
                this.displayCategory = displayCategory;
            }
        }
       
        static final FuncInfo[] functionInfo = {
            new FuncInfo( "addFive", "AddFive",
                    "Add five to the argument.",
                    new String[] { "nNumber" },
                    new String[] { "A number to which five will be added." },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "addSix", "AddSix",
                    "Add six to the argument.",
                    new String[] { "nNumber" },
                    new String[] { "A number to which six will be added." },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "matMultiply", "MatMultiply",
                    "Matrix multiplication.  Return matrix product of two matricies.",
                    new String[] { "matrix1",
                                    "matrix2",
                                    "(internal)" },
                    new String[] { "matrix1",
                                    "matrix2",
                                    "(internal)" },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "arrayOfRows", "DCPT_ArrayOfRows",
                    "Construct a single column, multiple row array from the arguments.",
                    new String[] { "arguments" },
                    new String[] { "Arguments that will be converted into an array." },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "arrayOfColumns", "DCPT_ArrayOfColumns",
                    "Construct a single row, multiple column array from the arguments.",
                    new String[] { "arguments" },
                    new String[] { "Arguments that will be converted into an array." },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "array2DRowMajor", "DCPT_Array2dRowMajor",
                    "Construct a two dimensional array from the arguments.  Each row is filled, column by column until all arguments are used up.",
                    new String[] { "numColumns",
                                    "arguments" },
                    new String[] { "Number of columns to be created in the array.",
                                    "Arguments that will be used to fill the array." },
                    "Add-In", "Add-In" )
            ,new FuncInfo( "array2DColumnMajor", "DCPT_Array2DColumnMajor",
                    "Construct a two dimensional array from the arguments.  Each column is filled, row by row until all arguments are used up.",
                    new String[] { "numRows",
                                    "arguments" },
                    new String[] { "Number of rows to be created in the array.",
                                    "Arguments that will be used to fill the array." },
                    "Add-In", "Add-In" )
        };

       
        //----------------------------------------
        // Interface: name.DannyBrewer.test.XDannysCalcFunctions1
        //----------------------------------------

        public int addFive( /*IN*/int x ) {
            return x + 5;
        }
        public int addSix( /*IN*/int x ) {
            return x + 6;
        }
        public java.lang.Object[][] matMultiply(
                        /*IN*/double[][] mat1,
                        /*IN*/double[][] mat2,
                        /*IN*/com.sun.star.beans.XPropertySet oSpreadsheetDocument )
        {
            int mat1Rows = getNumRows( mat1 );
            int mat1Cols = getNumCols( mat1 );
            int mat2Rows = getNumRows( mat2 );
            int mat2Cols = getNumCols( mat2 );
           
            Object[][] result = createArray( mat1Rows, mat2Cols );
           
            if( mat1Cols != mat2Rows ) {
                setArrayElement( result, 0, 0, "Incompatible matrix sizes." );
            } else {
                for( int row = 0; row < mat1Rows; ++row ) {
                    for( int col = 0; col < mat2Cols; ++col ) {
                        for( int i = 0; i < mat1Cols; ++i ) {
                            double m1Value = getArrayElement( mat1, row, i );
                            double m2Value = getArrayElement( mat2, i, col );
                            setArrayElement( result, row, col, getArrayElementAsDouble( result, row, col ) + m1Value * m2Value );
                        }
                    }
                }
            }
           
            return result;
        }
       
        public java.lang.Object[][] arrayOfRows( /*IN*/java.lang.Object[] aArgs ) {
            int numArgs = aArgs.length;
            // We will be returning a matrix that is one column wide.
            Object[][] result = createArray( numArgs, 1 );
           
            for( int i = 0; i < numArgs; ++i ) {
                setArrayElement( result, i, 1, aArgs[i] );
            }
           
            return result;
        }
        public java.lang.Object[][] arrayOfColumns( /*IN*/java.lang.Object[] aArgs ) {
            int numArgs = aArgs.length;
            // We will be returning a matrix that is one row tall.
            Object[][] result = createArray( 1, numArgs );
           
            for( int i = 0; i < numArgs; ++i ) {
                setArrayElement( result, 1, i, aArgs[i] );
            }
           
            return result;
        }
        public java.lang.Object[][] array2DRowMajor( /*IN*/int numColumns, /*IN*/java.lang.Object[] aArgs ) {
            int numArgs = aArgs.length;
            int numRows = numArgs / numColumns;
            if( numArgs % numColumns > 0 ) ++numRows;
           
            // We will be returning a matrix.
            Object[][] result = createArray( numRows, numColumns );
           
            int row = 0, col = 0;
            for( int i = 0; i < numArgs; ++i ) {
                setArrayElement( result, row, col, aArgs[i] );
                ++col;
                if( col >= numColumns ) {
                    col = 0;
                    ++row;
                }
            }
           
            return result;           
        }
        public java.lang.Object[][] array2DColumnMajor( /*IN*/int numRows, /*IN*/java.lang.Object[] aArgs ) {
            int numArgs = aArgs.length;
            int numColumns = numArgs / numRows;
            if( numArgs % numRows > 0 ) ++numColumns;
           
            // We will be returning a matrix.
            Object[][] result = createArray( numRows, numColumns );
           
            int row = 0, col = 0;
            for( int i = 0; i < numArgs; ++i ) {
                setArrayElement( result, row, col, aArgs[i] );
                ++row;
                if( row >= numRows ) {
                    row = 0;
                    ++col;
                }
            }
           
            return result;           
        }
       
       
        //----------------------------------------
       
        // Functions to manipulate an "Array" of values.
       
        Object[][] createArray( int rows, int cols ) {
            Object[][] result = new Object[ rows ][ cols ];
            return result;
        }
       
        int getNumRows( Object[][] oArray ) {
            return oArray.length;
        }
        int getNumCols( Object[][] oArray ) {
            return oArray[0].length;
        }
       
        Object getArrayElement( Object[][] oArray, int row, int col ) {
            Object element = oArray[ row ][ col ];
            return element;
        }
        double getArrayElementAsDouble( Object[][] oArray, int row, int col ) {
            Object element = oArray[ row ][ col ];
            if( element instanceof Double ) {
                Double d = (Double) element;
                return d.doubleValue();
            }
            return 0.0;
        }
       
        void setArrayElement( Object[][] oArray, int row, int col, Object value ) {
            oArray[ row ][ col ] = value;
        }
        void setArrayElement( Object[][] oArray, int row, int col, double value ) {
            oArray[ row ][ col ] = new Double( value );
        }
        void setArrayElement( Object[][] oArray, int row, int col, int value ) {
            oArray[ row ][ col ] = new Integer( value );
        }
        void setArrayElement( Object[][] oArray, int row, int col, String value ) {
            oArray[ row ][ col ] = value;
        }
       
        int getNumRows( double[][] oArray ) {
            return oArray.length;
        }
        int getNumCols( double[][] oArray ) {
            return oArray[0].length;
        }
       
        double getArrayElement( double[][] oArray, int row, int col ) {
            double element = oArray[ row ][ col ];
            return element;
        }
       
       
     }
    //######################################################################
   
   
    /**
     * Returns a factory for creating the service.
     * This method is called by the <code>JavaLoader</code>
     * <p>
     * @return  returns a <code>XSingleServiceFactory</code> for creating the component
     * @param   implName     the name of the implementation for which a service is desired
     * @param   multiFactory the service manager to be used if needed
     * @param   regKey       the registryKey
     * @see                  com.sun.star.comp.loader.JavaLoader
     */
    public static XSingleServiceFactory __getServiceFactory(
                        String implName,
                        XMultiServiceFactory multiFactory,
                        XRegistryKey regKey ) {
        XSingleServiceFactory xSingleServiceFactory = null;
       
        if( implName.equals( _DannysCalcFunctions1.class.getName() ) ) {
            xSingleServiceFactory = FactoryHelper.getServiceFactory(
                    _DannysCalcFunctions1.class,
                    _DannysCalcFunctions1.__serviceName,
                    multiFactory,
                    regKey );
        }
       
        return xSingleServiceFactory;
    }
   
    /**
     * Writes the service information into the given registry key.
     * This method is called by the <code>JavaLoader</code>
     * <p>
     * @return  returns true if the operation succeeded
     * @param   regKey       the registryKey
     * @see                  com.sun.star.comp.loader.JavaLoader
     */
    public static boolean __writeRegistryServiceInfo( XRegistryKey regKey ) {
        return FactoryHelper.writeRegistryServiceInfo(
                    _DannysCalcFunctions1.class.getName(),
                    _DannysCalcFunctions1.__serviceName,
                    regKey )
            && FactoryHelper.writeRegistryServiceInfo(
                    _DannysCalcFunctions1.class.getName(),
                    _DannysCalcFunctions1.ADDIN_SERVICE,
                    regKey );
    }
}


I use my own homebrew mechanism (FuncInfo) to implement the AddIn service's interface, as you can see.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Arkas
General User
General User


Joined: 23 Jul 2004
Posts: 24
Location: Stuttgart, BW, Germany

PostPosted: Tue Oct 05, 2004 8:07 am    Post subject: Reply with quote

Hi Danny,

at first, thx for that detailed post in this thread. it helped me for an better understanding of the uno-java-combination and save much time, i hope.

but i have some problems to get our files installed and running respectively.

so i need some help. could you take a look???

i made an project-structure where i saved your posted code and an ant build-file which does nearly the same as your batch files.

you only have to edit the file openoffice.properties on top-level and call "ant"

Sorry i have to remove the the link, post another soon

i hope you or someone else could help me

thanks a lot

Jan


Last edited by Arkas on Thu Oct 07, 2004 12:53 am; edited 1 time in total
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Oct 05, 2004 11:51 am    Post subject: Reply with quote

Right now, I use NetBeans 3.6.

I was not planning to learn Ant until NetBeans 4 comes out. About December (although they do not specify which year).

If I get a chance I'll take a look.

Really, all I'm doing to build an add in is....
1. compiling the source I gave you -- into a Jar, with a manifest.
2. compiling the IDL's into RDB files (using various batch files to invoke the necessary command line tools)
3. Zip up the jar and the rdb files.
4. Put into "user/uno_components", and run pkgchk.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
r_apodaca
General User
General User


Joined: 15 Sep 2004
Posts: 34

PostPosted: Tue Oct 05, 2004 5:42 pm    Post subject: Reply with quote

Hello Arkas,

I had a go at using your ant project setup. Yours is actually the first use of ant to build an OOo Java project, so thanks for putting this together. Here is my experience with it.

After customizing openoffice.properties and build.xml for my system (Linux), I ran ant. I got the following error several times whenever the sdk tools were accessed:

error while loading shared libraries: libsal.so.3: cannot open shared object file: No such file or directory

So I ran my setsdkenv_unix script and then ran ant again. Ant finished with only one error that I could find:

Code:
[echo] cpp: /home/rich/tmp/idli_sMfluV:17 No newline at end of file


I'm not sure if this matters, and I couldn't find the file.

I then looked in <OOo>/user/uno_packages (Danny, I couldn't find uno_components). This directory has all of the .zip files that came from the SDK examples using its makefile. So far so good, but I noticed two things:

(1) there was no CalcFunc.zip in this directory, but it was present in the build directory of your project.

(2) the functions defined in Danny's Java files were not present in Calc.

So I moved CaclFunc.zip into the uno_packages directory and ran pkgchk. I got the following error:

Code:
> warning: registering vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages/CalcFunc.zip.1097014313/CalcFunc.jar into registry file:///home/rich/local/OpenOffice/user/uno_packages/cache/services.rdb: failed! (cannot register implementation: Cannot determine registration class!)!


I'm really not familiar with the structure of this zip file that gets created, so this is about as much as I can contribute right now. Please post an update here if you come up with a solution, as I would like to adapt your build.xml to my own work.
[/quote][/code]
Back to top
View user's profile Send private message Visit poster's website
Arkas
General User
General User


Joined: 23 Jul 2004
Posts: 24
Location: Stuttgart, BW, Germany

PostPosted: Tue Oct 05, 2004 11:45 pm    Post subject: Reply with quote

you catche me red-handed Smile

I forgot to say that mechanism of moving and installing the zip isn't finished,yet, but is in work Smile
I also tested it only on a windows machine, but if you are interessted in my ant project, im going to test it on a unix/linux machine.

error about the shared libraries, is also caused by this problem. i'm going to solve this problem.

about the waring of cpp: the file idli_sMfulV is an temprarry created file of idlc, i got the same but i think its no problem for running.

i would proud if somebody could help with the warning while register the addin.

I try to make an new fixed version until end of week
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Oct 06, 2004 7:21 am    Post subject: Reply with quote

woodward wrote:
Danny, I couldn't find uno_components


Sorry, I meant uno_packages.

I did have one problem registering an add in. See this....
http://www.oooforum.org/forum/viewtopic.php?p=50607#50607

If you would like to try my component, it is here (for the moment).
http://kosh.datateam.com/~danny/OOo/Java-OOo/DannysCalcFunctions1
downlaod the zip file with the name DannysCalcFunctions1.uno.zip.

Please note, I may remove this file from my server at any time. So please get it in the near future.

If you unzip the file, you will see that it only has three things in it....
DannysCalcFunctions1.jar
name.DannyBrewer.misc.XCommand.rdb
name.DannyBrewer.test.DannysCalcFunctions1.rdb

These three files are simply produced from the source code earlier in this thread.

I have only tested this package on Win XP with OOo 1.1.3 that is using Java 1.4.2. (Run jvmsetup.exe in the OOo\programs folder to change which jvm your OOo uses.) I would love to hear if someone installs this package on Linux. (I should try it at home, but I'm too lazy.)

Simply put the above zip file into user\uno_packages. Then run pkgchk.

Then launch OOo, and you should see my new add in functions in the Insert --> Function dialog.
ADDFIVE
ADDSIX
MATMULTIPLY
DCPT_ARRAY2DCOLUMNMAJOR
DCPT_ARRAY2DROWMAJOR
DCPT_ARRAYOFCOLUMNS
DCPT_ARRAYOFROWS

(Please note the implementation of the last four functions is not complete, therefore they don't work. Don't use, for instance, DCPT_ARRAYOFCOLUMNS in a formula in your spreadsheet.)

This thread
Seeking ideas for new Calc add-in functions
http://www.oooforum.org/forum/viewtopic.php?t=12589
is where I discuss these functions.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
r_apodaca
General User
General User


Joined: 15 Sep 2004
Posts: 34

PostPosted: Wed Oct 06, 2004 5:47 pm    Post subject: Reply with quote

Thanks to the DannysCalcFunctions1.uno.zip file in the last post, I was able to pinpoint the problem with the ant project build.

The problem is with the MANIFEST.MF file that gets created by ant and which gets incorporated into CalcFunc.jar. The default manifest is getting created by ant, which just isn't good enough for OOo.Cool

So here is what I did to get it to work:

(1) use ant to build the project

(2) unzip CalcFunc.zip in the build directory

(3) unjar the CalcFunc.jar file in the folder containing the expanded CalcFunc.zip

(4) re-jar the CalcFunc.jar using the MANIFEST.MF contained in the file in Danny's last post:

Code:

Manifest-Version: 1.0
RegistrationClassName: name.DannyBrewer.test.DannysCalcFunctions1


using something like this so that the correct MANIFEST.MF is created:
Code:

jar cvfm DannyCalc.jar /home/rich/dl/DannyCalc/META-INF/MANIFEST.MF -C tmp .


(5) re-zip the CalcFunc.jar file along with the two .rdb files

(6) put this .zip file into <uno_packages>, and run pkgchk

And that's it. The new functions appear with the next invocation of a OpenOffice Spreadsheet.

If we can just incorporate these changes into build.xml, we should be done.
Back to top
View user's profile Send private message Visit poster's website
r_apodaca
General User
General User


Joined: 15 Sep 2004
Posts: 34

PostPosted: Wed Oct 06, 2004 7:36 pm    Post subject: Reply with quote

I now have a build.xml file that seems to work. Here is my build.xml file:

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<project default="calcfunc" name="OOo">

    <property file="compile.properties"/>
    <property file="openoffice.properties"/>

    <target name="pre-init" if="build.ext.OOo.dir">
        <echo message="PRE INIT"/>

        <!-- trick IDEAs ant support -->
        <property name="build.ext.OOo.dir" value="${build.ext.OOo.dir}"/>
        <property name="build.dir" value="${build.ext.OOo.dir}"/>
    </target>

    <target name="setProps" depends="pre-init">
        <property name="src.dir" value="${basedir}/src"/>
        <property name="lib.dir" value="${basedir}/lib"/>
        <property name="res.dir" value="${basedir}/resources"/>

        <property name="build.dir" value="build"/>
        <property name="build.classes.dir" value="${build.dir}/classes"/>
        <property name="build.lib.dir" value="${build.dir}/lib"/>
        <property name="build.res.dir" value="${build.dir}/resources"/>
    </target>
   
    <target name="init" depends="setProps" >
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes.dir}"/>
        <mkdir dir="${build.lib.dir}"/>
        <mkdir dir="${build.res.dir}"/>

        <copy todir="${build.lib.dir}">
            <fileset dir="${lib.dir}"/>
        </copy>

        <copy todir="${build.res.dir}">
            <fileset dir="${res.dir}"/>
        </copy>
    </target>

    <target name="compile" depends="init">
        <!-- Compile the standard components -->
        <javac destdir="${build.classes.dir}"
            deprecation="${compile.deprecation}" debug="${compile.debug}" optimize="${compile.optimize}">
            <classpath>
                <fileset dir="${lib.dir}">
                    <include name="**/*.jar"/>
                    <include name="**/*.zip"/>
                </fileset>
            </classpath>
            <src path="${src.dir}"/>
            <include name="**/*.java"/>
        </javac>
    </target>

    <target name="idl" if="idl.file" >
        <echo message="Execute command: ${openoffice.sdk.bin.dir}/idlc -C -O${build.res.dir}/idl -I${openoffice.sdk.dir}/idl ${idl.file}" />
        <echo message=""/>
        <exec executable="${openoffice.sdk.bin.dir}/idlc" outputproperty="idl.out">
            <env key="PATH" path="${java.library.path}:${openoffice.program.dir}"/>
            <arg value="-C" />
            <arg value="-O${build.res.dir}/idl" />
            <arg value="-I${openoffice.sdk.dir}/idl" />
            <arg value="${idl.file}" />
        </exec>
        <echo message="${idl.out}" />
    </target>

    <target name="regmerge" if="idl.file" depends="idl">
        <basename property="filename" file="${idl.file}" suffix=".idl"/>
        <echo message="Execute command: ${openoffice.sdk.bin.dir}/regmerge ${filename}.rdb /UCR ${build.res.dir}/idl/${filename}.urd" />
        <echo message=""/>
        <exec executable="${openoffice.sdk.bin.dir}/regmerge" outputproperty="regmerge.out">
            <env key="PATH" path="${java.library.path}:${openoffice.program.dir}"/>
            <arg value="${build.res.dir}/idl/${filename}.rdb"/>
            <arg value="/UCR" />
            <arg value="${build.res.dir}/idl/${filename}.urd"/>
        </exec>
        <echo message="${regmerge.out}" />
    </target>

    <target name="javamaker" if="idl.file" depends="regmerge" >
        <basename property="filename" file="${idl.file}" suffix=".idl"/>
        <echo message="Execute command: ${openoffice.sdk.bin.dir}/javamaker -nD -O${src.dir} -BUCR ${build.res.dir}/idl/${filename}.rdb ${openoffice.program.dir}/types.rdb" />
        <echo message=""/>
        <exec executable="${openoffice.sdk.bin.dir}/javamaker" outputproperty="javamaker.out">
            <env key="PATH" path="${java.library.path}:${openoffice.program.dir}"/>
            <arg value="-nD" />
            <arg value="-O${src.dir}" />
            <arg value="-BUCR" />
            <arg value="${build.res.dir}/idl/${filename}.rdb" />
            <arg value="${openoffice.program.dir}/types.rdb" />
        </exec>
        <echo message="${javamaker.out}" />
    </target>

    <target name="calcfunc" depends="init" >
        <antcall target="javamaker">
            <param name="idl.file" value="${build.res.dir}/idl/XCommand.idl"/>
        </antcall>
        <antcall target="javamaker">
            <param name="idl.file" value="${build.res.dir}/idl/XDannysCalcFunctions1.idl"/>
        </antcall>
        <antcall target="compile"/>
        <jar jarfile="${build.dir}/CalcFunc.jar" basedir="${build.classes.dir}">
            <include name="name/**/*.class"/>
            <exclude name="name/**/OOoUno/*.class"/>
       <manifest>
              <attribute name="RegistrationClassName" value="name.DannyBrewer.test.DannysCalcFunctions1"/>
            </manifest>
        </jar>
        <zip destfile="${build.dir}/CalcFunc.zip">
            <zipfileset file="${build.dir}/CalcFunc.jar"/>
            <zipfileset dir="${build.res.dir}/idl">
                <include name="*.rdb" />
                <exclude name="*.idl" />
                <exclude name="*.urd" />
            </zipfileset>

        </zip>
    </target>

    <target name="test" depends="init" >
        <antcall target="javamaker">
            <param name="idl.file" value="${build.res.dir}/idl/XCommand.idl" />
        </antcall>
    </target>

    <!--                 -->
    <!-- CLEAN UP TASK   -->
    <!--                 -->
    <target name="clean" depends="init">
        <delete dir="${build.dir}" includeEmptyDirs="true"/>
    </target>

</project>


Notice at line 109 I inserted the following three lines:

Code:

       <manifest>
              <attribute name="RegistrationClassName" value="name.DannyBrewer.test.DannysCalcFunctions1"/>
            </manifest>


That's all there is to it. After building, cd into the build directory. Copy CalcFunc.zip to <OOo>/user/uno_packagesuno_packages, then run pkgchk. I have no errors and Danny's addin functions now work in Calc.
Back to top
View user's profile Send private message Visit poster's website
r_apodaca
General User
General User


Joined: 15 Sep 2004
Posts: 34

PostPosted: Wed Oct 06, 2004 7:41 pm    Post subject: Reply with quote

One more thing. The build.xml above is for Linux. To make it work under Windows, ".exe" must be appended to the OOo binary tool paths, ie javamaker becomes javamaker.exe, etc.

build.xml should probably read the OS type from a config file, then use the appropriate versions of the binary build tools.
Back to top
View user's profile Send private message Visit poster's website
Arkas
General User
General User


Joined: 23 Jul 2004
Posts: 24
Location: Stuttgart, BW, Germany

PostPosted: Thu Oct 07, 2004 1:20 am    Post subject: Reply with quote

thx for all this help.

now it works fine. i try to create an zip with an useful poroject structure and support for windows and linux.

if there are wishes or proposals post them in this thread.
Back to top
View user's profile Send private message
r_apodaca
General User
General User


Joined: 15 Sep 2004
Posts: 34

PostPosted: Thu Oct 07, 2004 6:17 am    Post subject: Reply with quote

Here's another thing I found out.

The above build.xml still requires that the setsdkenv script be run prior to running ant. I was able to pinpoint the environment variable that needs to be set. So using the <env key> tag and setting the "LD_LIBRARY_PATH" environment variable for the targets invoking the SDK binary tools fixes the problem. For example:

Code:

    <target name="idl" if="idl.file" >
        <echo message="Execute command: ${openoffice.sdk.bin.dir}/idlc -C -O${build.res.dir}/idl -I${openoffice.sdk.dir}/idl ${idl.file}" />
        <echo message=""/>
        <exec executable="${openoffice.sdk.bin.dir}/idlc" outputproperty="idl.out">
            <env key="PATH" path="${java.library.path}:${openoffice.program.dir}"/>
            <env key="LD_LIBRARY_PATH" value="${openoffice.program.dir}" />
            <arg value="-C" />
            <arg value="-O${build.res.dir}/idl" />
            <arg value="-I${openoffice.sdk.dir}/idl" />
            <arg value="${idl.file}" />
        </exec>
        <echo message="${idl.out}" />
    </target>


And making similar changes to the other executable targets allows me to no longer run setsdkenv prior to using ant.

Now what I'd like to see is the elimination of all references to specific classes or files. One target in particular:

Code:

    <target name="calcfunc" depends="init" >
        <antcall target="javamaker">
            <param name="idl.file" value="${build.res.dir}/idl/XCommand.idl"/>
        </antcall>
        <antcall target="javamaker">
            <param name="idl.file" value="${build.res.dir}/idl/XDannysCalcFunctions1.idl"/>
        </antcall>
        <antcall target="compile"/>
        <jar jarfile="${build.dir}/CalcFunc.jar" basedir="${build.classes.dir}">
            <include name="name/**/*.class"/>
            <exclude name="name/**/OOoUno/*.class"/>
            <manifest>
              <attribute name="RegistrationClassName" value="${registration.classname}" />
            </manifest>
        </jar>
        <zip destfile="${build.dir}/CalcFunc.zip">
            <zipfileset file="${build.dir}/CalcFunc.jar"/>
            <zipfileset dir="${build.res.dir}/idl">
                <include name="*.rdb" />
                <exclude name="*.idl" />
                <exclude name="*.urd" />
            </zipfileset>

        </zip>
    </target>


It seems like it should be possible to invoke javamaker on all *.idl files in a directory without having to name them individually. But I don't know how to make this work yet. Any thoughts on this?
Back to top
View user's profile Send private message Visit poster's website
Arkas
General User
General User


Joined: 23 Jul 2004
Posts: 24
Location: Stuttgart, BW, Germany

PostPosted: Wed Oct 20, 2004 6:21 am    Post subject: Reply with quote

I spend some time to warp the executables into an tasks.

the whole project (src, jar, docs) is avalible at

http://www2.fht-esslingen.de/~jafuit00/openoffice-ant.zip

@r_apodaca:

with this tasks you can select mor than one *.idl file without a specific name. the idl-files also could be in different directories.

at this time it es only tested on windows machines. i will be glad if somebody test it on a linux system and give me some response.

arkaz
Back to top
View user's profile Send private message
John Harrison
Newbie
Newbie


Joined: 06 Dec 2004
Posts: 1

PostPosted: Mon Dec 06, 2004 9:57 am    Post subject: Reply with quote

Hi All,

Thanks for the good information! I'm actually developing an ant script for building/testing
uno components using cpp. I've implemented some of the approaches above (e.g):

<target name="idl" if="idl.file" >
<basename property="componentname" file="${idl.file}" suffix=".idl"/>
<echo message="Execute command: ${openoffice.sdk.bin.dir}/idlc -I${openoffice.sdk.dir}/idl -I${basedir}/${componentname} -I${basedir} -O.. ${basedir}/${componentname}/${idl.file}" />
<echo message=""/>
<exec executable="${openoffice.sdk.bin.dir}/idlc" outputproperty="idl.out" dir="${basedir}/${componentname}/Main">
<arg value="-I${openoffice.sdk.dir}/idl" />
<arg value="-I${basedir}/${componentname}" />
<arg value="-I${basedir}" />
<arg value="-O.." />
<arg value="${basedir}/${componentname}/${idl.file}" />
</exec>
</target>

<target name="regmerge" if="idl.file" depends="idl">
<basename property="componentname" file="${idl.file}" suffix=".idl"/>
<echo message="Execute command: rm -f ${componentname}.rdb" />
<echo message=""/>
<exec executable="rm" dir="${basedir}/${componentname}/Main">
<arg value="-f" />
<arg value="${componentname}.rdb"/>
</exec>
<echo message="Execute command: rm -rf ./geninc" />
<echo message=""/>
<exec executable="rm" dir="${basedir}/${componentname}/Main">
<arg value="-rf" />
<arg value="./geninc"/>
</exec>
<echo message="Execute command: ${openoffice.sdk.bin.dir}/regmerge ${componentname}.rdb /UCR ../${componentname}.urd" />
<echo message=""/>
<exec executable="${openoffice.sdk.bin.dir}/regmerge" outputproperty="regmerge.out" dir="${basedir}/${componentname}/Main">
<arg value="./${componentname}.rdb"/>
<arg value="/UCR" />
<arg value="../${componentname}.urd"/>
</exec>
<echo message="Execute command: ${openoffice.sdk.bin.dir}/regmerge ${componentname}.rdb / /usr/local/OpenOffice.org1.1.2/program/types.rdb" />
<echo message=""/>
<exec executable="${openoffice.sdk.bin.dir}/regmerge" outputproperty="regmerge.out" dir="${basedir}/${componentname}/Main">
<arg value="./${componentname}.rdb"/>
<arg value="/"/>
<arg value="/usr/local/OpenOffice.org1.1.2/program/types.rdb"/>
</exec>
</target>

<target name="cppumaker" if="idl.file" depends="regmerge" >
<basename property="componentname" file="${idl.file}" suffix=".idl"/>
<exec executable="${openoffice.sdk.bin.dir}/xml2cmp" outputproperty="xml2cmp.out" dir="${basedir}/${componentname}/Main">
<arg value="-types" />
<arg value="stdout" />
<arg value="${componentname}.xml" />
</exec>
<propertyregex property="mxml2cmp.out"
input="${xml2cmp.out}"
regexp=" "
replace=" -T"
global="true" />
<echo message="Execute command: cppumaker -Gc -BUCR -O./geninc ${mxml2cmp.out} ${componentname}.rdb" />
<echo message=""/>
<exec executable="cppumaker" outputproperty="cppumaker.out" dir="${basedir}/${componentname}/Main">
<arg value="-Gc" />
<arg value="-BUCR" />
<arg value="-O./geninc" />
<arg value="${mxml2cmp.out}" />
<arg value="./${componentname}.rdb" />
</exec>
</target>

Everything appears to be correct syntactically. However, I currently receive the
following response from cppumaker:

/usr/office/sdk110/OpenOffice.org1.1_SDK/linux/bin/ccpumaker : init registries failed,
check your registry files.

Result: 99

Does anyone have any ideas/suggestions on this?

Thanks

John
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group