Class ExternalApps

java.lang.Object
org.openoffice.da.comp.writer2latex.ExternalApps

public class ExternalApps extends Object
This class manages and executes external applications used by the Writer2LaTeX toolbar. These include TeX and friends as well as viewers for the various backend formats. The registry is used for persistent storage of the settings.
  • Field Details

  • Constructor Details

    • ExternalApps

      public ExternalApps(com.sun.star.uno.XComponentContext xContext)
      Construct a new ExternalApps object with empty content
  • Method Details

    • getUIAppName

      public static String getUIAppName(String sName)
      Return the localized name for an external app to use in the UI (only the viewers has a separate UI name)
      Parameters:
      sName - the app name
      Returns:
      the UI name
    • setProcessingLevel

      public void setProcessingLevel(short nLevel)
      Set the desired processing level (0: export only, 1: export and build, 2: export, build and preview)
      Parameters:
      nLevel - the desired level
    • getProcessingLevel

      public short getProcessingLevel()
      Get the desired processing level (0: export only, 1: export and build, 2: export, build and preview)
      Returns:
      the level
    • isViewer

      public boolean isViewer(String sAppName)
    • setApplication

      public void setApplication(String sAppName, String sExecutable, String sOptions)
      Define an external application
      Parameters:
      sAppName - the name of the application to define
      sExecutable - the system dependent path to the executable file
      sOptions - the options to the external application; %s will be replaced by the filename on execution
    • getApplication

      public String[] getApplication(String sAppName)
      Get the definition for an external application
      Parameters:
      sAppName - the name of the application to get
      Returns:
      a String array containing the system dependent path to the executable file as entry 0 and the parameters as entry 1 returns null if the application is unknown
    • setUseDefaultApplication

      public void setUseDefaultApplication(String sAppName, boolean bUseDefault)
      Define to use the system's default for an external application. This is only possible if the application is a viewer, otherwise setting the value to true will be ignored
      Parameters:
      sAppName - the name of the application
      bUseDefault - flag defining whether or not to use the default
    • getUseDefaultApplication

      public boolean getUseDefaultApplication(String sAppName)
      Get the setting to use the system's default application
      Parameters:
      sAppName - the name of the application
      Returns:
      true if the system's default should be used, false if not or if the application is unknown
    • execute

      public int execute(String sAppName, String sFileName, File workDir, Map<String,String> env, boolean bWaitFor)
      Execute an external application
      Parameters:
      sAppName - the name of the application to execute (ignored for default apps)
      sFileName - the file name to use
      workDir - the working directory to use
      env - map of environment variables to set (or null if no variables needs to be set, ignored for default apps)
      bWaitFor - true if the method should wait for the execution to finish (ignored for default apps)
      Returns:
      error code
    • execute

      public int execute(String sAppName, String sCommand, String sFileName, File workDir, Map<String,String> env, boolean bWaitFor)
      Execute an external application
      Parameters:
      sAppName - the name of the application to execute
      sCommand - subcommand/option to pass to the command
      sFileName - the file name to use
      workDir - the working directory to use
      env - map of environment variables to set (or null if no variables needs to be set)
      bWaitFor - true if the method should wait for the execution to finish
      Returns:
      error code
    • load

      public void load()
      Load the external applications from the registry
    • save

      public void save()
      Save the external applications to the registry