Hi,
This message is just to bring a peculiarity of the SDK to the attention of the 
subscribers to this mailing list.

Summary: as of AOO 4.1.0, %origin% is expanded into the "Office" folder in the 
"registry" subtree of your project (and installed extension).

Details follow.


The context: I was trying to add icons to the toolbar and menu commands of an 
extension I'm developing. I ended up following the pages at these addresses:
* 
https://wiki.openoffice.org/wiki/Framework/Article/Generic_UNO_Interfaces_for_complex_toolbar_controls
* 
https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/AddOns/Images_for_Toolbars_and_Menus

I couldn't get the images to appear although I was certain the URLs were fine. 
Therefore, I went back to creating a dummy add-on project in NetBeans so I 
could see which URL would be generated.

Instead of the %origin%/images/img.png pattern that I was using (and which is 
used in the second Wiki page mentioned above), the auto-generated Addons.xcu 
file had %origin%/../../../../../images/img.png

Images are found and displayed with the string of ".." parent folders but not 
without these double dots. Apparently, %origin% does not point to the root 
folder in which the extension is installed 
(AddOn\build\soffice_debug\user\uno_packages\cache\uno_packages\svfj5eg0.tmp_\AddOn.oxt\
 in my case), which seems (to me) to diverge from what the Wiki says. Maybe 
that the definition of %origin% could be updated in the Wiki or 
checked/clarified?

The conclusion that I come to is that %origin% gets expanded into [the 
pretty long] 
AddOn\build\soffice_debug\user\uno_packages\cache\uno_packages\svfj5eg0.tmp_\AddOn.oxt\registry\data\org\openoffice\Office\
 and not "just" 
AddOn\build\soffice_debug\user\uno_packages\cache\uno_packages\svfj5eg0.tmp_\AddOn.oxt\
 as I thought, reading the current Wiki.

Here is the complete scenario:
* In NetBeans, create a new Apache OpenOffice Add-On project.
* On the Define User Commands page of the wizard, pick a 16x16 PNG image as the 
small low-contrast image.

* Don't select anything as to the context. Finish the wizard. You'll see a 
bunch of "/.." in Addons.xcu.

* Right-click the project and select Debug Extension in Target Apache 
OpenOffice. The image is displayed.
* Exit. Then modify the URL (in Addons.xcu) to remove the parent folders in the 
path.
* Debug again. The image isn't displayed.
* Create a "images2" folder in registry/data/org/openoffice/Office/
* Copy your image in there and change its name to img2.png. Also change the 
path in Addons.xcu.

* In build.xml, add the XML fragment that is below this list of steps.
* Debug with and without the ".." parent folders in the path. You'll have your 
images displayed in both cases.


    <target name="-post-uno-package">
        <zip update="true" destfile="${uno.package.name}">
            <zipfileset dir="registry/data/org/openoffice/Office/images2" 
includes="*" casesensitive="yes" 
prefix="registry/data/org/openoffice/Office/images2" />
        </zip>
    </target>

Used:
* NetBeans 8.0
* AOO API Plugin  4.0.6
* AOO 4.1.0
Can someone who has access to the Wiki update the relevant page?


Regards.

Reply via email to