StarOffice 8 Administration Guide
只搜尋這本書
查看這本書:
以 PDF 格式下載這本書 (813 KB)

Chapter 2 Customizing StarOffice on a Network

This chapter describes how to use custom macros, templates, and AutoText in a network installation of StarOffice. The chapter also describes how to disable the StarOffice registration wizard as well as how to configure StarOffice to work with an email client.

Using Custom StarOffice Basic Macros and Libraries

StarOffice Basic is a programming language that you can use to automate tasks in StarOffice. StarOffice Basic macros are stored in modules which in turn are stored in libraries. Libraries also act as container for dialog boxes that you create in StarOffice Basic. You can store Basic libraries in any directory that a user can access.

For information on how to create StarOffice Basic macros, see the StarOffice 8 Programming Guide for BASIC.

About StarOffice Basic Libraries and Modules

The default StarOffice Basic libraries are located in the <StarOffice installation>/share/basic directory. A library contains the following files:

script.xlb

An XML file that contains the names of the modules in the library.

dialog.xlb

An XML file that contains the names OF dialog boxes in the library.

*.xba

An XML file that stores the StarOffice Basic source code for a single StarOffice Basic module. The name of the file corresponds to the name of the module.

*.xdl

An XML file that stores the dialog elements of a StarOffice Basic dialog. The name of the file corresponds to the name of the dialog.

*.pba

A StarOffice Basic module which is protected with a password, that is, the source code is encrypted. The name of the file corresponds to the name of the module.

About StarOffice Basic Configuration Files

The script.xlc and dialog.xlc configuration files list the location of StarOffice Basic libraries and dialogs. These files are in the <StarOffice installation>/user/basic/ directory which also contains the default Standard StarOffice Basic library as well as the user-defined libraries.


Caution – Caution –

You cannot change the location of the script.xlc and dialog.xlc configuration files.


The XML-based script.xlc file includes a list of all Basic libraries that are available to StarOffice. The following tags are used:


Example 2–1 Sample StarOffice Basic Configuration File

The following XML code is for a script.xlc configuration file for StarOffice Basic libraries. The only difference between this file and a dialog.xlc file is that the xlink:href tag points to the script.xlb file of a library instead of the dialog.xlb file.

<?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:///.../user/basic/Standard/script.xlb/" 
 xlink:type="simple" library:link="false"/>

<library:library library:name="FormWizard" 
 xlink:href="file:///.../share/basic/FormWizard/script.xlb/" 
 xlink:type="simple" library:link="true" library:readonly="false"/>
</library:libraries>
library:name

Specifies the name of the StarOffice Basic library

xlink:href

Specifies the URL of the script.xlb file for the library. The URL must begin with the file:/// notation.


Note –

You do not need to specify a value for the xlink:href tag if the library is in the <user installation directory>/user/basic directory of the user installation.


xlink:type

This tag, which is required by the xlink:href tag, must be set to simple.

library:link

Specifies that the entry is a link to a library that is not in the default library location. The default location for StarOffice Basic libraries is <user installation directory>/user/basic. If you only use the default location for the libraries, set the value of this tag to false. For all other libraries, set the value of this tag to true.

library:readonly

Specifies whether a library is read-only. Set the value of this tag to true for read-only access.


Distributing StarOffice Basic Libraries

You can make custom StarOffice Basic libraries available to existing StarOffice installations or new installations only.

程序To Make a Custom StarOffice Basic Library Available to All Users on a Network

Before You Begin

Use StarOffice to create a custom library as well as the macros in the library.

Steps
  1. As root, copy the custom library from the user installation where you created the library to the StarOffice server installation.

    cp -r <StarOffice user installation directory>/user/basic/custom library <StarOffice installation directory>/share/basic/


    Note –

    On Windows, the location of the custom library that you created is C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\custom library.


  2. In a text editor, open the script.xlc configuration file for the user installation and add a link to the script.xlb configuration file for the library.

    Use the following syntax for the link:

    <library:library library:name="Library Name"
    xlink:href="$(USER)/basic/Library Name/script.xlb/"
    xlink:type="simple" library:link="true" library:readonly="false"/>
    • On Solaris and Linux, open the <StarOffice user installation directory>/user/basic/script.xlc configuration file.

    • On Windows, open the C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\script.xlc configuration file.

  3. In a text editor, open the dialog.xlc configuration file for the user installation and add a link to the script.xlb configuration file for the library.

    Use the following syntax for the link:

    <library:library library:name="Library Name"
    xlink:href="$(USER)/basic/Library Name/dialog.xlb/"
    xlink:type="simple" library:link="false"/
    • On Solaris and Linux, open the <StarOffice user installation directory>/user/basic/dialog.xlc configuration file.

    • On Windows, open the C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\dialog.xlc configuration file.

  4. Restart StarOffice on the workstations.

程序To Make a Custom StarOffice Basic Library Available to a Single User

Steps
  1. Copy the custom library from the user installation where you created the library to the user installation where you want to deploy the library.

    • On Solaris and Linux, become root, and copy the library.

      cp -r <StarOffice user installation directory>/user/basic/custom library <StarOffice user installation directory>/user/basic/

    • On Windows, become a user with administrator privileges, and copy the library.

      The file name path for the library is C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\custom library

  2. In a text editor, open the script.xlc configuration file for the user installation and add a link to the script.xlb configuration file for the library.

    Use the following syntax for the link:

    <library:library library:name="Library Name"
    xlink:href="$(USER)/basic/Library Name/script.xlb/"
    xlink:type="simple" library:link="true" library:readonly="false"/>
    • On Solaris and Linux, open the <StarOffice user installation directory>/user/basic/script.xlc configuration file.

    • On Windows, open the C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\script.xlc configuration file.

  3. In a text editor, open the dialog.xlc configuration file for the user installation and add a link to the script.xlb configuration file for the library.

    Use the following syntax for the link:

    <library:library library:name="Library Name"
    xlink:href="$(USER)/basic/Library Name/dialog.xlb/"
    xlink:type="simple" library:link="false"/
    • On Solaris and Linux, open the <StarOffice user installation directory>/user/basic/dialog.xlc configuration file.

    • On Windows, open the C:\Documents and Settings\user id\Application Data\StarOffice 8\user\basic\dialog.xlc configuration file.

  4. Restart StarOffice.

程序To Install a Custom StarOffice Basic Library With a Macro

You can create a macros that installs a StarOffice Basic library from a StarOffice document.

Steps
  1. In Writer, create a custom StarOffice Basic library in a new document.

  2. Save the document.

  3. Create an installation macro.

    1. Choose Tools - Macros - Organize Macros - StarOffice Basic.

      The StarOffice Basic Macros dialog box opens.

    2. In the Macro from list, select your Writer document.

    3. In the Macro name box, enter a name from the installation macro.

    4. Click the New button.

      The BASIC IDE window opens.

    5. Enter the following code:

      Sub AddBasicLibrary
      	Dim SourceLibraryName As String, DestLibraryName As String
      	Dim oSrcLib As Object, oDestLib As Object, iCounter As Integer
      	Dim oLib As Object, oGlobalLib As Object
      	
      	' set these 2 variables to your lib name
      	SrcLibraryName = "TextLib" 
      	' The name of the library that contains the modules
      	DestLibraryName = "NewLib" 
      	' This library will be created and is the 
      	' destination for the modules from the source document.
      
      	oLib = BasicLibraries        ' For Basic libaries
      	oGlobalLib = GlobalScope.BasicLibraries
      	For iLib = 1 To 2 
      		If oGlobalLib.hasByName( DestLibraryName ) = False Then
      			oGlobalLib.createLibrary( DestLibraryName )
      		End If
      
      		If oLib.hasByName( SrcLibraryName ) Then
              oLib.loadLibrary( SrcLibraryName )
      		  	oSrcLib = oLib.getByName( SrcLibraryName )
      			sSrcModules = oSrcLib.getElementNames()
      			iCounter = lBound( sSrcModules() )
      			
      		  	while( iCounter <= uBound( sSrcModules() ) )
      				oDestLib = oGlobalLib.getByName(DestLibraryName)
      				If oDestLib.hasByName( sSrcModules(iCounter) ) = False 
      				Then
      					oDestLib.insertByName( sSrcModules(iCounter),
      					_ oSrcLib.getByName( sSrcModules(iCounter) ) )
      				End If
      				iCounter = iCounter + 1
      			wend
      		End If
      		
      		oLib = DialogLibraries   ' The same for the Dialog libraries
      		oGlobalLib = GlobalScope.DialogLibraries
      	Next iLib
      End Sub
    6. Replace the SrcLibraryName and DestLibraryName variables with the name of your library.

    7. Close the BASIC IDE window.

  4. Add a push button to the document.

    1. On the Tools toolbar, open the Controls toolbar, and click the Push Button icon.

    2. In your document, drag to draw the button.

  5. Assign the installation macro to a button event.

    1. Right-click the button, and choose Control.

    2. Click the Events tab.

    3. Click the ... next to a button event, for example, the Mouse button pressed event.

    4. In the Assign Macro dialog box, click the Assign button.

      The Macro Selector dialog box opens.

    5. In the Library list, select the library that contains the installation macro.

    6. In the Macro name list, select the installation macro.

    7. Click the OK button.

    8. In the Assign Macro dialog box, click the OK button.

  6. Save the document.

Using the StarOffice Package Manager

You can use the StarOffice Package Manager to add, to remove, to disable, to enable, and to export StarOffice packages. For example, you can use the Package Manager to add or to remove the following types of packages:

  • StarOffice Basic libraries

  • StarOffice dialog libraries

  • Universal Network Objects (UNO) components

    These components represent compiled software packages. UNO is the interface-based component model for StarOffice. For more information on this model, go to the UNO Development Kit project web site at: http://udk.openoffice.org.

  • Menu configuration data

  • Package bundles

    A package bundle is a *.zip archive file that contains one of more packages.


Note –

You cannot manage XSLT filters, language modules, or palettes with the Package Manager.


You can manage packages from a dialog box or a command-line.

Using the Package Manager Dialog Box

You can open the Package Manager dialog box from the Tools menu in any StarOffice Program. However, to add packages for all users of a StarOffice installation, you need to open the Package Manager dialog box from the command-line.

程序To Add a Package With the Package Manager Dialog Box

Steps
  1. Become root.

    • In UNIX and Linux, open a terminal, and type su.

    • In Windows, open a Command Prompt.

  2. Change to the <StarOffice installation directory>/Staroffice8/program directory.

  3. Type unopkg gui.

    The Package Manager dialog box opens.

  4. In the list of packages, select the package category that you want to add the package to.

  5. Click the Add button.

  6. Locate the package that you want to add, and then click the Open button.

程序To Remove a Package With the Package Manager Dialog Box

Steps
  1. Become root.

    • In UNIX and Linux, open a terminal, and type su.

    • In Windows, open a Command Prompt.

  2. Change to the <StarOffice installation directory>/Staroffice8/program directory.

  3. Type unopkg gui.

    The Package Manager dialog box opens.

  4. In the list of packages, select the package that you want to remove.

  5. Click the Remove button.

Using the unopkg Command to Manage Packages

You can manage packages from the command line. The syntax for the unopkg command is as follows:

unopkg add {v, f, log-file, shared} package-path | remove {v, f, log-file, shared} package-name | list {v, f, log-file, shared} package-name | reinstall {v, f, log-file, shared} | gui | -V | -h

add

Adds packages to a StarOffice installation.

remove

Removes packages from a StarOffice installation.

list

Displays information about the deployed packages.

reinstall

Reinstalls the deployed packages.

gui

Opens the Package Manager dialog box.

–V, – –version

Displays the version information for the unopkg command.

–h, – –help

Displays the help for the unopkg command.

-v, --verbose

Runs the command in verbose mode.

-f, --force

Overwrites existing packages that have the same names.

--log-file <filename>

Creates a log file. The default file name path for the log file is <cache-dir>/log.txt.

--shared

Expert feature: operate on shared installation deployment context; run only when no concurrent processes are running

Adding Template Files to a StarOffice Installation

You can make custom document templates to all or to individual users of a network installation of StarOffice network installation. You can also make specific directories for document templates available to these users.


Caution – Caution –

Do not give users write permission for template files.


程序To Add a Template For All Users of a StarOffice Network Installation

Steps
  1. Become root.

  2. Copy the template to the <StarOffice network installation directory>/share/template/ directory.

程序To Add a Template to a Workstation Installation of StarOffice

Steps
  1. Become root.

  2. Copy the template to the <StarOffice installation>/user/template/ directory on the workstation.

程序To Add a Template Directory to a StarOffice Installation

Steps
  1. In any StarOffice program, choose Tools – Options – StarOffice – Paths.

  2. In the list of default paths, select “Templates”, and then click the Edit button.

  3. In the Select Paths dialog box, click the Add button.

  4. Locate the template directory that you want to add and click the OK button.

  5. In the Select Paths dialog box, click the OK button.

  6. In the Options – StarOffice – Paths dialog box, click the OK button.

  7. Exit StarOffice.

    StarOffice saves the template path to the user installation directory/staroffice8/user/registry/data/org/openoffice/Office/Common.xcu configuration file.

  8. Copy the following code into the appropriate Common.xcu file.

    <node oor:name="Path">
      <node oor:name="Current">
       <prop oor:name="Template" oor:type="oor:string-list">
        <value>$(inst)/share/template/$(vlang)
    			$(user)/template new_template_directory
    		</value>
       </prop>
      </node>
     </node>
    • To make the template directory available to all users of the StarOffice network installation, copy the code into the StarOffice installation directory/share/registry/data/org/openoffice/Office/Common.xcu file.

    • To make the template directory available to a single user of a StarOffice network installation, copy the code into the user installation directory/user/registry/data/org/openoffice/Office/Common.xcu file.

Adding AutoText Files to a StarOffice Network Installation

StarOffice saves AutoText entries to categories in *.bau files. You can make custom AutoText files available to all or to individual users of a network installation of StarOffice network installation.


Note –

For information on how to create AutoText entries, search for the keyword "AutoText" in the online help for StarOffice Writer.


程序To Add a AutoText Files For All Users Of a StarOffice Network Installation

Steps
  1. Become root.

  2. Copy the AutoText *.bau file to the <StarOffice network installation directory>/share/autotext/ directory.

程序To Add AutoText Files to a Workstation Installation of StarOffice

Steps
  1. Become root.

  2. Copy the AutoText *.bau file to the <StarOffice installation>/user/autotext/ directory on the workstation.

程序To Add an AutoText Directory to a StarOffice Installation

Steps
  1. In any StarOffice program, choose Tools – Options – StarOffice – Paths.

  2. In the list of default paths, select “AutoText”, and then click the Edit button.

  3. In the Select Paths dialog box, click the Add button.

  4. Locate the directory that contains the AutoText *.bau files that you want to add and click the OK button.

  5. In the Select Paths dialog box, click the OK button.

  6. In the Options – StarOffice – Paths dialog box, click the OK button.

  7. Exit StarOffice.

    StarOffice saves the AutoText path to the user installation directory/StarOffice8/user/registry/data/org/openoffice/Office/Common.xcu configuration file.

  8. Copy the following code into the appropriate Common.xcu file.

    <node oor:name="Path">
      <node oor:name="Current">
       <prop oor:name="AutoText" oor:type="oor:string-list">
        <value>$(inst)/share/autotext/$(vlang)
    			$(user)/autotext new_autotext_directory
    		</value>
       </prop>
      </node>
     </node>
    • To make the AutoText directory available to all users of the StarOffice network installation, copy the code into the StarOffice installation directory/share/registry/data/org/openoffice/Office/Common.xcu file.

    • To make the AutoText directory available to a single user of a StarOffice network installation, copy the code into the user installation directory/user/registry/data/org/openoffice/Office/Common.xcu file.

Deactivating the StarOffice Registration Wizard

The first time that you start StarOffice, a wizard opens to guide you through the registration process. You can also start this process if you choose the Help – Registration menu item in any StarOffice program. If you want, you can use a configuration file to deactivate the registration wizard as well as the Registration menu command.

程序To Deactivate the Registration Wizard at the First Startup of StarOffice

Before You Begin

You can only perform this task during the first start up of StarOffice after you install StarOffice.

Steps
  1. Start StarOffice.

    The Registration Wizard opens.

  2. Follow the instructions.

  3. On the step 3 User Name page, leave the user information boxes empty.

  4. On the step 4 Registration page, select I do not want to register, and then click the Finish button.

  5. Create an archive file of the StarOffice 8 user directory.

    • On Windows XP, create a ZIP file of the C:\Documents and Settings\username\Application Data\StarOffice 8 directory.

    • On UNIX and Linux, create a TAR file of the home/.staroffice8 directory.

  6. Unpack the archive into the user directories where you want to deactivate the Registration Wizard.

    • On Windows XP, unpack the contents of the archive to C:\Documents and Settings\username\Application Data\StarOffice 8

    • On UNIX and Linux, unpack the contents of the archive to home/.staroffice8 directory.

Accessing Email Clients

In StarOffice, you can send the current document as an email attachment.

In Solaris and Linux, the email client must support the attachment of a document to an email message through a command-line. In Windows, the email client must support the Messaging Application Program Interface (MAPI).

StarOffice officially supports the following email clients on Solaris, Linux, and Windows:

  • Mozilla 1.4 and higher

  • Netscape 7.1 and higher

Configuring StarOffice to Use an Email Client on Solaris and Linux

You need to specify the email client that you want to use in the StarOffice Tools menu.

程序To Specify the Email Client to Use With StarOffice in Solaris and Linux

Steps
  1. In StarOffice Writer, choose Tools – Options – Internet – E-mail.

  2. Click the ... next to the E-mail program box.

  3. Locate the email client that you want to use and click the Open button.

Configuring StarOffice to Use an Email Client on Windows

You do not need to configure StarOffice to use an email client in Windows. StarOffice automatically uses the default email client, so long as the client uses the Messaging Application Program Interface (MAPI).


Note –

StarOffice uses the senddoc.exe program in the program directory of the StarOffice installation to access the MAPI email client.