/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Verbosio XML editor.
 *
 * The Initial Developer of the Original Code is
 * Alexander J. Vincent <ajvincent@gmail.com>.
 * Portions created by the Initial Developer are Copyright (C) 2005
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"
#include "nsITransactionManager.idl"
#include "nsITransactionListener.idl"

interface nsIDOMXULElement;
interface xeIBaseURIMap;
interface xeIDocumentWrapper;
interface xeITransaction;
interface xeIEntityManager;

[scriptable, uuid(acefcc56-0205-405d-b71b-a5ec53835826)]
interface xeIDocumentPack : nsISupports
{
  /* A common transaction manager for all document wrappers.
     If null, each document wrapper uses its own transaction manager.
   */
  readonly attribute nsITransactionManager txmgr;

  /* Pending transaction for a document.  Only one pending action per pack. */
  attribute xeITransaction pendingAction;

  /* Nesting transaction listener applied for changes to documents in
   * the pack.  The pack in question may not care; this may be null.
   */
  readonly attribute nsITransactionListener txlistener;

  /**
   * The XML entity manager for the document.
   */
  readonly attribute xeIEntityManager entityManager;

  /**
   * Return true if a wrapper with a given path has been loaded.
   *
   * @param aPath URI path to look up a wrapper for.
   *
   * @return True if the document pack has already loaded the wrapper.
   */
  boolean hasWrapper(in ACString aPath);

  /**
   * Get a document wrapper for a particular path.
   *
   * @param aPath Path to the file (not necessarily local).
   */
  xeIDocumentWrapper getWrapper(in ACString aPath);

  /**
   * Add a document wrapper to the document pack.
   *
   * @param aWrapper Document wrapper to add.
   */
  void addWrapper(in xeIDocumentWrapper aWrapper);

  /**
   * Remove a document wrapper to the document pack.
   *
   * @param aWrapper Document wrapper to remove.
   */
  void removeWrapper(in xeIDocumentWrapper aWrapper);

  /**
   * Get the scope ID's of pack viewer panels this pack needs.
   */
  void getViewerScopes(out unsigned long aCount,
                       [retval, array, size_is(aCount)]
                       out wstring aValues);

  xeIDocumentWrapper               item(in unsigned long index);
  readonly attribute unsigned long length;

  // The initial path to the file used to initialize the document pack.
  readonly attribute ACString initialAppPath;

  /* Use a <xul:precondition/> element to set properties of this. */
  void initializeByPrecondition(in nsIDOMXULElement aPrecondition);

  /**
   * Initialize the document pack by a file URI.
   *
   * @param aLocalPath The file URI to pass in.
   */
  void initializeByFile(in ACString aLocalPath);

  /**
   * Get a base URI map for a file path (not necessarily local).
   *
   * @param aPath Path to the file.
   */
  xeIBaseURIMap getBaseURI(in ACString aPath);
};
