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

How to embed application events records in an extension ?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
acapola
General User
General User


Joined: 23 Jun 2008
Posts: 7

PostPosted: Sat Jul 12, 2008 7:43 pm    Post subject: How to embed application events records in an extension ? Reply with quote

Hello,

I am preparing an extension which use the "On open document" event to run an OOBASIC script. Does any one knows how to include such assignation in an extension ?

Alternatively does any one knows how to programatically assign a OOBASIC script to application events ?

Best regards,

Sebastien
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sun Jul 13, 2008 8:32 am    Post subject: Re: How to embed application events records in an extension Reply with quote

acapola wrote:

I am preparing an extension which use the "On open document" event to run an OOBASIC script. Does any one knows how to include such assignation in an extension ?

Use Jobs configuration.
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Configuration
And event name can be found in:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Document_Events
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sun Jul 13, 2008 8:43 am    Post subject: Re: How to embed application events records in an extension Reply with quote

acapola wrote:
Alternatively does any one knows how to programatically assign a OOBASIC script to application events ?

Here is an example to assign an event to global event container.
Code:
Sub globalevent_1
  oGlobalEB = CreateUnoService("com.sun.star.frame.GlobalEventBroadcaster")
  oEvents = oGlobalEB.getEvents()
 
  Dim oProps(1) As New com.sun.star.beans.PropertyValue
  oProps(0).Name = "EventType"
  oProps(1).Name = "Script"
  oProps(0).Value = "Script"
  oProps(1).Value = _
    "vnd.sun.star.script:Standard.Module1.message?language=Basic&location=application"
  oEvents.replaceByName("OnLoad",oProps)
End Sub

Supported event names can be found in the link written above.
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Sun Jul 13, 2008 8:59 am    Post subject: Reply with quote

Oops, I'm sorry. Jobs configuration can not allow to invoke any Basic macro... It needs an UNO component implementation.
Back to top
View user's profile Send private message
acapola
General User
General User


Joined: 23 Jun 2008
Posts: 7

PostPosted: Mon Jul 14, 2008 4:05 am    Post subject: Reply with quote

Thanks you very much, your sample code works fine and is simple understand, perfect Very Happy

Now only one mystery remains: how to launch a script contained in an extension just after its installation ?

any idea is very welcome !

Best regards,

Sebastien
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
Page 1 of 1

 
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