Building the Scripting Framework  for  OpenOffice.org

Contents:

  1. Requirements
  2. CVS
  3. Setting up environment
  4. Modifying modules
  5. Building
  6. Create package
  7. Manual install


Requirements:

Projects to get from CVS

Backup your unoil and offapi modules and then checkout the following:

Modules to be checkout from CVS head:
If you only have solvers, you will also need to checkout the following modules on a tag that is appropriate to the release, you are building for:

Setting up build environment for Scripting

Assumption: That you have a build environment set-up to build OpenOffice.org or components for OpenOffice.org, otherwise please read the guide on Downloading and Building the Source

If you have configured your environment with Java and Ant, please skip on to ...... , otherwise you will need to re-run the configure script from the config_office project  and include the options --with-jdk-home=<PATH TO JAVA>  --with-ant-home=<PATH TO ANT> and source or run the environment set-up script.

NOTE: If configure can not get Ant, after you have sourced or run the environment set-up script,  you will need add all jarfiles under <PATH TO ANT>/lib to your $CLASSPATH

Modifying offapi, unoil and scripting modules for building

You will need to modify the offapi and unoil modules so that the services and interfaces for scripting are available.

offapi  module:

  1. Ensure that you have the drafts/com/sun/star/script directory under the offapi module, if you don't, you will need to check it out from CVS head
  2. Modify the prj/build.lst, you will need to add the following lines
  3. Modify the util/makefile.mk and add the following to UNOIDLDBFILES list 
    1. $(UCR)$/dcssscriptframework.db \ 
    2. $(UCR)$/dcsssfprovider.db \ 
    3. $(UCR)$/dcsssfstorage.db

unoil module:

  1. Ensure that you have the drafts/com/sun/star/script directory under the unoil module, if you don't, you will need to check it out from CVS head
  2. Modify the makefile.mk in the top level directory of the module -
    1. Change the line RDB  =  $(SOLARBINDIR)/offapi.rdb to RDB = $(PRJ)$/..$/offapi$/$(INPATH)$/ucr$/offapi.db
  3. Modify prj/build.lst
    1. Add the following line: ul  unoil\drafts\com\sun\star\script\framework      nmake   -   all ul_scriptf_drafts ul_ucb ul_frame NULL            
    2. Add ul_scriptf_drafts to the last line before NULL

scripting module:

  1. Remove the comments from the lines in source/cppumaker.mk:
    1. UNOUCRDEP=$(PRJ)/../offapi/$(INPATH)/ucr/offapi.db $(SOLARBINDIR)$/udkapi.rdb $(SOLARBINDIR)$/offapi.rdb
    2. UNOUCRRDB=$(PRJ)/../offapi/$(INPATH)/ucr/offapi.db $(SOLARBINDIR)$/udkapi.rdb $(SOLARBINDIR)$/offapi.rdb
  2. Comment out the lines in source/cppumaker.mk
    1. UNOUCRDEP=$(SOLARBINDIR)$/udkapi.rdb
    2. UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb
  3. Remove the comment from the following line in java/build.xml:
    1. <!-- <pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/> -->
  4. Comment out the line in java/build.xml:
    1. <pathelement location="${solar.jar}/unoil.jar"/>

Building scripting

  1. Execute build in the offapi module
  2. Execute build in the unoil module
  3. Execute build in the scripting module

Creating the UNO Package:

Please read the Developer's Guide for more information on UNO packages
  1. Create a separate directory ($pkg)
  2. In this directory, create directories called $pkg/<PLATFORM>.plt and $pkg/skip_registration (Where <PLATFORM> is like linux_x86)
  3. NOTE: A list of supported directories is available in the source file desktop/source/pkgchk/pkgchk_packages.cxx, you may need to modify this, if your platform is not supported
  4. Copy in the libraries from scripting/<platform>/lib to $pkg/<PLATFORM>.plt
  5. Copy in ScriptRuntimeForJava.jar from scripting/<platform>/class into the top level directory, $pkg
  6. Copy in unoil.jar from $pkg/unoil/<platform>/class  to skip_registration directory
  7. Merge the following registries from offapi/<platform>/ucr into one registry called ooscript.rdb under the top level directory, $pkg
    1. dcssscriptframework.db
    2. dcsssfprovider.db
    3. dcsssfstorage.db
  8. Now, zip up all files in this directory, $pkg

Manual Installation of the Scripting Framework

  1. Copy the zip file into your OpenOffice installation under the user/uno_packages directory 
  2. In the program directory, run pkgchk on the zip file
  3. Copy from the solver ($SRC_ROOT)/solver/643/<platform>/bin/regsingleton to your OpenOffice installation under the program directory
  4. Execute the following: 
    1. ./regsingleton <OpenOffice Path>/user/uno_packages/cache/services.rdb drafts.com.sun.star.script.framework.storage.theScriptStorageManager=drafts.com.sun.star.script.framework.storage.ScriptStorageManager
    2. ./regsingleton <OpenOffice Path>/user/uno_packages/cache/services.rdb drafts.com.sun.star.script.framework.theScriptRuntimeForJava=drafts.com.sun.star.script.framework.ScriptRuntimeForJava
  5. Modify the the ProtocolHandler.xcu file under <OpenOffice Path>/share/registry/data/org/openoffice/Office/, add the following lines:
    1. <node oor:name="com.sun.star.comp.ScriptProtocolHandler" oor:op="replace">
                              <prop oor:name="Protocols">
                                      <value>script:*</value>
                              </prop>
                      </node>
      Under the HandlerSet Tag
Unzip HighlightTextParcel.sxp from scripting/examples/java into <OpenOffice Path>/user, this should create a directory under user  called Scripts/java/HighlightText

Now, run OpenOffice and under the Tools->Configure menu add a new menu which is bound to the macro Standard.Main, then shut down OpenOffice and modify the file <OpenOffice>/user/config/soffice.cfg/writermenubar.cfg and change macro://Standard.main() to script://HighlightText.showForm. Start OpenOffice again and select the menu item you have added, this should bring up a Java dialog box call HighlightText

If you have any problems, please post your problem to dev@framework.openoffice.org