summaryrefslogtreecommitdiff
path: root/sw
AgeCommit message (Collapse)Author
2022-04-05sw lok: fix missing cache invalidation in SwRedlineTable::Insert()Miklos Vajna
The trouble is that the FillRects() call in SwRedlineTable::LOKRedlineNotification() builds a text portion list, but that's not yet correct, and later we don't build a text portion list as we already have one. Fix this similar to the frame size problem by invalidating the cache after we got our rectangles. Change-Id: Ida759be418bc3706810d9774e060d06143893bb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132521 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit 81bcee9866661ee0558474467d83c0fa929e932c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132392 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com>
2022-04-01tdf#147861 writerfilter: use GetFieldResult, not current DocPropertyJustin Luth
Import DOCX and RTF DocProperty fields as "fixed" if the displayed text does not match the File - Properties - Custom variable's content. Otherwise LO will automatically update the field and show the wrong contents (because MS Word requires the user to manually refresh via F9). (cherry picked from commit c4cb1d1dd581a5f120d9cf8b1d4274ec38f3eabe) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport17.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: Id5d3d0794e81b13465c5e824f1e994f563e62c1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132347 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-01tdf#147861 ww8import: solve TODO: not fixed-field if equalJustin Luth
Do not mark the field as "fixed" if the displayed string matches the internal variable. This allows changing the variable within LO and having the field update to reflect that change, which is the way that these fields are supposed to work (although in MS Word they only update manually via F9 which is why some needed to be fixed in the first place). (cherry picked from commit f5c2085e70c40370a790868d4683133a41e6599d) Change-Id: Id359cbf0b48e63bddab3e45871326988467d7ddb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132346 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-01tdf#147861 ww8export: DI_CUSTOM write fixed field, not plain txtJustin Luth
It looks like we just punt on fields, and try to avoid round-tripping them as much as possible. And for good reason since they are tough and poorly handled. But since import of DI_CUSTOM has improved for DOC, it would be nice to be able to round-trip it as well, so that is what this allows. It also opens the door to round-trip more field situations as well. This patch depends on the earlier related patch that removes " (fixed)" from the FieldName. RTF and DOCX also export OK, but import needs some love. (cherry picked from commit 7974d5ef1446f106a5f7c45b76ea2728fe4b18ce) Change-Id: I32d9aa1fea12763cc30a79bcfa6d1d1e19d2c619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132345 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-01tdf#147861 ww8import: use GetFieldResult, not current DocPropertyJustin Luth
In all the testing I could think of on DOCX and DOC examples (and only a very few exist in the unit tests) the actual value of the DocProperty was irrelevant to what Word shows as the document loads. It always takes the in-document, as-last-seen static text. As a way to hack a fix using existing capabilities, I marked as FIXEDFLD the unknown custom fields that weren't handled separately. That fixes what is displayed as the import value, (which of course means that F9 will no longer return a modification back to the DocProperty value). It also means the (fixed) field is lost on export, but a follow-up patch handles that for DOC/RTF/DOCX. There were NO DI_CUSTOM examples in existing ww8 tests, but: -ooxmlexport8: fdo74745.docx, fdo81486.docx -ooxmlexport10: tdf92157.docx and in these cases the plain text matched the variable anyway, but a manual manipulation showed that LO is importing DOCX wrong as well, so a similar import fix needs to happen for RTF/DOCX. My fear is that there are some special-magic-associations that worked properly the old way by accident that I will break by marking them as fixed. No backporting please since obviously very few people report bugs about fields. (cherry picked from commit 377e6f7e8556516b6d1698c58857a5662e6f5660) Conflicts: sw/qa/extras/ww8export/ww8export3.cxx Change-Id: I3f167eb3bd570b66ee829241bf9d31d557fc8749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132344 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-04-01related tdf#147861: cleanup + a function provides the nameJustin Luth
This is not quite a NonFunctionalChange because it avoids adding " (fixed)" to the name. But that is what I want anyway for bug 147861, so this is an all-around good simplification. Plus, the writerfilter loop doesn't need to run if an inside clause will never be true anyway. Putting this cleanup separately helps highlight the actual fix and not clutter the real patches. (cherry picked from commit a13faccd7e8c6503e96e9342a8615b4542b0601f) Change-Id: I12f345cc92627398ad00fe32b64b98b54e5ed14b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132343 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-31sw: fix crash in SwAttrSet::CopyToModify()Miklos Vajna
Regression from commit 938a4d6624a78f3e272b3c4c07f314cb0c6db723 (tdf#128375 sw: fix copying RES_PARATR_LIST_AUTOFMT to different SwDoc, 2019-11-01), the problem is that we may get an autofmt pool item which is set, but its style handle is empty. Assume that this is the same case as having no autofmt at all. (cherry picked from commit ddfafd9b67e6e61c144b29ac73bbafb413ddf03b) Conflicts: sw/Module_sw.mk sw/source/core/attr/swatrset.cxx [ Help backporting by also picking a single hunk from commit 1ad26c9fc237e00247f18fcc8ccc778fba88d1fd (loplugin:referencecasting add check for new rtl::Reference operator, 2021-02-11) as well. ] Change-Id: I87494fd04687d31201b4ec712cb0fb1ec7362b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132313 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-25make default selected table style to Default Table Style for only onlineMert Tumer
unfortunately when the table has a style sw/qa/uitest/writer_tests4/tdf115573.py fails because tables that have pre-applied style resets the style of the elements in their cells when a new row is inserted and the ui test above relies on that. For now this is LOK only Signed-off-by: Mert Tumer <mert.tumer@collabora.com> Change-Id: I2f60376fc2d929498aef45259a5ef291922ccdcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132124 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com>
2022-03-23sw: change inserttable style option default to 1Mert Tumer
Right now it is default to NONE in the list if the user explicitly choses otherwise but that does not align with inserttable option on the toolbar there it is defaulted to "Default Table Style" 1 means "Default Table Style" Signed-off-by: Mert Tumer <mert.tumer@collabora.com> Change-Id: I1db19f0292ac6775653b0db3f2860fea9e3b0adf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131971 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
2022-03-09Fix build error: include <optional>Tor Lillqvist
Change-Id: I4bb31565096cd4cb3dbb910b638e5003ce6d9724
2022-03-03tdf#141550 tdf#141557 tdf#140975 sw: fix textbox crashAttila Bakos (NISZ)
and regressions by refactoring SwTextBoxHelper. tdf#141550 was a DOCX import regression from commit ff321dd36554d25f0817903becf4598065e0a194 (tdf#140828 sw textbox: fix AS_CHAR regression), resulting bad horizontal position of the frame of the textbox. tdf#141557 was a regression resulting crash by changing text box anchoring "To Paragraph". tdf#140975 was an implementation error, resulting broken textbox by changing box anchoring to "As Character". In the SwTextBoxHelper class there were many repeating code parts for textbox positioning. Now these parts have been replaced with the calls of several new functions: 1) getShapeFormat() returns with the SwFrameFormat of the UNO XShape; 2) setWrapThrough() only sets the surround of the textframe (used in the code frequently); 3) changeAnchor() sets the anchor of the textframe according to the anchor of the shape; 4) doTextFramePositioning() sets the position of the textbox according to the shape (used in the code frequently); 5) isAnchorTypeDifferent() shows difference of the anchor types of the shape and the textframe. Also it handles the situation of anchoring "As Character"; 6) isTextBoxHasValidTextFrame() checks if the shape is a part of a textbox or not. Every function returns with true on success, otherwise gives information to the log. All of them can be called with ShapeFormat or UNO XShape. The goal of this to make the possibility to advance this class for further functions – rotation, grouped textboxes etc. – without code copying. Change-Id: I4441cab87931f161d0ace4983646d6d2a68a7321 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113463 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit cb965f2cf6d68c284ccbd8a9635abfdfcc0538ca) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130900 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-03-02lok: fix goto functionality in Accessibility Check dialogSzymon Kłos
Change-Id: Ie9ce42ccdb5cf6c72df3d3d48d3e7369f9e2f9cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130830 Reviewed-by: Pranam Lashkari <lpranam@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2022-02-28dont send text selection start/end when there is no selectionMert Tumer
when there is no selection, startrect and endrect get the cursor coordinates, we should not send it. Otherwise this causes selection handles to appear on online Signed-off-by: Mert Tumer <mert.tumer@collabora.com> Change-Id: I4402e04d4a16a1f840499c57421fd01caf43f116 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130525 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2022-02-24Make accessibility check dialog asyncNickWingate
Signed-off-by: NickWingate <nick.wingate@collabora.com> Change-Id: I88913b3d7e580a1d8c69a39454f2598e11ba43ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130438 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2022-02-23fix Writer key event delayed compression (tdf#145963)Luboš Luňák
SwEditWin::KeyInput() was stopping the flush timer on every invocation, which means that as long as key events kept coming the timer would be started again and again and would not time out, and so the input buffer would not be actually processed. It seems that AnyInput(KEYBOARD) there actually does not normally manage to return true ... except for Win11 where it seems that now GetQueueStatus() detects even key-up events even though it didn't before (I've not debugged this enough to be certain). I think it still makes sense to have the compression in case Writer get overloaded to help it process the pending input events, so fix this (but if there are problems, I think an easy solution is simply to drop it, it doesn't seem to be that necessary). Also decrease the timeout from 200 to 20ms, as 200ms is a very visible delay. Change-Id: I760ad9c4f58726a80bd6a9fbf93f2771f10cbdb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130083 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130251 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-20ofz#40593 remove Objects from m_xResizeDrawObjects if deleted during parseCaolán McNamara
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124563 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 2f01faaf88b6d172d7293f0c9e2a061d99b8ceb5) fix misplaced line Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124630 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 4ed359093c991291216c39cffe14a60e607ec551) Change-Id: I11fa665175ef067a36f4822676c02d4df1e1e250
2022-02-20crashtesting: UaF on layout of fdo53985-1.docxCaolán McNamara
Change-Id: Id8ca0d277f485347e21bd8d6d68de2a7de13de48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119060 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-20Only change SwLayAction::m_bAgain via SetAgainCaolán McNamara
no logic change intended Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118983 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 3a5383892e1f0e22558cd56cb77d56a09c515b7a) Change-Id: Ib0174f8040faa3efde7b9c5ba9b062bac5a35da3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125291 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-02-03lok: render image preview with lower resolutionSzymon Kłos
renderShapeSelection callback is used to render image previews which are later used during eg. rotation. Do not render preview with original size which slows down app a lot. Use 1280x720 max. Change-Id: Ia8365a67d87cea869ef74cb70ce4830439a523b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129376 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2022-02-03Use unique id for FN_UNO_TRANSFORMED_GRAPHICSzymon Kłos
Change-Id: I1425fbbe843534adba8b87f9c7b23461cc6049c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129375 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2022-01-28tdf#119952 DOCX import: fix negative page marginsAttila Szűcs
DOCX body text can overlap with header/footer, if top/bottom page margin is negative. To support this, convert header/footer text content to textbox anchored to header/footer, if needed. Note: possible improvements: 1) Skip this hack, if the header is small enough to not overlap with the body, calculate only the height of the header at the import time. 2) This hack does not fix the case when the top of the header is under the top of the body. (A problem in DOC import, too.) This could be achieved by repositioning the dummy header to the top, and lower the textbox by the same amount. (This would still not resolve the extreme situation, when the body start from 0 mm (in LibreOffice, header must be at least 1 mm). 3) Import of VertOrientation::BOTTOM property seems to be bad, or at least the footer loses this property after a DOCX round-trip, resulting bad footer position. 4) after a round-trip, the 1 mm height of the dummy header increases to 1 line height. Also the "Autofit height" and "Use dynamic spacing" settings are changed, likely related to their missing DOCX export. Co-authored-by: Tibor Nagy (NISZ) (cherry picked from commit d656191ec308d4280b93c7169372e543a255d108) Change-Id: I8319c93c6c5a980878ee9956c8ab2953da60409e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129102 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-28tdf#95806 tdf#125877 tdf#141172 DOCX: fix tables in footnotesLászló Németh
and endnotes by converting them to floating tables during the import, and removing floating at the DOCX export. Writer core doesn't support non-floating tables in footnotes and endnotes officially, (flowfrm:cxx: "Tables in footnotes are not truly supported"), so their DOCX import resulted serious problems: – missing table paint (tdf#95806); – table loss during saving to ODT (tdf#125877); – table loss during copying them or their footnotes and endnotes in the document (this resulted the regression of the optimized footnote and endnote import: tdf#141172); – table loss during changing the order of the chapters in the Navigator. (cherry picked from commit e11c51eefe8c3210cef2b5850f401ba67a401d01) Conflicts: sw/qa/extras/odfexport/odfexport.cxx writerfilter/source/dmapper/PropertyMap.cxx Change-Id: Ife8af41936ae3ab003a3a9ad33b98c1d813e9c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129101 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-26tdf#143591 DOCX import: handle anchored objects as at-charMiklos Vajna
This partially reverts cc8f8ae55f681755f5da3bf64e4c30bb713f0383 (DOCX drawingML shape import: wp:anchor's behindDoc attribute, 2013-11-19), it seems to be more important to be consistent with the DOC import than with the VML import which is no longer used for DOCX shapes crated with Word >= 2010. Change-Id: I631da010bce1b4d3c392645e0ae3797a03665a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122367 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128927 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>
2022-01-23tdf#146728 lok: IME: preset formatting in the new paragraphSzymon Kłos
When we wrote something using Heading or Title style and then moved to the next paragraph by pressing enter we should get "Text Body" style in the new line. Do not copy style. Use NOHINTEXPAND when inserting initially so we can use EMPTYEXPAND later - at the end of composing - and use correct styling. followup for: lok: IME: directly copy formatting for inserted text d8dbd123bfa7f39489ceb15ac83142635531fd43 https://cgit.freedesktop.org/libreoffice/core/commit/?id=d8dbd123bfa7f39489ceb15ac83142635531fd43 Change-Id: I55b764068337e125eea3fba641edb6486b2ac9d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127875 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ash@collabora.com>
2022-01-19sw: fix unexpected paragraph border inside table cellsMiklos Vajna
The bug document has a table cell, which contains a paragraph with borders. Its left/right/bottom borders are rendered in Writer, but not in Word. The reason for the left/right border is that it's outside the paragraph's frame area, which is not rendered in Word. Fix this by clipping the rendered borders so they don't go outside the paragraph's frame area. (Normally the frame area is the larger rectangle, and then margins may cause a smaller "print area", but in this case we have a negative right margin, so clipping the print area to fit into the frame area actually does something.) This is quite similar to what commit 1e21902106cbe57658bed03ed24d4d0863685cfd (tdf#117884: intersect border with paint area of upper frame., 2018-05-26) did for table borders. The bottom border is a different problem: the cell has a fixed height and enough content so the paragraph is cut off vertically. This means that technically the bottom border would be inside the frame area, but Word cuts it off, because they apply clipping on the not-yet-cut-off rectangle. Fix this by dropping the bottom margin when the frame is cut off. (cherry picked from commit 4a7281fa206c0a82cfc2ba23f25c31ae775d8777) Conflicts: sw/qa/core/layout/layout.cxx sw/source/core/layout/paintfrm.cxx Change-Id: I7f65b68997330b247db65839db8a484e74f78c64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128611 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-05Set the original size in crop dialog to preferred DPI calc. sizeTomaž Vajngerl
If we have the document setting preferred image size set, then use that as the default DPI and recalcualte the logical image size using the DPI and the size in pixels. This is useful so we have the preferred DPI size as 100% in the crop dialog, so we can adjust the size in relation to that value. This adds to SfxTabPage a new member maAdditionalProperties, to make it easier to transfer additional properties into a tab page. This is then used to transfer the preferred DPI into the tab page, which was previously done by user data, which is less than ideal and always doesn't work. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127096 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit e34067483ef78c1569641becfe99b79a97600aed) Change-Id: I50806f194032e228ee2cf56a39e5735a57358d46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127240 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-05Add graphic size checker for the preferred document DPITomaž Vajngerl
This change adds a graphic size checker, which checks all the images in the document, if they largely differ (outside of 50% and 110% of the image size) from the set preferred image DPI document setting. For all images that don't fall under this bounds, list them in the dialog and offer the posibility to select/goto the image and pop-up the properties dialog for the image to change its size. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127094 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 046e6cfa544d2ffd67fd29ba7dde41b495744618) Change-Id: I06efce77c291fdb6ec3864d72c2f4d15dba9c42b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127239 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-05Add image preffered DPI document setting, use it in Writer, ImpressTomaž Vajngerl
This adds a "image preferred DPI" document setting, which is used as a suggestion of the DPI that an image should have in the document. This is currently used when the image is inserted into the document (Writer, Impress/Draw) to resize it to the preferred DPI value. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126334 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 4c00e8fb10437fcaefe8635ef390b78376938d15) Change-Id: I3ee9d409257e3c6aa2ead05144ecbba7b3b916f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127238 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-12-21ofz#39252 use safer SwUnoCursor for the pos to move back toCaolán McNamara
Change-Id: Iba6f200cea92196986bd30564cf56ab5d8b954b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122611 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-21ofz#38011 save and restore m_pLastAnchorPos via UnoCursorCaolán McNamara
when we do some operations that may delete paragraphs Change-Id: I2165dd287771f06c6d0fd061dd7659b06db4bd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121511 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-21ofz#37322 Bad-castCaolán McNamara
use a SwUnoCursor for the LastAnchorPos around here, this is similar to ofz#9858 Bad-cast Change-Id: I194a39ae13c382740b0ba8145dcc33fb2107105d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120679 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-21crashtesting: UaF on layout of ooo98566-1.odtCaolán McNamara
in: sw/source/core/text/itrform2.cxx:2643 SwTextFormatter::NewFlyCntPortion at: pFly = static_cast<SwTextFlyCnt*>(pHint)->GetFlyFrame(pFrame) (gdb) print m_pCurr $2 = (SwLineLayout *) 0x55ea220a0020 after calling GetFlyFrame m_pCurr is unchanged and we will call m_pCurr->MaxAscentDescent on it. But m_pCurr is deleted during GetFlyFrame by... #18 0x00007f98c5cd337f in SwLineLayout::~SwLineLayout() (this=this@entry=0x55ea220a0020, __in_chrg=<optimized out>) at source/libo-core/sw/source/core/text/portxt.hxx:26 #19 0x00007f98c5cd347a in SwParaPortion::~SwParaPortion() (this=0x55ea220a0020, __in_chrg=<optimized out>) at source/libo-core/sw/source/core/text/porlay.cxx:2491 #20 0x00007f98c5cd3485 in SwParaPortion::~SwParaPortion() (this=0x55ea220a0020, __in_chrg=<optimized out>) at source/libo-core/sw/source/core/text/porlay.cxx:2491 #21 0x00007f98c5d05e70 in std::default_delete<SwParaPortion>::operator()(SwParaPortion*) const (__ptr=<optimized out>, this=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:75 #22 0x00007f98c5d05e70 in std::unique_ptr<SwParaPortion, std::default_delete<SwParaPortion> >::reset(SwParaPortion*) (__p=<optimized out>, this=<optimized out>) at /usr/include/c++/8/bits/unique_ptr.h:382 #23 0x00007f98c5d05e70 in SwTextLine::SetPara(SwParaPortion*, bool) (bDelete=true, pNew=0x0, this=<optimized out>) at source/libo-core/sw/source/core/text/txtcache.hxx:45 #24 0x00007f98c5d05e70 in SwTextFrame::ClearPara() (this=this@entry=0x55ea21302b60) at source/libo-core/sw/source/core/text/txtcache.cxx:113 #25 0x00007f98c5d1be89 in SwTextFrame::Init() (this=this@entry=0x55ea21302b60) at source/libo-core/sw/source/core/text/txtfrm.cxx:757 #26 0x00007f98c5d2630c in SwTextFrame::Prepare(PrepareHint, void const*, bool) (this=0x55ea21302b60, ePrep=PrepareHint::FlyFrameArrive, pVoid=<optimized out>, bNotify=<optimized out>) at source/libo-core/sw/source/core/text/txtfrm.cxx:3086 #27 0x00007f98c5b1edb8 in SwFlyInContentFrame::NotifyBackground(SwPageFrame*, SwRect const&, PrepareHint) (this=<optimized out>, rRect=..., eHint=<optimized out>) at source/libo-core/sw/inc/anchoredobject.hxx:205 #28 0x00007f98c5b261a6 in Notify(SwFlyFrame*, SwPageFrame*, SwRect const&, SwRect const*) (pFly=pFly@entry=0x55ea21a18d60, pOld=0x0, rOld=SwRect = {...}, pOldPrt=pOldPrt@entry=0x7ffeb50390f8) at source/libo-core/sw/source/core/inc/frame.hxx:1177 #29 0x00007f98c5b2ceca in SwFlyNotify::~SwFlyNotify() (this=0x7ffeb50390d0, __in_chrg=<optimized out>) at source/libo-core/sw/source/core/layout/frmtool.cxx:648 #30 0x00007f98c5b1fa25 in SwFlyInContentFrame::MakeAll(OutputDevice*) (this=0x55ea21a18d60) at source/libo-core/sw/source/core/inc/frmtool.hxx:419 #31 0x00007f98c5aec3a9 in SwFrame::PrepareMake(OutputDevice*) (this=0x55ea21a18d60, pRenderContext=0x55ea212bc4c0) at source/libo-core/sw/source/core/layout/calcmove.cxx:375 #32 0x00007f98c5b17ad2 in SwFlyFrame::Calc(OutputDevice*) const (this=<optimized out>, pRenderContext=<optimized out>) at source/libo-core/sw/source/core/layout/fly.cxx:2890 #33 0x00007f98c5b636c5 in SwObjectFormatter::FormatLayout_(SwLayoutFrame&) (this=this@entry=0x55ea2244d150, _rLayoutFrame=...) at source/libo-core/include/rtl/ref.hxx:206 #34 0x00007f98c5b6413e in SwObjectFormatter::FormatObj_(SwAnchoredObject&) (this=this@entry=0x55ea2244d150, _rAnchoredObj=...) at source/libo-core/sw/source/core/layout/objectformatter.cxx:296 #35 0x00007f98c5b6705b in SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject&, bool) (this=0x55ea2244d150, _rAnchoredObj=..., _bCheckForMovedFwd=<optimized out>) at source/libo-core/sw/source/core/layout/objectformattertxtfrm.cxx:136 #36 0x00007f98c5b6359f in SwObjectFormatter::FormatObj(SwAnchoredObject&, SwFrame*, SwPageFrame const*) (_rAnchoredObj=..., _pAnchorFrame=<optimized out>, _pPageFrame=<optimized out>) at source/libo-core/sw/source/core/layout/objectformatter.cxx:190 #37 0x00007f98c5d717aa in SwTextFlyCnt::GetFlyFrame_(SwFrame const*) (this=this@entry=0x55ea214d8810, pCurrFrame=pCurrFrame@entry=0x55ea21302b60) at source/libo-core/sw/source/core/inc/frame.hxx:1177 #38 0x00007f98c5cb511b in SwTextFlyCnt::GetFlyFrame(SwFrame const*) (pCurrFrame=0x55ea21302b60, this=0x55ea214d8810) at source/libo-core/sw/inc/txtflcnt.hxx:48 #39 0x00007f98c5cb511b in SwTextFormatter::NewFlyCntPortion(SwTextFormatInfo&, SwTextAttr*) const (this=this@entry=0x7ffeb503a6b0, rInf=..., pHint=0x55ea214d8810) at source/libo-core/sw/source/core/text/itrform2.cxx:2643 (gdb) print this (SwLinePortion * const) 0x55ea220a0020 The SwTextFrame of SwTextFrame::ClearPara is the same pFrame/m_pFrame at SwTextFormatter::NewFlyCntPortion ClearPara is not called if the SwTextFrame is "Locked", so try using that to protect GetFlyFrame Change-Id: Ia9dcb1f345f6953d995f2acf1ec23492d1680364 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118784 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-21ofz#34749 don't remove trailing paragraph if something got anchored to itCaolán McNamara
Change-Id: Ic6eec2f9829c415abd4f2628bc51efbf98f918fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118228 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-21ofz#31538 null-derefCaolán McNamara
Change-Id: I3264c0fd509e16cf4727847199f0be316d03d0e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111713 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-12-09lok: don't limit line length in HTMLWriterSzymon Kłos
Problem: https://github.com/CollaboraOnline/online/issues/3645 Test case: 1. Open Collabora Online and paste "Alphabet" section from wikipedia article: https://en.wikipedia.org/wiki/Estonian_language#Alphabet 2. Select last two sentences (starting from "The letter") 3. Open Insert -> Hyperlink dialog Result: notice that some spaces was removed/converted into new line Expected: Text field should contain original text Hyperlink dialog uses current selection which is get as HTML from the core. In the SwHTMLWriter there is a parameter defining how long line should be and it replaces ' ' space into '\n' new line when limit is reached. This patch turns off that feature but only for getting html for current selection in LOK case. For now don't remove new line at the beginning as cypress has to be fixed first. Added FIXME in the code. Change-Id: I03b540b0b2d639a08774ecc4fc75abb7b3f0b7a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125482 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
2021-12-08sw: fix crash in SwFEShell::SelectObj()Miklos Vajna
Crashreport signature: SwContact::GetFormat() sw/inc/dcontact.hxx:112 SwFEShell::SelectObj(Point const&, unsigned char, SdrObject*) sw/source/core/frmedt/feshview.cxx:292 SwWrtShell::UnSelectFrame() sw/source/uibase/wrtsh/select.cxx:326 SwWrtShell::DelRight() sw/source/uibase/wrtsh/delete.cxx:467 SwBaseShell::ExecDelete(SfxRequest&) sw/source/uibase/shells/basesh.cxx:198 I.e. it seems that in case we're in the middle of a delete, then it's possible that the mark list contains an SdrObject that doesn't have a matching SwClient anymore. Ignore such SdrObjects when looking for the textbox of a draw shape. Change-Id: I065b2ea44d39220184a5f604c3ea13f6a106ddb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126537 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-23Crash when fetching clipboard data.Michael Meeks
Seems like some unusual corner-case around HTML export. sw::DocumentContentOperationsManager::CopyImplImpl(SwPaM&, SwPosition&, bool, SwPaM*, bool) const /sw/source/core/doc/DocumentContentOperationsManager.cxx:5068 sw::DocumentContentOperationsManager::CopyImpl(SwPaM&, SwPosition&, bool, SwPaM*, bool) const /sw/source/core/doc/DocumentContentOperationsManager.cxx:4609 sw::DocumentContentOperationsManager::CopyRange(SwPaM&, SwPosition&, bool, bool, bool) const /sw/source/core/doc/DocumentContentOperationsManager.cxx:1936 SwEditShell::CopySelToDoc(SwDoc*) /sw/inc/pam.hxx:193 (discriminator 2) SwFEShell::Copy(SwDoc*, rtl::OUString const*) /sw/source/core/frmedt/fecopy.cxx:224 (anonymous namespace)::lclOverWriteDoc(SwWrtShell&, SwDoc&) /sw/source/uibase/dochdl/swdtflvr.cxx:413 SwTransferable::GetData(com::sun::star::datatransfer::DataFlavor const&, rtl::OUString const&) /include/sfx2/objsh.hxx:866 TransferableHelper::getTransferData2(com::sun::star::datatransfer::DataFlavor const&, rtl::OUString const&) /include/com/sun/star/uno/Type.h:121 TransferableHelper::getTransferData(com::sun::star::datatransfer::DataFlavor const&) /include/rtl/ustring.hxx:438 getFromTransferrable.isra.0 /include/com/sun/star/uno/Any.hxx:151 encodeImageAsHTML /desktop/source/lib/init.cxx:4382 doc_getTextSelection Change-Id: I1af52d827ebdc9bbc5278f56547d1b3fd1b87e7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125455 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-11-15disable Writer shadow hack in LOK caseLuboš Luňák
LOK redraws always with new content, so there's no need to rewrite any possible previous content, and this breaks transparency in LOK case. Change-Id: I1df3fe738f5ac1290720f0e18d6d391e220eb8ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125225 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-11-14lok: sw: remove database tabHenry Castro
It is not functional the database feature yet. Change-Id: Iea073512424a738dc2d789923740b837d6f3d691 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125113 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit ead2aa7a7088aa2b41a90746351fdf74822dbbe0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125129
2021-11-13sw, out of order undo: allow multiple actions from other viewsMiklos Vajna
Previously we assumed that the action to be executed is always exactly the top of the undo stack minus 1 element. Extend this, so that in case an other view appends two or more elements to the undo stack, we still find our undo action. Obviously only do this if all those undo actions are independent from us. This requires replacing the swap in svl/ with a move-out + move a range down + move in construct. (cherry picked from commit 39f231360013e944a8713248359662b9f282d902) Conflicts: sw/source/core/undo/docundo.cxx Change-Id: Ic12d32d6eb5e77618d99eddb4fa096802f32d655 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125102 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-12Fix -Werror=shadow in basesh.cxxAron Budea
sw/source/uibase/shells/basesh.cxx: In member function ‘void SwBaseShell::ExecUndo(SfxRequest&)’: sw/source/uibase/shells/basesh.cxx:564:29: error: declaration of ‘rView’ shadows a member of ‘SwBaseShell’ [-Werror=shadow] 564 | SwView& rView = rWrtShell.GetView(); | ^~~~~ In file included from sw/source/uibase/shells/basesh.cxx:63: sw/source/uibase/inc/basesh.hxx:41:18: note: shadowed declaration is here 41 | SwView &rView; | ^~~~~ Since c72e500ccaf0ce2261c5233b80fba9342778f810. Change-Id: I5fda3ad4805dc59a9e0e01dd262c09952a2bc97e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125077 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
2021-11-12make it explicit whether to ignore the result of getLOKPayload()Luboš Luňák
Returning an empty string to signify 'ignore' was a poor design, as some messages types actually may have valid empty messages. Change-Id: Ia82d3d97d150bc5ef412a1bd4b1091d9b2d84385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125089 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2021-11-11sw, out of order undo: allow a subset of a non-empty redo listMiklos Vajna
Specifically, we used to not allow out of order undo at all if the redo list was non-empty. This relaxes that condition a bit. Out of order undo is OK with a non-empty redo list, in case all undo actions in the redo list are either 1) owned by the current view or 2) independent from the undo action to be executed I.e. if view1 has lots of type undo actions and an view2 adds a single type undo action on top of it, then allow view 1 to execute multiple of its typing undo actions, not just a single one. (cherry picked from commit 2875c65946e59f5dd7968155463bf00bd71d440b) Conflicts: sw/source/core/undo/docundo.cxx Change-Id: I2f5d9404a9994ed74b65233d2a315976c27b28b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125039 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-11lok: no need to layout comments in writercp-21.06.6-1Szymon Kłos
Annotations in writer use EditEngine what caused to send cursor position from that EditEngine to online and showing cursor in the top left corner of a document after comment insertion. We don't need to resize/update position comment windows as we send only abstract description of the comments and later rendering is handled by client. Change-Id: I1df0e44f9500c438efd00942a372754c7fbaa170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124794 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
2021-11-11do not draw "desktop" (=surrounding background) in Writer in LOK modeLuboš Luňák
It's meant to stay transparent. Change-Id: Ia6264c44f369e80092f78a6a6674857460cd7c04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124716 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
2021-11-11sw: allow undo of typing in 2 views independent from each otherMiklos Vajna
Undoing out of order is dangerous by default, so limit this to a very specific case as a start, that allows growing in follow-up commits. For now, allow out of order undo if: 1) redo stack is empty 2) we're in LOK mode (different views represent different users) 3) we undo a single action (count is 1) 4) the top undo action doesn't belong to the current view 5) the top and the previous undo actions are independent Which only requires that SwUndoInsert::UndoImpl() is independent for two different paragraphs, which seems to be the case. Independent undo actions opt in for this, currently the only such allowed undo action is SwUndoInsert ("typing"), which adds characters to a single text node. Even those are only considered independent if they operate on different text nodes. On the positive side, this allows out of order undo in the frequent case where two users collaborate on a long document and they just type some new content into the document at different paragraphs. (cherry picked from commit 8e8e72f08b01a284cf1a90b888d48acfb6a33d2e) Conflicts: sw/source/core/inc/UndoManager.hxx sw/source/uibase/shells/basesh.cxx Change-Id: Ibb4551e8f7046b4947491b8bf751eaa0cbb2d060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124955 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-10sw: Wrong ZOrder after import for images anchored to non-1nd pageTomaž Vajngerl
Importing a document that has images anchored to the non-1st page, can result in images having the wrong the wrong Z index (ZOrder). If there are overlapping objects in the document, this can become a problem. The issue is with the call to SwRootFrame::RemoveMasterObjs, which removed the "master objects" - SwFlyDrawObj* castable objects. Normally the SwFlyDrawObj* objects on the page are wrapped and replaced by SwVirtFlyDrawObj*, but when the call to the RemoveMasterObjs was made, this hasn't happen yet to all the objects (objects that were not on the 1st page). The fix is to move the RemoveMasterObjs call to a different place, where we processed all the pages, so we can safely remove the remaining master objects on the page. Change-Id: I7d2f31614d269c22a82e7e5dea960f3d0844a5d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124597 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 8b7dbd220dbdfd286de2d770503dae8bf6d2e53e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124686 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2021-11-09sw: try grouping undo actions of IME-edited textMiklos Vajna
This is a problem since commit e7760d428bc82ccfcae14f1907b78f9f1013b88c (Fix tdf#87500 - Freeze with English/Japanese mixture undo., 2015-09-08), that started not grouping IME-edited text completely. This means that in case you go via SwEditWin::Command() instead of SwEditWin::KeyInput() to type a 4 characters word, then it'll create 4 undo actions. Fix the problem by tracking who was the last caller of sw::DocumentContentOperationsManager::InsertString(), so we can only disable grouping switching between IME and non-IME, and we can have grouping for a series of IME input. (cherry picked from commit 6680e51716e383c68bb1ec9cc0a05d698d3b6a3d) Change-Id: I31bd02db4fe653ab63e41a77c75b8bebfc749ff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124834 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-26tdf#138531: Also update DDE tables, not only fieldsco-21.06.5-1Bjoern Michaelsen
Change-Id: I0cbf8ce355b460b2f7ea73c8fae653641c980979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124129 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 98247b039baea4697e6c387025afcf6a2963c043) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124020
2021-10-25use pull model also for LOK text selectionLuboš Luňák
Make LOK_CALLBACK_TEXT_SELECTION, LOK_CALLBACK_TEXT_SELECTION_START, LOK_CALLBACK_TEXT_SELECTION_END and LOK_CALLBACK_TEXT_VIEW_SELECTION also use pull model, i.e. LO core will only set a flag and when CallbackFlushHandler needs the actual data it'll use getLOKPayload(). This again avoids a large number of messages passed to CallbackFlushHandler only for them to be sooner or later discarded. Change-Id: Ia7528039be996a6e9e8491b4eba3f4133582fa56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124147 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>