Bug 40651 - Cannot remove event from document
Summary: Cannot remove event from document
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: mab3.4
  Show dependency treegraph
 
Reported: 2011-09-06 04:55 UTC by Niklas Johansson
Modified: 2011-12-24 00:10 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Document with document open event attached (10.11 KB, application/vnd.oasis.opendocument.text)
2011-09-06 04:55 UTC, Niklas Johansson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niklas Johansson 2011-09-06 04:55:08 UTC
Created attachment 50934 [details]
Document with document open event attached

If you write a simple BASIC macro for example:
Sub main
    msgbox "hello"
End Sub

Go to Tools->Customize...->Events
Select the event Open Document
Click on Macro and locate the macro
Save in "the document"
Press OK

Save and close the file.

Reopen the file. The macro should start (if the macro-settings allows it).

Now go back to Tools->Customize...->Events
Select the event Open Document
Click on remove (it gets removed from the list of events...)
Click OK

Save and close the document

Reopen the file, the event is still called.

I can change the event to something else but not remove it.

I've added a document where the event is assigned. To be able to run the macro you need to lower the macro security to Medium or lower. Go to Tools->Options->Security->Macro Security...
Set to Medium click OK
click OK

When you open the "Cannot remove event.odt" you will need to Enable Macros.

Now you can just try to remove the Event see instructions above.
Comment 1 Niklas Johansson 2011-09-06 05:23:25 UTC
Forgot to say that I've tested in LibreOffice 3.4.3 Windows 64 bit.

I've seen the problem on Ubuntu though I don't remember witch version of LibreOffice.

It does however work on XP with LibreOffice 3.3.4
Comment 2 Rainer Bielefeld Retired 2011-09-06 23:28:45 UTC
[Reproducible] with reporter's sample (and own documents) and "LibreOffice 3.4.3 RC2 - WIN7 Home Premium (64bit) German UI [OOO340m1 (Build:302)]".

My test:
0. Save at reliable place for macro execution, adapt macro security so that macros will be executed for document.
1. open sample
   "hello" box from event appears
2. Menu 'Tools -> Customize -> Events'
   Macro "Standard.Module1.main" as event for "Open Document"
3. Click <Remove>
   Event disappears from list
4. Menu 'Save as' and save with new name
5. Close
6. Reopen
   Expected: no "hello" box 
   Actual: "hello" box from event appears
           Checking  Menu 'Tools -> Customize -> Events' still or again shows 
           Macro "Standard.Module1.main" as event for "Open Document"

Although in step 3 it looks as if the event has been deleted, it's still active.

Same problem with Server installation of Master "LibO-dev 3.5.0 – WIN7 Home Premium (64bit) English UI [(Build ID:  3b32204-7f92fce-2ba0a9f)]"

You can shorten the text if you redo step 2 of test after step 3: you will see that event macro still (again) is listed, deletion failed.

Worked fine with "LibreOffice Portable 3.3.3  - WIN7  Home Premium (64bit) German UI [OOO330m19 (Build:301  Tag 3.3.3.1)]", so REGRESSION
Comment 3 Niklas Johansson 2011-09-18 23:48:46 UTC
This might be a clue to whats going on... Earlier when i tried to remove an event from a document i used the code below. This does not work anymore.

' My old code
Sub removeEventOnNewDocument()
Dim vListeners
Dim replacementEvent As Any
	vListeners = ThisComponent.getEvents()
	vListeners.replaceByName("OnLoad", replacementEvent)
End Sub


But... Changing the Dim of the replacementEvent to a Variable works.

' My new code
Sub removeEventOnNewDocument()
Dim vListeners
Dim replacementEvent As Variable
	vListeners = ThisComponent.getEvents()
	vListeners.replaceByName("OnLoad", replacementEvent)
End Sub
Comment 4 Niklas Johansson 2011-09-19 00:01:30 UTC
The bug has been seen on LibreOffice 3.4.3  Mac OS X 10.6.8 as well.

http://nabble.documentfoundation.org/Remove-Macros-td3346273.html
Comment 5 Björn Michaelsen 2011-12-23 12:40:42 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 6 Rainer Bielefeld Retired 2011-12-24 00:10:41 UTC
No longer reproducible with reporter's sample and parallel Dev-Installation of  "LibreOffice 3.5.0 Beta2- WIN7 Home Premium (64bit) German UI [Build-ID : 8589e48-760cc4d-f39cf3d-1b2857e-60db978], so WFM.

@reporter:
Please feel free to reopen this bug if you find out that the problem still exists with LibreOffice version 3.5.