https://bugs.freedesktop.org/show_bug.cgi?id=49517

             Bug #: 49517
           Summary: : Java Macro Embedded in document will not
    Classification: Unclassified
           Product: LibreOffice
           Version: LibO 3.5.2 Release
          Platform: Other
        OS/Version: All
            Status: UNCONFIRMED
 Status Whiteboard: BSA
          Severity: normal
          Priority: medium
         Component: Writer
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created attachment 61063
  --> https://bugs.freedesktop.org/attachment.cgi?id=61063
Test file is an empty document with an embedd 'HelloWorld' java macro.

Running libreoffice 3.5.2.2

Problem description: 
The HelloWorld java macro that runs just fine when invoked from its normal
location (under libreoffice/share/Scripts/) but fails with a scripting error if
the same macro is embedded in an .odt and run from there. A popup says: 

"A Scripting framework error occurred while running the Java script
org.libreoffice.example.java_scripts.HelloWorld.printHW.

Message: org.libreoffice.example.java_scripts.HelloWorld.printHW"

Running this macro in the same .odt in an earlier version (3.4.4) of
libreoffice (and an old openoffice) works just fine.

I have to admit that embedding a macro in a document is not something that I
can find any documentation on. Although this is something that I have done for
several years with OpenOffice and LibreOffice with no problem, perhaps it was
an undocumented feature that has been removed?

Steps to reproduce:
1. First test the existing macro:
Open writer.
Tools/Macro/Run Macros/LibreOffice
Macros/HelloWorld/org.libreoffice.example.java_scripts.HelloWorld.printHW
The text "Hello World (in Java)" is written into the open document. 
This is as expected.

2. I do not know the 'correct' method for embedding a macro in a document (if
there is one), but this works on earlier versions of libre office:
- save an empty .odt
- unzip the .odt
- copy the HelloWorld.jar and parcel-decsriptor.xml from /opt... to the
unzipped files Scripts/java/
- make suitable changes to the META-INF/manifest.xml
- zip it back up to the .odt
To save you the bother, a test.odt is attached to this report.

3. Change your libreoffice security options to allow macros to run from a given
directory as a 'trusted source'. Save a copy of test.odt there.

4. Open test.odt. 
Tools/Macro/Run
Macros/test.odt/HelloWorld/org.libreoffice.example.java_scripts.HelloWorld.printHW
The above error popup is displayed.

Current behavior:
Macro fails to run.

Expected behavior:
Expect the macro to run and write "Hello World (in Java)" into the .odt.
This works in version 3.4.4

Platform (if different from the browser): 

Browser: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101
Firefox/12.0
Also true on Ubuntu 12.04 64 bit with the same result.
Also tried removing Ubuntu libreoffice packages, downloading everything from
libreoffice directy and installing those '.deb's. 
All give same error.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- 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

Reply via email to