You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by Amenel VOGLOZIN <wa...@yahoo.fr> on 2014/08/11 10:57:56 UTC

[EXT] Actual expanded value of %origin% for toolbar and menu images

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.

Re: [EXT] Actual expanded value of %origin% for toolbar and menu images

Posted by Jürgen Schmidt <jo...@gmail.com>.
On 11/08/14 10:57, Amenel VOGLOZIN wrote:
> 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.

your observation is correct and it is misleading that %origin% is
expanded to the folder where the xcu file is stored. A poor design or
bug if you want. The plugin takes care of this and referenced images
relatively as you noticed.

Juergen

> 
> 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.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: [EXT] Actual expanded value of %origin% for toolbar and menu images

Posted by Jürgen Schmidt <jo...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 11/08/14 13:03, Ariel Constenla-Haile wrote:
> 
> Hello Amenel,
> 
> On Mon, Aug 11, 2014 at 09:57:56AM +0100, Amenel VOGLOZIN wrote:
>> 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.
> 
> [...]
> 
> It is less error prone to use the vnd.sun.star.extension:// 
> protocol, see http://markmail.org/message/d3fgr74luh6ydl3p

indeed very useful and I haven't forgot it. Seems to be a useful
change for the NetBeans plugin.

Juergen


> 
> [...]
> 
>> Can someone who has access to the Wiki update the relevant page?
> 
> I'm sure that, as you go reading the Developer's Guide, you'll find
> other places that need correction; if you are willing to help in
> this documentation area, you can request a wiki account as 
> explained here https://wiki.openoffice.org/wiki/Help:Logging_in
> and fix those places yourself :)
> 
> 
> Regards
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCgAGBQJT6K6iAAoJEM/u8xZRtf3oisEQAIIRqMWIj6eusWqnR4+Qp4Uf
zo1mbZ/RzdVseGM2Uqe1Q0XKH4M9appTi+qcIWnFqVU1c62GdI2J/JEjJsdUT3TC
1QDkXQbV+zQ4wZe6RXVfNr8BCGKo/kYv0fQJ5CSaGkyvgxOETBESLZFpBMOU1n8E
83aXxjuAm2QmBwKgMsnaIuV0dfsYrX7jVPIlanT/i2Qgd2PDLziFEaOQM9mj1tQV
GVQaJdlOvUb0+CrgoQWPqLFDqG6/+6LnINQqTdwspKIfeImPJpGmyc/lYnQoPVkz
6NGoSL83OZMtYJqcrmcV9vOiwoxp8UYMQsaHhAWB2Hh47yk5EoXCZLy+3CinIa08
OztuHOWQcEuioj4tAH/Ey2XW/qp8yHorMxj0yuUythltC4mrOy0Fb7wxy7sTUOB3
R5VIlcwlF4Dj+S49n/JLjaz2GuZryKPo5xkWK6ylOJTZxnvWMQ5L6YaQKiTTnLzc
mJd3Jr9/2FIJPWPwM/KDA4cWtO3bHnHnKmmZuHAzNoq2Lvs8soooApBkn1gxyErw
0o6EEcX0MURnKjMWA6EIHdX6rTF3mfniI+v/4F0f0u8NEmDi7P8LGmY7FLNJbTPd
hmlo6ga0cDCfR7lB7vetRTKY+GCqh5bA93jFlYHZ3jJRRn3PE55BA6w9APy9Qa6A
nt+kEkOarHx05S5n08x2
=BmQe
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: [EXT] Actual expanded value of %origin% for toolbar and menu images

Posted by Ariel Constenla-Haile <ar...@apache.org>.
Hello Amenel,

On Mon, Aug 11, 2014 at 09:57:56AM +0100, Amenel VOGLOZIN wrote:
> 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.

[...]

It is less error prone to use the vnd.sun.star.extension:// protocol,
see http://markmail.org/message/d3fgr74luh6ydl3p

[...]

> Can someone who has access to the Wiki update the relevant page?

I'm sure that, as you go reading the Developer's Guide, you'll find
other places that need correction; if you are willing to help in this
documentation area, you can request a wiki account as explained here
https://wiki.openoffice.org/wiki/Help:Logging_in and fix those places
yourself :)


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina