Re: [dev] XInitialization
Hello Jan, On Monday 23 August 2010, 02:12, Jan private wrote: Hello Ariel, I have written a C++ component, which works fine. But just recently I noticed that void SAL_CALL myComponent::initialize( const Sequence Any aArguments ) throw ( Exception, RuntimeException) is called four times after running openoffice.org -writer before the empty writer document opens. what kind of component have you written? I am not sure what information you need. there are different kinds of UNO components you can implement. Each component can have a different behavior. Here is the class definition (C ++, Linux x86) and the relevant method: class iMath : public cppu::WeakImplHelper6 XDispatchProvider, XDispatch, XInitialization, XServiceInfo, XDialogEventHandler, XContainerWindowEventHandler I guess you are implementing a css.frame.ProtocolHandler. aren't you? { public: // XInitialization virtual void SAL_CALL initialize (const ::com::sun::star::uno::Sequence ::com::sun::star::uno::Any aArguments) throw (Exception, RuntimeException); } how, when, why, ..., your components gets initialized depends on the component type. For your purpose you may need to implement a css.task.Job, to be instantiated every time a document is loaded from its location or a new one is created. It all depends on what you're trying to achieve. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [dev] XInitialization
Hello Ariel, I guess you are implementing a css.frame.ProtocolHandler. aren't you? I suppose you are right. I started out by copying from some SDK example. Now I looked and found in iMath.cxx: #define SERVICE_NAME de.gmx.rheinlaender.jan.imath.ProtocolHandler how, when, why, ..., your components gets initialized depends on the component type. For your purpose you may need to implement a css.task.Job, to be instantiated every time a document is loaded from its location or a new one is created. It all depends on what you're trying to achieve. Yes, that is what I want: A component of which an instance is attached to every document and lives as long as the document is opened. But it also needs to provide and handle menus, dialogs and other user interaction. So do I need both Job and ProtocolHandler? I found sdk/examples/DevelopersGuide/Components/Addons/JobsAddon and will try to adapt it to my purposes. Thank you! Jan - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org
Re: [dev] XInitialization
Hello Jan, On Sunday 22 August 2010, 02:53, Jan private wrote: hello, I have written a C++ component, which works fine. But just recently I noticed that void SAL_CALL myComponent::initialize( const Sequence Any aArguments ) throw ( Exception, RuntimeException) is called four times after running openoffice.org -writer before the empty writer document opens. what kind of component have you written? Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [dev] XInitialization
Hello Ariel, I have written a C++ component, which works fine. But just recently I noticed that void SAL_CALL myComponent::initialize( const Sequence Any aArguments ) throw ( Exception, RuntimeException) is called four times after running openoffice.org -writer before the empty writer document opens. what kind of component have you written? I am not sure what information you need. Here is the class definition (C ++, Linux x86) and the relevant method: class iMath : public cppu::WeakImplHelper6 XDispatchProvider, XDispatch, XInitialization, XServiceInfo, XDialogEventHandler, XContainerWindowEventHandler { public: // XInitialization virtual void SAL_CALL initialize (const ::com::sun::star::uno::Sequence ::com::sun::star::uno::Any aArguments) throw (Exception, RuntimeException); } and its implementation: void SAL_CALL iMath::initialize( const Sequence Any aArguments ) throw ( Exception, RuntimeException) { // Get the service manager for later use mxMCF = mxCC-getServiceManager(); // get the frame for later use Reference XFrame xFrame; if (aArguments.getLength()) { aArguments[0] = xFrame; mxFrame = xFrame; } // Create the toolkit to have access to it later mxToolkit = Reference XToolkit ( mxMCF-createInstanceWithContext(OUString( RTL_CONSTASCII_USTRINGPARAM(com.sun.star.awt.Toolkit )), mxCC), UNO_QUERY_THROW ); // Here comes custom initialization for the component omitted // And this tells me about the multiple calls: std::cout iMath::initialize called std::endl; } Is that what you were asking for? Regards, Jan - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org
[dev] XInitialization
hello, I have written a C++ component, which works fine. But just recently I noticed that void SAL_CALL myComponent::initialize( const Sequence Any aArguments ) throw ( Exception, RuntimeException) is called four times after running openoffice.org -writer before the empty writer document opens. Also, data stored in the myComponent instance that was initialized gets lost during my editing session to the document. What am I doing wrong? How can I tie the myComponent instance to the lifetime (the time it is opened) of the document? There is no data in myComponent that needs to survive document closing/re-opening, but it would be nice to be able to keep data for the editing session of the document! Thanks for any hints Jan - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org