Hi Andrea,

based on your info i created an addin in Java with our NB plugin. You can resue the IDL's, and the xcu file. Take a look into the Java skeleton and adapt your C++ class ...

SomeValuesAddin.idl
####
#ifndef _org_openoffice_addin_SomeValuesAddIn_
#define _org_openoffice_addin_SomeValuesAddIn_

#include "XSomeValuesAddIn.idl"

module org { module openoffice { module addin {
    service SomeValuesAddIn : XSomeValuesAddIn;
}; }; };

#endif
####

XSomeValuesAddin.idl
####
#ifndef _org_openoffice_addin_XSomeValuesAddIn_
#define _org_openoffice_addin_XSomeValuesAddIn_

#include <com/sun/star/lang/XLocalizable.idl>

#include <com/sun/star/uno/XInterface.idl>


module org { module openoffice { module addin {
    interface XSomeValuesAddIn {
        /// used to set an add-in locale for formatting reasons for example
        [optional] interface ::com::sun::star::lang::XLocalizable;

        double someValues([in] sequence< sequence< double > > values);
    };
}; }; };

#endif
####

CalcAddins.xcu
####
<?xml version='1.0' encoding='UTF-8'?>

<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; oor:name="CalcAddIns" oor:package="org.openoffice.Office">
    <node oor:name="AddInInfo">
<node oor:name="org.openoffice.addin.SomeValuesAddIn" oor:op="replace">
            <node oor:name="AddInFunctions">
                <node oor:name="someValues" oor:op="replace">
                    <prop oor:name="DisplayName">
                        <value xml:lang="en">SomeValues</value>
                    </prop>
                    <prop oor:name="Description">
<value xml:lang="en">add your function description here</value>
                    </prop>
                    <prop oor:name="Category">
                        <value>Add-In</value>
                    </prop>
                    <prop oor:name="CompatibilityName">
                        <value/>
                    </prop>
                    <node oor:name="Parameters">
                        <node oor:name="values" oor:op="replace">
                            <prop oor:name="DisplayName">
                                <value xml:lang="en">Values</value>
                            </prop>
                            <prop oor:name="Description">
<value xml:lang="en">add your paramter description here</value>
                            </prop>
                        </node>
                    </node>
                </node>
            </node>
        </node>
    </node>
</oor:component-data>
####

####
####

Java skeleton
####
package org.openoffice.addin;

import com.sun.star.uno.XComponentContext;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.lib.uno.helper.WeakBase;


public final class SomeValuesAddInImpl extends WeakBase
   implements com.sun.star.lang.XServiceInfo,
              com.sun.star.lang.XLocalizable,
              org.openoffice.addin.XSomeValuesAddIn
{
    private final XComponentContext m_xContext;
private static final String m_implementationName = SomeValuesAddInImpl.class.getName();
    private static final String[] m_serviceNames = {
        "org.openoffice.addin.SomeValuesAddIn" };

private com.sun.star.lang.Locale m_locale = new com.sun.star.lang.Locale();

    public SomeValuesAddInImpl( XComponentContext context )
    {
        m_xContext = context;
    }

public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
        XSingleComponentFactory xFactory = null;

        if ( sImplementationName.equals( m_implementationName ) )
xFactory = Factory.createComponentFactory(SomeValuesAddInImpl.class, m_serviceNames);
        return xFactory;
    }

public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {
        return Factory.writeRegistryServiceInfo(m_implementationName,
                                                m_serviceNames,
                                                xRegistryKey);
    }

    // com.sun.star.lang.XServiceInfo:
    public String getImplementationName() {
         return m_implementationName;
    }

    public boolean supportsService( String sService ) {
        int len = m_serviceNames.length;

        for( int i=0; i < len; i++) {
            if (sService.equals(m_serviceNames[i]))
                return true;
        }
        return false;
    }

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

    // com.sun.star.lang.XLocalizable:
    public void setLocale(com.sun.star.lang.Locale eLocale)
    {
        m_locale = eLocale;
    }

    public com.sun.star.lang.Locale getLocale()
    {
        return m_locale;
    }

    // org.openoffice.addin.XSomeValuesAddIn:
    public double someValues(double[][] values)
    {
// TODO: Exchange the default return implementation for "someValues" !!!
        // NOTE: Default initialized polymorphic structs can cause problems
        // because of missing default initialization of primitive types of
// some C++ compilers or different Any initialization in Java and C++
        // polymorphic structs.
        return 0;
    }

}
####

Andrea wrote:
Andrea wrote:
Steffen Grund wrote:
Especially getDisplayArgumentName() and getArgumentDescription()
require some table to map the
function name (aProgrammaticName) and the argument id (nArgument) to
the argument name and description.
No, you do not have to implement XAddIn. As far as I know, the AddIn
service is an older concept for providing the information that is now
stored in the CalcAddIns.xcu file. As Jürgen stated in a previous mail,
this has the advantage of not having to load the whole component for
accessing simple text information.
I do not have a link to an example for this, I am afraid. Perhaps
someone else can help here?
If you have used
http://wiki.services.openoffice.org/wiki/Calc/Add-In/CompleteAddIn
as a template, I fear that example should be updated.
That is new to me. I mush have missed the point where XAddIn is optional and, 
yes, I have followed
that template + the SimpleCalcAddin (where the is an other subtle error to do 
with the linker).
Things should get easier without this interface.
I will try to remove it and report what happens.


Andrea

I have removed

 interface com::sun::star::sheet::XAddIn;

from my IDL, which now looks like

        service Service
        {
            interface XMaths; <<<<<<<<<<<<<< This is my interface 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            interface com::sun::star::lang::XInitialization;
            interface com::sun::star::lang::XServiceName;
            //      interface com::sun::star::sheet::XAddIn;
        };

but now in OOCalc all my formulae appear as

=org.asi.Service.black()

instead of =BLACK()

and the result is #NAME?

I see you don't have an example, maybe there exists some documentation. What 
are the xcu files?
I want to use C++, but an example in Java could work as well.

Andrea


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Sun Microsystems GmbH        Juergen Schmidt
Nagelsweg 55                 Technical Lead Programmability
20097 Hamburg, Germany

Registered Office: Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Commercial register of the Local Court of Munich: HRB 161028
Managing Directors: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Chairman of the Supervisory Board: Martin Haering

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to