Apache OpenOffice (AOO) Bugzilla – Issue 25273
Cannot assign scripts from Insert/Fields/Other dialog
Last modified: 2005-01-06 11:22:56 UTC
Open a Writer document and then Select the Insert/Fields/Other menu item. In the dialog that pops up, select the Functions tab. From the Type list, select Execute Macro, then click on the Macro button. The macro chooser dialog pops up so you can choose a Basic macro to assign to the field. You should also be able to assign scripts in other languages to the field.
.
Information from Thomas Benisch on reproducing this, and also on two other locations where the Macro Chooser is shown: 1. Macro fields in a text document ------------------------------- UI: - File / New / Text Document - Insert / Fields / Other... - tab page 'Functions' - select 'Execute macro' in left list box - press 'Macro...' button - Macro Chooser is shown - select a macro in the Macro Chooser - press 'Choose' button in Macro Chooser - enter some text in the 'Reference' edit field of the 'Functions' tab page - press 'Insert' button - press 'Close' button - click on the inserted field in the text document - the assigned macro is then executed CODE: sw\source\ui\fldui\fldmgr.cxx: SfxApplication::ChooseMacro() 2. Data validity in a spreadsheet ------------------------------ UI: - File / New / Spreadsheet - cell A1 must be selected - Data / Validity... - tab page 'Error Alert' - check box 'Show error message ...' must be checked - select 'Macro' in 'Action' combo box - press 'Browse...' button - Macro Chooser is shown - select a macro in the Macro Chooser - press 'Choose' button in Macro Chooser - select tab page 'Criteria' in 'Validity' dialog - select 'Decimal' in 'Allow' combo box - select 'less than' in 'Data' combo box - enter a value of '10' in 'Maximum' edit field - press 'OK' button - enter a value of '11' in cell A1 - the assigned macro is then executed CODE: sc\source\ui\dbgui\validate.cxx: SfxApplication::ChooseMacro() 3. Macro action of a draw object in a presentation ----------------------------------------------- UI: - File / New / Presentation - press 'Next >>' (2x), 'Create', 'OK' - insert a rectangle (from left toolbar) - select 'Interaction...' from rectangle context menu - select 'Run macro' in 'Action at mouse click' combo box - press 'Browse...' button - Macro Chooser is shown - select a macro in the Macro Chooser - press 'Choose' button in Macro Chooser - press 'OK' button in Interaction dialog - deselect rectangle in presentation - click on rectangle - the assigned macro is then executed CODE: sd\source\ui\dlg\tpaction.cxx: SfxApplication::ChooseMacro()
I have seperated the Calc and Impress areas of this into a seperate issues, 27451 and 27452. Initial investigation of this shows that the UI for the Execute Macro function in the Insert/Fields/Other dialog is quite Basic specific. After the user selects a Macro in the Macro Chooser, the macro name is inserted in an Edit Controls within the dialog. However there is also a ListBox which is populated with all of the other macros in the same module are listed. Given the current Scripting Framework API it will not be possible to do this if we replace the Macro Chooser with the new Scripting Framework Macro Selector. I have discussed this with Oliver Specht and he has agreed that the functionality of populating the ListBox with the other macros in the same container as the one chosen is not particularly useful. So the behaviour of the UI will be changed to only fill the macro name Edit Control and leave the ListBox empty. We agreed that this minimal change does not require a specification. Further changes will be needed to the Writer code that handles fields to add support for executing Scripting Framework macro URLs using the ScriptProvider UNO interface.
os->toconner: I didn't aggree that we don't need a spec. UI changes cannot be done without a spec. The change in the dialog has to be added to the Scripting framework spec on http://specs.openoffice.org/scripting_framework/ScriptSelectorSpecification.sxw Please add a chapter regarding this dialog. It should contain a screenshot with a disabled ListBox in the middle. The title of the ListBox will then be "Format" instead of "Select" because all other fields in the dialog use it with "Format".
toconnor->os Sorry about that, I have updated the specification with a screenshot and a description of the changed behaviour.
This has now been fixed during the implementation of the Macro Selector specification. Note that the name and URL to the specification has changed, it can now be found at: http://specs.openoffice.org/scripting_framework/MacroSelectorSpecification.sxw When the user clicks the Macro button when they have Execute Macro selected in the Functions tab, the new Macro Selector dialog should be opened. This should also happen if they select a macro field in a document, right click the field and click the Fields... menu option. When the user selects a macro and clicks OK in the Macro Selector, they will see the Macro Name appear in the Macro Name text box. The Macro Name that is displayed is gotten by parsing the URI for the macro and calling getName on it use the new UNO API for vnd.sun.star.script URIs. This is different from the Data Validity dialog in Calc and the Interaction dialog in Impress where the full URI is displayed. The reason for this is that the Macro Name edit field in the Insert/Fields/Other is read only so the user would not be able to see the full URI. I have also tested that fields for Basic macros created in previous versions of OOo should still load and execute correctly.
*** Issue 27296 has been marked as a duplicate of this issue. ***
Verified. The dialog is available, bindings appear to be working so far.
closing, i have verified that this is working in an m69 build