Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing
|Summary:||Bad behaviour deleting a worksheet with Modify Event attached|
|Component:||programming||Assignee:||AOO issues mailing list <issues>|
|Status:||CONFIRMED ---||QA Contact:|
|Issue Type:||DEFECT||Latest Confirmation in:||4.1.1|
Description mdelfede 2006-02-08 22:48:14 UTC
Following snippet attach an ModifyEvent to each worksheet in a workbook when document opened : Option Explicit Global NumSheets as integer Global SheetsEvents() as Object Sub OnDocumentLoad 'ATTACHED TO DOCUMENT OPEN EVENT dim iSheet as integer dim aListener as Object NumSheets = ThisComponent.Sheets.Count ReDim SheetsEvents(NumSheets) for iSheet = 0 to NumSheets-1 aListener = CreateUnoListener("Sheet_", "com.sun.star.util.XModifyListener") ThisComponent.Sheets(iSheet).AddModifyListener(aListener) SheetsEvents(iSheet) = aListener next iSheet End Sub Sub Sheet_Modified(Evt as object) MsgBox "Sheet modified" End Sub Sub Sheet_Disposing(Evt as object) End Sub If I have for example these 3 worksheets in document : "Table1", "Table2" and "Table3", deleting worksheet "Table3" doesn't kill the event handler but does attach it to "Table2" worksheet, making the event handler called twice when modifying "Table2" worksheet. Even whorse, undoing the deletion restores "Table3" sheet but the event handler still remains attached to "Table2" sheet.
Comment 1 frank 2006-03-07 13:36:43 UTC
Hi Niklas, as discussed on the phone one for you on target later. Frank
Comment 2 oooforum (fr) 2015-04-29 08:11:26 UTC
Seems to be obsolete. Since OOo 3.1, we can assign macro directly on sheet events through Edit > Sheet > Events...
Comment 3 mroe 2015-04-29 13:57:30 UTC
Don't know why you mean it could be obsolete. Assigning events via API or via GUI are two different things. But it has nothing to do with this issue.
Comment 4 mroe 2015-04-29 13:59:15 UTC
Created attachment 84714 [details] testfile with the sample macro testfile with the macro from comment 1. Issue still exists.
Comment 5 mroe 2015-04-29 14:00:53 UTC
Check the testfile.