LibreOffice

LibreOffice 是一个基于版权许可的综合办公套件,与大多数文档格式和标准兼容。「LibreOffice is an integrated office suite based on copyleft licenses and compatible with most document formats and standards.」

Github stars Tracking Chart

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文件,其中有关于该模块的某种程度的文档;我们非常欢迎对这些文件进行修补。我们已经把这些文件变成了一个网页,在这里。

https://docs.libreoffice.org/

然而,有两百个模块,其中许多只是对专业观众的边缘兴趣。那么 -- 好东西在哪里,最有用的代码在哪里。这里是对最重要的模块的一个快速概述。

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 上询问 -- 我们是一个友好的、普遍有帮助的暴徒。我们知道这些代码一开始可能很难进入,所以没有什么愚蠢的问题。



Overview

Name With OwnerLibreOffice/core
Primary Language
Program languageShell, Perl, Makefile, C++, Java, Python, Objective-C, Visual Basic, Assembly, HTML (Language Count: 0)
PlatformLinux, Mac, Windows
License:GNU General Public License v3.0
Release Count1494
Last Release Namelibreoffice-24.2.3.1 (Posted on 2024-04-11 19:31:48)
First Release Nametesting_libreoffice-3.3.99.4-hotfixes1 (Posted on 2011-05-06 16:44:21)
Created At2013-10-31 15:46:52
Pushed At2024-04-14 16:42:24
Last Commit At2024-04-14 16:03:39
Stargazers Count2.4k
Watchers Count94
Fork Count592
Commits Count494.9k
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count42
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

LibreOffice

Coverity Scan Build Status CII Best Practices Translation status

LibreOffice is an integrated office suite based on copyleft licenses
and compatible with most document formats and standards. Libreoffice
is backed by The Document Foundation, which represents a large
independent community of enterprises, developers and other volunteers
moved by the common goal of bringing to the market the best software
for personal productivity. LibreOffice is open source, and free to
download, use and distribute.

A quick overview of the LibreOffice code structure.

Overview

You can develop for LibreOffice in one of two ways, one
recommended and one much less so. First the somewhat less recommended
way: it is possible to use the SDK to develop an extension,
for which you can read the API docs here
and here.
This re-uses the (extremely generic) UNO APIs that are also used by
macro scripting in StarBasic.

The best way to add a generally useful feature to LibreOffice
is to work on the code base however. Overall this way makes it easier
to compile and build your code, it avoids any arbitrary limitations of
our scripting APIs, and in general is far more simple and intuitive -
if you are a reasonably able C++ programmer.

The Build Chain and Runtime Baselines

These are the current minimal operating system and compiler versions to
run and compile LibreOffice, also used by the TDF builds:

  • 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: a browser with SharedMemory support (threads + atomics)
    • Build: Qt 5.15 with Qt supported Emscripten 1.39.8
    • See README.wasm

If you want to use Clang with the LibreOffice compiler plugins, the minimal
version of Clang is 5.0.2. Since Xcode doesn't provide the compiler plugin
headers, you have to compile your own Clang to use them on macOS.

You can find the TDF configure switches in the distro-configs/ directory.

To setup your initial build environment on Windows and macOS, we provide
the LibreOffice Development Environment
(LODE) scripts.

For more information see the build instructions for your platform in the
TDF wiki.

The Important Bits of Code

Each module should have a README.md file inside it which has some
degree of documentation for that module; patches are most welcome to
improve those. We have those turned into a web page here:

https://docs.libreoffice.org/

However, there are two hundred modules, many of them of only
peripheral interest for a specialist audience. So - where is the
good stuff, the code that is most useful. Here is a quick overview of
the most important ones:

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

Then applications

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

There are several other libraries that are helpful from a graphical perspective:

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.

Rules for #include Directives (C/C++)

Use the "..." form if and only if the included file is found next to the
including file. Otherwise, use the <...> form. (For further details, see the
mail Re: C[++]: Normalizing include syntax ("" vs
<>)
.)

The UNO API include files should consistently use double quotes, for the
benefit of external users of this API.

loplugin:includeform (compilerplugins/clang/includeform.cxx) enforces these rules.

Finding Out More

Beyond this, you can read the README.md files, send us patches, ask
on the mailing list libreoffice@lists.freedesktop.org (no subscription
required) or poke people on IRC #libreoffice-dev on irc.libera.chat -
we're a friendly and generally helpful mob. We know the code can be
hard to get into at first, and so there are no silly questions.

To the top