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
Status: CONFIRMED
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:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-03 00:37 UTC by thierrym
Modified: 2018-07-17 07:36 UTC (History)
3 users (show)

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


Attachments
Issue 69205_Spreadsheet with macro XlModifyListener (10.51 KB, application/vnd.sun.xml.calc)
2006-09-03 15:04 UTC, thierrym
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
Hello,
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_", "com.sun.star.util.XModifyListener" )
oCells.addModifyListener(oListener)
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)
oCells.removeModifyListener(oListener)
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.

Frank
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.

Frank
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 "issues@openoffice.apache.org".
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 !