home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / messenger.jar / content / messenger / msgPrintEngine.js < prev    next >
Text File  |  2001-02-14  |  3KB  |  97 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  * The contents of this file are subject to the Netscape Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/NPL/
  6.  * 
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  * 
  12.  * The Original Code is Mozilla Communicator client code, released
  13.  * March 31, 1998.
  14.  * 
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation. Portions created by Netscape are
  17.  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  */
  20.  
  21. /* This is where functions related to the print engine are kept */
  22.  
  23. /* globals for a particular window */
  24. var printEngineContractID      = "@mozilla.org/messenger/msgPrintEngine;1";
  25. var printEngineWindow;
  26. var printEngine;
  27.  
  28. /* Functions related to startup */
  29. function OnLoadPrintEngine()
  30. {
  31.   PrintEngineCreateGlobals();
  32.     InitPrintEngineWindow();
  33.   printEngine.StartPrintOperation();    
  34. }
  35.  
  36. function OnUnloadPrintEngine()
  37. {
  38. }
  39.  
  40. function PrintEngineCreateGlobals()
  41. {
  42.     /* get the print engine instance */
  43.     printEngine = Components.classes[printEngineContractID].createInstance();
  44.     printEngine = printEngine.QueryInterface(Components.interfaces.nsIMsgPrintEngine);
  45. }
  46.  
  47. function InitPrintEngineWindow()
  48. {
  49.   /* Tell the nsIPrintEngine object what window is rendering the email */
  50.   printEngine.SetWindow(window);
  51.  
  52.   // See if we got arguments.
  53.   // Window was opened via window.openDialog.  Copy argument
  54.   // and perform compose initialization 
  55.   //
  56.   if ( window.arguments && window.arguments[0] != null ) 
  57.   {
  58.     var numSelected = window.arguments[0];
  59.     var uriArray = window.arguments[1];
  60.     var statusFeedback = window.arguments[2];
  61.  
  62.     printEngine.SetStatusFeedback(statusFeedback);
  63.  
  64.     if (numSelected > 0)
  65.     {
  66.       printEngine.SetPrintURICount(numSelected);
  67.       for(var i = 0; i < numSelected; i++)
  68.         {
  69.         dump(uriArray[i]);
  70.         printEngine.AddPrintURI(uriArray[i]);      
  71.         dump("\n");
  72.         }        
  73.       }
  74.   }
  75. }
  76.  
  77. function ClearPrintEnginePane()
  78. {
  79.   if (window.frames["printengine"].location != "about:blank")
  80.       window.frames["printengine"].location = "about:blank";
  81. }
  82.  
  83. function StopUrls()
  84. {
  85.     printEngine.StopUrls();
  86. }
  87.  
  88. function PrintEnginePrint()
  89. {
  90.   var left = screen.width + 50;
  91.   var top = screen.height + 50;
  92.   printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
  93.                                                         "",
  94.                                                         "chrome,dialog=no,all",
  95.                                                         "left="+left+",top="+top+")");
  96. }
  97.