屬性/樣式初始化【轉(zhuǎn)】
一、PP_AttrProp類
?? 1、類功能說明,代表了一個(gè)相同類型的屬性/樣式集合
?? 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、代表一個(gè)數(shù)組,數(shù)組中的元素類型是PP_AttrProp對象的指針。
三、pt_VarSet類
?? 1、存儲(chǔ)文檔數(shù)據(jù)
????? UT_GrowBuf???????? m_buffer[2];--存儲(chǔ)字符、圖片等數(shù)據(jù)
????? pp_TableAttrProp??m_tableAttrProp[2];--存儲(chǔ)屬性/樣式
????? 0代表讀取的數(shù)據(jù),1代表編輯時(shí)插入的數(shù)據(jù)
四、初始化流程
?? 1、pt_VarSet::_finishConstruction函數(shù)初始化m_tableAttrProp數(shù)組,分別存入索引值為0的PP_AttrProp對象
?? 2、pt_PieceTable::_loadBuiltinStyles函數(shù)構(gòu)建不同名字的屬性/樣式,將數(shù)據(jù)存入m_tableAttrProp[0]中,
????? 索引值從1開始
?? 3、根據(jù)PP_AttrProp的實(shí)例的索引構(gòu)建PD_Style對象
?? 3、在PD_Document::setAttrProp函數(shù)初始化文檔的屬性/樣式
五、輸入文字時(shí)屬性/樣式處理流程
?? 1、pp_Author對象的初始化
?? 2、在pt_PieceTable::createAndSendDocPropCR函數(shù)中,初始化文檔的樣式,創(chuàng)建PP_AttrProp實(shí)例
?? 3、在PD_Document::addAuthorAttributeIfBlank函數(shù)中,初始化一個(gè)靜態(tài)的PP_AttrProp實(shí)例(0x80000001),設(shè)????? 置屬性是PT_AUTHOR_NAME宏。可以替換為:author 字符串。
?? 4、在pt_PieceTable::_insertFmtMarkFragWithNotify函數(shù)中,構(gòu)建一個(gè)具有author 屬性的PP_AttrProp實(shí)例??????? (0x80000002),如果是插入后面(如第二個(gè)字符),前面四步不在執(zhí)行。
?? 5、在pt_PieceTable::_realInsertSpan中,可以根據(jù)pf_Frag_FmtMark實(shí)例獲取PT_AttrPropIndex的值,根據(jù)該?????? 值可以獲取PP_AttrProp實(shí)例,插入pf_Frag_Text對象實(shí)例。如果是插入后面(如第二個(gè)字符),該???????????????? pf_Frag_Text對象的屬性/樣式繼承他前面的對象樣式
?? 6、在pf_Frag_Text構(gòu)造函數(shù)中,調(diào)用lookupProperties函數(shù),設(shè)置字體的樣式。
????? 6.1、display、bgcolor樣式的設(shè)置。在PP_lookupProperty函數(shù)中,查找系統(tǒng)定義的static PP_Property ??? _props[]數(shù)組中該樣式的值。返回PP_Property指針對象。
??????
????? 6.2、根據(jù)pf_Frag對象實(shí)例的pSpanAttrProp查找樣式的值,如果找不到繼續(xù)
????? 6.3、根據(jù)fl_BlockLayout對象實(shí)例的pBlockAttrProp查找樣式的值,如果找不到繼續(xù)
????? 6.4、獲取Normal樣式對象PD_Style查找樣式的值,如果找不到繼續(xù)
????? 6.5、獲取文檔對象的PP_AttrProp實(shí)例查找樣式的值,如果找不到繼續(xù)
????? 6.6、繼承PP_Property對象的值
?? 7、FL_DocLayout::findFont設(shè)置字體,查找樣式的方式參考第6步。
???
六、改變系統(tǒng)的字體樣式
?? 1、當(dāng)改變當(dāng)前編輯的字體樣式時(shí)(比如:字體的大小),系統(tǒng)會(huì)按第五步的前5步添加pf_Frag_FmtMark對象
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

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