1 #include "nsISupports.idl"
2
3 interface nsIDOMDocument;
4 interface nsISHEntry;
5 interface nsIPrintSettings;
6
7
8 %{ C++
9 class nsIWidget;
10 class nsIDeviceContext;
11 struct nsRect;
12 %}
13
14 [ptr] native nsIWidgetPtr(nsIWidget);
15 [ptr] native nsIDeviceContextPtr(nsIDeviceContext);
16 [ref] native nsRectRef(nsRect);
17
18 [scriptable, uuid(89653afe-182f-401f-9f3c-8858d91387cd)]
19 interface nsIContentViewer : nsISupports
20 {
21
22 [noscript] void init(in nsIWidgetPtr aParentWidget,
23 in nsIDeviceContextPtr aDeviceContext,
24 [const] in nsRectRef aBounds);
25
26 attribute nsISupports container;
27
28 void loadStart(in nsISupports aDoc);
29 void loadComplete(in unsigned long aStatus);
30 boolean permitUnload();
31 void pageHide(in boolean isUnload);
32
33 /**
34 * All users of a content viewer are responsible for calling both
35 * close() and destroy(), in that order.
36 *
37 * close() should be called when the load of a new page for the next
38 * content viewer begins, and destroy() should be called when the next
39 * content viewer replaces this one.
40 *
41 * |historyEntry| sets the session history entry for the content viewer. If
42 * this is null, then Destroy() will be called on the document by close().
43 * If it is non-null, the document will not be destroyed, and the following
44 * actions will happen when destroy() is called (*):
45 * - Sanitize() will be called on the viewer's document
46 * - The content viewer will set the contentViewer property on the
47 * history entry, and release its reference (ownership reversal).
48 * - hide() will be called, and no further destruction will happen.
49 *
50 * (*) unless the document is currently being printed, in which case
51 * it will never be saved in session history.
52 *
53 */
54 void close(in nsISHEntry historyEntry);
55 void destroy();
56
57 void stop();
58
59 attribute nsIDOMDocument DOMDocument;
60
61 [noscript] void getBounds(in nsRectRef aBounds);
62 [noscript] void setBounds([const] in nsRectRef aBounds);
63
64 /**
65 * The previous content viewer, which has been |close|d but not
66 * |destroy|ed.
67 */
68 [noscript] attribute nsIContentViewer previousViewer;
69
70 void move(in long aX, in long aY);
71
72 void show();
73 void hide();
74
75 attribute boolean enableRendering;
76
77 attribute boolean sticky;
78
79 /*
80 * This is called when the DOM window wants to be closed. Returns true
81 * if the window can close immediately. Otherwise, returns false and will
82 * close the DOM window as soon as practical.
83 */
84
85 boolean requestWindowClose();
86
87 /**
88 * Attach the content viewer to its DOM window and docshell.
89 * @param aState A state object that might be useful in attaching the DOM
90 * window.
91 * @param aSHEntry The history entry that the content viewer was stored in.
92 * The entry must have the docshells for all of the child
93 * documents stored in its child shell list.
94 */
95 void open(in nsISupports aState, in nsISHEntry aSHEntry);
96
97 /**
98 * Clears the current history entry. This is used if we need to clear out
99 * the saved presentation state.
100 */
101 void clearHistoryEntry();
102
103 /*
104 * Change the layout to view the document with page layout (like print preview), but
105 * dynamic and editable (like Galley layout).
106 */
107 void setPageMode(in PRBool aPageMode, in nsIPrintSettings aPrintSettings);
108
109 /**
110 * Get the history entry that this viewer will save itself into when
111 * destroyed. Can return null
112 */
113 readonly attribute nsISHEntry historyEntry;
114 };