https://bugs.freedesktop.org/show_bug.cgi?id=79217
Priority: medium
Bug ID: 79217
Assignee: [email protected]
Summary: IDE: Writer will not support running a Macro from the
IDE
Severity: normal
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: Other
Whiteboard: BSA
Status: UNCONFIRMED
Version: 4.2.3.3 release
Component: BASIC
Product: LibreOffice
Created attachment 99783
--> https://bugs.freedesktop.org/attachment.cgi?id=99783&action=edit
Writer file with the simple test case to reproduce the problem described
Problem description:
====================
Writer will not support running a Macro from the IDE (or debugging) if the
Macro references a dialog. Any calls to event handlers that reference the
dialog object cause a run time error.
How to reproduce the problem:
=============================
1. Open the uploaded file “LibreOffice-simple-dialog-test-20140525a.odt”
2. Select Tools --> Macros --> Organize Macros --> LibreOffice Basic ...
3. Select Library TestDialogs, Module TestCase1, Function RunDlg1
4. Run 'RunDlg1'
5. Push the Start button in the dialog (this fails with a run-time error)
6. Click OK to the run time error and click OK to exit the dialog
7. Select Tools --> Macros --> Run Macros ...
8. Run TestDialogs/TestCase1/RunDlg1 (this works as correctly and puts text in
the text box)
Current behavior:
=================
-- This causes a run time error, “Basic Run Time Error! Object Variable Not
set”.
-- Any breakpoints (e.g. at beginning of TestDlg1Start) are ignored.
-- The same behavior is observed in both Linux (fc20) and Windows (Win7/64,
XP/32) and LibreOffice version 4.2.4.2 and 4.2.3.3)
-- If however the same macro is run using the macro selector, the dialog runs
correctly.
-- I have confirmed that the problem is not present in Calc, Impress, Draw, and
when the TestDialogs library is imported into [My Macros & Dialogs]. This was
verified by exporting the “TestDialogs” library, and then importing it into a
new document (for example Calc), then editing the newly imported library and
running TestDialogs/TestCase1/RunDlg1 in the IDE directly. Breakpoints also
worked correctly. Importing into a new Writer document did not work.
Expected behavior:
==================
-- Macro should run with dialog Start button putting text into the text box and
the Clear button clearing text from the text box.
-- It should be possible to set breakpoints in the event handlers.
Based on further investigation, it appears as if running the function directly
from the IDE (for Writer) creates a separate context when the dialog is
running. Creating the dialog with CreateUnoDialog() will create an object in
the global variable, but that variable will not be available during the event
handlers. Therefor all dialog operations will fail because there is not a valid
dialog object available and initialized for their use when referencing the
dialog object in a helper function. Further, all global and static variables
are separate and can be set and changed independently of one another. Increment
a global variable in the event handlers and that change will not be seen once
the dialog exits.
Operating System: All
Version: 4.2.3.3 release
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs