1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef nsIDocumentObserver_h___
|
|
|
|
#define nsIDocumentObserver_h___
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
|
|
|
class nsIContent;
|
1998-06-03 19:40:56 +04:00
|
|
|
class nsIPresShell;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsIStyleSheet;
|
|
|
|
class nsString;
|
1998-07-23 03:32:19 +04:00
|
|
|
class nsIDocument;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-03 19:40:56 +04:00
|
|
|
#define NS_IDOCUMENT_OBSERVER_IID \
|
|
|
|
{ 0xb3f92460, 0x944c, 0x11d1, {0x93, 0x23, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
// Document observer interface
|
|
|
|
class nsIDocumentObserver : public nsISupports {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Notify that a content model update is beginning. This call can be
|
|
|
|
* nested.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify that a content model update is finished. This call can be
|
|
|
|
* nested.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD EndUpdate(nsIDocument *aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that a document load is beginning.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD BeginLoad(nsIDocument *aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that a document load has finished. Note that
|
|
|
|
* the associated reflow of the document will be done <b>before</b>
|
|
|
|
* EndLoad is invoked, not after.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD EndLoad(nsIDocument *aDocument) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that the document is being reflowed in
|
|
|
|
* the given presentation shell.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD BeginReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
1998-06-03 19:40:56 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify the observer that the document is done being reflowed in
|
|
|
|
* the given presentation shell.
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD EndReflow(nsIDocument *aDocument, nsIPresShell* aShell) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notification that the content model has changed. This method is
|
|
|
|
* called automatically by content objects when their state is changed
|
|
|
|
* (therefore there is normally no need to invoke this method
|
|
|
|
* directly). The notification is passed to any
|
|
|
|
* IDocumentObservers. The notification is passed on to all of the
|
|
|
|
* document observers. <p>
|
|
|
|
*
|
|
|
|
* This notification is not sent when a piece of content is
|
|
|
|
* added/removed from the document (the other notifications are used
|
|
|
|
* for that).
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContent the piece of content that changed
|
|
|
|
* @param aSubContent subrange information about the piece of content
|
1998-05-06 20:28:55 +04:00
|
|
|
* that changed
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContent,
|
1998-06-03 19:40:56 +04:00
|
|
|
nsISupports* aSubContent) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifcation that the content model has had data appended to the
|
|
|
|
* given content object. This method is called automatically by the
|
|
|
|
* content container objects when a new content object is appended to
|
|
|
|
* the container (therefore there is normally no need to invoke this
|
|
|
|
* method directly). The notification is passed on to all of the
|
|
|
|
* document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContainer the container that had a new child appended
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notification that content has been inserted. This method is called
|
|
|
|
* automatically by the content container objects when a new content
|
|
|
|
* object is inserted in the container (therefore there is normally no
|
|
|
|
* need to invoke this method directly). The notification is passed on
|
|
|
|
* to all of the document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContainer the container that now contains aChild
|
|
|
|
* @param aChild the child that was inserted
|
|
|
|
* @param aIndexInContainer the index of the child in the container
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
1998-06-03 19:40:56 +04:00
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Notification that content has been replaced. This method is called
|
|
|
|
* automatically by the content container objects when a content object
|
|
|
|
* is replaced in the container (therefore there is normally no need to
|
|
|
|
* invoke this method directly). The notification is passed on to all
|
|
|
|
* of the document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContainer the container that now contains aChild
|
|
|
|
* @param aOldChild the child that was replaced
|
|
|
|
* @param aNewChild the child that replaced aOldChild
|
|
|
|
* @param aIndexInContainer the index of the old and new child in the
|
|
|
|
* container
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
1998-06-03 19:40:56 +04:00
|
|
|
nsIContent* aOldChild,
|
|
|
|
nsIContent* aNewChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Content is going to be removed immediately after this call. This
|
|
|
|
* method is called automatically by content container objects when a
|
|
|
|
* content object is about to be removed from the container (therefore
|
|
|
|
* there is normally no need to invoke this method directly). The
|
|
|
|
* notification is passed on to all of the document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContainer the container that contains aChild
|
|
|
|
* @param aChild the child that will be removed
|
|
|
|
* @param aIndexInContainer the index of the child in the container
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentWillBeRemoved(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
1998-06-03 19:40:56 +04:00
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Content has just been removed. This method is called automatically
|
|
|
|
* by content container objects when a content object has just been
|
|
|
|
* removed from the container (therefore there is normally no need to
|
|
|
|
* invoke this method directly). The notification is passed on to all
|
|
|
|
* of the document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aContainer the container that had a child removed
|
|
|
|
* @param aChild the child that was just removed
|
|
|
|
* @param aIndexInContainer the index of the child in the container
|
|
|
|
* before it was removed
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD ContentHasBeenRemoved(nsIDocument *aDocument,
|
|
|
|
nsIContent* aContainer,
|
1998-06-03 19:40:56 +04:00
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aIndexInContainer) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A StyleSheet has just been added to the document.
|
|
|
|
* This method is called automatically when a StyleSheet gets added
|
|
|
|
* to the document. The notification is passed on to all of the
|
|
|
|
* document observers.
|
|
|
|
*
|
1998-07-23 03:32:19 +04:00
|
|
|
* @param aDocument The document being observed
|
1998-04-14 00:24:54 +04:00
|
|
|
* @param aStyleSheet the StyleSheet that has been added
|
|
|
|
*/
|
1998-07-23 03:32:19 +04:00
|
|
|
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
|
|
|
|
nsIStyleSheet* aStyleSheet) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The document is in the process of being destroyed.
|
|
|
|
* This method is called automatically during document
|
|
|
|
* destruction.
|
|
|
|
*
|
|
|
|
* @param aDocument The document being observed
|
|
|
|
*/
|
|
|
|
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument) = 0;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsIDocumentObserver_h___ */
|