To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=101318 Issue #|101318 Summary|OnLoad event missing, unknown events found. Component|scripting Version|OOo 3.0.1 Platform|PC URL| OS/Version|Windows 2000 Status|NEW Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|code Assigned to|kr Reported by|bzl
------- Additional comments from [email protected] Fri Apr 24 09:29:19 +0000 2009 ------- I don't know if this is the correct Component/Subcomponent, but here is what I found out: (Short version) I found out that during a macro of mine the OnLoad event never triggered. (Needed the OnLoad event because the ToC didn't get the correct page numbers) Started OpenOffice with: "-invisible -headless" opened file with: Array(MakePropertyValue( "Hidden", True ),) After opening of file in macro the only event that triggered was one without an EventName. Since the OnLoad event never triggered I don't know when it is done loading. Perhaps the event without the EventName set is the OnLoad event. (This seems a correct assumption, since the ToC gets filled correctly if the macro continues after that event.) The file in which the ToC needs to be updated doesn't have the correct information in the meta.xml (The file is changed from outside OpenOffice) I also posted a question about this on the Forum: http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=17879 (Long version) In Perl I create a filled document from a OpenOffice file. This goes fine, but the created file contains a Table of Content(ToC) which I want to update. I'll be using the following subs and global variables in my macro: REM ***** BASIC ***** Dim DocumentLoaded as boolean Sub RegisterListener (ThisComponent) oListener = CreateUnoListener ( "DocumentListener_","com.sun.star.document.XEventListener" ) ThisComponent.com_sun_star_document_XEventBroadcaster_addEventListener( oListener ) End Sub Sub DocumentListener_notifyEvent( o as object ) 'If o.EventName == "OnLoad" Then 'commented out because my macro never finished. DocumentLoaded = true 'placed breakpoint here to see why o.EventName ! = "OnLoad" 'EndIf end sub Sub DocumentListener_disposing() End Sub The sub that opens a file updates the indexes and then saves and closes the file. Sub Constructor: Sub SaveAs( cType, cExtension, cFile ) Call to run the macro: "C:/progra~1/openoffice.org 3/program/soffice" - invisible -headless macro:///TestLibrary.Test.SaveAs("MS Word 97",.doc,C:/OODFile.odt) OODFile.odt is the file created by PERL using the OpenOffice::OODoc module. it contains a meta.xml file with incorrect information written inside it. I've got a global boolean that I need to (re)set: DocumentLoaded = false Then I open the file and attach a event listener: cURL = ConvertToURL( cFile ) oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, _ Array(MakePropertyValue( "Hidden", True ),)) RegisterListener(oDoc) After the file is opened I check if there are any indexes and if so then to wait for the onload event (at the moment it is set to the first event that triggers) before updating the indexes: oIndexes = oDoc.getDocumentIndexes() If oIndexes.getCount () > 0 Then Do Until DocumentLoaded wait 100 Loop for i = 0 to oIndexes.getCount () - 1 oIndexes (i).update next i EndIf And at last save the file in a new extension and close it: cFile = Left( cFile, Len( cFile ) - 4 ) + cExtension cURL = ConvertToURL( cFile ) ' Save the document using a filter. oDoc.storeToURL( cURL, Array(_ MakePropertyValue( "FilterName", cType ),) oDoc.close( True ) EndIf Exit Sub When I was testing this macro with several files (with or without indexes) I noticed that my indexes weren't updated correctly so I added the wait loop and the event register part including the check if it is an OnLoad event. Next testrun to update the indexes ended in no file returning at all, the OnLoad event was never triggered. so I checked which events I did receive and the only event that I received was one without an EventName. Is this perhaps the OnLoad event in which the text OnLoad as EventName is missing? I also posted a question about this on the Forum: http://user.services.openoffice.org/en/forum/viewtopic.php?f=45&t=17879 --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
