To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=61802
                  Issue #:|61802
                  Summary:|Bad behaviour deleting a worksheet with Modify Event
                          |attached
                Component:|Spreadsheet
                  Version:|OOo 2.0.1
                 Platform:|All
                      URL:|
               OS/Version:|Windows XP
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|programming
              Assigned to:|spreadsheet
              Reported by:|mdelfede





------- Additional comments from [EMAIL PROTECTED] Wed Feb  8 14:48:14 -0800 
2006 -------
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.

---------------------------------------------------------------------
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]

Reply via email to