summaryrefslogtreecommitdiff
path: root/editeng
AgeCommit message (Collapse)Author
2023-12-29Resolves: tdf#158608 put calc spelling suggestions at start of context menuCaolán McNamara
a problem since: commit 57544b075b77331b7b1cc7cb18898a52e7bb21a6 Author: Caolán McNamara <caolanm@redhat.com> Date: Sat Dec 12 21:21:09 2020 +0000 weld editview menu Change-Id: Id2ffd7f4f3da15d5c0ebc1c7a17247e8ab1ec5bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161389 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-29editeng: simplify and remove unneded const. of ContentNode & coTomaž Vajngerl
ContentNode, CharAttribList, ContentAttribs constructors and destructors can be simplified and in some cases removed (if they are empty). Change-Id: Id5b1d4c1934a9b0b6e0ed8a7fe2af0d41ce4b4fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161356 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: move source of ContentNode & co. to own sourcefileTomaž Vajngerl
Move ContentNode, CharAttribList, ContentAttribs methods to own source class. Change-Id: Idd1371430ecaf36431de763dc4e3e3978ba60641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161355 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: prefix members of ContentNode, CharAttribList, ContentAttribsTomaž Vajngerl
Change-Id: I2af96b6525ee0d4410200775ce4daf71bcc80db4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161354 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: move ContentNode & dependents in its own header fileTomaž Vajngerl
Change-Id: Ia492dacafb88d42ab3dcdae8af9843d3586dffbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161353 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: ItemList - prefix members, move methods in classTomaž Vajngerl
- Move methods into class def. as the class is simple enough. - Prefix member variables. - Remove unneeded includes. Change-Id: Ide567c64dad3606f1a9faf837571ae2a5c3d69ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161352 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: move ItemList in its own header fileTomaž Vajngerl
Change-Id: I52f3f2a557db7058aa584ca7c1cee08eae58d726 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161351 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: simplify FormatterFontMetricTomaž Vajngerl
We don't really need a custom constructor and default values can now be set directly. Change-Id: I7e8aabf2c60d3b63abf1764bbff512685803f71e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161349 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-29editeng: move TextPortion to own header fileTomaž Vajngerl
Change-Id: I54d0bbad4ef142705191672319774f26abf3e735 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161348 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28Fix typoAndrea Gelmini
Change-Id: Ie4af9884dca493646636dc60a1605a748d50ad1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161376 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-28editeng: ImpEditView - clean-up UNO typesTomaž Vajngerl
use com::sun::star namespace as the base for UNO types Change-Id: I5ce71f21a914f4653d908162f5ec6f773023165e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161347 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: prefix ImpEditEngine pVirtDev, pRefDevTomaž Vajngerl
Change-Id: I4e215b374178314a836cfddb0107b8cdbe6c1f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161346 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: unneeded forward declarationTomaž Vajngerl
Change-Id: Icd97c2d382fd9495c67071e08362de0bd4985bbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161350 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: move inline methods into ImpEditEngine classTomaž Vajngerl
Change-Id: Id9e6e1a4308b7f7d0384a1b28c7279aaa3c716f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161345 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: add EPaM unit testsTomaž Vajngerl
Change-Id: Icc15746bf2712bae446f16fd378f94f8be5ec61e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161342 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: move EPaM in its own header fileTomaž Vajngerl
Change-Id: Ib3682dd5df09162748aad4402108b2b3cec3a853 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161341 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-28editeng: add ESelection unit testsTomaž Vajngerl
Change-Id: I79cff7b08944fe81c785c224587e4e6f6c8ff9c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161339 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-12-24cid#1545470 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1545468 COPY_INSTEAD_OF_MOVE cid#1545446 COPY_INSTEAD_OF_MOVE cid#1545435 COPY_INSTEAD_OF_MOVE cid#1545419 COPY_INSTEAD_OF_MOVE cid#1545415 COPY_INSTEAD_OF_MOVE cid#1545410 COPY_INSTEAD_OF_MOVE cid#1545390 COPY_INSTEAD_OF_MOVE cid#1545384 COPY_INSTEAD_OF_MOVE cid#1545374 COPY_INSTEAD_OF_MOVE cid#1545371 COPY_INSTEAD_OF_MOVE cid#1545368 COPY_INSTEAD_OF_MOVE cid#1545366 COPY_INSTEAD_OF_MOVE cid#1545335 COPY_INSTEAD_OF_MOVE cid#1545331 COPY_INSTEAD_OF_MOVE cid#1545327 COPY_INSTEAD_OF_MOVE cid#1545308 COPY_INSTEAD_OF_MOVE cid#1545280 COPY_INSTEAD_OF_MOVE cid#1545199 COPY_INSTEAD_OF_MOVE Change-Id: If05a13125b05ccd93d34d0eced566e7b3b58aaef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161256 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-22Lok: make Ignore All list name independent on UI languageMike Kaganski
Fixes not working "Ignore All" context menu entry in e.g. German UI in Online. Change-Id: I761c9f65c89fb5c7e929ea20f2db4eff20f7d53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161170 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-19Keep selection as after copying the textPranam Lashkari
This also aligns code with 'else' branch behaviour problem: in online when coping a slide with comment, comment text was never copied in online, it required document to reload to show it correctly Change-Id: I6d444c10808ef23f282370b4b305c41eb5043b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160812 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit db7faa06762ac902ff56ecbab3fff763951146e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160943 Tested-by: Jenkins
2023-12-18tdf#158703: return updated position from FnAddNonBrkSpaceMike Kaganski
The paragraph text may become shorter after the function succeeds, because it may remove arbitrary number of preceding spaces; since the position may then be used to access data in the string in the caller, we need to update it, to avoid use of old position (which may point beyond the string, and produce a crash; or it may point to a wrong position in it). Change-Id: Ib1b4b63cbd7150e0f69c97032e3410db7dadd4dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160924 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-18tdf#158186 Fix saving ApplyNumberingAfterSpaceSamuel Mehrbrodt
Change-Id: I6880f75c140f6e800bbdb6c56dd1ff166a3191d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160916 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-12-08tdf#129357 editeng: show soft hyphen in text boxes and shapesLászló Németh
Shapes and text boxes didn't show the optional hyphen at line break. Change-Id: I5cc842964fc91571e5c55995981de697da966b14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160453 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-12-07cid#1546503 Using invalid iteratorCaolán McNamara
and cid#1546284 Using invalid iterator cid#1546275 Using invalid iterator cid#1546049 Using invalid iterator cid#1545929 Using invalid iterator cid#1545870 Using invalid iterator cid#1545668 Using invalid iterator cid#1545420 Using invalid iterator Change-Id: I3ad3000631b4be5917b9c5f49f21b8cc003a309c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159056 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-07simplify and modernise ScopedBitmapAccessNoel Grandin
(*) Make all of it use a "Scoped" paradigm (*) pass by value, no need to allocate on heap (*) make all of the construction go via the *Access constructors, instead of it being some via the constructors and some via the Acquire*Access methods. (*) take the Bitmap& by const& in the constructor, so we can avoid doing const_cast in random places. Change-Id: Ie03a9145c0965980ee8df9a89b8714a425e18f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160293 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-05cid#1546503 Using invalid iteratorCaolán McNamara
and cid#1546284 Using invalid iterator Change-Id: I9ff3498b65ce392dbe859566b49e60a31e0779f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160370 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-04cid#1545597 Using invalid iteratorJulien Nabet
and : cid#1545537 Using invalid iterator cid#1545508 Using invalid iterator cid#1545494 Using invalid iterator cid#1545478 Using invalid iterator cid#1545427 Using invalid iterator cid#1545420 Using invalid iterator cid#1545400 Using invalid iterator cid#1545300 Using invalid iterator cid#1545258 Using invalid iterator cid#1545257 Using invalid iterator cid#1545200 Using invalid iterator cid#1545183 Using invalid iterator Change-Id: Ibf3a41902f34286967195c5c3b22e337a4b06809 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160322 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-04cid#1545810 Using invalid iteratorJulien Nabet
and : cid#1545802 Using invalid iterator cid#1545745 Using invalid iterator cid#1545717 Using invalid iterator cid#1545675 Using invalid iterator cid#1545668 Using invalid iterator cid#1545639 Using invalid iterator cid#1545634 Using invalid iterator cid#1545629 Using invalid iterator cid#1545620 Using invalid iterator cid#1545608 Using invalid iterator cid#1545607 Using invalid iterator cid#1545601 Using invalid iterator Change-Id: I403842175f64a570d7e52fba7c3e03bf21b7d05b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160320 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-04cid#1546021 Using invalid iteratorJulien Nabet
and : cid#1545983 Using invalid iterator cid#1545969 Using invalid iterator cid#1545949 Using invalid iterator cid#1545929 Using invalid iterator cid#1545911 Using invalid iterator cid#1545910 Using invalid iterator cid#1545886 Using invalid iterator cid#1545870 Using invalid iterator cid#1545813 Using invalid iterator Change-Id: I2ad10c2a9affd348050a4abe0917a90927a52547 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160317 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-04cid#1546275 Using invalid iteratorJulien Nabet
and : cid#1546219 Using invalid iterator cid#1546088 Using invalid iterator cid#1546070 Using invalid iterator cid#1546061 Using invalid iterator cid#1546055 Using invalid iterator cid#1546049 Using invalid iterator Change-Id: I6f3a786852b5c262d60c3195e446a37967ed9b59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160311 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-04cid#1546422 COPY_INSTEAD_OF_MOVECaolán McNamara
and cid#1546416 COPY_INSTEAD_OF_MOVE cid#1546415 COPY_INSTEAD_OF_MOVE cid#1546391 COPY_INSTEAD_OF_MOVE cid#1546390 COPY_INSTEAD_OF_MOVE cid#1546317 COPY_INSTEAD_OF_MOVE cid#1546252 COPY_INSTEAD_OF_MOVE cid#1546251 COPY_INSTEAD_OF_MOVE cid#1546249 COPY_INSTEAD_OF_MOVE cid#1546243 COPY_INSTEAD_OF_MOVE cid#1546195 COPY_INSTEAD_OF_MOVE cid#1546193 COPY_INSTEAD_OF_MOVE cid#1546137 COPY_INSTEAD_OF_MOVE cid#1545738 COPY_INSTEAD_OF_MOVE cid#1545782 COPY_INSTEAD_OF_MOVE Change-Id: I10d5091aa72b682371764b8a18cc5062e272c031 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160285 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-03cid#1546503 Using invalid iteratorCaolán McNamara
and: cid#1546480 Using invalid iterator cid#1546479 Using invalid iterator cid#1546454 Using invalid iterator cid#1546419 Using invalid iterator cid#1546410 Using invalid iterator cid#1546150 Using invalid iterator cid#1546039 Using invalid iterator cid#1545831 Using invalid iterator cid#1545736 Using invalid iterator cid#1545701 Using invalid iterator cid#1545630 Using invalid iterator cid#1545381 Using invalid iterator Change-Id: I9e151b623f751ee1e982b5da0011ff08ab0ad5e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160270 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-01cid#1546413 silence Using invalid iteratorCaolán McNamara
sample to test silencing this Change-Id: I73a8e22a5266367d7b2c76aa00d38d40431b4841 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160213 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-25tdf#158317 fix cleanup of SfxPoolItems in editengArmin Le Grand (allotropia)
It is not possible to use implCreateItemEntry/implCleanupItemEntry, that is tooling limited *by purpose* to svl/Item/ItemSet stuff. But what I can do is to do that SfxPoolItemHolder I already talked/thought about. It is a helper that can safely hold a SfxPoolItem in cases where an SfxItemSet is too expensive. Think about it as a SfxItemSet for a single item. That solves the problem why DirectPutItemInPool/DirectRemoveItemFromPool is used in general (each usage is a 'compromize'). Did that now, works well. Editengine is now free of DirectPutItemInPool/DirectRemoveItemFromPool. Replaced ::CursorMoved with checkAndDeleteEmptyAttribs since all these got static with no longer need to DirectRemoveItemFromPool. Corrected create/delete counters. Change-Id: Ia6e53f48ac2e479b461546515e68697039b5b628 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159931 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-11-25tdf#156243 Fix off-by-one bug for autocorrectMatt K
This change removes the "-1" from the code that applies the autocorrection so that the entire string to be autocorrected is replaced, instead of leaving off the last character. Also, the starting character of the string is preserved (i.e. non-bold if changing to bold) by adding 1 to the start position; this is for the case when the user cancels the autocorrect dialog. Change-Id: Ibe500a1ba0ca5b12ec9c918b51353074b8dd12ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154685 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-20Extended loplugin:ostr: editengStephan Bergmann
Change-Id: I5dbd4047d2b66c12475020abfdd2b8f16d65a8f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159714 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-18c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 4)Julien Nabet
Change-Id: I6af5501e3fde07024dcc74f00c8fd69bd369d8d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159613 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-18tdf#157716 - Rename "Language settings" to "Languages and Locales"t-aswath
Change-Id: Idd31b18c87998b03d884e7aa17197c459241abf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159315 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-11-15tdf#158031 editeng: rename GetFieldAtCursorJustin Luth
because it doesn't really get the field at the cursor, and certainly is not similar to SelectFieldAtCursor. It first gets the field under the mouse. Then, if there is a selection, it gets the selected field, else it looks for the field on either side. There were LOTS of places where it probably had not been used properly. Most of those are gone now, so it is easier to rename the function. Change-Id: I1a64af24092582cf865509d2a474080258edd76c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159022 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
2023-11-15tdf#158031 editeng SID_REMOVE_HYPERLINK: use AlsoCheckBeforeCursorJustin Luth
This patch depends on prior patches for this bug report. This is mostly just a clean-up patch to make it function like the others. It was a lot like EDIT_HYPERLINK - because it selects the hyperlink first, so it didn't need any fixing up. However, there was one instance where KEYBOARD selection of Remove Hyperlink in Draw could have been cancelled/slot-invalidated if the mouse had been moved away from the field. Change-Id: Id1b911f2548b8e2751ae34a2158ee4984dfc9a59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159018 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
2023-11-15tdf#158031 editeng SID_COPY_HYPERLINK: use AlsoCheckBeforeCursorJustin Luth
This patch depends on prior patches for this bug report. This fixes nothing being copied if the mouse was right-clicked over that second half of the hyperlink (since a "smart" positioning set the cursor after the field instead of before it). Change-Id: I6c933224cd8d36f48f4e1f0aafaa1f45555e46d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159015 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
2023-11-15tdf#158031 editeng SID_*_HYPERLINK: use AlsoCheckBeforeCursorJustin Luth
This fixes the GTK3 problem where only the first half of the link successfully ran SID_EDIT_HYPERLINK against an editeng hyperlink. Fixed for Writer and Calc editeng hyperlinks (i.e. in textboxes). TODO: fix SID_COPY_HYPERLINK (which doesn't SelectFieldAtCursor) The problem showed up when the menu option was added because the mouse was over an unselected field, but when the mouse moved to select the menu option, the slot was not considered valid anymore if the cursor had moved behind the field. (The right-click to open the context menu puts the cursor before or after the field.) Now, by checking for a field-before-the-cursor during validation, the field is found and the command is not prevented from running. Once this is all in place, some older commits from Caolan should be able to be reverted. (Strangely, SID_OPEN_HYPERLINK and SID_REMOVE_HYPERLINK seem to run before the slot is invalidated. No idea why they are different. For GEN, the popup usually either kept the pre-menu mouse position, or else it always runs the command before the slot invalidates.) Change-Id: If992b3fdc94d89162b60447458cabced2d5e3f19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158856 Reviewed-by: Justin Luth <jluth@mail.com> Tested-by: Jenkins
2023-11-15related tdf#158031 editeng: GetFieldAtSel...(+look before cursor)Justin Luth
Nearly a No-Functional-Change, but not quite. For practical and intentional purposes, it can be considered NFC. Although I didn't find an actual case where it happened, a code read says SelectFieldAtCursor COULD select a non-field. It assumed that previous code had already identified that there must be a field here. Well, I want to extend GetFieldAtSelection to check backwards to solve bug 158031 anyway, so I might as well "fix" this assumption to only select a valid field. This function REALLY depends on GetFieldAtSelection working properly. So, I put some asserts in to ensure that stays true. Change-Id: Ie22945a418497511501b04df5e17071d977cbd5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158855 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-11-11use more concrete type in ImpEditEngine::SetUndoManagerNoel Grandin
instead of dynamic_cast'ing to the type we want, and __ignoring__ the parameter if it is not, just adjust the type that we want, which luckily everything is already sending Change-Id: If083e11c9818cdcae199afc1261efbdb652e1c76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159295 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-10loplugin:fieldcast in accessibility::AccessibleContextBaseNoel Grandin
Change-Id: Ibd71c2e809731114d4415754c8fd94110bd5736b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159225 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-10tdf#157363 add HTML format when pasting into draw textOliver Specht
adds HTML to paste(special) in draw text in impress/draw/calc/writer Change-Id: Iaede82e1b3d48be362b70bd631e7f912b02b9822 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158659 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-11-07ITEM: Get away from classic 'poolable' Item flagArmin Le Grand (allotropia)
To understand this, some look back in history will be needed to see why it is as it is today. In some (reworked) comments 'poolable' is described as flag to hold Items in the ItemPool, also always having only one incarnation of each possible Item. This is not the original intention, but a side-effect. The reason is what the binary format in the office did: To save a document, the Objects & the Pool were saved, *not* individual Items *together* with the objects. The Pool was completely (binary) saved (and loaded) in one run. Temporary IDs were used to represent at the objects in file which Items were referenced. This *required* to have only one incarnation per item to have a minimal binary file size, thus this high effort was put into this. At doc load, the pool was loaded, all Items were set to RefCount 5000, the references from the objects were restored and then for each Item the RefCount was lowered by 5000 again and - if being zero - deleted. Items for UI were marked 'non-poolable' to *not* safe them with the document, so poolable was a flag to decide if that Info/Item was to be saved with the document - or more direct: if it is Model Data. Items are small, so if we prefer runtime it is okay to no longer being strict with this, anyways does not happen often and has only marginal memory effects - compared to runtime effects/savings. Other problems which this caused: One example is that objects in the UNDO stack were still in the pool, so e.g. deleted pictures were saved with the document despite no longer being used (!). That is the reason we have an UndoItemPool and a method MigrateItemPool to move stuff to that Pool when objects go to the UNDO stack - all of this is also no longer needed. Cleaning this up means to ideally have all items in the SfxItemSet, no longer at the Pool. The Pool should be reduced to a 'Default-Item- Holder' and a 'Slot-to-whichId-mapper'. This needs thorough cleanups/removals, but will be worth it because that massive simplification(s) will increase safety an runtime and make migrating to the goal of completely type-based ItemSet stuff easier for the future. Hopefully only view code in the office working with items will have to be changed for this. In this 1st step I already found that some 'compromizes' will be needed: - There are still Items that have to be at the pool to make the Surrogate-stuff working. This gives back all Items in a Pool of a type and is used in ca. 80 cases. Each one looks at these Items *without* context (e.g. a SfxItemSet at an Object would be a context), so if e.g. a dialog is open that temporarily uses Items of that type you would also get these - without knowing about it... To make that work there is still a mechanism to have Items at the Pool, but now just *registering* (and un-reg) them without any sort/search/ remove needs. Also only for Items that need that, so I evaluated the GetItemSurrogates calls and added some asserts when GetItemSurrogates tries to access an unregistered item type which needs to be added. - Another caveat is that there are about 250 places that directly put Items to the Pool (not all remove these, that is done at pool deletion, so some kind of silent 'garbage-collection' is in place). To have an overview I renamed the accessing methods to separate them from the same functionality at the SfxItemSet, which had the same names. An implementation does still add these directly to the pool, there is no way to cleanup those usages for now. In principle all these should be changed to hold the data at an SfxItemSet. I am still hunting problems. But you can build the office, all apps work (including chart) and you can do speed comparisons already. There are test throwing errors, so I hunt these now. It is hard to give an estimation about how much more changes/corrections will be needed. Completed adaptions to new registered Items at Pool, that reduces the failing tests. Still many that I need to hunt. Added stuff to work around that 'compromize' in ScDocumentPool: It overloads ::PutImpl of the pool to implement special handling for a single Item in SC, the ScPatternAttr. In former code that method was used from SfxItemSet and ::PutImpl at the pool directly, so it was only used in one place. I am not sure if it was used from the SfxItemSet functionality, but better offer it for now. To not waste too much runtime the callbacks depend on the boolean 'NewItemCallback' at the SfxPoolItem, it gets set for that single Item in SC and only then the callbacks trigger. I hope to get rid of those again, e.g. newItem_UseDirect is only needed since we have no 'real' StaticPoolDefaults currently - another thing that needs to be cleaned up in a next step. Since usages of impl(Create|Cleanup)ItemEntry and Direct(Put|Remove)ItemInPoolImpl got more and more similar I decided to unify that: move impl(Create|Cleanup)ItemEntry to tooling, make it globally available in svl and use it also directly for Direct(Put|Remove)ItemInPoolImpl. This slightly increases the failing tests again, but only since in Direct(Put|Remove)ItemInPoolImpl that fallback (e.g. tryToGetEqualItem) was used before, thus this is the same class of errors (SfxPoolItem ptr-compare) as the others which I will need to find anyways. Also fixed some missing stuff. Have now idenified and redirected all SfxPoolItem ptr-compares to be able to debug these - one cause for the remaining errors is probably that before with bPoolable those often were sufficient, but are no longer. Used the [loplugin:itemcompare] and a local clang build to do so, see https://gerrit.libreoffice.org/c/core/+/157172 Stabilized Direct(Put|Remove)ItemInPoolImpl forwards, added parameter to implCreateItemEntry to signal that it gets called from DirectPool stuff - currently needed. Hopefully when getting rid of that DirectPool stuff we can remove that again Added two more debug functionalities: - Added a SerialNumber to allow targeted debugging for deterministic cases - Added registering & listing of still-allocated SfxPoolItems at office shutdown Found PtrComp error in thints.cxx - POC, thanks to areSfxPoolItemPtrsEqual. Will hopefully help more with other tests Found some wrong asserts/warnings where I was too careful and not finding something/succeeding is OK, fixes some UnitTests for SC For SC I now just tried to replace all areSfxPoolItemPtrsEqual with the full-ptr-content compare SfxPoolItem::areSame. I also needed to experiment/adapt the newItem_Callback solution but got it working. Did that replacement now for SW too, found some places where the direct ptr compare is OK. Continued for the rest of occurrences, now all 160 places evaluated. Also done some cleanups. Massive cleanups of stuff no longer needed with this paradigm change. Also decided to keep tryToGetEqualItem/ITEM_CLASSIC_MODE for now. It is used for *one* Item (ScPatternAttr/ATTR_PATTERN) in SC that already needs many exceptions. Also useful for testing if errors come up on this change to test if it is related to this. Added forwarding of target Pool for ::Clone in SvxSetItem and SvxSetItem, simplified SfxStateCache::SetState_Impl and returned to simple ptr compares in SfxPoolItem::areSame to not do the test in areSfxPoolItemPtrsEqual. Debugged through UITest_calc_tests9 and found that in tdf133629 where BoxStyle is applied to fully selected empty calc the Item- reuse fallback has to be used not only for ATTR_PATTERN, see comment @implCreateItemEntry. Maybe more... Problem with test_tdf156611_insert_hyperlink_like_excel. Found that in ScEditShell::GetFirstURLFieldFromCell the correct SvxURLField is found and returned as ptr, but it's usage crashes. That is due to the SfxItemSet aEditSet used there gets destroyed at function return what again deletes the SvxFieldItem that is holding the SvxURLField that gets returned. This shows a more general problem: There is no 'SfxPoolItemHolder' that safely holds a single SfxPoolItem - like a SfxItemSet for a single Item (if Items would be shared_ptrs, that would be a safe return value). That will be needed in the future, but for now use another solution: Since I see no reason why EE_FEATURE_FIELD should not be shareable I wil change this for ow in the SfxItemInfo for EditCharAttribField. That way the Item returned will be shared (RefCnt > 1) and thus not be deleted. I changed the return value for GetURLField() and GetFirstURLFieldFromCell() in ScEditShell: At least for GetFirstURLFieldFromCell the return type/value was not safe: The SvxFieldItem accessed there and held in the local temporary SfxItemSet may be deleted with it, so return value can be corrupted/deleted. To avoid that, return a Clone of SvxFieldData as a unique_ptr. With all that UnitTest debugging and hunting and to get the paradigm change working to no longer rely on shared/pooled items I lost a little bit focus on speed, so I made an optimization round for the two central methods implCreateItemEntry/implCleanupItemEntry to get back to the speed improvements that I detected when starting this change. It was mainly lost due to that 'strange' chained pool stuff we have, so I added to detect the target pool (the one at which the WhichID is registered) directly and only once. Next thing to cleanup will/should be the pool and it's concept, all this is not needed and really costs runtime. Since implCreateItemEntry/implCleanupItemEntry are executed millions of times, each cycle counts here. Had an error in the last changes: pool::*_Impl methods use index instead of WhichID - most of them. Another bad trap, I really need to cleanup pool stuff next. Change-Id: I6295f332325b33268ec396ed46f8d0a1026e2d69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157559 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-11-07tdf#158083: RTF: drop export for \pgdsctblVasily Melenchuk
This table is not standard extension to RTF format. It is not described in RTF specification and even is not used by Writer on import these days. Change-Id: I52f27dfd30877d461ad535b7847f40dd4c6f4ea5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158986 Tested-by: Jenkins Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-11-03NFC related tdf#158031 editeng: flatten and simplify the codeJustin Luth
No Functional Change intended. Just some slight optimizing that leads to some nice flattening. Change-Id: I46d20a56821f218973c728f51575b104e6020500 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158854 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2023-11-02this should never be null, so we can use a referenceCaolán McNamara
Change-Id: I682e30cfb4fd63a4f906bfb875cafdf77ae9cfe3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158805 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>