summaryrefslogtreecommitdiff
path: root/editeng
AgeCommit message (Collapse)Author
2024-05-08tdf#152906: use correct Y offsetMike Kaganski
GetEditCursor now returns the position relative to the line, not to the whole text. In ImpEditEngine::CreateLines, its use wasn't fixed, and so the Y position of all lines in the calculation was the same, thus adjusting to the same contour's horizontal stripe. Change-Id: I16362bab47f3064281eefb45a12834d836a8ada3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167042 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167188 (cherry picked from commit 9f5664f4d34e8f04cc18dc252cad4b3b853db882)
2024-04-15editeng: use text scaling that better mimics MSO text scalingTomaž Vajngerl
Implement text scaling algorithm that is similar to MSO text scaling for text boxes for the compatibility purpuse, so that the Impress slides better match how the PP slides are layed out. This also moves the implementation into EditEng, where it is possible to better control how searching for the best scaling factor is performed without doing additional irrelevant work or trigger invalidations that should not be triggered. An additional change is that the paragraph with no content at the end are ignored, and are not taken into account when determining the height of the content. This is done for compatibility reasons. Fix horizontal spacing of tabs - the spacing shouldn't be scaled and the tab shouldn't include the space at the beginning of the line. Change-Id: Ie37fa67f1cf300e915a4ebaef2a7f968bf6c5744 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165441 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit f61ea135430d7b4a1fac7de1e57a1314fbb1b49e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166087 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-04-15editeng: combine scaling parameters into ScalingParameters structTomaž Vajngerl
This makes dealing with scaling parameters much clearer and it improves readability. Change-Id: I327b6530ef5587972cc0075390704754a33563a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165632 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 4bdbf0f898e8642b0a34195537d1516cc8eee819) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165712 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-04-07tdf#63259 cycle case on sentencesOliver Specht
Cycle case will be applied to the sentence if the cursor is at a sentence end. Writer now also keeps the word/sentence selection after case change. Change-Id: I9dd561775ac612689526bcb118533ba81b5722be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165018 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165800
2024-04-07tdf#63259 Cycle case should work on end of wordsOliver Specht
Now words are selected if the cursor is positioned at the end of the word. SENTENCE_CASE does not force sentence selection anymore. Change-Id: I672352b2c18bb695004fd4eb0f20ae5fd7a0ac53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164546 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165799
2024-03-15tdf#160213 Don't let insert empty line with numbering, end numberingGülşah Köse
We applied the writer's empty bullet line policy to impres. Now We don't let insert empty bullet lines in impress too. Instead we end numbering and start to write normal paragraph at the same line. Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com> Change-Id: I28042d9db59b5622434da0826f8b760f01ad64f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164799 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit f3f3ea4cc9c3bec761d095fbfefd6ba8724fcdef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164828 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2024-03-07tdf#159797 replace dash also between sentencesOliver Specht
Autocorrection replaces " - " with " <enDash/emDash> " also after dot, question mark and exclamation mark. Change-Id: Iad4b6c6073ab90b0c86514b8683dd2a07197f59d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163659 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> (cherry picked from commit 95017739a05c4f515fc42caebfd1e01e8a9ba160) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163625 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2024-03-06Moving parts of readonly checks from model to view.Gökay Şatır
Summary for what's done with this commit: init.cxx * Add guards for modify commands. viewsh: * Add "IsCurrentLokViewReadOnly" for ease of use. unocitm: * Add guard for modify comamnds dispatch.cxx * Implement readonlyview. objmisc: * Modify IsReadOnlyUI check for LokReadOnly view. svx.sdi: * Disable TableChangeCurrentBorderPosition command for readOnly views. sw-editwin: * Treat mouse moves as readonly when the view is LokReadOnly. gridwin: * For autofilter. impedit2, inputhdl: * For text input. svdedtc: * For sdr object dragging. Signed-off-by: Gökay Şatır <gokaysatir@gmail.com> Change-Id: I71fc353976256bce22042bbb6042ee464b65cc13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163731 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com>
2024-02-05lok: calc: fix for rendering issues on in place editingMarco Cecchetti
Our main problem is how to compute the correct output area for the requested tile zoom level. The old solution was using a fine-tuned edit rectangle as output area. An edit rectangle is the rectangle computed according to the range of rows and columns involved in the text editing. Unfortunately in some cases the edit rectangle can be enough larger than the output area. For instance that occurs with centered text. The new proposed solution is able to scale the output area to the requested tile zoom level by a few pixels (0 up to 3) offset/size error. The hope is to reduce the error in some follow-up patch. The new solution is also able to perform painting of text edited by different views in the correct order. The last painted text is the one belonging to the last view where editing occurred. SfxViewShell::maEditViewHistory keeps track of the last 10 editing events per document. Change-Id: I8f1035a730cb2b94b0990f3c8eb6445511b94223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162196 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162986 Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
2024-02-02tdf#159507 editeng: support pasting HTML fragmentsMiklos Vajna
Commit ce53519f025158f8f64a4e8603c8c6e0dc35473a (cool#8023 editeng: support HTML paste, 2024-01-24) added support for pasting HTML files into Calc cells while editing, but this doesn't work when only a HTML fragment is provided, without headers and footers. The HTML code in ImpEditEngine::PasteText() was modeled after the HTML_SIMPLE case, which is some custom format from MSIE and that rejected the data in case the header didn't match, so the HTML case also required a HTML header in the above commit, but this doesn't work for HTML fragments. Fix the problem by just dropping the header check in ImpEditEngine::PasteText(), because that data already comes from the text/html slot of the clipboard, so there is already indication about the file format, even without the header. And without headers, it's almost impossible to recognize if the HTML fragment is a HTML one or not. Note that this is the HTML paste when a cell edit is active, the normal Calc HTML paste is a different codepath, in sc/. (cherry picked from commit 0503f6718f7686f3e2c93fc13af23e9fbfdace42) Change-Id: I4d37d80f947880fe22051c5fe84dc6bbc257e108
2024-01-30LanguageTag ctor can canonicalize against various known tagsCaolán McNamara
so can optimize skipping the _lt_tag_canonicalize path which ends up using a fairly expensive xmlXPathEval Change-Id: Ie96f16482d247f3731c1c8eac6d613736b8b289a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162596 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit c225d602e093da9240693d7f67afb9da4806e0e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162629 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2024-01-25cool#8023 editeng: support HTML pasteMiklos Vajna
editeng text (e.g. Writer shape text or Calc cell text edit) had working plain text and RTF paste, but HTML paste was not working. This is typically not noticed because desktop paste usually goes via RTF, but it can be visible when a LOK client just puts the best format on the clipboard, i.e. HTML is provided, but RTF is unavailable in the browser and plain text is also not written to the LOK clipboard. Fix the problem by connecting the existing ImpEditEngine::ReadHTML() to the generic ImpEditEngine::PasteText(): this already worked for plain text and RTF, but not for HTML. Note that "SIMPLE_HTML" was already supported, but that's not really HTML but some custom format that contains HTML, and it's claimed that MS IE 4.0 produced this. (cherry picked from commit ce53519f025158f8f64a4e8603c8c6e0dc35473a) Change-Id: Ib41529c66d9bda30cc4ed5faca4a99274ae594d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162449 Tested-by: Jenkins
2024-01-23tdf#159313: pass properties in correct orderMike Kaganski
Regression after commit c4fc18308074634e9578ad12d94d937f259aa22a (Autocorrect: Add option for autoformat bulleted lists after space, 2023-09-07). Change-Id: I35fafc1441b4f67886a86d4d67764a91146b8ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162359 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit ca33b8b35a10243dc13e68c93e7c7512eef937ec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162289 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-01-17Lok: 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>
2024-01-17tdf#154248 Impress: fix color of hyperlinkAttila Szűcs
Added a new FindAttrib method that searches in the attribs a bit different. The original FindAttrib searches in attribs as if their position intervals are closed from both side [Start,End]. However, the actual attribs array was created using PaMs as positions, and these are right-opened intervals [Start,End) Change-Id: I9a46b6b27ce447366fc20af1b46fd60b5c745359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161836 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-01-16calc: on editing invalidation of view with different zoom is wrongMarco Cecchetti
This patch fixes the following invalidation issue: There are 2 views with different zoom levels. In a view text editing for a cell occurs. The other view is not invalidated properly: the computed invalidation rectangle is misplaced. Change-Id: I72db61486647640ee68e6cb2db96b2902de5b997 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160303 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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162161 Tested-by: Jenkins
2024-01-15Keep 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
2024-01-12tdf#159049 use RTF_LINE for EE_FEATURE_LINEBR for copyRegina Henschel
Copy of simple text uses ImpEditEngine::WriteItemAsRTF() method. Error was, that in case of a line break ('\n') the string OOO_STRING_SVTOOLS_RTF_SL was written, but it needs to be the string OOO_STRING_SVTOOLS_RTF_LINE. Change-Id: I1c2ff2087c563b26e26d8768dfcfd1645be91d2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161842 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161954
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/+/161327 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2023-12-19tdf#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> (cherry picked from commit 1325d66a7f8657aaf9951a0664fbf14cca86905b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160934 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
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> (cherry picked from commit cefe7488930895a971dce41a286144dae39f57d4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160930
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>
2023-11-02crash seen in EditView::GetTransferable in calcCaolán McNamara
if (pColor->getComplexColor().getType() == model::ColorType::Unused) (gdb) print pColor $10 = <optimized out> but: (gdb) print *pSet $12 = {_vptr.SfxItemSet = 0x7f7cd56f3198 <vtable for SfxItemSet+16>, m_pPool = 0x31e7d880, m_pParent = 0x0, m_ppItems = 0x33ecece0, m_pWhichRanges = { m_pairs = 0x7f7cd47b2480 <svl::Items_t<(unsigned short)4008, (unsigned short)4064>::value>, m_size = 1, m_bOwnRanges = false}, m_nCount = 1, m_bItemsFixed = false} (gdb) print *(pSet->m_ppItems) $11 = (const SfxPoolItem *) 0x0 so, apparent null deref of pColor #0 SvxUnoTextRangeBase::_getOnePropertyStates (pSet=0x7ffe47b3ded0, pMap=0x7f7cd5a50600 <ImplGetSvxTextPortionPropertyMap()::aSvxTextPortionPropertyMap+384>, rState=@0x38ae2d4c: com::sun::star::beans::PropertyState::PropertyState_DIRECT_VALUE) at editeng/source/uno/unotext.cxx:1179 #1 0x00007f7cd1e6f5be in SvxUnoTextRangeBase::_getPropertyStates (this=0x3543bc00, PropertyName=..., nPara=nPara@entry=-1) at editeng/source/uno/unotext.cxx:1057 #2 0x00007f7cd1e6fa12 in SvxUnoTextRangeBase::getPropertyStates (this=<optimized out>, aPropertyName=...) at editeng/source/uno/unotext.cxx:1031 #3 0x00007f7cd41e723b in (anonymous namespace)::FilterPropertiesInfo_Impl::FillPropertyStateArray (this=this@entry=0x32e94820, rPropStates=std::vector of length 0, capacity 0, rPropSet=..., rPropMapper=..., bDefault=bDefault@entry=false, pOnlyTheseProps=pOnlyTheseProps@entry=0x0) at xmloff/source/style/xmlexppr.cxx:327 #4 0x00007f7cd41e9230 in SvXMLExportPropertyMapper::Filter_ (this=this@entry=0x34dc72a0, rExport=..., xPropSet=..., bDefault=bDefault@entry=false, bEnableFoFontFamily=bEnableFoFontFamily@entry=false, pOnlyTheseProps=0x0) at xmloff/source/style/xmlexppr.cxx:651 #5 0x00007f7cd41ea026 in SvXMLExportPropertyMapper::Filter (this=this@entry=0x34dc72a0, rExport=..., rPropSet=..., bEnableFoFontFamily=bEnableFoFontFamily@entry=false, pOnlyTheseProps=pOnlyTheseProps@entry=0x0) at xmloff/source/style/xmlexppr.cxx:526 #6 0x00007f7cd42dbbcd in XMLTextParagraphExport::Add (this=this@entry=0x37110830, nFamily=nFamily@entry=XmlStyleFamily::TEXT_TEXT, rPropSet=..., aAddStates=..., bDontSeek=bDontSeek@entry=false) at xmloff/source/text/txtparae.cxx:685 #7 0x00007f7cd42dd09f in XMLTextParagraphExport::exportTextRange (this=this@entry=0x37110830, rTextRange=..., bAutoStyles=bAutoStyles@entry=true, rPrevCharIsSpace=@0x7ffe47b3eef0: true, openFieldMark=@0x7ffe47b3ec34: XMLTextParagraphExport::NONE) at xmloff/source/text/txtparae.cxx:3731 #8 0x00007f7cd42e57df in XMLTextParagraphExport::exportTextRangeEnumeration (this=this@entry=0x37110830, rTextEnum=..., bAutoStyles=bAutoStyles@entry=true, bIsProgress=bIsProgress@entry=false, rPrevCharIsSpace=@0x7ffe47b3eef0: true) at xmloff/source/text/txtparae.cxx:2438 #9 0x00007f7cd42ea746 in XMLTextParagraphExport::exportParagraph (this=this@entry=0x37110830, rTextContent=..., bAutoStyles=bAutoStyles@entry=true, bIsProgress=bIsProgress@entry=false, bExportParagraph=bExportParagraph@entry=true, rPropSetHelper=..., eExtensionNS=<optimized out>) at xmloff/source/text/txtparae.cxx:2378 #10 0x00007f7cd42e0634 in XMLTextParagraphExport::exportTextContentEnumeration (this=this@entry=0x37110830, rContEnum=..., bAutoStyles=bAutoStyles@entry=true, rBaseSection=..., bIsProgress=bIsProgress@entry=false, bExportParagraph=bExportParagraph@entry=true, pRangePropSet=<optimized out>, eExtensionNS=<optimized out>) at xmloff/source/text/txtparae.cxx:2008 #11 0x00007f7cd42e113a in XMLTextParagraphExport::exportText (this=this@entry=0x37110830, rText=..., bAutoStyles=bAutoStyles@entry=true, bIsProgress=bIsProgress@entry=false, bExportParagraph=bExportParagraph@entry=true, eExtensionNS=eExtensionNS@entry=TextPNS::ODF) at xmloff/source/text/txtparae.cxx:1762 #12 0x00007f7cd1e78669 in XMLTextParagraphExport::collectTextAutoStyles (bExportParagraph=true, bIsProgress=false, rText=..., this=<optimized out>) at include/xmloff/txtparae.hxx:459 #13 (anonymous namespace)::SvxXMLTextExportComponent::ExportAutoStyles_ (this=0x7f7cb4522930) at editeng/source/xml/xmltxtexp.cxx:341 #14 0x00007f7cd406121c in SvXMLExport::ImplExportAutoStyles (this=this@entry=0x7f7cb4522930) at xmloff/source/core/xmlexp.cxx:1127 #15 0x00007f7cd40645f5 in SvXMLExport::exportDoc (this=0x7f7cb4522930, eClass=<optimized out>) at xmloff/source/core/xmlexp.cxx:1380 #16 0x00007f7cd1e78d64 in SvxWriteXML (rEditEngine=..., rStream=..., rSel=...) at editeng/source/xml/xmltxtexp.cxx:321 #17 0x00007f7cd1da1d0c in ImpEditEngine::WriteXML (this=this@entry=0x34f87990, rOutput=..., rSel=...) at editeng/source/editeng/impedit4.cxx:270 #18 0x00007f7cd1d88881 in ImpEditEngine::CreateTransferable (this=0x34f87990, rSelection=...) at editeng/source/editeng/impedit2.cxx:3843 #19 0x00007f7cd1d4c091 in EditEngine::CreateTransferable (this=<optimized out>, rSelection=...) at editeng/source/editeng/editeng.cxx:816 #20 0x00007f7cd1d5c91a in EditView::GetTransferable (this=0x33eb8190) at editeng/source/editeng/editview.cxx:662 #21 0x00007f7cc2c03eac in ScModelObj::getSelection (this=<optimized out>) at sc/source/ui/unoobj/docuno.cxx:904 Change-Id: Idb8cbbebe02188678f9c1b17e80cf89feffa9de8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158803 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>