Issue 69205 - XModifyListener for cells in one sheet works when removing other sheet
Summary: XModifyListener for cells in one sheet works when removing other sheet
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2006-09-03 00:37 UTC by thierrym
Modified: 2023-03-19 09:58 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Issue 69205_Spreadsheet with macro XlModifyListener (10.51 KB, application/vnd.sun.xml.calc)
2006-09-03 15:04 UTC, thierrym
no flags Details
Sample document with event (10.02 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-03-19 09:58 UTC, oooforum (fr)
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description thierrym 2006-09-03 00:37:10 UTC
I use an "XModifyListener" for detecting a change in cells in one sheet. This
works fine when I'm on the sheet. But the listener works even if I remove an
other sheet that isn't the aim of the listener. This occurs only when I remove a
sheet not when I add one.
This is my macro :

'*****  BASIC  *****
'Macros permettant d'intercepter un événement :
'ici détecte une modif dans une plage de cellules oCells
'dans la feuille oSheet ("Dates")
'Utilisation de XModifyListener qui est constituée de
'4 routines obligatoirement
Option Explicit

Global oListener as object, oCells as object

Sub LanceEcoute 'procédure à assigner à l'évènement ouverture du
'document Outils-Personnaliser-Evènement (dans le doc)
dim oDoc as object, oSheets as object, oSheet as object
oDoc = thisComponent
oSheets = oDoc.getSheets()
oSheet = oSheets.getByName("Dates")
oCells = oSheet.getCellRangeByName("B1:E44")
oListener = CreateUnoListener( "LS_", "" )
MsgBox "Listener actif !" 'permet de vérifier que le Listener est actif
End Sub

Sub FermeEcoute 'procédure à assigner à l'évènement fermeture DE
'document Outils-Personnaliser-Evènement (dans le doc)
MsgBox "Listener désactivé !" 'permet de vérifier que le Listener est déchargé
End Sub

Sub LS_modified(evt as object) 'Macro qui se déclenche dès
'que l'événement est détecté (changement dans les cellules)
MsgBox "Feuille Dates modifiée !"
End Sub

Sub LS_disposing'(evt as object)
' routine OBLIGATOIRE lancée à la fermeture du document
End Sub

'************************************* Fin
Comment 1 thierrym 2006-09-03 11:01:21 UTC
Exactly, It depends where the sheet is added or removed in comparison to the
position of the sheet "listened".
If I add a sheet after, it's OK.
If I add a sheet before, the listener works whereas it should'nt.
If I remove a sheet touching the sheet listened, the listener works whereas it
should'nt. But if I remove a sheet which is after and not near to the sheet
listened, it's OK.
Comment 2 thierrym 2006-09-03 15:04:03 UTC
Created attachment 38913 [details]
Issue 69205_Spreadsheet with macro XlModifyListener
Comment 3 frank 2006-09-07 13:50:06 UTC
Hi Christof,

please have a look at this one and proceed as needed.

Comment 4 frank 2006-10-17 12:38:45 UTC
Please don't change the version field if you just want to let us know that it's
still in 2.0.4. The Version field tells us the timeframe of the first occurence.

Comment 5 chne 2006-10-18 13:13:47 UTC
cn->nn: in a SO8PP1 this behavior is not reproducable but in src680_m184
Comment 6 niklas.nebel 2007-12-04 18:11:38 UTC
retarget 2.x -> 3.x
Comment 7 Marcus 2017-05-20 11:27:34 UTC
Reset assigne to the default "".
Comment 8 LucienM 2018-07-17 07:36:19 UTC
I confirm that this issue is still present in Open Office version 4.1.5

I also add a clarification : thierry stated "If I add a sheet before, the listener works whereas it should'nt"

Expressed in another way, this means : 

when a sheet is added before, the listener event subroutine is triggered : however no cell in the listened sheed has been changed due to the sheet insertion . Thus the addition or removal of a sheet should not trigger this listener event subroutine !
Comment 9 oooforum (fr) 2023-03-19 09:56:50 UTC
This issue is old now. Since 3.3, you have sheet events and "Content changed" action. Assign directly your macro on this event.
Each sheet is independant and macro scope can be reproduced when you add a new sheet.

For me, it's a WONT_FIX status
Comment 10 oooforum (fr) 2023-03-19 09:58:52 UTC
Created attachment 87178 [details]
Sample document with event