zoukankan      html  css  js  c++  java
  • Abiword文档对象初始化

    Abiword文档对象初始化

    新建或开发文档

    • PD_Document类的实例化

    如果是新建文档,调用PD_Document::newDocument函数创建新文档,或则调用PD_Document::readFromFile打开一个文档。

    • pt_PieceTable类的实例化,通过该类初始化文档的物理存储架构。也就是PieceTable数据结构的实现
    1. pf_Frag_Strux_Section类,该类实例化后放入pf_Fragments中。
    2. pf_Frag_Strux_Block 类,同样放入pf_Fragments中。
    3. pf_Frag 类,实例化pf_Frag::PFT_EndOfDoc的对象,表示文档结尾的片段。
    • AP_Frame::_showDocument方法
    1. 调用_createViewGraphics函数创建:GR_Graphics对象,FL_DocLayout类的实例化

        FL_DocLayout is a formatted representation of a specific PD_Document, 
        formatted for a specific GR_Graphics context. 

    1. FV_View类的实例化, 调用AP_Frame::_replaceView函数
    2. FL_DocLayout::fillLayouts函数中,实例化fl_DocListener
    3. PD_Document::addListener方法将fl_DocListener对象添加到文档中
    4. pt_PieceTable::addListener,循环pf_Fragments(链表数据结构)对象,初始化对应的布局类。
    • fl_DocSectionLayout 类,该类对应pf_Frag_Strux_Section类,并且存储这个类对象的指针

    该类实例化后,被添加到FL_DocLayout中。

    - each FL_DocLayout contains a list of fl_SectionLayout objects
    - each fl_SectionLayout are composed of fl_BlockLayout objects

    • fl_BlockLayout类,该类对应pf_Frag_Strux_Block ,并且存储这个类对象的指针

    Where each fl_BlockLayout corresponds to a logical element in
     the PD_Document (i.e., usually a paragraph of text).

    在fl_BlockLayout::_insertEndOfParagraphRun函数中,初始化FL_DocLayout的物理结构。

    •  fp_EndOfParagraphRun类的实例化。
    • fp_Line 类的实例化。
    • FL_DocLayout::addNewPage函数初始化fp_Page类
    • fp_Column 类实例化
    • 调用fp_VerticalContainer::insertContainer函数把fp_Line 添加到fp_Column 类中。
    • 把fp_EndOfParagraphRun对象添加到fp_Line 中

    编辑文档

    •  FV_View::_charInsert函数
    1. FV_View::insertParaBreakIfNeededAtPos

              Insrts a block and returns true if the point is at the end of a 
              section or document and the previous strux is not a block

            if(!isParaBreakNeededAtPos(pos))
           {
               return false;
           }
           m_pDoc->insertStrux(pos,PTX_Block);//如果需要就插入Block
           return true;

    2.  PD_Document::insertSpan

             pt_PieceTable::_insertFmtMarkFragWithNotify, 实例化pf_Frag_FmtMark类、fp_FmtMarkRun类

             pt_PieceTable::insertSpan函数,实例化pf_Frag_Text

             通过构建PX_ChangeRecord类,调用PD_Document::notifyListeners函数,通过fl_DocListener::change方法通知fmt层数据发生变化。

             通过fl_SectionLayout,fl_BlockLayout::_doInsertTextSpan的方法,实例化fp_TextRun

    • 增加新行时,实例化pf_Frag_Strux_Block、fl_BlockLayout、fp_EndOfParagraphRun、fp_Line
  • 相关阅读:
    js之自定义鼠标右键菜单
    js之键盘控制div移动
    js之select标签---省市联动小例子
    html之浮动和定位
    java开发简单的用户管理系统
    ASP.NET Web API 2中的属性路由(Attribute Routing)
    ASP.NET Web API中的路由
    Web API 2中的操作结果
    WebApi~通过HttpClient来调用Web Api接口
    Quartz.NET 作业调度
  • 原文地址:https://www.cnblogs.com/songtzu/p/3539763.html
Copyright © 2011-2022 走看看