屬性/樣式初始化【轉】
一、PP_AttrProp類
?? 1、類功能說明,代表了一個相同類型的屬性/樣式集合
?? PP_AttrProp captures the complete set of XML and CSS
?? Attributes/Properties for a piece of the document.
?? These are generally created by the file-reader.? Attributes
?? represent all of the attribute/value pairs in the XML with
?? the exception of the PT_PROPS_ATTRIBUTE_NAME attribute.
?? The value of the this attribute is parsed into CSS properties.
?? PP_AttrProp just provides a pair of association lists
?? (one for attributes and one for properties), it does not
?? know the meaning of any of them.
二、pp_TableAttrProp類
?? 1、代表一個數組,數組中的元素類型是PP_AttrProp對象的指針。
三、pt_VarSet類
?? 1、存儲文檔數據
????? UT_GrowBuf???????? m_buffer[2];--存儲字符、圖片等數據
????? pp_TableAttrProp??m_tableAttrProp[2];--存儲屬性/樣式
????? 0代表讀取的數據,1代表編輯時插入的數據
四、初始化流程
?? 1、pt_VarSet::_finishConstruction函數初始化m_tableAttrProp數組,分別存入索引值為0的PP_AttrProp對象
?? 2、pt_PieceTable::_loadBuiltinStyles函數構建不同名字的屬性/樣式,將數據存入m_tableAttrProp[0]中,
????? 索引值從1開始
?? 3、根據PP_AttrProp的實例的索引構建PD_Style對象
?? 3、在PD_Document::setAttrProp函數初始化文檔的屬性/樣式
五、輸入文字時屬性/樣式處理流程
?? 1、pp_Author對象的初始化
?? 2、在pt_PieceTable::createAndSendDocPropCR函數中,初始化文檔的樣式,創建PP_AttrProp實例
?? 3、在PD_Document::addAuthorAttributeIfBlank函數中,初始化一個靜態的PP_AttrProp實例(0x80000001),設????? 置屬性是PT_AUTHOR_NAME宏。可以替換為:author 字符串。
?? 4、在pt_PieceTable::_insertFmtMarkFragWithNotify函數中,構建一個具有author 屬性的PP_AttrProp實例??????? (0x80000002),如果是插入后面(如第二個字符),前面四步不在執行。
?? 5、在pt_PieceTable::_realInsertSpan中,可以根據pf_Frag_FmtMark實例獲取PT_AttrPropIndex的值,根據該?????? 值可以獲取PP_AttrProp實例,插入pf_Frag_Text對象實例。如果是插入后面(如第二個字符),該???????????????? pf_Frag_Text對象的屬性/樣式繼承他前面的對象樣式
?? 6、在pf_Frag_Text構造函數中,調用lookupProperties函數,設置字體的樣式。
????? 6.1、display、bgcolor樣式的設置。在PP_lookupProperty函數中,查找系統定義的static PP_Property ??? _props[]數組中該樣式的值。返回PP_Property指針對象。
??????
????? 6.2、根據pf_Frag對象實例的pSpanAttrProp查找樣式的值,如果找不到繼續
????? 6.3、根據fl_BlockLayout對象實例的pBlockAttrProp查找樣式的值,如果找不到繼續
????? 6.4、獲取Normal樣式對象PD_Style查找樣式的值,如果找不到繼續
????? 6.5、獲取文檔對象的PP_AttrProp實例查找樣式的值,如果找不到繼續
????? 6.6、繼承PP_Property對象的值
?? 7、FL_DocLayout::findFont設置字體,查找樣式的方式參考第6步。
???
六、改變系統的字體樣式
?? 1、當改變當前編輯的字體樣式時(比如:字體的大小),系統會按第五步的前5步添加pf_Frag_FmtMark對象
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
