Tuần tự được gọi khi người dùng chọn mục trình đơn lưu hoặc mở. nó serializes ma trận, một tế bào tại một thời điểm. Trong trường hợp tải, nó cũng đặt con trỏ ma trận tế bào của tế bào. | The Word Application m_psEdit min m_psFirstMark m_psLastMark RectSet repaintSet DeleteText repaintSet pDC m_psFirstMark m_psLastMark UpdateAllViews NULL 0 CObject repaintSet break UpdateParagraphAndPageArray The method CharDown is called every time the user presses a regular character. If the character is not printable nothing happens. Otherwise if the text is marked that text is first removed. Thereafter the character is added to the current paragraph the paragraph array is updated and the next font is set to null. void CWordDoc CharDown UINT uChar CDC pDC if isprint uChar RectSet repaintSet if m_eWordState WS_MARK DeleteText repaintSet pDC m_psFirstMark m_psLastMark m_eWordState WS_EDIT m_psEdit min m_psFirstMark m_psLastMark Paragraph pParagraph m_paragraphArray pParagraph- AddChar uChar m_pNextFont m_eKeyboardState pParagraph- Recalculate pDC repaintSet delete m_pNextFont m_pNextFont NULL SetModifiedFlag UpdateAllViews NULL 0 CObject repaintSet UpdateParagraphAndPageArray MakeVisible UpdateCaret 372 Chapter 9 When the user clicks with the mouse we first have to decide which paragraph they hit. The method PointToParagraph traverses the paragraph array to find the correct paragraph. If the user clicks beyond the last paragraph the last one is returned. Likewise if the user clicks at the end of a page beyond the last paragraph of the page the last paragraph of that page is returned. int CWordDoc PointToParagraph const CPoint ptMouse const int iParagraphs int for int iParagraph 0 iParagraph iParagraphs iParagraph Paragraph pParagraph m_paragraphArray iParagraph if pParagraph- GetStartPos return iParagraph - 1 return iParagraphs - 1 The method PointToChar returns the position of the clicked paragraph and character index by calling PointToParagraph. Position CWordDoc PointToChar const CPoint ptMouse const int iParagraph PointToParagraph ptMouse Paragraph pParagraph .