Jo wrote:
The mind boggles. I read:

http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml#1_9_1_UNO_Package_Installation_Using_unopkg,
4.9.1

and

http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml,
4.7.3


several times. What I don't find in there is what names those files need to
have. OK, there is this:

example_addon.zip:
   Addons.xcu
   ProtocolHandler.xcu
   windows.plt/
       example_addon.dll

Hi Jo,



now what goes itno Addons.xcu and what goes into ProtocolHandler.xcu? There
is a lot of xml in the paragraphs preceding this example, from which I
distilled the following, since I only want to add a toolbar to my package:

The Developer's Guide has a whole chapter (4.7 Integrating Components into OpenOffice.org) explaining the ProtocolHandler.xcu and Addons.xcu.

The "Addons.xcu" contains the definition of the user interface of an add-on (e.g. which buttons are part of the add-on toolbar and which command URL should they execute). The "ProtocolHandler.xcu" contains the association between the command URL schema and the implementation which executes the URL.


<?xml version='1.0' encoding='UTF-8'?>
<oor:component-schema oor:name="Addons" oor:package="org.openoffice.Office"
xml:lang="en-US" xmlns:oor="http://openoffice.org/2001/registry"; xmlns:xs="
http://www.w3.org/2001/XMLSchema"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
   <templates>
       <group oor:name="ToolBarItem">
           <prop oor:name="URL" oor:type="xs:string"/>
           <prop oor:name="Title" oor:type="xs:string"
oor:localized="true"/>
           <prop oor:name="ImageIdentifier" oor:type="xs:string"/>
           <prop oor:name="Target" oor:type="xs:string"/>
           <prop oor:name="Context" oor:type="xs:string"/>
       </group>
       <group oor:name="UserDefinedImages">
           <prop oor:name="ImageSmall" oor:type="xs:hexBinary"/>
           <prop oor:name="ImageBig" oor:type="xs:hexBinary"/>
           <prop oor:name="ImageSmallHC" oor:type="xs:hexBinary"/>
           <prop oor:name="ImageBigHC" oor:type="xs:hexBinary"/>
           <prop oor:name="ImageSmallURL" oor:type="xs:string"/>
           <prop oor:name="ImageBigURL" oor:type="xs:string"/>
           <prop oor:name="ImageSmallHCURL" oor:type="xs:string"/>
           <prop oor:name="ImageBigHCURL" oor:type="xs:string"/>
       </group>
       <group oor:name="Images">
           <prop oor:name="URL" oor:type="xs:string"/>
           <node-ref oor:name="UserDefinedImages"
oor:node-type="UserDefinedImages"/>
       </group>
       <set oor:name="ToolBarItems" oor:node-type="ToolBarItem"/>
   </templates>
   <component>
       <group oor:name="AddonUI">
           <set oor:name="Images" oor:node-type="Images"/>
           <set oor:name="OfficeToolBar" oor:node-type="ToolBarItems"/>
       </group>
   </component>
</oor:component-schema>

<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry";
xmlns:xs="http://www.w3.org/2001/XMLSchema"; oor:name="Addons" oor:package="
org.openoffice.Office">
   <node oor:name="AddonUI">
       <node oor:name="OfficeToolBar">
           <node oor:name="org.openoffice.Office.addon.example"
oor:op="replace">
               <node oor:name="m1">
                   <prop oor:name="URL" oor:type="xs:string">
                       <value>org.openoffice.Office.addon.example:Function1
</value>
                   </prop>
                   <prop oor:name="Title" oor:type="xs:string">
                       <value/>
                       <value xml:lang="en-US">Function 1</value>
                       <value xml:lang="de">Funktion 1</value>
                   </prop>
                   <prop oor:name="Target" oor:type="xs:string">
                       <value>_self</value>
                   </prop>
                   <prop oor:name="Context" oor:type="xs:string">
                       <value>com.sun.star.text.TextDocument</value>
                   </prop>
               </node>
           </node>
       </node>
   </node>
</oor:component-data>

Those are the examples, minus everything related to menus and help files.

I created a toolbar in OOo and I had hoped that I would be able to just grab
the code that I found in C:\Documents and Settings\MyUserName\Application
Data\OpenOffice.org2\user\config\soffice.cfg\modules\swriter\toolbar\custom_toolbar_1.xml

Add-ons uses a completely different mechanism to describe their user interface. Therefore you cannot use a plain toolbar xml file from that folder. Plain toolbar xml files just contain the command every button should execute. The Addons.xcu file contains more properties which makes sense for add-ons, e.g. Context, Title, UserDefinedImages, ...



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD
OfficeDocument 1.0//EN"
"toolbar.dtd">
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar";
xmlns:xlink="http://www.w3.org/1999/xlink"; toolbar:uiname="ETUC">
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertETUCLogo?language=Basic&amp;location=application"
toolbar:text="Insert Logo" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertETUCLogo?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertFooterFrame?language=Basic&amp;location=application"
toolbar:text="Insert Footer" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertFooterFrame?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertEurDate?language=Basic&amp;location=application"
toolbar:text="Date Fr" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertEurDate?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertUSDate?language=Basic&amp;location=application"
toolbar:text="Date En" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertUSDate?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertPageBreak?language=Basic&amp;location=application"
toolbar:text="Saut de page" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertPageBreak?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertConcernTable?language=Basic&amp;location=application"
toolbar:text="concern." toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertConcernTable?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.Insert2SignaturesTable?language=Basic&amp;location=application"
toolbar:text="2 sign." toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.Insert2SignaturesTable?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertAnnexes?language=Basic&amp;location=application"
toolbar:text="annex" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertAnnexes?language=Basic&amp
;location=application"/>
   <toolbar:toolbaritem xlink:href="
vnd.sun.star.script:ETUC.ETUC.InsertCc?language=Basic&amp;location=application"
toolbar:text="Cc:" toolbar:helpid="
vnd.sun.star.script:ETUC.ETUC.InsertCc?language=Basic&amp
;location=application"/>
</toolbar:toolbar>

and here: C:\Documents and Settings\MyUserName\Application
Data\OpenOffice.org2\user\config\soffice.cfg\modules\swriter\images\sc_imagelist.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE image:imagecontainer PUBLIC "-//OpenOffice.org//DTD OfficeDocument
1.0//EN" "image.dtd">
<image:imagescontainer xmlns:image="http://openoffice.org/2001/image";
xmlns:xlink="http://www.w3.org/1999/xlink";>
   <image:images xlink:type="simple" xlink:href="Bitmaps/sc_userimages.png"
image:maskcolor="#0" image:maskmode="maskcolor">
       <image:entry image:bitmap-index="0" image:command="
vnd.sun.star.script:ETUC.ETUC.InsertPageBreak?language=Basic&amp
;location=application"/>
       <image:entry image:bitmap-index="1" image:command="
vnd.sun.star.script:ETUC.ETUC.InsertFooterFrame?language=Basic&amp
;location=application"/>
       <image:entry image:bitmap-index="2" image:command="
vnd.sun.star.script:ETUC.ETUC.InsertEurDate?language=Basic&amp
;location=application"/>
       <image:entry image:bitmap-index="3" image:command="
vnd.sun.star.script:ETUC.ETUC.InsertUSDate?language=Basic&amp
;location=application"/>
       <image:entry image:bitmap-index="4" image:command="
vnd.sun.star.script:ETUC.ETUC.Insert2SignaturesTable?language=Basic&amp
;location=application"/>
       <image:entry image:bitmap-index="5" image:command="
vnd.sun.star.script:ETUC.ETUC.InsertETUCLogo?language=Basic&amp
;location=application"/>
   </image:images>
</image:imagescontainer>

I even found this:

C:\Documents and Settings\MyUserName\Application
Data\OpenOffice.org2\user\config\soffice.cfg\modules\swriter\images\Bitmaps\sc_userimages.png
The sc_userimages.png contains all user defined images. It's possible that this file contains more images than just your toolbar. The images are added horizontally to this single image file. You have to load the image file, cut every bitmap and store it (using the bitmap file format!) separately. Put your single images into your uno package file and add references to them in the "UserDefinedImages" set.

<node oor:name="AddonUI">
 <node oor:name="Images">
  <node oor:name="com.etuc.comp.addon.image1" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string"> <value>vnd.sun.star.script:ETUC.ETUC.InsertETUCLogo?language=Basic&amp;location=application</value>
   </prop>
   <node oor:name=”UserDefinedImages”>
    <prop oor:name=”ImageSmallURL”>
     <value>%origin%/insertetuclogo.bmp</value>
    </prop>
   </node>
  </node>
  ...
 </node>
</node>


containing all the icons I used for the toolbar. How do I convert that to a
value that can be used as follows:

<node oor:name="UserDefinedImages">
                   <prop oor:name="ImageSmall">
<value>424df80000000000000076000000280000001000000010000000010004000000000000000000120b0000120b000000000000000000000000ff0000ffff0000ff0000ffff0000ff000000ff00ff00ffffff00c0c0c0008080800000000000000080000080800000800000808000008000000080008000cccccccccccccccc2c266b181b666c2c5cc66b818b6665c555566b181b66655555566b818b66655555566b181b6665555a8666bbb6668a55a0a866666668a0a5000a8666668a000a6000a86668a000a556000a868a000a55556000a8a000a5555556000a000a55555555600000a55555555556000a55555555555560a55555550000</value>
                   </prop>
                   <prop oor:name="ImageSmallHCURL">
                       <value>%origin%/function1.bmp</value>
                   </prop>
               </node>





I'm starting to doubt that I'm smart enough for this stuff. It's great that
there is documentation, but I would be nice to find out what needs to be
saved in which files and it would be great to have an easy way to get from
what OOo generates to work with to what is expected for this uno.pkgstructure.

I think you are a little bit overwhelmed by the new configuration stuff. The old way with the xml file looks a lot simpler. If you understand how all the parts work together than it's not so complicated.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to