The document events I'm using on a regular basis (currently with all my documents) are: OnViewCreated OnDocumentHasBeenSaved OnDocumentHasBeenSavedAs If a document is containing macros, and macro execution was not permitted when opening it (Security Options), the Sub stored to the local Standard library, and assigned to the mentioned events, are not called. Steps to reproduce: Edit Basic macros for LibO. (No document opened.) Create an arbitrary hello-world-macro in a module of the local Standard library. Assign this macro to 'On View Created' via >Tools>Customize>Events (LibreOffice as target). Have at hand any document containing a macro. Open it with either Macro Security 'High' or 'Medium' and macros not permitted. Expected: The mentioned hello-world-macro is executed. Experienced: No action. Open the same document permitting the execution of document macros. Expected: The mentioned hello-world-macro is executed. Experienced: As expected. The bug: Macro security should only concern document macros. Local macros and their bindings to events shouldn't be afflicted. Since the bug depends on the local settings and event bindings, it can't be demonstrated by an example file.
I added a Calc Hello World macro to My Macros > Standard > Module1 and it works with View Created even with High macro security. I got the macro from https://www.debugpoint.com/2014/09/writing-a-macro-in-libreoffice-calc-getting-started/ I tested both with 7.2.0 and the latest master. Arch Linux 64-bit Version: 7.4.0.0.alpha1+ / LibreOffice Community Build ID: ff2b4bff61d2e1679bb525d754c960c48b81c495 CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb) Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: threaded Built on 25 May 2022 Macro: REM ***** BASIC ***** sub hello_world dim document as object dim dispatcher as object document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") dim args1(0) as new com.sun.star.beans.PropertyValue dim args2(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "ToPoint" args1(0).Value = "$A$1" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) args2(0).Name = "StringName" args2(0).Value = "Hello World!" dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2()) msgbox "Completed!" end sub
Created attachment 180375 [details] containing local code and a tiny "Hello World" macro. (In reply to Buovjaga from comment #1) > I added a Calc Hello World macro to My Macros > Standard > Module1 and it > works with View Created even with High macro security. ... I did neither see reasons for using a recorded macro for the test nor for using one specialized on Calc. It is expected to throw an error if a different doctype has created its view. The macro actually bound to onViewCreated by customization on my Win 10 system currently working with LibO V 7.3.3.2 is: Sub onViewCreated(pEvent) showFileLocationInTitleBar(pEvent.Source, preferredPathStyle, preferredLastModifiedFormat, queryPartContent) End Sub where the called macro does NOT call in turn any document macros. You will find every detail of probable interest in the attached example. I do not attach, however, my complete buser profile. ;-) If I open exactly this attached document on my customized install for which macro security is set to 'Medium', I experience the originallky reported bug: Having permitted the execution of dopcument macros I get all the additional information I want to see in the titlke bar. Having prohibited the execution of document macro no info is appeneded: The onViewCreated() macro simply is not called.
I had forgotten to test with a document containing a macro, so I did a new test. I can reproduce.
Dear Wolfgang Jäger, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Created attachment 194347 [details] The announced archive as a fake .odg (In reply to QA Administrators from comment #4) > Dear Wolfgang Jäger, ... > Warm Regards, > QA Team > > MassPing-UntouchedBug As far as I can see the bug is living happily in V 24.2.2.2. For easing your checks I attach as a ".fake.odg" a 7z-archived folder containing two excample files and a user profile which was virgin a few hours ago, and only got included the two "MyMacros" routines, language settings, and the Medium/Prompt setting for macro security. unpack the archive to an empty folder and call soffice with -env:UserInstallation=file:///symbolicPathToYourEmptyFolder/tdf_144162 (I made this all under Win 10.) Regards