Abiword文档对象初始化

系统 1575 0

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

Abiword文档对象初始化


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论