summaryrefslogtreecommitdiff
path: root/vcl/inc
AgeCommit message (Collapse)Author
2024-04-08Exclude getHScale from DirectWrite font renderingMike Kaganski
... and drop it, since it's unused now. Unkike with Skia, where the ratio produces a visible effect, in DirectWrite the effect seems cancelled by transformations. Yet, it produced computational instability, noticable in small vertical text. Change-Id: I2f3b20913075d1338dc75c5a04c9cc0ef29c75ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165877 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-06tdf#143148 use pragma once instead of include guardsHeikki Ilvesmäki
Change-Id: I87f971d5c5e61127025e66947f181d6012e20ecb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165825 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
2024-04-02Fix UBSan RTTI needsStephan Bergmann
...vcl_graphic_test now failed with > DynamicLibraryManagerException: "Failed to load dynamic library: workdir/LinkTarget/CppunitTest/libtest_vcl_graphic_test.so > workdir/LinkTarget/CppunitTest/libtest_vcl_graphic_test.so: undefined symbol: _ZTI10ImpGraphic" Change-Id: I1d11a50ef9dbb0003f7bc66540829b43c1412a16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165653 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-04-01tdf#160430: Fix glyph bounds calculation, and use basegfx::B2DRectangleMike Kaganski
... instead of tools::Rectangle. Several problems were there: 1. First, a horizontal bounding rectangle was calculated, with due rounding; and then the result was rotated, and after that, rounded again. That made the resulting rotated rectangle coordinates very imprecise. 2. Also, ceil/floor was applied without normalization; and in case of rotated font, that meant, that sometimes the range could be not expanded to cover partially covered pixels, but instead collapsed. 3. The rotation to angles other than 90 degree multiples was done incorrectly, resulting in cut off parts of characters. 4. For 90 degrees, the imprecise result of sin/cos converted 0.0 into values like 3e-16, which then could be ceil'ed up to 1. Using B2DRectangle and its transform allows to simplify and fix the calculations easily, and avoids premature rounding. Render of rotated text of small size is more stable with this change. Change-Id: Idffd74b9937feb2418ab76a8d325fdaf4ff841b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165553 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-30vcl: add resetLastUsed to ImpGraphTomaž Vajngerl
We reset the last used member variable in many places in the same way, so instead of duplicating the implementation, add that to a method. Change-Id: I747559ecf1a6736f976b4d560ab5052c19431898 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165207 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-30vcl: change (graphic) Manager into a general memory managerTomaž Vajngerl
Graphic memory manager was changes so that it can work with any object that implements a specific interface (MemoryManaged). With this it will be possible to use other objects (that take a lot of memory) to be managed by the manager. It is also a first step to move memory managin responsibilities away from Graphic and move it into the specific objects instead (BitmapEx, Animation and VectorGraphic). Change-Id: I7638bd89a1c9ece5c4bc95b506d2192492894ef3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164958 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-30Related: tdf#160159 use a stock icon for the character mapCaolán McNamara
https://specifications.freedesktop.org/icon-naming-spec/0.8/ar01s04.html Where "accessories-character-map" is "The icon used for the ... character accessory program" Change-Id: I48c72aaa3827037eb6921571bcce061fe60ac135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165561 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-03-29Simplify and drop unused methodMike Kaganski
Change-Id: Ie987bce2bb25232d54a4a83631c609ad6dba7213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165467 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-28vcl: Implement JSLevelBarHubert Figuière
This fixes the JSDialog layout of the sheet protection dialog. This was introduced for 24.02 to provide password strength indication of the sheet password. Defined a new WindowType of PROGRESSBAR. The type property in JSDialog JSON will be "progressbar". Change-Id: I202528a81706943e1838f3c37fb555f4a1bf889e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165236 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-03-27clang-format CPDManager sourcesMichael Weghorn
These will likely be significantly changed in the process of updating the code to support current CPDB (Common Print Dialog Backends) versions, see [1]. [1] https://lists.freedesktop.org/archives/libreoffice/2024-March/091748.html Change-Id: I2d8fe1cfedb703e4843ade261e5c09e24dfe30b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165366 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-03-25Avoid -Werror,-Wcast-function-type-mismatch, remove unused int returnStephan Bergmann
> vcl/unx/generic/app/i18n_ic.cxx:225:51: error: cast from 'int (*)(XIC, XPointer, XPointer)' (aka 'int (*)(_XIC *, char *, char *)') to 'XIMProc' (aka 'void (*)(_XIM *, char *, char *)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch] > 225 | maPreeditStartCallback.callback = reinterpret_cast<XIMProc>(PreeditStartCallback); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I94d1d0042516a01f8597bc65895042ddae76c98b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165291 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-23vcl: set "default" type only thorugh a ImpGraphic constructorTomaž Vajngerl
and do some more clean-up. Change-Id: I28c33887226444046d21076118fd066eb3a231d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164947 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-22vcl: remove 4-bit scanline transformerTomaž Vajngerl
We don't use 4-bit bitmap anymore and haven't for a long time. Change-Id: I00b55a82df4609fbddd50b35f67e338e06f02c4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164754 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-22vcl: simplify constructors of ImpGraphicTomaž Vajngerl
Change-Id: I6df0da16d777549e6187327271868774498d073b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164694 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-20jsdialog: send update on spin button range changeJaume Pujantell
On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164998 Tested-by: Jenkins
2024-03-16reduce symbol visibility in vclNoel Grandin
Change-Id: Ia56bb092a4634e301ff8922ae63e6f7ede874d80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164865 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-14reduce symbol visibility in vclNoel Grandin
Change-Id: Ifaa37246e79678aa0c548b9ca8a9faf8036b9195 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164804 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-14replace VCL_DLLPRIVATE with SAL_DLLPRIVATENoel Grandin
it is always SAL_DLLPRIVATE, and we are already using SAL_DLLPRIVATE mostly, so just be consistent Change-Id: I7df969506a9b7a078921400cf245cede3c60c5f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164805 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-13Introduce a guard to delay processing of idlesMike Kaganski
In a following scenario, there could be a crash: 1. Platform: a Windows system with MS Word installed. 2. LibreOffice is run in a listener mode; 3. A Java program opens a Writer document in a visible mode, with an embedded Word OLE object; 4. It adds some text; then resizes the OLE object; then removes the OLE object. Word OLE objects have OLEMISC_RECOMPOSEONRESIZE flag [1]; this means, that every re-layout of the document with this object must ask the OLE server to re-layout the object content. So, the request thread changes the document text, which triggers idle re-layout or redraw; the idles start executing immediately in the idle main thread, with solar mutex locked; then the request thread starts the OLE object removal operation. The ongoing relayout in main thread would at some stage need to execute a call to the OLE object, which temporarily releases the solar mutex (this makes impossible using solar mutex to synchronize the order of operations in this scenario). Other mutexes guarding OLE object (in OleEmbeddedObject, and in OleComponent) are also released for the duration of the call. Thus, the removal that happens in the request thread proceeds, and the node containing the OLE object is destroyed, while the main thread (processing exactly this node) is waiting for the OLE server response, then for mutexes, to proceed. After that, the main thread would attempt to access the destroyed node object. This change introduces a scheduler guard (a RAII object), that sets a flag to not process idle events during the lifetime of the guard. In its constructor, it also makes sure, that current pending idle events are finished. This would make sure that guarded code started from other threads would not race with idles potentially accessing the model that is currently in transient state. [1] https://learn.microsoft.com/en-us/windows/win32/api/oleidl/ne-oleidl-olemisc Change-Id: I2ef0601ccd8b5872588a88493d1f43e39022dbed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164753 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-08use more string_viewNoel Grandin
found by tweaking the stringview loplugin Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-05reduce heap allocation in JSDialogNotifyIdleNoel Grandin
makes the code simpler too Change-Id: Ic452895a20fb2908f7383082069a84ef3fa6a4d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164395 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-04vcl: interface for WinAPI FlashWindow() functionVasily Melenchuk
To improve LibreOffice UX it will be great to have possibility to signal user on some event did happen, but without capuring focus and bringing LO to foreground, like it is happenings sometimes. It can be annoying. For example, if dialog window is opening slowly and user did switch to another application, this is used to inform user that there are some updates in LO window: dialog finally alive. There are somewhat confusing implementation of this feature: VCL dialog window became visible and actual Windows window should use ::FlashWindow() are very different in hierarchies, so it is somewhat challenging to find window to flash or even decide shoud we flash window or not. Change-Id: I6ca6706d2dda8902aea273ebe6e318ec9bf4beda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158472 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-02-29tdf#158030 qt a11y: Implement new QAccessibleAttributesInterfaceMichael Weghorn
Implement the new `QAccessibleAttributesInterface` just added upstream to Qt in qtbase commit [1] commit fb5ffe862688a87cfc136113e067bcba0c49a7ae Author: Michael Weghorn <m.weghorn@posteo.de> AuthorDate: Fri Nov 10 18:25:02 2023 +0100 Commit: Volker Hilsheimer <volker.hilsheimer@qt.io> CommitDate: Thu Feb 29 04:44:22 2024 +0000 a11y: Add new QAccessibleAttributesInterface , see also QTBUG-119057. [2] This API is available with Qt >= 6.8. That interface makes it possible to report object attributes that are bridged to the platform a11y layers. Use it to bridge the attributes retrieved from the `XAccessibleExtendedAttributes` UNO interface. Together with the pending upstream qtbase change that implements the AT-SPI bridge for Linux [3], the "level" AT-SPI object attribute for headings in Writer is correctly reported to AT-SPI, making the Orca screen reader announce "Heading level N" as expected. For now, map not explicitly handled attributes as key-value pairs to Qt via the special `QAccessible::Attribute::Custom` attribute, which causes them to be mapped to AT-SPI unchanged, and can e.g. be used for testing the tdf#158030 scenario. For common attributes - like those specified in the Core Accessibility API Mappings specification [4] - suggesting to add new enum values to the `QAccessible::Attribute` enum to upstream Qt and using those instead should be considered for the future. Related commit for gtk4: commit 3aca2d9776a871f15009a1aa70628ba3a03ee147 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Nov 9 15:31:57 2023 +0100 gtk4 a11y: Handle the "level" object attribute [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=fb5ffe862688a87cfc136113e067bcba0c49a7ae [2] https://bugreports.qt.io/browse/QTBUG-119057 [3] https://codereview.qt-project.org/c/qt/qtbase/+/517526 [4] https://www.w3.org/TR/core-aam-1.2/ Change-Id: Ibe357bfd72bb2dc6e44ad941e62737d5cac21e1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159309 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-27tdf#159910 vcl a11y: Allow explicitly setting toolbar item a11y nameMichael Weghorn
Add `ToolBox::SetAccessibleName` (and corresponding getter) to allow explicitly setting an accessible name for a toolbox/toolbar item with the VCL toolbar implementation. In the a11y class for a toolbar item, use any explicitly set name if it's non-empty, otherwise fall back to the previous logic. This will be used in an upcoming commit to take into account the accessible name set in .ui files and align the VCL ToolBox more with the gtk implementation using native GtkToolbar and native widgets for the toolbar items. Change-Id: Ib0255e2741a7ab2489a857ac120fb87f680fa775 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164033 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-26tdf#143148 Use pragma once instead of include guards in vcl and xmloffanish.deshpande
Change-Id: I317da0a6f626e8ddb3f090099347b130e99ff2a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163856 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-02-23tdf#159793 Save printer paper tray in RTF and DOCXOliver Specht
Saves the paper tray id as w:paperSrc w:first and w:other in docx and \binfsxn and \binsxn in RTF Change-Id: I79004f54aba3b6609d7921afacf815726f7f2678 Change-Id: Ie3c11fffa6a133250b7db69b4e845bccaa8e2280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163654 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-02-23tdf#143148 Use pragma once instead of include guardsAhmedHamed
Change-Id: I5ea12f17e35e4eb3dd36781fd31664caaef17e50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163785 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
2024-02-21Fix UBSan build's RTTI needsStephan Bergmann
...after 3ba92b5f1eaf7d4447a0943ea260db515ca799dc "hide more symbols" had caused CppunitTest_vcl_text to fail with > DynamicLibraryManagerException: "Failed to load dynamic library: /home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/LinkTarget/CppunitTest/libtest_vcl_text.so > /home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/LinkTarget/CppunitTest/libtest_vcl_text.so: undefined symbol: _ZTIN3vcl8unotools15VclCanvasBitmapE" > Path (length: 252) is '/home/tdf/lode/opt/bin:/etc/alternatives/java_sdk_11/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/home/tdf/.local/bin:/home/tdf/bin:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/etc/alternatives/java_sdk_17/bin' (<https://ci.libreoffice.org/job/lo_ubsan/3080/>) Change-Id: Ib0a82e185a8600955704f8026238b511d46acc56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163685 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-20merge desktop_detector library into vcl libraryNoel Grandin
Noting that the main feature of using a separate library - avoiding linking against SM and ICE - is no longer a thing, since we have not used those in some time. Change-Id: I9ecd6758e97f0fa19b224346aa577a04b46793b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163638 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-19tdf#126638 dispatch key shortcut events to modal windowsPatrick Luby
While commit 4f907fbe52749265ba4eb7c40ed187b453bb1de9 fixed tdf#126638, it caused the "disallowed action" beep. Some modal windows, such as the native Open and Save dialogs, return NO from -[NSWindow performKeyEquivalent:]. Fortunately, the main menu's -[NSMenu performKeyEquivalent:] is then called so we can catch and redirect any modal window's key shortcut events without triggering the modal window's "disallowed action" beep. Change-Id: Ib1fff68ab159361ceb847881e3a4da4736a33f51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163605 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-19hide more symbolsNoel Grandin
using the bin/find-can-be-private-symbols.py script to find classes with large numbers of exported symbols that can hidden. before exported = 58104 imported = 30810 unused_exports = 35433 after exported = 55094 imported = 31073 unused_exports = 32423 Change-Id: Idd0a70ee3740afd5ca1a86771e0e2ff8090d102d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163456 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-18tdf#126638 dispatch key shortcut events to modal windowsPatrick Luby
Some modal windows, such as the native Open and Save dialogs, ignore any key shortcut events so use the same existing special dispatching code that -[VCL_NSApplication sendEvent:] uses to dispatch key shortcuts to non-modal, non-LibreOffice windows. Also, disable all menu items when displaying modal windows. For some unknown reason, key shortcuts are dispatched to the main menu instead of the modal window so enable the "autoenabledItems" property instances so that -[SalNSMenuItem validateMenuItem:] will be called before handling a key shortcut and the menu item can be temporarily disabled if a modal window is displayed. Change-Id: I6c06024dd6ed05a4ee83f2b37e29c555b52ef555 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163527 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-15tdf#130857 qt weld: Implement QtInstanceDialog::{g,s}et_modalMichael Weghorn
Change-Id: I975d10ccc73c79b34da733411097a7970c8bf916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163361 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-15tdf#130857 qt weld: Move QWidget* member to QtInstanceWidgetMichael Weghorn
Move the `m_pWidget` member from `QtInstanceWindow` to the base class `QtInstanceWidget` and add a getter for it. This allows to get the `QWidget` directly from the base class, which will be used in an upcoming commit. Change-Id: I9c41b48936e5a6051afb9721dae2fac5add22e4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163360 Tested-by: Jenkins Reviewed-by: Omkar Acharekar <omkaracharekar12@gmail.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-13fix windows --enable-mergelibs buildNoel Grandin
after commit b663d94cf67a5af4fd89c1ac8bdffd6059f6bf85 Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Mon Feb 5 08:50:24 2024 +0200 create --enable-mergelibs=more Change-Id: Ib9f0b3b28df70a9bab10d9bb0aa77a2b2decc616 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163308 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-13tdf#156562 qt: Sync with system clipboard content if necessaryMichael Weghorn
If the `QtClipboardTransferable`'s mime data gets out of sync with the system clipboard's one, no longer cease operation and stop reporting any transfer data, but sync with the clipboard data, i.e. update the mime data with those currently in the system clipboard. For the "Paste Special" dialog with qt6 on Wayland (see tdf#156562), an external clipboard update gets triggered between the point in time when the std::shared_ptr<const TransferableDataHelper> aDataHelper in the `SID_PASTE_SPECIAL` case in `SwBaseShell::ExecClpbrd` gets assigned and when the callback set via `pDlg->StartExecuteAsync` gets called, even if there was no user interaction with the system clipboard at all. This however meant that the `aDataHelper` used in the callback would no longer return any transfer/mime data, so pasting wouldn't work. Handle that case by updating the `QtClipboardTransferable` mime data with the current system clipboard's data, but keep emitting a warning at least. As a consequence, opening the "Paste Special" dialog, then copying something else to the clipboard, then confirming the dialog will copy the newly copied data rather than what was in the clipboard when the dialog was initially started. That's the same for gtk3 already, but on Windows, the original clipboard content would still be pasted. (Retrieving the clipboard content anew in the callback using `TransferableDataHelper::CreateFromSystemClipboard` instead of passing the original `aDataHelper` into the callback would have a similar effect. However, on other platforms, reusing the previously copied data from the clipboard when the actual system clipboard was changed in between may be what's desired.) The observed extra/unexpected clipboard change event may be related/similar to what the following commit was addressing for the case of LO itself being the clipboard owner: commit 71471a36b125f6bdc915d5dbcae92ebcaa7ff5a4 Date: Tue Apr 6 01:41:08 2021 +0200 tdf#140404 Qt ignore "unchanged" clipboard events LO gets a Qt signal on all clipboard changes. For X11 you get one signal when you set the clipboard. Anything else normally signals lost of clipboard ownership. But on Wayland LO somehow gets a second notification without any actual change. AFAIK it's not triggered by any LO actions and isOwner still indicates, that LO has the ownership. This breaks the single notification assumption, the code was relying on. (...) Backtrace showing how the clipboard update gets triggered (with mode `QClipboardMode::Clipboard`, not just `QClipboardMode::Selection`; qtbase dev as of 0d0810e2dcc8a9ee28935af5daadc2ef36ed25a2): 1 QtClipboard::handleChanged QtClipboard.cxx 156 0x7f6284c7a7a8 2 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard:: *)(QClipboard::Mode)>::call(void (QtClipboard:: *)(QClipboard::Mode), QtClipboard *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 153 0x7f6284c8450f 3 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard:: *)(QClipboard::Mode)>::call(void (QtClipboard:: *)(QClipboard::Mode), QtClipboard *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard:: *)(QClipboard::Mode)>::call(void (QtClipboard:: *)(QClipboard::Mode), QtClipboard *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 72 0x7f6284c8500b 4 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QClipboard::Mode>, void, void (QtClipboard:: *)(QClipboard::Mode)>::call qobjectdefs_impl.h 152 0x7f6284c8457f 5 QtPrivate::FunctionPointer<void (QtClipboard:: *)(QClipboard::Mode)>::call<QtPrivate::List<QClipboard::Mode>, void> qobjectdefs_impl.h 200 0x7f6284c833ee 6 QtPrivate::QCallableObject<void (QtClipboard:: *)(QClipboard::Mode), QtPrivate::List<QClipboard::Mode>, void>::impl qobjectdefs_impl.h 571 0x7f6284c81f81 7 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 487 0x7f62841b863f 8 doActivate<false> qobject.cpp 4116 0x7f628425772e 9 QMetaObject::activate qobject.cpp 4176 0x7f628424cdef 10 QClipboard::changed moc_qclipboard.cpp 182 0x7f62831e9fcc 11 QClipboard::emitChanged qclipboard.cpp 558 0x7f62831e9bc1 12 QPlatformClipboard::emitChanged qplatformclipboard.cpp 89 0x7f628324ed69 13 QtWaylandClient::QWaylandDataDevice::data_device_selection qwaylanddatadevice.cpp 295 0x7f6281b8eaf1 14 QtWayland::wl_data_device::handle_selection qwayland-wayland.cpp 985 0x7f6281b7389a 15 ?? 0x7f629681a40e 16 ?? 0x7f629681971d 17 ffi_call 0x7f6296819ef3 18 ?? 0x7f629955c921 19 ?? 0x7f6299558c09 20 wl_display_dispatch_queue_pending 0x7f629955a5ac 21 QtWaylandClient::EventThread::dispatchQueuePending qwaylanddisplay.cpp 227 0x7f6281afd5f4 22 QtWaylandClient::EventThread::readAndDispatchEvents qwaylanddisplay.cpp 109 0x7f6281afd124 23 QtWaylandClient::QWaylandDisplay::flushRequests qwaylanddisplay.cpp 508 0x7f6281af5b98 24 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 153 0x7f6281b13ebb 25 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 72 0x7f6281b151f0 26 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, void * *) qobjectdefs_impl.h 152 0x7f6281b13f1c 27 QtPrivate::FunctionPointer<void (QtWaylandClient::QWaylandDisplay:: *)()>::call<QtPrivate::List<>, void>(void (QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, void * *) qobjectdefs_impl.h 200 0x7f6281b11250 28 QtPrivate::QCallableObject<void (QtWaylandClient::QWaylandDisplay:: *)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *) qobjectdefs_impl.h 571 0x7f6281b0d5e3 29 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 487 0x7f62841b863f 30 QMetaCallEvent::placeMetaCall qobject.cpp 650 0x7f6284243bf9 31 QObject::event qobject.cpp 1447 0x7f6284245095 32 QApplicationPrivate::notify_helper qapplication.cpp 3298 0x7f62823a696c 33 QApplication::notify qapplication.cpp 3249 0x7f62823a677d 34 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1138 0x7f62841b1162 35 QCoreApplication::sendEvent qcoreapplication.cpp 1581 0x7f62841b1d0b 36 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1936 0x7f62841b33c4 37 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1770 0x7f62841b255e 38 postEventSourceDispatch qeventdispatcher_glib.cpp 244 0x7f62846384ac 39 ?? 0x7f628b9111f4 40 ?? 0x7f628b914317 41 g_main_context_iteration 0x7f628b914930 42 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 394 0x7f6284638d41 43 QPAEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 87 0x7f628395c418 44 QtInstance::ImplYield QtInstance.cxx 453 0x7f6284cd9a40 45 QtInstance::DoYield QtInstance.cxx 464 0x7f6284cd9b69 46 ImplYield svapp.cxx 390 0x7f628f739c32 47 Application::Yield svapp.cxx 474 0x7f628f73a9d0 48 Application::Execute svapp.cxx 368 0x7f628f739925 49 desktop::Desktop::Main app.cxx 1614 0x7f6299037216 50 ImplSVMain svmain.cxx 229 0x7f628f758df4 51 SVMain svmain.cxx 261 0x7f628f759109 52 soffice_main sofficemain.cxx 94 0x7f62990a4367 53 sal_main main.c 51 0x56508cf899d4 54 main main.c 49 0x56508cf899ba Change-Id: I1720d8acd72dca4ef6bc32935b920b2c1ff4d8f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163304 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-13tdf#156562 qt: Don't cache supported mime types/data flavorsMichael Weghorn
Drop the optimization to remember the supported data flavors in `QtTransferable::m_aMimeTypeSeq` and evaluate them each time instead. This is in preparation of allowing to change the mime data in an upcoming commit. Another alternative would be to (re-)calculate `QtTransferable::m_aMimeTypeSeq` only at the point in time that the mime data are set. Keep that in mind for further consideration in case this should ever become relevant from a performance perspective. Change-Id: Ic1792f6c2a19bf4c8f642a6288e9f3413fe7c893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163303 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-02-13tdf#143148 Use pragma instead of include guardsSteven Casey (SMCode)
Change-Id: I0541d79dc8ddb79d433109d18aa658ff31dc7e0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163268 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
2024-02-13jsdialog: use action for set_sensitiveSzymon Kłos
This will reduce protocol volume as we will send short message instead of JSON for the complete widget. Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I5e7541915f7e2da4bf822b99a05cc3066073334e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163279 Tested-by: Jenkins
2024-02-12use more UNLESS_MERGELIBSNoel Grandin
Change-Id: I351a9127fb26369d8f598b6d6519d7e490fa476b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-10tdf#54169: implement auto-accelerator feature on WindowsMike Kaganski
Change-Id: I219dfc0c8377628c10e5a19232d19260923bf614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163215 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-10Drop obsolete handling of wheel mouseMike Kaganski
Change-Id: I9958e69c953563285577f5cdea220371af4848d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163213 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-10Simplify a bitMike Kaganski
Use existing rtl_ustr_ascii_compareIgnoreAsciiCase, instead of inventing an own local comparison function. And standardize on WM_SETTINGCHANGE, which is the same as WM_WININICHANGE. Change-Id: Ifaf1f73066edf7d553174b529be5aa55179ae92e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163212 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-09tdf#155218 sc: fix different page orientation in print dialogTibor Nagy
The page orientation is correct if you set it in the page style first. However, if you change it in the Print dialog the page layout and size refresh but the content orientation remains the same. Change-Id: I5e494a0714e398221bee00744d7e25c419a41df7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162845 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.extern@allotropia.de>
2024-02-05tdf#143148 Use pragma once in vcl/inc/graphicTuukka Orava
Change-Id: Id88d0c64f02d9a0ca111de3d08e3d542dfba2a1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162997 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-02-05tdf#108037 speed up exporting large pdf (2)Noel Grandin
reduce the number of allocations we need to do for OStringBuffer Shaves 2% off the convert time. Change-Id: I0852c870b3c9e1941213f80f359d00cb8ee391df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162879 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-04tdf#130857 qt weld: Support asnyc running of msg dialogsMichael Weghorn
Implement methods required to run a welded Qt message dialog asynchronously: `QtInstanceMessageDialog::runAsync` and `QtInstanceMessageDialog::response`. Run the dialog asynchronously using `QDialog::open` and connect to the `QDialog::finished` signal to be notified when the dialog gets closed. Similar to how the gtk-based implementation, use local variables for the `std::shared_ptr`s and reset the members right away, not only at the end of the slot, since resetting the relevant one set in the corresponding `runAsync` overload will result in the object getting deallocated, thus the members can no longer be accessed safely. Take the solar mutex before calling the callback function as that seems to be expected (e.g. otherwise triggers an assert for the below example where the callback functions modifies VCL widgets). With this in place, running welded Qt message dialogs asynchronously works instead of not showing up at all, e.g. 1) start Writer with qt6 VCL plugin and without `SAL_VCL_QT_NO_WELDED_WIDGETS` set 2) open "File" -> "Properties" -> "Security" 3) click the "Protect..." button 4) enter 2 different passwords and press "OK" button Change-Id: Ic1b1bfc7d89c1be8a9f9dee59bc86cf3da37a280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162948 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-01-28tdf#159323 qt weld: Set standard buttons via weld APIMichael Weghorn
Instead of mapping the `VclButtonsType` to the corresponding `QMessageBox::StandardButtons` and using that to set the standard buttons for the `QMessageBox` using `QMessageBox::setStandardButtons`, use `weld::MessageDialog::add_button` to add all of the buttons manually, using their standard button texts. While the former is somewhat nicer, it depends on the ability to map between the VCL response code and a `QMessageBox::ButtonRole`. While there is currently a mapping in place (s. `lcl_vclResponseTypeToQtMessageBoxButtonRole` and `lcl_qtMessageBoxButtonRoleToVclResponseType`), this turned out to not be sufficient, since the VCL return code cannot only be one of the enum values in `VclResponseType` (which are currently handled) but any int. This commit is in preparation of an upcoming one that will replace the current mapping to support arbitrary int response codes. Change-Id: Icca68f2ccec182f8ff6ae3c64680a4d28bd687d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162559 Tested-by: Jenkins Reviewed-by: Omkar Acharekar <omkaracharekar12@gmail.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-01-24tdf#154381 qt weld: Allow setting message box default buttonMichael Weghorn
Implement `QtInstanceMessageDialog::set_default_response` by identifying the `QPushButton` in the `QMessageBox` that has the `QMessageBox::ButtonRole` corresponding to the given VCL return type and setting that as the default button in the `QMessageBox`. With this in place, the qt6 welded message dialog that shows up when opening a file that's already open in another instance of LibreOffice (s. `AlreadyOpenQueryBox::AlreadyOpenQueryBox`) has initial focus on the "Open Read-Only" button when it opens, just as is the case for the non-welded one (whose use can be forced by setting env var `SAL_VCL_QT_NO_WELDED_WIDGETS=1`). Change-Id: I6d543b43cb6adec2dde9646e1452aa03bdcbf331 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162441 Tested-by: Jenkins Reviewed-by: Omkar Acharekar <omkaracharekar12@gmail.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-01-24tdf#154381 qt weld: Add button handling for message boxMichael Weghorn
Override the `QtInstanceDialog` methods `add_button` and `run` in `QtInstanceMessageDialog`, and implement handling for these buttons with the native `QMessageBox` that is used internally: Implement `QtInstanceMessageDialog::add_button` to make adding buttons to the welded message dialog work. Map the VCL response type to a corresponding `QMessageBox::ButtonRole`. Some mappings are straightforward, others are a bit more arbitrary, but the only essential thing is that the mapping back to the VCL response code is consistent. `QMessageBox::exec` [1] overrides `QDialog::exec` [2], and while the int returned by the latter corresponds to a `QDialog::DialogCode` code, the int returned by the former corresponds to a `QMessageBox::StandardButton` value. Since the current `QtInstanceDialog::run` implementation relies on the `QDialog` behaviour, override it for the message dialog case. Since the `QMessageBox::ButtonRole` is set in `QtInstanceMessageDialog::add_button`, retrieve the corresponding role from the clicked button instead of using the return value of the `QMessageBox::exec` to be able to get the correct VCL return code again. With this in place, the qt6 welded message dialog that shows up when opening a file that's already open in another instance of LibreOffice (s. `AlreadyOpenQueryBox::AlreadyOpenQueryBox`) shows buttons and clicking any of them behaves as expected, just as is the case for the non-welded one (whose use can be forced by setting env var `SAL_VCL_QT_NO_WELDED_WIDGETS=1`). [1] https://doc.qt.io/qt-6/qmessagebox.html#exec` [2] https://doc.qt.io/qt-6/qdialog.html#exec Change-Id: Ie37573951302f13eab758f889d478dc9351e9c07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162440 Tested-by: Jenkins Reviewed-by: Omkar Acharekar <omkaracharekar12@gmail.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>