# Document Handling module

Copyright © 1995-2004 Opera Software AS. All rights reserved. This file is part of the Opera web browser. It may not be distributed under any circumstances.
$Id$

## Introduction

The dochand module contains important classes such as `WindowManager`, `Window`, `DocumentManager` and `FramesDocElm`. It needs to have better documentation written.

## WindowManager

The class `WindowManager` essentially keeps track of all open windows, from Core's perspective. (A window, from Core's perspective, might be something that isn't really a window as such in somebody else's perspective; such as a the contents of a popup dialog, e-mail message or a side-bar panel.) It also has various functions for handling windows and to open URL:s in a window, in another (named) window, or in a newly opened window.

## Window

The class `Window` represents an open window, from Core's perspective (see above.) It keeps track available history positions and the currently active history position as numbers (min, max and current) and also keeps track of various window-level information. Apart from this, it doesn't really do much, normally.

## DocumentManager

The class `DocumentManager` handles loading of URL:s, creation of documents when loading the right kind of URL:s, and history. There is one top-level document manager in each Core window, and further one document manager in each FRAME and IFRAME in a document.

### History

History, as handled by a document manager, is a list of object of the small utility class `DocListElm`. Each DocListElm represents a history position, and knows the number of that history position. The history list in each document manager is "sparse," that is, it doesn't necesserily contain one element for each history number in the range defined by the window. When no element directly represents a given history number, the element used for that history number is the element number having the highest number smaller than that history number.

Each DocListElm has a reference the document that should be displayed when that history element is activated, and how the document was scrolled. Several consecutive history elements may reference the same document at different scroll positions. This occurs when the links to anchors in the document are followed.

## FramesDocElm

The class `FramesDocElm` represents a FRAMESET, FRAME or IFRAME element. The ones representing FRAMESET elements are mostly just used to layout frames and to hold references to the child FRAME elements. Also, there is one FramesDocElm object that simply acts as the parent of all FramesDocElm objects representing IFRAME elements in a document. A FramesDocElm object owns a document manager, which in turn manages the document displayed in that FRAME or IFRAME.