【 轉(zhuǎn) 】
Text Model 存儲(chǔ)文本以及相應(yīng)屬性的模型,主要有兩種不同的實(shí)現(xiàn)策略:樹形結(jié)構(gòu)和平面結(jié)構(gòu)。樹形結(jié)構(gòu)類似 Dom,可以很好的表現(xiàn)結(jié)構(gòu)化文檔,但是比較復(fù)雜。平面結(jié)構(gòu)相對(duì)簡(jiǎn)單的多,大多數(shù)的編輯器(e.g. Emacs),字處理器(e.g. AbiWord, OpenOffice)都用的是平面結(jié)構(gòu)。
Text Model Coords 用來(lái)在 Text Model 中定位的坐標(biāo)系。對(duì)于樹形結(jié)構(gòu)的 Text Model 其定位方式為節(jié)點(diǎn)鏈接(或指向節(jié)點(diǎn)的路徑 e.g. XPath)以及節(jié)點(diǎn)內(nèi)偏移值。對(duì)于平面結(jié)構(gòu)則僅僅是一個(gè)索引值。
Text Presentation 展示文本的模型,一般分別為 Block, Line, Run …
Text Presentation Coords 用來(lái)在 Text Presentation 中定位的坐標(biāo)系,其值通常為 (x,y)。Text Editor 必須能夠在 Text Model Coords 和 Text Presentation Coords 之間變換。例如將鼠標(biāo)點(diǎn)擊(x,y)對(duì)應(yīng)到 Text Model 中的某個(gè)字符/元素。由 fp_Page::mapXYToPosition成員函數(shù)實(shí)現(xiàn)
FL_DocLayout 類:
page fmt_overview Formatter
??? FL_DocLayout is a formatted representation of a specific PD_Document,?
??? formatted for a specific GR_Graphics context.?
??? A %FL_DocLayout encapsulates two related hierarchies of objects.?
??? The?
logical
?(or content) hierarchy corresponds
??? to the logical structure of the document.
??????? - each FL_DocLayout contains a list of fl_SectionLayout objects
??????? - each fl_SectionLayout are composed of fl_BlockLayout objects
??? Where each fl_BlockLayout corresponds to a logical element in
??? the PD_Document (i.e., usually a paragraph of text).
??? The?
physical
?(or layout) hierarchy, by contrast,
??? encapsulates the subdivision of physical space into objects of
??? successively finer granularity.
??????? - each FL_DocLayout contains a list of fp_Page objects, each
????????? of which was constructed during the process of formatting
????????? the document
??????? - each fp_Page is a list of fp_Columns (fp_Column)
??????? - each fp_Column is a list of fp_Lines (fp_Line)
??????? - each fp_Line is a list of fp_Runs (fp_Run)
??? Where each fp_Run contains some fragment of content from the original?
??? document, usually text.?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

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