关闭

LibreOffice源码开发_重要数据结构

标签: libreoffice源码参考文档开发数据结构
405人阅读 评论(0) 收藏 举报
分类:

暂时记录一下,有空整理


SfxPoolItem, SfxItemPool and SfxItemSet

From object property's view, a SfxPoolItem represents one property of an object. For an example, SvxBrushItem(sub of SfxPoolItem) represents background of an object. The object can be a cell, a drawing object, etc. SvxFontHeightItem represents font size of character. Every SfxPoolItem has a nWhich as its identity. Every object has several properties. For complex object, it may have tens of properties. For an example, Spreadsheet cell can have 53 properties. There are thousands of objects in one document. If the document model holds every object's every properties independently, it must use huge of memory. So there is a pool to hold the SfxPoolItems, SfxItemPool. Let's take ScDocumentPool as example. A SfxItemPool can hold many designated(nWhich id is between nStart and nEnd) SfxPoolItems. It has 2 level pointer array. The first level array is used to hold different kinds of SfxPoolItem. The second level array is used to hold different instance of one SfxPoolItem. SfxItemPool has a member pImp points to SfxItemPool_Impl structure, which has a member ppPoolItems points to a pointer array(blue part). For ScDocumentPool, it can be considered that ScDocumentPool has a pointer array to hold SfxPoolItems which nWhich ids are from 100 to 188. Every pointer in the array points to another structure, SfxPoolItemArray_Impl. SfxPoolItemArray_Impl has a member, pData, which points to a SfxPoolItem pointer array(green part). Every element in this array is a pointer points to real SfxPoolItem object.

SfxItemPool.png

The SfxPoolItems are different in the pool. When user set a property of one object, the corresponding SfxPoolItem should be set to the object. It will check whether this SfxPoolItem is existed in the pool before put it in the pool. If it is existed, it will return a pooled SfxPoolItem to set to the object. If it is not existed, it will be added in the pool. So every SfxPoolItem object is distinct from each other. Please refer SfxItemPool::Put(const SfxPoolItem rItem, USHORT nWhich) for detail info. All obejcts' properties are put into the pool. Because there is only one instance of SfxPoolItem for one value in the pool, and because most object has similar properties, the memory will not be taken too much though there are many objects which has many properties. The SfxPoolItem is shared by many object. The life cycle of SfxPoolItem is not same as the related object. It uses reference count. When get one SfxPoolItem from pool to set to one object, the reference of this SfxPoolItem object should be plus one. When remove one property from object, the reference of this SfxPoolItem object should be minus one. Please refer SfxItemPool::Put(const SfxPoolItem rItem, USHORT nWhich) and SfxItemPool::Remove(const SfxPoolItem& rItem)for detail info. SfxItemSet is a set of SfxPoolItem. Which SfxPoolItem can be put into the set is decided when construct the SfxItemSet. SfxItemSet::_pWhichRanges is used to specify the ranges for nWhich ID. SfxItemSet::_aItems is a pointer array. Each pointer points the real SfxPoolItem object in the pool.


1
0
查看评论

LibreOffice源码开发 _排版

LibreOffice writer 进行排版的参考文档       https://wiki.openoffice.org/wiki/Writer/Text_Formatting 其实只看是不能深刻理解的,对一些概念如LinePortion,SwtxtFor...
  • qq_31175231
  • qq_31175231
  • 2016-07-19 13:00
  • 359

再谈数据结构的重要性

那一年, 大二, 老师为了讲数据结构而讲数据结构, 学完了, 我真的是啥也不懂。 根本就不知道这门课有啥用。 后来, 通过自学, 逐渐了解并入门了数据结构, 一个简单的Josephus环让我对数据结构产生了好感。 那数据结构到底有什么用呢? 这就是本文要扯淡的话题。     &#...
  • stpeace
  • stpeace
  • 2015-08-19 19:48
  • 3721

几种常见的重要数据结构总结

<br />栈的表示<br />1. 数组<br />2. 链表(优点:无需指定大小,不存在栈溢出等情况的处理)<br /> <br />队列表示<br />1. 数组(构造成循环队列以提高空间使用效率)<br ...
  • Andrew659
  • Andrew659
  • 2010-07-30 22:10
  • 8027

Nginx 代码解析(2) : 主要数据结构解析

Nginx 主要数据结构解析 本篇主要分析nginx代码中用到的主要的数据结构。 Nginx对自用数据结构的定义非常规范,统一,考虑也很周全,非常好的适配了linux, windows两个主流的OS,同时也很好的规避了32/64位机器的风险。另一方面,nginx的数据结构定义风格非常新颖,统...
  • mikemiller2
  • mikemiller2
  • 2015-12-08 22:36
  • 213

LibreOffice Calc求和操作

ubuntu的LibreOffice,对某一列快速求和
  • yangyangrenren
  • yangyangrenren
  • 2017-01-07 16:04
  • 2937

java实现在线预览doc,txt,ppt,xls等文档,用到了libreOffice,openOffice,SWFTools,JODConverter,flexPaper

涉及到的图片请看附件。 libreOffice转换的代码: public String doDocToFdpLibre() { // File inputFile = new File("d:/1.txt"); // File inputFile = new File...
  • dongdong_919
  • dongdong_919
  • 2015-04-09 14:01
  • 5892

GUI系统之SurfaceFlinger(10)SurfaceFlinger的启动与工作原理

文章都是通过阅读源码分析出来的,还在不断完善与改进中,其中难免有些地方理解得不对,欢迎大家批评指正。转载请注明:From LXS. http://blog.csdn.net/uiop78uiop78/GUI系统之SurfaceFlinger章节目录:blog.csdn.net/uiop78uiop7...
  • uiop78uiop78
  • uiop78uiop78
  • 2013-05-21 13:42
  • 6524

libreoffice API 开发(三):创建保存一个swriter文档

本文主要演示一个创建保存swriter类型文档的实例。
  • jsairre
  • jsairre
  • 2016-11-03 21:56
  • 1252

LibreOffice 生成VS2012工程

生成VS2012解决方案 编译好之后,建议最好可以进入build目录运行以下命令生成Visual Studio 2012的工程: /opt/lo/bin/make vs2012-ide-integration 但实际我执行的时候并没有产生相应的文件。因此分析了下makefi...
  • wu554513392
  • wu554513392
  • 2015-04-03 14:35
  • 1080

在LibreOffice 中启用录制宏的功能

LibreOffice 打开录制宏的方法
  • u013589130
  • u013589130
  • 2015-05-13 18:42
  • 1915
    个人资料
    • 访问:11984次
    • 积分:462
    • 等级:
    • 排名:千里之外
    • 原创:32篇
    • 转载:3篇
    • 译文:0篇
    • 评论:6条
    最新评论