Commit Graph
100 Commits
Author SHA1 Message Date
Tor Lillqvist 5bc9425900 Avoid illegal names also for the LibreOfficeKitGtk structs
Change-Id: If8b5987e0779ece9518384f88a0363a3c596d7ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197937
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2026-01-25 22:33:22 +01:00
Tor Lillqvist dc5d4942bd We do seem to need <vcl/menu.hxx> here
Otherwise I get compilations errors for PopupMenu, at least for
--with-distro=CODAWindows.

Change-Id: I5a3af1b04ab373527d26ab84bf3634568cfec1f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197870
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-23 10:10:14 +01:00
Tor Lillqvist 729722ff0d This needs <vcl/keycod.hxx> on _WIN32
Change-Id: Iaead98cd0507866fafcd0ad95b5865965eedc72f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197869
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-23 10:10:00 +01:00
Tor Lillqvist 3404d99464 Don't use illegal identifiers in LibreOfficeKit
Identifiers with an initial underscore followed by an uppercase letter
are reserved for the C++ implementation.

Change-Id: I3eabc8aa3570b17e05259c0d56d3b16246335ffc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196572
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197868
2026-01-23 07:28:03 +01:00
Tor Lillqvist 901b41845c Handle a non-ASCII installation path in LibreOfficeKit on Windows
The new Collabora Office passes the installation path as UTF-8. On
Windows, turn that it into UTF-16 and use the wide character APIs, as
one should.

Add some comments to LibreOffiecKit mentioning this.

Also make lok_dlerror() use wide character APIs on Windows, and return
the message as UTF-8.

The wrappers used for this UTF-8/UTF-16 dance are copies of those in
<tools/UnixWrappers.h> (but with different names), because sadly
including that file in LibreOfficeKitInit.h caused other complicated
problems because LibreOfficeKit is apparently seen as part of the UNO
API when the ODK is constructed.

(It would be *wrong* and unhelpful to try to use system codepage for
pathnames instead of UTF-8. Codepages are obsolete. A proper Windows
program should use the wide character APIs. The Windows file system
has names in UTF-16. Using system codepage will not work for pathnames
that can't be expressed in the system codepage. Such user profile
directories might very well exist on some machines.)

The "normal" parts of core of course already use UTF-16 all over the
place on all platforms with OUString, so core on Windows hopefully
already accesses the file system only using wide character APIs.

Also remove extendUnoPath(). There is no URE/bin folder in a core
instdir any more. (Otherwise, the code in it would have had to be
changed to use wide character system APIs, too.)

Note that this commit by itself is not enough to fix problems when the
new Collabora Office is installed in a location with a non-ASCII
pathname. There are more problems in fontconfig, freetype, and cairo,
most likely. But for other LibreOfficeKit use cases on Windows, where
core is built in a normal manner without the "headless" backend, this
might be enough.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I2458ed98b89abcd18bf6ad658e285fcc55fd28b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196401
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197542
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-20 08:35:46 +01:00
Tor Lillqvist 8438825c64 Make <tools/UnixWrappers.h> more robust
Surround with a multiple inclusion guard, and use the modern C++
[[maybe_unused]] thing only when available.

Change-Id: Id1eebd65edb6846d1551b56e208917c2c1f6b34d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196681
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197541
Tested-by: Jenkins
2026-01-20 08:35:30 +01:00
Tor Lillqvist f63f00c611 Set up pkg-config environment variables when cross-compiling to Linux
Otherwise we won't find the .pc files. Tested by running configury on
arm64 Ubuntu, for cross-compiling to amd64 Ubuntu. Note: No idea yet
whether such a cross-build will run successfully to completion, or the
result work.

Change-Id: I517c1674d1230f91341b240f02b1b65d3ceaaef2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197207
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-01-18 11:27:08 +01:00
Tor Lillqvist 3229dddb53 Obey --enable-msvc-debug-runtime when building harfbuzz
Otherwise you will get linking errors if core is configured with that
option.

Change-Id: Id0982fb7f15f7d185b5fe4eaa15e905464d435f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197508
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-17 21:50:07 +01:00
Tor Lillqvist 80f8fe8479 Make also fonts installed from the Microsoft Store show up in CODA-W
This was much more complicated than expected. Most of that thanks to
the inscrutability of fontconfig.

Fonts from the Microsoft Store get installed in a separate folder per
product, under the WindowsApps folder. Each such font product folder
contains one or several TrueType font files, and metadata files, and
preview images, etc.

Add a C++ source file to fontconfig that uses DirectWrite to enumerate
the available fonts. Take only those with a source type of
DWRITE_FONT_SOURCE_TYPE_APPX_PACKAGE into account. Other fonts are
found as before, looking in the system fonts folder (typically
C:\Windows\Fonts) and in the per-user fonts folder (typically
C:\Users\username\AppData\Local\Microsoft\Windows\Fonts).

This C++ code requires headers from the winrt tree in the Windows SDK,
so add that to SOLARINC.

Sadly, thanks to the way fontconfig works (scanning directories for
font files), I need to let it scan the folders of font products from
the Microsoft Store to find the font files, even if the DirectWrite
API would already give us the font file names directly. But I didn't
want to modify fontconfig too much, so oh well.

There was something weird in how fontconfig calculates the hash for
directory names to be used in its cache files. It ended up creating
more and more cache files for the same directories each time CODA-W
was run. I could not understand what was going on, but in any case,
just making sure that FcConfigMapFontPath() and FcConfigMapSalt()
don't do anything on Windows seems to help.

Also change the way freetype is built so that only the special
FT_Done_MM_Var is exported, not all public functions. This was
necessary because for some unknown reason, when linking the vcl DLL I
started getting errors for the freetype symbols that happen to be
linked into also the cairo DLL. If we eventually can switch to
building all of core statically for CODA-W this problem will go away.

Also stop defining FT_DEBUG_LOGGING, such logging will not show up
anywhere for end-users, and fixing problems in freetype on Windows
will have to be done by reproducing and debugging in the VS debugger
anyway.

There is still much to do to make fontconfig (and probably freetype
and cairo) work really correctly on Windows. The most obvious thing is
that the file name handling is broken. This is perhaps understandable
as the port of that code to Windows is from over 20 years ago, I
think.

It works for file and folder names in ASCII, but most likely not for
others. At least the user profile directory, under which per-user font
files are stored, will definitely have non-ASCII in many cases. We
should modify the code to use <tools/UnixWrappers.h>, so that all file
system access is done using proper wide character (UTF-16)
APIs. Pathnames that these libraries handle will then be in UTF-8. The
opendir() etc emulation in fontconfig should also be replaced by
adding such to UnixWrappers.h instead.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I4bc6e32dcc32ff74b79679edacee1aecebd774c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196336
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197507
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 21:49:57 +01:00
Tor Lillqvist fd304eaa93 Look for fonts also in WINDOWSUSERFONTDIR
That is where fonts installed by the user goes.

Change-Id: If23c542fee8a832da723d1165d38669b24b2fb57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197505
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 21:49:46 +01:00
Tor Lillqvist e219153c0c Don't use sub-pixel rendering in WASM and CODA-W
We have no knowledge of the sub-pixel order of the display hardware.

Change-Id: I7aee7797d5b4a976b34cc95e93b605cc23039617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194615
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197502
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 21:49:29 +01:00
Tor Lillqvist 703466d7fa Don't package conflicting and pointless fontconfig configuration files
For instance, having both 10-no-antialias.conf and
10-yes-antialias.conf in the same conf.d folder is silly.

Look at what Ubuntu has in /etc/fonts/conf.d and keep only those. Note
that ExternalPackage_fontconfig_data is used only for WASM and CODA-W
anyway, so the "local" and "user" ones are surely irrelevant.

Change-Id: I76219eb38675f2e3018d84ab1fc845b1131cc4f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194613
Reviewed-by: Thorsten Behrens <thorsten.behrens@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197501
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-17 21:49:17 +01:00
Tor Lillqvist a7411d59ce Package the fonts.conf file and the conf.d folder also for Windows
On Windows, fontconfig looks for fonts.conf in a "fonts" subfolder of
the folder where DLL is where the fontconfig code lives. Thus in our
case, the "program" folder.

Change-Id: I2d7ae5ea02c61bd22c2ae9ca19e1138ffd35881e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194612
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197500
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 21:49:07 +01:00
Tor Lillqvist ee9b315713 Make the windowsfonts.patch apply again
Change-Id: Ic6a6dbcb5cbb41a05efaabebc3329f50fdd50443
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197498
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 21:48:47 +01:00
Tor Lillqvist c65da08f5f Don't fail assertion in Task::~Task() if LibreOfficeKit is active
Apps using LibreOfficeKit often have unusual lifecycles.

Change-Id: Ie113d7458cff10beba2e44181d0b6ce5758a7634
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197504
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 20:59:50 +01:00
Tor Lillqvist 3d16a6e9d3 Skip private system fonts found by fontcofig on macOS
They have family names starting with a period. They are not intended
to be used by apps, and not normally visible in apps that use just
Apple APIs. So we should not use them even if they are found by
fontconfig. (Letting them be found leads to an assertion failure in
boost, even. Did not investigate further.)

See for instance
https://eclecticlight.co/2015/11/10/qa-how-to-use-san-francisco-font-in-docs/
, from which I quote:

👉 This is accomplished by prefacing its name and ID with a period
(.), so that its TrueType Unique ID record, for example, describes it
as “.SF NS Text”, and it is explicitly identified as a System Font.
This ensures that it is omitted from font selection menus and
dialogs. 👈

Change-Id: I4efea606331c5c37a321b30e908a0c8c789816e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195230
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197506
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 20:59:03 +01:00
Tor Lillqvist 7b1bb740a7 Add some DISABLE_DYNLOADING ifdefs to osl/w32, as for unx
Lots of things will have to be tweaked to build core statically for
Windows. This is just one small isolated and fairly obvious trivial
commit. (Assuming that in the disable-dynloading case, for Windows we
want to drop the same dynamic library loading functions in osl as for
Unixish systems.)

Change-Id: Ica0a00d7a3d5b85e5eb933ebd5722824fbf5deeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197503
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-17 20:58:40 +01:00
Tor Lillqvist 8e6eef100e No Noto font in configury here
Change-Id: Ib99a8eb7f621f94ca7ef168eef3c2fdb28c61054
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197499
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-17 20:58:01 +01:00
Tor Lillqvist 1a714f6a80 Don't check some POSIX things on file systems known to be weird
On a Mac volume mounted in a Linux virtual machine under Parallels
Desktop, hard-linking works (from the Linux VM). Looking at it in the
host macOS the linked files also show up as linked, with identical
inode number and a link count of 2. But in the Linux VM, the
hard-linked files each have a link count of 1, and different inode
numbers. (Still, they *are* the same file. If you write to one, it
shows up in the other, too, etc.)

I am not saying it necessarily makes sense to build core on such a
file system. Quite likely it makes more sense to just create a native
Linux file system on a Parallels virtual hard drive (that is a file on
a Mac volume). But it is fun to experiment with stuff like this.

Yes, if it turns out that we need to get the name of the file system
type some folder or file is on in other places, too, the code for that
should be put in some shared place.

Change-Id: I315eb2ed0fd0803da3070645119b2bd3019cc9a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197305
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-01-15 20:49:31 +01:00
Tor Lillqvist 599c2092c5 No need to look up SHGetFolderPathA dynamically
There was perhaps a good reason for that over 20 years ago when
fontconfig was initially ported to Windows, but surely not any longer.

Change-Id: I6bbe37e0aaff1c58646fb75ade1ba216668795e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194610
Reviewed-by: Thorsten Behrens <thorsten.behrens@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197215
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-14 23:42:37 +01:00
Tor Lillqvist 38372e10ab Make the weird FT_Done_MM_Var() trick in vcl work also on Windows
For Windows we build freetype as a static library. But we must build
freetype with DLL_EXPORT defined so that symbols like FT_Done_MM_Var
get exported by the DLL into which the static freetype library is
linked. That is mergedlo.dll or vcllo.dll.

Then in vcl's dlFT_Done_MM_Var() we can't just call
osl_getAsciiFunctionSymbol() with a nullptr for the first "module"
parameter and expect it to look through all modules, like dlsym() does
on Unixes. On Windows, osl_getAsciiFunctionSymbol() calls
GetProcAddress(), and passing a NULL first parameter to tht is simply
invalid. We must look for FT_Done_MM_Var in mergedlo.dll, or if that
isn't loaded, vcllo.dll.

Possibly it would be simpler to just pretend we don't HAVE_DLAPI in
this case and call FT_Done_MM_Var() directly.

Without this commit, FT_Done_MM_Var will not be found, so the code
will just call free() instead of FT_Done_MM_Var(), and if built using
the debugging C library that will lead to a strange assertion failure
in the C library. With the non-debugging C library it might perhaps
lead to some odd bug, or just not do whatever proper deallocation of
resources or something it is that FT_Done_MM_Var() does.

Change-Id: Ia7b726cc7167ba22ea8f3263ad85f8cd4ac5c483
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194608
Reviewed-by: Thorsten Behrens <thorsten.behrens@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197213
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-14 14:07:29 +01:00
Tor Lillqvist 0234ce8214 We don't use GetSystemWindowsDirectoryA() any more so don't look it up
Change-Id: Ibafb12bbc1f7c474efae4bc07c3061f172318f70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194609
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197214
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-14 11:15:07 +01:00
Tor Lillqvist aad13413e5 Clarify that freeError() despite its name is a generic LOKit deallocation API
Especially on Windows it is important to not call free() in your own
code on a pointer returned from some random other dynamic library
(like the one the desktop/source/lib/init.cxx code goes into). It
might have been allocated by calling malloc() (etc) in a C runtime
library that is different from the one used by your code. That will
lead to a crash.

One should alays call the free() in the same C runtime where the
malloc() that allocated the pointer is.

Add a wrapper called freeMemory() to the C++ API.

Change-Id: Ibf9cf6fad2c30c4416d2a1f6badbd161c7ba18a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194594
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197107
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-13 15:31:47 +01:00
Tor Lillqvist d219a50fd5 Use more obvious macro names
Instead of TARGET_LIB, just call it SOFFICEAPP_LIB, as it is the
"sofficeapp" dynamic library that it always refers to. And instead of
TARGET_MERGED_LIB, just call it MERGED_LIB, as that always refers to
the "mergedlo" dynamic library.

Change-Id: Ic3a8f29cd9b168f064bc2d02f15341b5ea1afef0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194593
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197106
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-13 14:03:43 +01:00
Tor Lillqvist e11f21a4d9 Don't even try to load a clearly bogus sofficeapp library
If it is smaller than 1000 bytes it can't be real, it must be the
dummy text file in the --enable-mergelibs case.

Change-Id: Ib3a913830bf34dc1e17955626576e72f5f7cd2d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194592
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197104
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-13 14:03:30 +01:00
Tor Lillqvist 8c6295036d Avoid MSVC warnings in freetype (needed in a --enable-headless build)
Also make the "dlg" thing internal to freetype.

Change-Id: I525c6dfdbf60ea7b464d8ddb4d765865ca94180d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194581
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197100
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-13 14:03:18 +01:00
Tor Lillqvist 0127eda727 Make avmediawin conditional on AVMEDIA
Change-Id: I2cdec861d840d5987a70c26fd1b61ba1f39f0a30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194591
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197103
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-13 12:31:06 +01:00
Tor Lillqvist faddfc7942 _FORTIFY_SOURCE has a meaning only in glibc
Change-Id: Ia087324841e4019d414d5ae3c845e80c7a7d1b73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194566
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197102
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-13 10:12:16 +01:00
Tor Lillqvist 9a23dff43e Accept Homebrew pkg-config also on an Intel Macs
On Intel Macs, Homebrew sadly uses the installation prefix /usr/local
and not /opt/homebrew.

Change-Id: I96a15dc69292799168cb67514b841a977dc353ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194588
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197105
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-13 07:18:24 +01:00
Tor Lillqvist 8f9d54f22f We seem to need postprocess_fontconfig also for CODA-W, for make check
In that case, USE_HEADLESS_CODE will be non-empty, even if USING_X11
and DISABLE_GUI are empty.

Change-Id: I553407737395789acef2380e0b1edb824bbcbad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194582
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197101
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-12 19:50:51 +01:00
Tor Lillqvist dd9b5ec78b We do need salsrc.res also in the --enable-headless case
Change-Id: I4e53550585a156bb0be09eaaa97ef29f90f9bba8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194578
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197098
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-12 19:25:23 +01:00
Tor Lillqvist fa8e80f065 Be prepared for a case-insensitive file system on Linux, too, not just macOS
Can easily happen at least on WSL.

Also avoid warnings about the deprecated readdir_r(). In current
POSIX, readdir() is required to be thread-safe. (It might well have
been for a long time in those POSIXish platforms we care for, I don't
know.)

Change-Id: I2b89b7aa170f661365580979d151c1b0557955fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197053
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-01-12 13:16:15 +01:00
Tor Lillqvist 2119f7fa5a Build fix for Windows in an --enable-headless build, i.e. CODA-W
No need to look up a cairo function dynamically as we know that in
Windows we are using a cairo we build ourselves so we can be sure that
it is has what we want.

There is a TEXT() macro in winnt.h, and we use that (indirectly)
elsewhere, so we can't just undefine it in postwin.h. Thus we can't
initialise a variable calld TEXT using parentheses.

Check USE_HEADLESS_CODE before checking _WIN32 to get the former code
in the CODA-W case and the latter otherwise for Windows.

Change-Id: I8987e3b33d51ea232f8262413d17a50910d8e7b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197007
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 22:55:17 +01:00
Tor Lillqvist 4857a2ba16 Make cairo and pixman build on Windows again
Change-Id: Icbed00952f6fcc04bd29c5946d7ea626ef5113f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196990
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-11 16:55:36 +01:00
Tor Lillqvist a7a806de51 Make pixman build for Windows on ARM64
Also silence more warnings in pixman and cairo.

Change-Id: Ic00c0ece203a0bdac5407f958c446ac8147093b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194597
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196989
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 16:54:43 +01:00
Tor Lillqvist 7feb6ec87e Update the Windows build of cairo for pixman 0.46.4 (for CODA-W)
Change-Id: I03f1010c0f15e9cc226c02daa529cec30888d5de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196988
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-11 16:54:22 +01:00
Tor Lillqvist f7bb23754e Update the Windows build of fontconfig for 2.17.1
Change-Id: Ieff4d01cbd60f225a6363566b6bc29c8bb9005bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196987
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-11 13:43:21 +01:00
Tor Lillqvist 5538c5066b Make the fontconfig Windows patch apply to fontconfig 2.16.1
Note that this patch is for now just a start of work that is paused
for now. The handling of non-ASCII filenames in the external libraries
that in the CODA case are now used also on Windows is likely very
broken, and needs to be carefully checked and modified. The new
<tools/UnixWrappers.h> thing, with additional work, will probably be
used.

Change-Id: I30cb09747a8de8716608669a75c872b73812b3f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194587
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196986
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-11 08:41:11 +01:00
Tor Lillqvist 1bc1c360cb Add some missing gb_StaticLibrary_use_unpacked calls
I had missed that such are needed, which explains why I had had to
manually hand-hold the build of those externals. (These are built as
static libraries, for now, only for CODA-W.)

Change-Id: Ib19ed82e0ab443b7ddfab254ed5754efd013bdf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194583
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196985
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:40:29 +01:00
Tor Lillqvist aa51cab2d7 Ignore two more warnings from MSVC in fontconfig
Change-Id: If949c2c73d2caa25f150691e3af2dc5b5c73b943
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194580
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196984
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:39:07 +01:00
Tor Lillqvist a958294ff2 Update the Windows build of fontconfig for 2.16.0
As before, use files generated on Linux, modified where needed.

Change-Id: I0ed6f93d7215e135d1333fff9c8a60bf9fcafa04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194576
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196983
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:38:57 +01:00
Tor Lillqvist cc7b9f1842 Use gb_UnpackedTarball_workdir
Change-Id: I4ce3c487425191bba4f004e8a93fb81d7316c700
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194574
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196982
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:36:36 +01:00
Tor Lillqvist 0bb6632422 Avoid duplicated files in the Ẃindows --enable-headless case
Change-Id: I7aad14b5830374d37980a1b5c8c358cff19e15b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194575
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196981
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:34:42 +01:00
Tor Lillqvist 430f603c6a Make --enable-headless possible also on Windows, for CODA-W
We variously look at both ENABLE_HEADLESS and USE_HEADLESS_CODE to
check for the --enable-headless case. Are both really needed?

In the --enable-headless case, freetype, fontconfig and cairo are
built. For now, cairo is built as a Library (DLL), but fontconfig and
freetype as StaticLibrary. Possibly should change these to DLLs,
too. (See preceding commits.) Do not build the vclplug_win.

Windows-specific fixes to the headless vcl code, and headless-specific
fixes to some Win32 vcl code. Use <tools/UnixWrappers.h> where
appropriate instead of <unistd.h>, <sys/mman.h>, etc.

fontconfig already has code for Windows, but likely things will break
on machines with a non-ASCII name for the Windows fonts directory, or
for funky font names. Should eventually make it use the new
<tools/UnixWrappers.h>.

Change-Id: Id3a1313083b1c7c44b0b26819c1ffb5138e15bc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194573
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196980
Tested-by: Tor Lillqvist <tml@iki.fi>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-11 08:34:27 +01:00
Tor Lillqvist fb2e5cd38c Add possibility to build cairo for Windows
As a Library, i.e. DLL. Using our build mechanism, not its own. This
commit does not yet actually add any configury to get it built,
BUILD_TYPE will never contain CAIRO on Windows. Running "make cairo"
won't work.

Change-Id: Ia0fb98471bea92ffb60a0d2a941a378c1fbc6b29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194572
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196979
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-11 08:32:41 +01:00
Tor Lillqvist 21dde17df5 Add possibility to build fontconfig for Windows
As a StaticLibrary for now. Using our build mechanism, not its
own. This commit does not yet actually add any configury to get it
built, BUILD_TYPE will never contain FONTCONFIG on Windows. Running
"make fontconfig" won't work.

Squashed in:
Apply windows-related patch only on Windows

Change-Id: I067d0d14dc4a1d99b4aae656b5f948c0a9952633
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194571
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196956
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
2026-01-10 16:22:52 +01:00
Tor Lillqvist 08c6a6fc5c Add possibility to build freetype for Windows
As a StaticLibrary for now. Using our build mechanism, not its own
configury and makefilery. This commit does not yet actually add any
configury to get it built, BUILD_TYPE will never contain FREETYPE on
Windows. Running "make freetype" won't work.

Change-Id: I30dc2ece4e69687ea02a407f8b2fbbfe70e79ba2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194570
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196955
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-10 16:19:35 +01:00
Tor Lillqvist 0a5bf9517a Drop use of <sys/time.h> in vcl/headless/svpinst.cxx
Instead use <tools/time.hxx> functionality, more specifically
tools::Time::GetMonotonicTicks(). More portable.

Change-Id: If05de20ad637e22fd2ab6c8287796a8e31c6d90d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194568
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196954
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-10 16:19:15 +01:00
Tor Lillqvist 836a190c2d Fix build on Windows with --disable-opencl
Change-Id: Ie85150aca1f4896e4e1d265a38dbeb19e92e53fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194564
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196884
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-09 18:49:45 +01:00
Tor Lillqvist 1d2d04bae6 Rename file-local ImplYield() to InnerYield() to reduce potential confusion
There are other functions called ImplYield in vcl, it's annoying to
confuse them.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Id184f96d74a88dc9b90181a4945f0707865d24f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194565
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196885
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2026-01-09 18:49:02 +01:00
Tor Lillqvist c91280773c Fix typo in --enable-cairo-rgba help string
Change-Id: Ib14c05419d3f165d4917bc074de042479cc35b8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194567
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196886
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
2026-01-09 15:02:45 +01:00
Tor Lillqvist 1238770c7b Put mxDropMediaSizeListener inside HAVE_FEATURE_AVMEDIA
Also another compilation fix for !HAVE_FEATURE_AVMEDIA.

Change-Id: I442d81f4817fbd28ff04e91c1503f947890007fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194559
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196671
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-08 12:33:43 +01:00
Tor Lillqvist cb335d48c7 Add initial attempt at CODA for Windows configuration
Notes for the master branch:

* "CODA" was (is) the internal codename for what now is known as (the
  new) Collabora Office. It stands for "Collabora Online as a Desktop
  Application".

* This indeed was just the initial attempt, the file will be modified
  in later commits.

Change-Id: I6c0d97998b5e57b6738086f8460bb9d0c1491d08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194555
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196627
Tested-by: Jenkins
2026-01-07 05:48:59 +01:00
Tor Lillqvist 951a74d047 Add --enable-msvc-debug-runtime to use that even without dbgutil
Adapt libxml2 build accordingly. It's MSVC_USE_DEBUG_RUNTIME we should
check to see whether the ICU libraries have a 'd' suffix in their
names, not ENABLE_DBGUTIL.

Change-Id: Ic817e3c15e7164478ae557627047d3793e3a88c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194584
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196618
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins
2026-01-06 21:07:34 +01:00
Tor Lillqvist b28a46aa50 Make sure that <tools/UnixWrappers.h> stays compilable as C
We don't use it yet from any C source file, but the plan is to do
that. Mainly from freetype, fontconfig, and cairo, when these are
built for Windows when the --enable-headless options is used (for the
new Collabora Office).

Also some cleanups, sorting #include lines, avoiding warnings, etc.

Change-Id: Ifef3588d06fdcceaeaeb3482399737faaf558d7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195602
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-12-15 07:31:21 +01:00
Tor Lillqvist 567612e5ac Move m_xPlayerListener inside HAVE_FEATURE_AVMEDIA
Change-Id: I59b96ddde501a91223b67ddf6f4eadc0e23bd2ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195544
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-12-12 15:03:06 +01:00
Tor Lillqvist ddcfcd67af Add wrappers to use Unix-style file APIs on Windows
Of course, LibreOffice has tons of APIs from before whose whole point
is to hide system dependencies behind a cross-platform API. All the
"sal" and "osl" stuff, for starters. The wrappers in this file is not
intended to replace those. The point with these wrappers is to quickly
port code that was written for Unix *only* to Windows, with minimal
changes to the source code. Basically you just need to prefix calls to
functions like open() and stat() with wrap_.

In Windows, "file descriptors" are a thing in the C library, not the
operating system. But the C library does provide the same core set of
functionality as Unix-like systems do. The functions use almost the
same names, except that for some reason, to avoid compilation
warnings, you need to call variants with names preceded by an
underscore, like _close().

Another Windows complication is that the file system is based on
UTF-16 names. You can't just pass file names as eight-bit characters
to _open() and expect it to work for all file names. Instead, you need
to call a function with a "w" prefix, like _wopen(), that takes a wide
character string (UTF-16).

This header is in C, not C++, because we want it to be usable from
some external libraries written in C that we compile as part of
LibreOffice in some circumstances, particularly for Windows.

All functions behave like the wrapped ones, set errno on errors.

Change-Id: Ia093ccf976659ceabbef6e0071da73d4df0b63b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195422
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-12-11 15:49:28 +01:00
Tor Lillqvist b0ecad5a3d Make the CODA-W PDF export file save dialog hack a bit more secure
Look for the mangled ++ name, to catch a potential mismatch in
function signature. Also, check that the returned function pointer is
non-null before calling it.

Change-Id: Ib2e0d1cd4b3e26081800b736b74e5972d0819736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195380
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-12-11 15:49:22 +01:00
Tor Lillqvist 754f13a421 Add horrible hack to ask the filename when exporting PDF in CODA-W
The PDF export functionality displays a dialog from JavaScript that
allows the user to choose various PDF parameters. But unlike export to
other formats, no system file save dialog gets displayed by CODA. So
do something horrible: Look up a function in CODA.cpp and call it
directly. Sorry.

Change-Id: I21932b2ba67d3aab72463d51f8ef71182ca5c736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195379
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-12-11 15:49:15 +01:00
Tor Lillqvist 4147d2f934 Don't let the last translation act as a default
Change-Id: Ia75743ad23ce651c9aab392098686d1978b49fe2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193629
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195194
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-12-08 09:42:50 +01:00
Tor Lillqvist 64a8aba7f3 Add apparently missing check on missing both ENABLE_NSS and ENABLE_OPENSSL
Not sure if such a build makes sense, but it was something I tried
(and disregarded), and we have similar conditionals elsewhere.

Change-Id: Ic9d99e0acb70bdcf769e46a4dcdd27e340a905b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194556
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194912
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-12-02 17:13:28 +01:00
Tor Lillqvist aa842cdc48 Fix build with --disable-opencl
Change-Id: Ib97d303ce7d03df237d78175f0c32ed466fdfa2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183039
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194811
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-11-29 15:15:50 +01:00
Tor Lillqvist f3b250fa28 Downgrade an assert to a warning
Change-Id: I26b623ded575e2c0b22dff19ae6cabae42003c1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191951
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@iki.fi>
2025-10-08 10:00:54 +02:00
Tor Lillqvist cfdda21862 Remove pointless assertion
After cc93fa1d10 the function handles
viewShell being null so no need to fail an assert if it is null.

Change-Id: Ie7d398f300e5eb695ae249291b9b8611dddc6423
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189865
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-18 18:02:28 +02:00
Tor Lillqvist 0340cbbc34 Bin the unused paintTileToCGContext special thing for iOS
It was used by "LibreOfficeLight" which died years ago.

Change-Id: I71a1315448baa4f1ec7a22b20cb3dd39c88cda78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151066
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-04-27 06:53:22 +02:00
Tor Lillqvist 4348f87828 Bin leftover dead code
Change-Id: Ie0583d52b01bba92e6fc41f0fee3fd4732f1d479
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151054
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-04-26 14:58:48 +02:00
Tor Lillqvist 153263957b Fix compilation with latest Xcode with iOS SDK 16.4
Alternatively we could just remove lots of stuff that we apparently
don't actually need from this file, including the problematic typedef
and its uses.

_Unwind_Exception_Class now gets typedeffed in <unwind_itanium.h> as
uint64_t which effectively is the same as the unsigned
__attribute__((__mode__(__DI__))) that is used here.

Change-Id: Id96d43eb481ee4ae97dd315aa2fd741e5f627916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150702
Reviewed-by: Patrick Luby <plubius@neooffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2023-04-20 21:35:01 +02:00
Tor Lillqvist 660f733855 There is no XAccessibleStateType
What is meant is surely AccessibleStateType.

Change-Id: I57903dd7e1eb9b0a3cac42a96633093569f770eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149194
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-21 09:10:53 +00:00
Tor Lillqvist e1c6f36d8b Add a to_string() function to the code generated for UNO IDL constant groups
If the inpt matches one of the constants exactly, the result is the
name of that constant. If the input matches some combination of
constant values that are single bits, the result is the sequence of
the names of those constants joined with plus signs.

For instance, if the IDL has:

constants Constants {
    const byte BIT0 = 1;
    const byte BIT1 = 2;
    const byte BIT2 = 4;
    const byte BIT3 = 8;
}

The result of Constants::to_string(5) is "BIT0+BIT2", and the result
of Constants::to_string(17) is "17".

I am sure there are corner cases that aren't handled as would be
intuitive, especially with types that include unsigned values.
Correspondingly, the semantics of the generated to_string() functions
is not formally defined.

Also add a unit test for the new functionality.

Change-Id: I14aa826d0989ac6dfe97dd5c09119b1601c65643
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148995
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-17 11:46:36 +00:00
Tor Lillqvist 910226f291 Remove false documentation
There are no such duplicated constant labels in this file.

Change-Id: I6352766834bf832667b5644d7507ec250932492a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148976
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-16 10:43:29 +00:00
Tor Lillqvist 42e94211ad Improve documentation of lok::Document::getPartPageRectangles()
Change-Id: Ic507749064ff27b36cac8e01a54fb58dd10cdda5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148779
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-13 11:34:35 +00:00
Tor Lillqvist bcf0f2b6d8 Make error message more useful
Change-Id: I3c6efcbd2a2759385912aa352d0c250963e5f004
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148464
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-08 12:22:48 +00:00
Tor Lillqvist 1f4e9eacc3 Drop the LibreOfficeKit paintThumbnail() API
It turns out that Mert's original idea is actually the simplest and it
is known to work. And in that, the separate paintThumbnail() is rather
pointless, as all paintThumbnail() did was to call paintTile(). The
caller (in Collabora Online) knows when a file is opened specifically
for thumbnailing, and can call paintTile() itself with the appropriate
parameters.

My misguided idea would have had paintThumbnail() somehow figure out
the physical Twip coordinates of the current location (for text
documents, the insertion caret location) in the document. (Or, as
LibreOfficeKit for some reason calls them, "logical" coordinates, even
if a Twip is a very physical length unit.) Then it would have called
paintTile() with those coordinates. But it turned out to be rather
hard to figure out the Twip coordinates of the current location in
the document.

Mert's idea was that when a document is opened for thumbnailing, only
Online actually needs to know that. From LibreOfficeKit's and core's
point of view it is a normal document load operation. Then Online
performs the .uno:OpenHyperlink magic, which makes core move the
current position to the requested "target" or "mark" (the terminology
varies) location. And then a "cursor" callback is used by Online to
get the Twip coordinates of the target. It is a bit unclear to me
whether .uno:HyperLink causes the document to be opened an extra time,
but whatever, this way is said to work. So let's do it like that.

This reverts the paintThumbnail part of
1aa37ca991.

Change-Id: I8f3d9917ee362c1518834fc10a57c57ebc4a6edb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148390
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-07 14:40:02 +00:00
Tor Lillqvist f3a0ed5d63 Fix Doxygen comment thinko: dumpState() is in lok::Office, not in lok::Document
Change-Id: I87626370fdd8cbe906ed31d1b8c92234696e9708
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148414
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-07 11:06:11 +00:00
Tor Lillqvist 91afabee6b Improve the LibreOfficeKit Document::paintThumbnail() API
No implementation yet.

Change-Id: Ie1dc955bc8b589bd336af0545a2270cbe84a8b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148028
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-03-01 08:28:21 +00:00
Tor Lillqvist a62cb6db82 It seems to work to compile also the MMX code for WASM
Change-Id: I27b56297a07e248102cae1bee4074b7be422ce23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147875
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-27 10:55:10 +00:00
Tor Lillqvist 6f29310fe8 Don't call CuiResId() in a global static variable initialiser
Instead, have a function that returns a reference to a local static
variable. That local static is then initialised only when the function
is called for the first time. Calling CuiResId() in a global
initialiser is a bit questionable, and causes an uncaught exception
when LO core is used in a WASM app. Possibly it would also have been
problematic on other uncommon platforms.

Change-Id: I4fd799ba3aa8d63fd3db1eb8cf6211aeed904ed2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147512
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-23 13:47:56 +00:00
Tor Lillqvist d24b80c783 Fix --disable-scripting build (for example for WASM)
Was broken by ccd0ef98f7.

Change-Id: I37f3cf14e14ca32919d54f3d0cddbc042c2a7056
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147463
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-22 18:40:08 +00:00
Tor Lillqvist 1aa37ca991 Extend LOKit API with functionality to extract a request and paint thumbnails
Original author was Mert Tümer.

Change-Id: I181a9955bcce1d5ee4c81e2a52445ef318dc4823
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147396
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-22 08:14:30 +00:00
Tor Lillqvist 49445ccb89 Use -O3 for Emscripten, seems to work
Change-Id: I7effd75355ff81e6d4f85b1c6047c7656bfbb915
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147006
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-16 21:27:14 +00:00
Tor Lillqvist 21e9ebb75b Add comment about using WASM exceptions
Change-Id: I402bf56b89b3a18f854331915f827f7512fb05e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147152
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-16 11:35:39 +00:00
Tor Lillqvist d88fa033f0 Make a few warning messages a bit more useful
Change-Id: Ie533e76532f2ee6477cce8042d958d36bf9ebb9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147082
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-15 14:45:33 +00:00
Tor Lillqvist 297c71c82b Mention that Emscripten 3.1.30 is known to work for COWASM
Change-Id: Id01004121a306dea953b908c32acc7f2c0e6841c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146857
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-13 09:05:21 +00:00
Tor Lillqvist 4277e37e65 Don't overload the word 'module' unnecessarily
Change-Id: I10fb7d16192ddfb0802c976419c00302d4688c4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146856
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-13 08:59:40 +00:00
Tor Lillqvist 6d0a0e09ce Avoid implicit function declaration warnings
Noticed when compiling with Emscripten for WASM, but might well happen
in other cases, too.

Change-Id: I37ae326af21204d81a6a3267831d7a0198d1d501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146744
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-10 14:04:47 +00:00
Tor Lillqvist 8d90e02b4c Get the shared object of a bundled fontconfig into rpm and deb packages
Change-Id: I9630fa25178637bba189c263605a2198ef5c6064
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141550
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146720
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146740
Tested-by: Jenkins
2023-02-10 11:54:16 +00:00
Tor Lillqvist cbac6b9d8f Pass product name and not hardcoded "LibreOffice" to make_installer.pl -p
Change-Id: I9b2d84bcc18e21b325960f7057e259daa37234a5
Reviewed-on: https://gerrit.libreoffice.org/55640
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 12d1b08aac8cc8c3176040efc7290377e380f0c4)
Reviewed-on: https://gerrit.libreoffice.org/79128
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit 0069417b55c99166aec5489ccef803eba25d2b4f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136842
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146741
Tested-by: Jenkins
2023-02-10 08:48:39 +00:00
Tor Lillqvist d5f5f09845 Use SIMD in pixman for WASM
Emscripten and WASM do have some support for SSSE3, so let's try to
use it, with -msimd128. See
https://emscripten.org/docs/porting/simd.html.

WASM is not x86, though, so avoid use of inline x86 assembly, like the
CPUID instruction.

Emscripten does not have <mmintrin.h> but does have <xmmintrin.h>,
<emmintrin.h>, and <tmmintrin.h>.

Change-Id: Ic3a47291f6c6dee6843e93ccecc92a643b269cb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146691
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-09 14:55:26 +00:00
Tor Lillqvist d552b4a549 Enable opening of downloaded fonts only in ForKit in Online
We want that only the ForKit process needs to have access to new font
files added to a Collabora Online instance dynamically by downloading
from a server. There are however many locations in the Kit process, in
core and in external libraries like harfbuzz, where the code wants to
open a font file.

Handle this so that the ForKit process opens such a downloaded font
file and doesn't close it. The file descriptor is thus inherited by
Kit processes.  The font file pathname passed on to other code is a
fake on in the format "/:FD:/%d" where the %d is the file descriptor
of the opened font file. Add checks in all places where font files are
opened, look for this special pathname format, and modify the code to
just dup() the already open file descriptor in that case.

All this is relevant for Linux only, as Collabora Online runs on
Linux.

Do the above for harfbuzz, cairo, fontconfig, and freetype.

In addition make sure that these libraries (except harfbuzz which
needs to be a static library and freetype) when bundled, on Linux, are
built as shared libraries, and won't be confused with the
corresponding system libraries by making sure their sonames are
different.

Change-Id: Ib059cb27e1637d07bb709249abd0d984f948caa9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140714
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146341
Tested-by: Jenkins
2023-02-09 13:47:02 +00:00
Tor Lillqvist 187d3b6e8f Minor typo fixes and some additional information
Change-Id: Ic0b76ca37dce37f88df62d80495e111c4d50818e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146572
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-06 10:01:21 +00:00
Tor Lillqvist 6f6b879e8d Add instructions for when building headless LO core for WASM
Change-Id: Ic5fb943f8c26d21d94bafb815963960bdd2f26b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146497
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-02-02 11:52:58 +00:00
Tor Lillqvist 18d2c7e82d Avoid compiler warning
Change-Id: I322b2c0ea14bbf8ed2fe1a306c0ed28f5e5ae258
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136875
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
(cherry picked from commit ece304df9ad2aa0f974927320a1324c06b89f337)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146076
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-01-28 20:24:24 +00:00
Tor Lillqvist 6e2d28934e Clarify comment
Change-Id: I33d10ea4f3ca35619d6f857d18b5c53a22d822a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146097
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-24 15:21:31 +00:00
Tor Lillqvist d514097753 Surround recently added code that breaks on COWASM with ifdef
After 7a6324ea0d I started getting UNO
exceptions with the message "component context fails to supply service
com.sun.star.xml.crypto.SEInitializer of type
com.sun.star.xml.crypto.XSEInitializer".

It is likely that it breaks in the iOS and Android apps, too, so
bypass for those, too.

Change-Id: Id08afbf6bea071c8b0b6564342716e0b064cb712
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146071
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-24 15:17:30 +00:00
Tor Lillqvist e37a4598bb Use PYTHONWARNINGS=ignore instead of 'default' for Emscripten
The Emscripten compiler, emcc is a Python script that wraps the actual
compiler. It outputs annoying warnings like

    .../emscripten/tools/building.py:638: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/emscripten_temp_0fvvg__1/conftest.js.jso.js' mode='w' encoding='utf-8'>

to stderr. (Ditto for em++.) Some steps in typical configure script
think that a non-empty stderr means there was a problem in compiling a
test program. This happens even for a microscopic test program with an
option like -Werror which surely *is* supported.  Avoid this by
setting PYTHONWARNINGS=ignore.

Change-Id: I11927fc7dccaa65a239ba65dfc7c6bb7487bf12d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146070
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-24 15:11:49 +00:00
Tor Lillqvist a771945f98 Be consistent in checks for LIBO_INTERNAL_ONLY
Only check whether LIBO_INTERNAL_ONLY is defined or not. Don't check its value.

If undefined, its value will default to 0, but checking the value will
cause a warning that will be treated as an error if you compile with
-Werror, as you should.

Change-Id: I1d9e4569a016d2e6dbaa9d612071a5528ff1902e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146066
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-24 14:02:40 +00:00
Tor Lillqvist 5cd3a8ec6d Enforce compiling cairo and pixman for WASM with -O3
Earlier, no -O flag at all got used in the cairo and pixman
builds. Which was sad, as these two libraries are performance-critical.

Yes, this change is quick-and-dirty. The proper way would be to modify
things in solenv/gbuild. But that is somewhat complicated.

In general it seems fairly hard to make sure the same compiler flags
get used for every external bundled library. Each external library is
a special snowflake, more or less, with a differently structured
ExternalProject makefile.

For instance for the libwpd library (just picked randomly as an
example), even -O2 gets used. (Which as such is OK.) This despite
solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk apparently trying to
enforce use of -O1 for Emscripten.

This change has a visible impact on the performance of COWASM.

Change-Id: I99d74db2da733134fde16661881856f9a81100f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146009
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-23 22:58:54 +00:00
Tor Lillqvist 36c492bb01 Bin line that was commented-out in December 2021
Change-Id: Ie6c6891d1a682d57e4606454fb6b295072e57644
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146038
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-23 20:18:35 +00:00
Tor Lillqvist d648f2ae3a Adapt for --enable-wasm-exceptions
Actually, it seems that to build core with --fwasm-exceptions for use
in a LibreOffice Technology -using WASM executable, you need to
compile *everything* with that (i.e. *all* of core's externals). Just
these gbuild things are not enough to ensure that. You have to put

  CC=emcc -pthread -fwasm-exceptions -s SUPPORT_LONGJMP=wasm
  CXX=em++ -pthread -fwasm-exceptions -s SUPPORT_LONGJMP=wasm

into your autogen.input.

Change-Id: I10d21ad0f73e7e5d72864864d595077bd770f4f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145646
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2023-01-17 07:57:12 +00:00
Tor Lillqvist 5c355dbae8 Don't bother building the liborcus benchmark
It causes a problem when building with Emscripten and
--enable-wasm-exceptions. Instead of fixing that problem, just don't
bother building executables we won't run anyway. (Ideally liborcus
should have some --disable-benchmark configure options, ping Kohei.)

Change-Id: Ic8c1d51513793bba85dc2833cc8fd9ec5b97ce76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145645
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2023-01-17 07:56:42 +00:00