Bug 61398 - FILEOPEN: can't get rid of macro warning
Summary: FILEOPEN: can't get rid of macro warning
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All Linux (All)
: high minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2013-02-24 14:25 UTC by Richard Parkins
Modified: 2019-01-12 22:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Minimal example to provoke bug (34.37 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-01-08 22:52 UTC, Richard Parkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Parkins 2013-02-24 14:25:26 UTC
I imported an XLS file which contained VBA macros into LibreOffice calc. It can't do VBA macros so I deleted the macros and saved the file as an ODS file. Every time I open the ODS file it warns me that "This document contains macros". I look in Tools->Macros->Organise Macros and there are no macros in the file. Presumably the ODS file still contains some trace of the macros that were in the original XLS file. How do I get rid of the warning? What is the point of warning me about traces that I can't delete of macros that I can't run?
Comment 1 Joel Madero 2013-05-29 21:10:05 UTC
I've noticed this before also - quite annoying. Glad you reported it :)


Marking as:

New
Minor - doesn't prevent high quality work but slows it down and is quite annoying
High - makes users think a macro exists still, anyone who had a macro and deletes it will be affected

ProposedEasyHack


Confirmed on:
4.2 Master built last week
Bodhi Linux x64
Comment 2 Joel Madero 2014-02-27 22:55:30 UTC
In order to limit the confusion between ProposedEasyHack and EasyHack and to make queries much easier we are changing ProposedEasyHack to NeedsDevEval.

Thank you and apologies for the noise
Comment 3 Joel Madero 2015-03-11 17:05:51 UTC
@Richard - I think that this issue has been resolved. Can you verify that this is the case with 4.4.1.2 or newer and mark the bug as RESOLVED -> WORKSFORME?
Comment 4 Robinson Tryon (qubit) 2015-12-13 11:21:06 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-01-03 19:47:08 UTC Comment hidden (obsolete)
Comment 6 Dave 2017-10-09 11:12:54 UTC
This bug still exists in version 5.4.2.2.

I have an ODS calc file that I have deleted macros from. I tried renaming .config/libreoffice/4 in case there was a problem in there, but no change.

OS: slackware 14.2 64bit.
LibreOffice: 5.4.2.2
Comment 7 Justin L 2018-01-09 18:59:12 UTC
Just deleting all of the macro code (which to all appearances is the only way to delete this stuff) is not enough to get rid of the macro warning.

However, I just found a way to get rid of the entire VBAMacros library. Go to the Macros Organizer (Tools - Macros - Organize Dialogs), switch to the libraries tab and set the location as your file. Then you can select the VBAMacros library and delete it.

After that, no more prompts.
Comment 8 Richard Parkins 2019-01-08 22:52:08 UTC
Created attachment 148157 [details]
Minimal example to provoke bug
Comment 9 Richard Parkins 2019-01-08 22:55:21 UTC
This is a copy of my file from which I've deleted all the data except for two sheets, which I've renamed as sheet1 and sheet2 and deleted all the content. AS is is, opening it provokes the "has macros" message. Deleting either of the two sheets gets rid of the message
Comment 10 Richard Parkins 2019-01-08 23:03:43 UTC
The bug is still present in LibreOffice Version: 6.1.3.2.

Tools->Macros->Run Macro... doesn't show any macros in the file.
Tools->Macros->Organise Macros->LibreOffice Basic... doesn't show any macros in the file.
Tools->Macros->Organise Macros->JavaScript... doesn't show any macros in the file.
Tools->Macros->Organise Macros->Python... doesn't show any macros in the file.
Tools->Macros->Organise Dialogs... doesn't show any macros in any of its tabs.

I do have a global My Macros file, but this doesn't provoke the error message with any of my other spreadsheets.
Comment 11 Justin L 2019-01-11 18:40:24 UTC
(In reply to Richard Parkins from comment #8)
> Minimal example to provoke bug
The code that identifies the "presence" of the macros is in sfx2/source/doc/docmacromode.cxx.

So, ODS files are just zip files.  I believe that the presence of Basic folder with script files in it triggers the macros.  I was able to unzip the file, delete the Basic folder, and re-zip the file to avoid the macro problem.

I didn't see anywhere in the code that could have accomplished this. One thing to investigate is why the "delete" button cannot delete these things in the modules area.
Comment 12 Justin L 2019-01-11 19:01:13 UTC
When editing the macros, when you double click on "sheet2", it pops up the code tab with Sub Main/End Sub.  Right clicking on the tab gives a delete option, but then the empty code file is just re-created again.
Comment 13 Justin L 2019-01-12 05:09:24 UTC
if I force to module dialog code to enable the delete button (basctl/source/basicide/moduldlg.cxx), it still fails to actually delete the Document Object, so I give up.
Comment 14 Richard Parkins 2019-01-12 18:48:42 UTC
(In reply to Justin L from comment #11)
> (In reply to Richard Parkins from comment #8)
> > Minimal example to provoke bug
> The code that identifies the "presence" of the macros is in
> sfx2/source/doc/docmacromode.cxx.
> 
> So, ODS files are just zip files.  I believe that the presence of Basic
> folder with script files in it triggers the macros.  I was able to unzip the
> file, delete the Basic folder, and re-zip the file to avoid the macro
> problem.
> 
> I didn't see anywhere in the code that could have accomplished this. One
> thing to investigate is why the "delete" button cannot delete these things
> in the modules area.

There are several zip algorithms supported by Linux. In order to replicate the solution that you describe, I need to know which algorithm to use to re-zip the file. I tried zipinfo on the original file, but it doesn't tell me.
Comment 15 Justin L 2019-01-12 18:52:57 UTC
(In reply to Richard Parkins from comment #14)
> I need to know which algorithm to use to re-zip the file.
I just used "zip" from the command line, which is Info-Zip 3.0 in my case.
Comment 16 Richard Parkins 2019-01-12 22:10:42 UTC
(In reply to Justin L from comment #15)
> (In reply to Richard Parkins from comment #14)
> > I need to know which algorithm to use to re-zip the file.
> I just used "zip" from the command line, which is Info-Zip 3.0 in my case.

OK, thanks. That fixes my original file, so it looks as if it a good workaround.

However IMHO the bug (deleting macros not removing the warning) still needs to be fixed.