LibreOffice
LibreOffice 是一个基于版权许可的综合办公套件,与大多数文档格式和标准兼容。Libreoffice 得到了文档基金会的支持,该基金会代表了一个由企业、开发者和其他志愿者组成的大型独立社区,他们的共同目标是为市场带来最好的个人生产力软件。LibreOffice 是开源的,并且可以免费下载、使用和分发。
对LibreOffice代码结构的快速概述
概述
您可以通过两种方式为 LibreOffice 进行开发,一种是推荐的方式,一种是不太推荐的方式。首先是不太推荐的方式:可以使用 SDK 来开发一个扩展,你可以在 这里 和 这里阅读 API 文档。这重新使用了 UNO 的 API(非常通用),这些 API 也被 StarBasic 的宏脚本所使用。
然而,给LibreOffice添加一个普遍有用的功能的最好方法是在代码库中工作。总的来说,这种方式更容易编译和构建你的代码,它避免了我们的脚本API的任何任意限制,而且总的来说更简单和直观 - 如果你是一个合理的C++程序员。
构建链和运行时基线
这些是目前运行和编译 LibreOffice 的最小操作系统和编译器版本,也被 TDF 构建所使用:
- Windows:
- Runtime: Windows 7
- Build: Cygwin + Visual Studio 2019 version 16.5
- macOS:
- Runtime: 10.12
- Build: 10.14.4 + Xcode 11.3
- Linux:
- Runtime: RHEL 7 or CentOS 7
- Build: either GCC 7.0.0; or Clang 5.0.2 with libstdc++ 7.3.0
- iOS (only for LibreOfficeKit):
- Runtime: 11.4 (only support for newer i devices == 64 bit)
- Build: Xcode 9.3 and iPhone SDK 11.4
- Android:
- Build: NDK r19c and SDK 22.6.2
- Emscripten / WASM:
- Runtime: 一个支持共享内存(SharedMemory)的浏览器(threads + atomics)
- Build: Qt 5.15 with Qt supported Emscripten 1.39.8
- See README.wasm
如果你想在 LibreOffice 编译器插件中使用 Clang,Clang 的最小版本是 5.0.2。由于 Xcode 没有提供编译器插件的头文件,你必须编译你自己的 Clang 来在 macOS 上使用它们。
你可以在 distro-configs/ 目录中找到 TDF 的配置开关。
为了在 Windows 和 macOS 上设置你的初始构建环境,我们提供了 LibreOffice 开发环境(LODE)的脚本。
欲了解更多信息,请参见 TDF 维基 中关于您的平台的构建说明。
代码的重要部分
每个模块都应该有一个 README.md文件,其中有关于该模块的某种程度的文档;我们非常欢迎对这些文件进行修补。我们已经把这些文件变成了一个网页,在这里。
然而,有两百个模块,其中许多只是对专业观众的边缘兴趣。那么 -- 好东西在哪里,最有用的代码在哪里。这里是对最重要的模块的一个快速概述。
Module | Description |
---|---|
sal/ | this provides a simple System Abstraction Layer |
tools/ | this provides basic internal types: Rectangle , Color etc.
|
vcl/ | this is the widget toolkit library and one rendering abstraction |
framework/ | UNO framework, responsible for building toolbars, menus, status bars, and the chrome around the document using widgets from VCL, and XML descriptions from /uiconfig/ files
|
sfx2/ | legacy core framework used by Writer/Calc/Draw: document model / load/save / signals for actions etc. |
svx/ | drawing model related helper code, including much of Draw/Impress |
然后是应用
Module | Description |
---|---|
desktop/ | this is where the main() for the application lives, init / bootstrap. the name dates back to an ancient StarOffice that also drew a desktop
|
sw/ | Writer |
sc/ | Calc |
sd/ | Draw / Impress |
还有一些其他的库,从图形的角度来看是有帮助的。
Module | Description |
---|---|
basegfx/ | algorithms and data-types for graphics as used in the canvas |
canvas/ | new (UNO) canvas rendering model with various backends |
cppcanvas/ | C++ helper classes for using the UNO canvas |
drawinglayer/ | View code to render drawable objects and break them down into primitives we can render more easily. |
#include指令的规则(C/C++)
使用 "..." 的形式,当且仅当包含的文件在包含的文件旁边找到时。否则,使用 <...> 形式。(关于进一步的细节,请参阅邮件Re: Re: C[++]: Normalizing include syntax ("" vs <>)。
为了这个 API 的外部用户的利益,UNO API 的包含文件应该始终使用双引号。
loplugin:includeform (compilerplugins/clang/includeform.cxx) 执行这些规则。
发现更多
除此之外,你可以阅读 README.md 文件,给我们发送补丁,在邮件列表 libreoffice@lists.freedesktop.org 上提问(不需要订阅),或者在 irc.libera.chat 的 IRC #libreoffic-dev 上询问 -- 我们是一个友好的、普遍有帮助的暴徒。我们知道这些代码一开始可能很难进入,所以没有什么愚蠢的问题。