Book Image

Microsoft Visual C++ Windows Applications by Example

By : Stefan Bjornander, Stefan Björnander
Book Image

Microsoft Visual C++ Windows Applications by Example

By: Stefan Bjornander, Stefan Björnander

Overview of this book

Table of Contents (15 chapters)
Microsoft Visual C++ Windows Applications by Example
Credits
About the Author
About the Reviewer
Preface
Index

The Document Class


The document class CWordDoc handles the pages and paragraphs of the document. It receives input from the view class CWordView, to which it also sends notification of repainting.

The unit of choice in this application is hundredths of millimeters (MM_HIMETRIC). As a letter 216 times 297 millimeter, its total width and height are 21,600 and 27,900 logical units. The paper has, however, a margin of 25 millimeters, or 2,500 logical units, which implies that the actual width and height are the dimensions of the pages subtracted from the margins. The constants PAGE_WIDTH and PAGE_HEIGHT hold those values.

The application can be in edit or the mark state and the keyboard can be in the insert or overwrite state. The fields m_eWordState and m_eKeyboardState keep track of the states. They have the enumeration types WordState and KeyboardState. As KeyboardState is used by the paragraph class, it is defined in Paragraph.h

enum WordState {WS_EDIT, WS_MARK};
enum KeyboardState {KM_INSERT...