Hi Muthu,

Sorry for having you left waiting so long..

On Tue, Apr 18, 2006 at 10:10:48 +0530, Muthu Subramanian wrote:

> This is my code in table4.cxx:
> [...]
>             Reference< XInterface > xInterface =
> xServiceManager->createInstance(
>                             ::rtl::OUString::createFromAscii("
> com.sun.star.i18n.OrdinalSuffix") );

Did you check whether that service is really instanciated?

    if (xInterface.is())
        ... query interface ...
    else
        ... fail ...

If it isn't, that probably means you didn't register the new component's
service with the OOo installation. To do so, presuming that your
implemantation is within the i18npool.uno.so library, either build a new
install set, or use the 'regcomp' utility from the build environment's
solver to register the modified library with an already existing
installation:

cd <OOoPath>/program
regcomp -register -r services.rdb -c i18npool.uno.so

Invoke regcomp without parameters for usage help.

See also
http://wiki.services.openoffice.org/wiki/Tutorial_UNO_Client

If indeed you did try to register the new service, then you probably
don't have the service name registered by the component_writeInfo()
function. See below at the end of this mail.

>         Reference< XOrdinalSuffix > xos ( xInterface, UNO_QUERY );
>         if(xos.is())
>         {
>             printf("\n Success \n");
>         }
> 
> The problem is xos.is() returns false. I don't know what I am missing. I
> tried using XInitialization also.
> (The printf's in ordinalsuffix.cxx too don't seem to be called)

Well, if the service can't be instanciated, there is no interface to
query..


> Skeleton of other files:
> 
> XOrdinalSuffix.idl
> --------------------------
> #ifndef __com_sun_star_i18n_XOrdinal_Suffix_idl__
> #define __com_sun_star_i18n_XOrdinal_Suffix_idl__

Please, as I already mentioned earlier, align the define with the idl
name, so __com_sun_star_i18n_XOrdinalSuffix_idl__ would be correct, note
the space.

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

Locale doesn't seem to be used below and is then superfluous.

> 
> //============================================================================
> 
> module com { module sun { module star { module i18n {
> 
> //============================================================================
> 
> interface XOrdinalSuffix : com::sun::star::uno::XInterface
> {
>     void getOrdinalSuffix([inout] string aValue, [in] long nDigits);
> };

Please avoid [inout] parameters, they don't work with Java. Use [in] and
return a string instead.

> 
> //============================================================================
> }; }; }; };
> //============================================================================
> #endif



> OrdinalSuffix.idl
> -----------------------
> 
> #ifndef __com_sun_star_i18n_Ordinal_Suffix_idl__
> #define __com_sun_star_i18n_Ordinal_Suffix_idl__

Same as above, please use __com_sun_star_i18n_OrdinalSuffix_idl__
instead.

> 
> #include <com/sun/star/lang/XServiceInfo.idl>
> 
> #ifndef __com_sun_star_i18n_XOrdinal_Suffix_idl__

dito, __com_sun_star_i18n_XOrdinalSuffix_idl__

> #include <com/sun/star/i18n/XOrdinalSuffix.idl>
> #endif

But I think here you can remove the include guards and simply write
#include <com/sun/star/i18n/XOrdinalSuffix.idl>
XOrdinalSuffix.idl won't be included by XServiceInfo.idl nor its includes.

Snipped
> ordinalsuffix.hxx
> ordinalsuffix.cxx

In both files I don't see the public
component_getImplementationEnvironment(), component_getFactory() and
component_writeInfo() functions mandatory for components. I'm assuming
again that your implementation is part of the i18npool.uno.so library,
so you may use the existing IMPL_CREATEINSTANCE macro stub in
i18npool/source/registerservices/registerservices.cxx, and add your
service to the InstancesArray aInstances[] table.

HTH

  Eike

-- 
 OOo/SO Calc core developer. Number formatter stricken i18n transpositionizer.
 GnuPG key 0x293C05FD:  997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

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

Reply via email to