| Adolfo Jayme Barrientos | b963086 | 2015-05-24 19:42:51 -0500 | [diff] [blame] | 1 | # LibreOffice |
| Adolfo Jayme Barrientos | 72bb069 | 2019-10-31 09:27:57 -0600 | [diff] [blame] | 2 | [](https://scan.coverity.com/projects/211) [](https://bestpractices.coreinfrastructure.org/projects/307) [](https://weblate.documentfoundation.org/engage/libo_ui-master/?utm_source=widget) |
| Adolfo Jayme Barrientos | b963086 | 2015-05-24 19:42:51 -0500 | [diff] [blame] | 3 | |
| Thorsten Behrens | 8ff280a | 2020-02-05 10:16:04 +0100 | [diff] [blame] | 4 | <img align="right" width="150" height="200" src="https://opensource.org/files/OSIApproved.png"> |
| 5 | |
| David Ostrovsky | 700f080 | 2015-11-28 09:08:56 +0100 | [diff] [blame] | 6 | LibreOffice is an integrated office suite based on copyleft licenses |
| 7 | and compatible with most document formats and standards. Libreoffice |
| 8 | is backed by The Document Foundation, which represents a large |
| 9 | independent community of enterprises, developers and other volunteers |
| 10 | moved by the common goal of bringing to the market the best software |
| 11 | for personal productivity. LibreOffice is open source, and free to |
| 12 | download, use and distribute. |
| 13 | |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 14 | A quick overview of the LibreOffice code structure. |
| 15 | |
| 16 | ## Overview |
| 17 | |
| 18 | You can develop for LibreOffice in one of two ways, one |
| 19 | recommended and one much less so. First the somewhat less recommended |
| Michael Stahl | deec9bd | 2015-03-31 14:55:56 +0200 | [diff] [blame] | 20 | way: it is possible to use the SDK to develop an extension, |
| Hossein | 622b92d | 2022-04-15 12:46:24 +0200 | [diff] [blame] | 21 | for which you can read the [API docs](https://api.libreoffice.org/) |
| 22 | and [Developers Guide](https://wiki.documentfoundation.org/Documentation/DevGuide). |
| Michael Stahl | deec9bd | 2015-03-31 14:55:56 +0200 | [diff] [blame] | 23 | This re-uses the (extremely generic) UNO APIs that are also used by |
| 24 | macro scripting in StarBasic. |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 25 | |
| 26 | The best way to add a generally useful feature to LibreOffice |
| 27 | is to work on the code base however. Overall this way makes it easier |
| 28 | to compile and build your code, it avoids any arbitrary limitations of |
| 29 | our scripting APIs, and in general is far more simple and intuitive - |
| 30 | if you are a reasonably able C++ programmer. |
| 31 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 32 | ## The Build Chain and Runtime Baselines |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 33 | |
| 34 | These are the current minimal operating system and compiler versions to |
| 35 | run and compile LibreOffice, also used by the TDF builds: |
| 36 | |
| 37 | * Windows: |
| Korrawit Pruegsanusak | beff251 | 2017-10-23 19:37:10 +0700 | [diff] [blame] | 38 | * Runtime: Windows 7 |
| Hossein | 7fe7565 | 2022-04-24 12:04:33 +0200 | [diff] [blame] | 39 | * Build: Cygwin + Visual Studio 2019 version 16.10 |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 40 | * macOS: |
| Ilmari Lauhakangas | 0c96561 | 2022-06-14 11:22:13 +0300 | [diff] [blame] | 41 | * Runtime: 10.14 |
| Stephan Bergmann | 3469f69 | 2022-01-13 16:54:33 +0100 | [diff] [blame] | 42 | * Build: 11.0 + Xcode 12.5 |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 43 | * Linux: |
| Christian Lohmaier | b1a17c2 | 2019-06-05 12:17:14 +0200 | [diff] [blame] | 44 | * Runtime: RHEL 7 or CentOS 7 |
| Stephan Bergmann | fe60431 | 2022-02-16 17:16:55 +0100 | [diff] [blame] | 45 | * Build: either GCC 7.0.0; or Clang 8.0.1 with libstdc++ 7.3.0 |
| jan Iversen | 79c392a | 2017-10-04 12:07:58 +0200 | [diff] [blame] | 46 | * iOS (only for LibreOfficeKit): |
| Tor Lillqvist | 6961b75 | 2018-06-07 17:15:07 +0300 | [diff] [blame] | 47 | * Runtime: 11.4 (only support for newer i devices == 64 bit) |
| 48 | * Build: Xcode 9.3 and iPhone SDK 11.4 |
| Miklos Vajna | 77f633a | 2019-08-26 12:34:53 +0200 | [diff] [blame] | 49 | * Android: |
| Miklos Vajna | 7ab68018 | 2019-10-28 17:40:51 +0100 | [diff] [blame] | 50 | * Build: NDK r19c and SDK 22.6.2 |
| Jan-Marek Glogowski | 8a41739 | 2021-04-23 13:45:05 +0200 | [diff] [blame] | 51 | * Emscripten / WASM: |
| 52 | * Runtime: a browser with SharedMemory support (threads + atomics) |
| 53 | * Build: Qt 5.15 with Qt supported Emscripten 1.39.8 |
| Hossein | 622b92d | 2022-04-15 12:46:24 +0200 | [diff] [blame] | 54 | * See [README.wasm](static/README.wasm.md) |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 55 | |
| Hossein | d0e50ba | 2022-06-09 15:48:11 +0200 | [diff] [blame] | 56 | Java is required for building many parts of LibreOffice. In TDF Wiki article |
| 57 | [Development/Java](https://wiki.documentfoundation.org/Development/Java), the |
| 58 | exact modules that depend on Java are listed. |
| 59 | |
| 60 | The baseline for Java is Java Development Kit (JDK) Version 11 or later. It is |
| 61 | possible to build LibreOffice with JDK version 9, but it is no longer supported |
| 62 | by the JDK vendors, thus it should be avoided. |
| 63 | |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 64 | If you want to use Clang with the LibreOffice compiler plugins, the minimal |
| Stephan Bergmann | d1a2b80 | 2022-02-15 15:03:24 +0100 | [diff] [blame] | 65 | version of Clang is 12.0.1. Since Xcode doesn't provide the compiler plugin |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 66 | headers, you have to compile your own Clang to use them on macOS. |
| 67 | |
| Hossein | 628c1c3 | 2021-04-12 22:29:51 +0430 | [diff] [blame] | 68 | You can find the TDF configure switches in the `distro-configs/` directory. |
| Jan-Marek Glogowski | 1079893 | 2017-09-07 12:09:25 +0200 | [diff] [blame] | 69 | |
| 70 | To setup your initial build environment on Windows and macOS, we provide |
| 71 | the LibreOffice Development Environment |
| 72 | ([LODE](https://wiki.documentfoundation.org/Development/lode)) scripts. |
| 73 | |
| 74 | For more information see the build instructions for your platform in the |
| Hossein | d0e50ba | 2022-06-09 15:48:11 +0200 | [diff] [blame] | 75 | [TDF wiki](https://wiki.documentfoundation.org/Development/How_to_build). |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 76 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 77 | ## The Important Bits of Code |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 78 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 79 | Each module should have a `README.md` file inside it which has some |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 80 | degree of documentation for that module; patches are most welcome to |
| 81 | improve those. We have those turned into a web page here: |
| 82 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 83 | <https://docs.libreoffice.org/> |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 84 | |
| 85 | However, there are two hundred modules, many of them of only |
| 86 | peripheral interest for a specialist audience. So - where is the |
| 87 | good stuff, the code that is most useful. Here is a quick overview of |
| 88 | the most important ones: |
| 89 | |
| 90 | Module | Description |
| 91 | ----------|------------------------------------------------- |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 92 | [sal/](sal) | this provides a simple System Abstraction Layer |
| 93 | [tools/](tools) | this provides basic internal types: `Rectangle`, `Color` etc. |
| 94 | [vcl/](vcl) | this is the widget toolkit library and one rendering abstraction |
| 95 | [framework/](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 |
| 96 | [sfx2/](sfx2) | legacy core framework used by Writer/Calc/Draw: document model / load/save / signals for actions etc. |
| 97 | [svx/](svx) | drawing model related helper code, including much of Draw/Impress |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 98 | |
| 99 | Then applications |
| 100 | |
| 101 | Module | Description |
| 102 | ----------|------------------------------------------------- |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 103 | [desktop/](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 |
| 104 | [sw/](sw/) | Writer |
| 105 | [sc/](sc/) | Calc |
| 106 | [sd/](sd/) | Draw / Impress |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 107 | |
| 108 | There are several other libraries that are helpful from a graphical perspective: |
| 109 | |
| 110 | Module | Description |
| 111 | ----------|------------------------------------------------- |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 112 | [basegfx/](basegfx) | algorithms and data-types for graphics as used in the canvas |
| 113 | [canvas/](canvas) | new (UNO) canvas rendering model with various backends |
| 114 | [cppcanvas/](cppcanvas) | C++ helper classes for using the UNO canvas |
| 115 | [drawinglayer/](drawinglayer) | View code to render drawable objects and break them down into primitives we can render more easily. |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 116 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 117 | ## Rules for #include Directives (C/C++) |
| Mike Kaganski | 646448d | 2017-10-27 15:39:12 +0300 | [diff] [blame] | 118 | |
| 119 | Use the `"..."` form if and only if the included file is found next to the |
| 120 | including file. Otherwise, use the `<...>` form. (For further details, see the |
| 121 | mail [Re: C[++]: Normalizing include syntax ("" vs |
| 122 | <>)](https://lists.freedesktop.org/archives/libreoffice/2017-November/078778.html).) |
| 123 | |
| 124 | The UNO API include files should consistently use double quotes, for the |
| 125 | benefit of external users of this API. |
| 126 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 127 | `loplugin:includeform (compilerplugins/clang/includeform.cxx)` enforces these rules. |
| Stephan Bergmann | b0eab4b | 2018-10-01 09:10:07 +0200 | [diff] [blame] | 128 | |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 129 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 130 | ## Finding Out More |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 131 | |
| Hossein | ea5641b | 2021-03-29 21:55:26 +0430 | [diff] [blame] | 132 | Beyond this, you can read the `README.md` files, send us patches, ask |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 133 | on the mailing list libreoffice@lists.freedesktop.org (no subscription |
| Christian Lohmaier | ef0d150 | 2021-06-02 15:57:31 +0200 | [diff] [blame] | 134 | required) or poke people on IRC `#libreoffice-dev` on irc.libera.chat - |
| Adolfo Jayme Barrientos | 89d825c | 2015-03-22 21:21:57 -0600 | [diff] [blame] | 135 | we're a friendly and generally helpful mob. We know the code can be |
| 136 | hard to get into at first, and so there are no silly questions. |