I am trying to modify the complete cpp add-in.
/Applications/OpenOffice.org_SDK/examples/DevelopersGuide/Components/CppComponent
I want to change method 2 to return a double and add method 5 which also returns a double
My idl now is
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/lang/IllegalArgumentException.idl>
Code: Select all
module my_module
{
interface XSomething
{
string methodOne( [in] string val );
double methodTwo();
double methodFive();
};
service MyService1 : XSomething;
service MyService2 : XSomething
{
create([in]string sArgument)
raises (::com::sun::star::lang::IllegalArgumentException);
};
};
Code: Select all
class MyService1Impl
: public ::my_module::XSomething
, public lang::XServiceInfo
, public lang::XTypeProvider
{
virtual OUString SAL_CALL methodOne( OUString const & str )
throw (RuntimeException);
virtual double SAL_CALL methodTwo( )
throw (RuntimeException);
virtual double SAL_CALL methodFive( )
}
Code: Select all
/ XSomething implementation
OUString MyService1Impl::methodOne( OUString const & str )
throw (RuntimeException)
{
m_sData = str;
return OUString( RTL_CONSTASCII_USTRINGPARAM(
"called methodOne() of MyService1 implementation: ") ) + m_sData;
}
double MyService1Impl::methodTwo( )
throw (RuntimeException)
{
return 3;
}
double MyService1Impl::methodFive( )
throw (RuntimeException)
{
return 2;
}
The following changes were made to service2_impl.cxx
Code: Select all
class MyService2Impl : public ::cppu::WeakImplHelper3<
::my_module::XSomething, lang::XServiceInfo, lang::XInitialization >
{
virtual OUString SAL_CALL methodOne( OUString const & str )
throw (RuntimeException);
virtual double SAL_CALL methodTwo( )
throw (RuntimeException);
virtual double SAL_CALL methodFive( )
throw (RuntimeException);
}
Code: Select all
// XSomething implementation
OUString MyService2Impl::methodOne( OUString const & str )
throw (RuntimeException)
{
m_sData = str;
return OUString( RTL_CONSTASCII_USTRINGPARAM(
"called methodOne() of MyService2 implementation: ") ) + m_sData;
}
double MyService2Impl::methodTwo( )
throw (RuntimeException)
{
return 5;
}
double MyService2Impl::methodFive( )
throw (RuntimeException)
{
return 3;
}
I changed the XCU file as well and edited TestComponent.cpp. The functions work correctly when I run TestComponent from the shell. I can also call MethodOne from Calc and have it work correctly. But if I call MethodTwo or MethodFive calc crashes....
Any suggestions?? Another question is there a way to convert the rdb file back to idl and make sure I have the correct definitions in there??
Saleem