package izyndoc;

import com.jacob.com.*;

/**
 * <p>Title: Word</p>
 * <p>Description: Create an ActiveXComponent for Microsoft Word
 * and wrap Word functions and properties.</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: Izyn Technologies</p>
 * @author Richard Norton - original framework sourced from
 * <a href="http://forum.java.sun.com/thread.jsp?forum=40&thread=215469&tstart=135&trange=15">sun forum</a>
 * @version 1.0
 */

public class Word extends com.jacob.activeX.ActiveXComponent
{
  public final static Integer DO_NOT_SAVE   = new Integer(0);
  public final static Integer SAVE          = new Integer(-1);
  public final static Integer PROMPT_SAVE   = new Integer(-2);
  public final static Boolean FALSE = new Boolean(false);
  public final static Boolean TRUE = new Boolean(true);

  /**
   * Constructor.
   */
  public Word()
  {
    super("Word.Application");
  }

  /**
   * Gets the Property Documents.
   * This is an Object that has a number of capabilities,
   * such as Open, and also holds the Document collection.
   *
   * @return WordDocuments
   */
  public WordDocuments getDocuments()
  {
    return new WordDocuments(this.getProperty("Documents").toDispatch());
  }

  /**
   * Bring the Application to the foreground (in to focus).
   *
   */
  public void activate()
  {
    this.call(this, "Activate");
  }

  /**
   * Quit the Application.
   *
   * @param options Variant[]
   */
  public void quit(Variant[] options)
  {
    this.invoke("Quit", options);
  }

  /**
   * Change Word visible property.
   *
   * @param isVisible boolean
   */
  public void setVisible(boolean isVisible)
  {
    this.setProperty("Visible", new Variant(isVisible));
  }

  /**
   * Get Word visible property.
   *
   * @return boolean
   */
  public boolean getVisible()
  {
    return this.getProperty("Visible").toBoolean();
  }

  /**
   * Get Word version property.
   *
   * @return String
   */
  public String getVersion()
  {
    return this.getProperty("Version").toString();
  }
}