Process of creating a macro and assigning it to an event


Assign a macro that was created and saved in the Standard Library of OpenOffice called Test().
The directory soffice.cfg is created in the user/config directory once you assign a macro to a key.
An xml file per context is created and contains all the bindings.
Because the macro is in the Standard Library of OpenOffice and that the binding is only applied to a key in Writer:
The file writerkeybinding.xml is created


Content of writerkeybinding.xml


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE accel:acceleratorlist PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "accelerator.dtd">
<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink">
...
<accel:item accel:code="KEY_F10" xlink:href="macro:///Standard.Module1.Alexis()"/>
...
</accel:acceleratorlist>


Content of Accelerator.dtd


<!ENTITY % boolean "(true|false)">


<!ELEMENT accel:acceleratorlist (accel:item*)>
<!ATTLIST accel:acceleratorlist
xmlns:accel CDATA #FIXED "http://openoffice.org/2001/accel"
xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"
>


<!ELEMENT accel:item EMPTY>
<!ATTLIST accel:item
accel:code CDATA #REQUIRED
accel:shift %boolean; "false"
accel:mod1 %boolean; "false"
accel:mod2 %boolean; "false"
xlink:href CDATA #REQUIRED
>


The content of user/basic is formed by a directory per library you modified (in that case Standard was modified) and 2 files .xlc.
Script.xlc is the file that will be explained:


Content of the file script.xlc


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
<library:library library:name="Standard" xlink:href="file:///home/al91857/StarOffice6.0/user/basic/Standard/script.xlb/" xlink:type="simple" library:link="false"/>
<library:library library:name="WebWizard" xlink:href="file:///usr/dist/share/staroffice,v6.0/share/basic/WebWizard/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
...
</library:libraries>


Content of Libraries.dtd


<!ENTITY % boolean "(true|false)">


<!ELEMENT library:libraries (library:library)*>
<!ATTLIST library:libraries
xmlns:library CDATA #FIXED "http://openoffice.org/2000/library"
xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"
>


<!ELEMENT library:library EMPTY>
<!ATTLIST library:library
library:name CDATA #REQUIRED
xlink:href CDATA #IMPLIED
xlink:type CDATA #IMPLIED
library:link %boolean; #REQUIRED
library:readonly %boolean; #IMPLIED
>


You can see that the xlink:href of the library:name="Standard" is locating as file in the home directory because I modified that library.


Content of the file script.xlb in file:///home/al91857/StarOffice6.0/user/basic/Standard


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false">
<library:element library:name="Module1"/>
</library:library>


Content of Library.dtd


<!ENTITY % boolean "(true|false)">


<!ELEMENT library:library (library:element)*>
<!ATTLIST library:library
xmlns:library CDATA #FIXED "http://openoffice.org/2000/library"
library:name CDATA #REQUIRED
library:readonly %boolean; #REQUIRED
library:passwordprotected %boolean; #REQUIRED
>


<!ELEMENT library:element EMPTY>
<!ATTLIST library:element
library:name CDATA #REQUIRED
>


Content of the file where my macro was saved: Module1.xba


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****


Sub Main


End Sub


Sub Alexis
print &quot;alexis&quot;
End Sub</script:module>


Content of Module.dtd


<!ELEMENT script:module (#PCDATA)>
<!ATTLIST script:module
xmlns:script CDATA #FIXED "http://openoffice.org/2000/script"
script:name CDATA #REQUIRED
script:language CDATA #REQUIRED
>


When you save the document including the macro, everything is in a Zip file with the same hierarchy than explained above.


The file hierarchy is:


Archive: test.sxw
testing: content.xml
testing: Basic/Standard/Module1.xml
testing: Basic/Standard/script-lb.xml
testing: Basic/script-lc.xml
testing: styles.xml
testing: meta.xml
testing: settings.xml
testing: META-INF/manifest.xml


So the script-lb.xml file is the equivalent to the script.xlb file explained above
The script-lc.xml file is the equivalent to the script.xlc file explained Above.