summaryrefslogtreecommitdiff
path: root/sw/source/core/frmedt/fetab.cxx
AgeCommit message (Collapse)AuthorFilesLines
2024-02-16Deduplicate and unify SwNodes::Go(Next|Prev)(Section)Mike Kaganski1-2/+2
The "Next" methods are made static, just as "Prev" ones. Overloads taking SwNodeIndex and SwPosition are implemented using a common implementation function, to avoid code duplication. Change-Id: I4035188b5c29d19824cd6d031e05d668d5cf1e86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163443 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-08tdf#43848 fix selection in table with split/merged cellsOliver Specht1-2/+2
extends the selection of table cells to reach a more rectangular selection area Additionally tdf#155670 is taken care of by not showing the row selection cursor if row selection is not supported Change-Id: If31aa1030c91d81bc889d8aaa668e96c5328f03f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162508 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-09-28tdf#157492 sw: fix tracked drag & drop of table rowLászló Németh1-1/+4
Selecting table rows by the left row border, and moving them via drag & drop resulted only tracked deletion, but not tracked insertion. See also commit 3e6125c72f8c07c14df42d45571cab44f24e9f70 "tdf#155846 sw tracked table column: fix drag & drop". This reverts also commit 5a1c19624eda0c8b847af0dcee70b82502578ceb "tdf#146965 sw track changes: fix tracked table row moving". Change-Id: I7287e46188eee123b5fd36a5ec7ac5311699840b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157382 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2023-09-28tdf#155846 sw tracked table column: fix drag & dropLászló Németh1-1/+4
Selecting table columns by the top border, and moving them via drag & drop resulted only tracked deletion, but not tracked insertion. See also commit 912336f3c85d9a631fa0ac0f270bab04b204f619 "tdf#154599 sw: fix crash at drag & drop table columns". Change-Id: Ib392f0700ec8c17a342df435c8bb1883967b0711 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157370 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-09-28tdf#156900 sw tracked table column: fix row deletionLászló Németh1-16/+12
If the last deleted table column was hidden, it was not possible to delete the table rows. Regression from commit aff269c18b9029fec992135a406dc5031927c401 "tdf#155345 sw tracked table column: hide them in Hide Changes mode". Change-Id: I51b78f6f5552bdba2240bf278ac1d796830a1beb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157330 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-08-27tdf#156784 sw tracked table column: fix crash at Select AllLászló Németh1-1/+2
Section starting table with hidden deleted first column freezed at Select All, resulting crash because of infinite recursion during waiting frame creation of a hidden cell without frame in Hide Changes mode. Regression from commit d1004cdd6a445ae73673b0ca360ae034b0ec09f2 "tdf#150673 sw offapi: add change tracking of table column deletion". Change-Id: I15d9fa0138261d7a95c6e34a8d07fb2e001d0c7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156056 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-08-09tdf#156487 sw tracked table column: fix Hide ChangesLászló Németh1-10/+23
In Hide Changes mode, deleting table columns with change tracking wasn't applied on the table layout immediately, only using Show Changes and Hide Changes again. Now the deleted column removed from the table instead leaving an empty table column. Also revert commit 33058b5dc47a140516669945efbdd30ea65138a6 "tdf#156544 sw tracked table column: delete empty column". See also commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Change-Id: If03d2bc5996a168cb44839b0753effb9031edbc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155522 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-08-03tdf#156595 sw tracked table column: fix crash at row deletionLászló Németh1-10/+16
In Hide Changes mode, deleting a row, which has a hidden column deletion before the first cell, resulted a crash because of missing cell frame/table cursor. Regression from commit aff269c18b9029fec992135a406dc5031927c401 "tdf#155345 sw tracked table column: hide them in Hide Changes mode". Note: it seems, plain uiwriter testing is not enough to catch the problem. Change-Id: I12675ecd402d6411107b90809728454f13e60580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155287 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2023-08-01tdf#156544 sw tracked table column: delete empty columnLászló Németh1-1/+3
Empty table columns were removed without change tracking in Record Changes mode, too. Follow-up to commit fe43f5971dfd2a121634eea9e39c7ad0cf3f962a "tdf#156475 sw tracked table column: delete empty cell". Change-Id: I8154cb1c75cf793f5a60e8259a91dd779fc766e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155153 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-07-27tdf#156475 sw tracked table column: delete empty cellLászló Németh1-0/+17
Tracking changes, only non-empty cells of the deleted columns got coloring, and were hidden in Hide Changes mode. Add dummy text content to empty cells of the deleted columns to get visible deletion in Show Changes mode, also working context menu in that cell; to allow hiding them in Hide Changes mode, also to store the time stamp of the deletion, if all the other rows are removed during editing. Follow-up to commit 472abf99a4d90d7a53316394a2e51a26b7e62345 "tdf#155341 sw tracked table column: add insertion". Change-Id: Ieb5d237b3c82c81fded25608ef3d2906d7474003 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154994 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-05-11tdf#150673 sw offapi: add change tracking of table column deletionLászló Németh1-3/+46
This is a minimal extension of the text range based change tracking to record and apply table column deletions with full Undo/Redo support. Add property HasTextChangesOnly to com::sun::star::text::CellProperties. During recording of track changes, deletion of table columns wasn't recorded: columns were removed completely with their text content. Now the deletion deletes the cell content with change tracking, setting also HasTextChangesOnly property of table cells to FALSE. If a tracked deletion is accepted in a deleted column, and the result is an empty cell, the column will be removed, if HasTextChangesOnly property of the deleted cell is FALSE. Note: Deletion of empty columns isn't recorded. Hiding deleted columns hasn't been supported yet in the Hide Changes mode. Follow-up to commit 05366b8e6683363688de8708a3d88cf144c7a2bf "tdf#60382 sw offapi: add change tracking of table/row deletion". Change-Id: I36915d7a58f66b4a3bdaf90495cb998d29c36561 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151593 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2023-01-27tdf#114973 sw: enable SelectAll with hidden para at start/endMichael Stahl1-1/+1
If there's a hidden para the shell cursor can't be positioned in it ordinarily, so SelectAll will exclude these at the start or end of the document. There is already special code to handle a table at the start of the document body, and it's relatively simple to adapt it to handle hidden paragraphs as well. This appears to work surprisingly well, the point is at the start of the first node of the document, and moving it right immediately puts it to the first non-hidden paragraph. But it only works for paragraphs hidden by character formatting or hidden paragraph field, not if there's a hidden section - there are no (not even 0-height) SwTextFrames in hidden sections. Change-Id: Ifd3c11f4169a037fdae2c2b376d0138bec46774f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146257 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-12-22check GetEditShell()Caolán McNamara1-3/+4
Change-Id: I975c7dca9ea569e326fc5d8670a078959ab9f093 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144761 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-12-09tdf#150578 sw track changes: fix table toolbar at row deletionLászló Németh1-0/+4
In Hide Changes mode with enabled change tracking, table row deletion disabled the table toolbar, so it wasn't possible to repeat the click on the toolbar deleting multiple rows row by row. Follow-up to commit 16c705ec0d1ab4b4428577ccb0ea3fc14ee0fc88 "tdf#148849 sw: fix cursor pos at tracked DeleteRow in Hide Changes". Change-Id: I297bae405cb24f7090144344947c01a1dadf9261 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143876 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-10-21tdf#151657 sw: delete row with nested table in Hide ChangesLászló Németh1-2/+2
Fix for tdf#150976 didn't work in Hide Changes mode. Follow-up to commit c809867f3ee92a8eb36cbab840bd6d6c5b3b1c26 "tdf#150976 sw: fix tracked deletion of row with nested table". Change-Id: If10c8184a01d025e3df53e33fc9503107fce0980 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141611 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-10-08use more SwPosition::AssignNoel Grandin1-2/+2
part of the process of hiding the internals of SwPosition Change-Id: I6c14e620fa5dcfac8c90a7adf942267d9970381b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141100 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-23tdf#46733 sw: don't double-select column during deleteColJustin Luth1-1/+9
The problem here was that under IsNewModel tables were selecting the entire column (including merged cells) and then using THAT selection to ExpandColumnSelection. Well, that ends in disaster. Since NewModel already expands to catch the cells that are contained inside the selected cells, there is no need to expand the selection of GetTableCell. Change-Id: I43089d912cdd17b2599619a43e40fecc2f5dd3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140455 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
2022-09-01cid#1513469 silence Dereference null return valueCaolán McNamara1-1/+1
Change-Id: Iaddf5aa526438757195d60dcb255d6928128cf9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139153 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-26make the parameter to SwTableNode::MakeOwnFrames optionalNoel Grandin1-2/+1
since most of the call sites seem to be just creating a temporary and then ignoring it Change-Id: Ia50cdd4ce5eca665351d3f76e395178bab827b08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138879 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-24tdf#150576 sw: fix cursor pos deleting at rows deleted alreadyLászló Németh1-0/+23
Instead of jumping in the start of the document, set cursor after (or deleting the last row, before) the rows deleted already in Hide Changes mode with enabled change tracking. Regression from commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Follow-up to commit 189aa05c6ea17a8e823b4eab18ea0d1131d9d73e "tdf#148849 sw: fix cursor pos at tracked DeleteRow in Hide Changes". Change-Id: Ifc2a7f41a57f413d27d9b464a0e464643d15f404 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138772 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-08-22tdf#148849 sw: fix cursor pos at tracked DeleteRow in Hide ChangesLászló Németh1-8/+19
In Hide Changes mode, the text cursor jumped to the start of the document after tracked deletion of a table row, instead of remaining in the table in the next table row. Regression from commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes". Change-Id: Iff959c9a9940db013827e1c827bcb92c07b4b26a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138683 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-08-14use more GetContentIndexNoel Grandin1-1/+1
Change-Id: I48e36a95872b5c2bdb6b92c66403d4c08eedd38c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138255 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-14rename SwPaM::GetNode to GetPointNode/GetContentNodeNoel Grandin1-2/+2
Using a parameter to select point/mark makes the code much harder to read Change-Id: I4ac8b904ac423e2b99253b7e4b6adc72c8afe1a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-07make ParkCursor take a SwNode, not an SwNodeIndexNoel Grandin1-1/+1
as part of the process of hiding the internals of SwPosition Change-Id: I5fde455225b5571bca7f461898146800837fa4cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-05use more SwPosition::AssignNoel Grandin1-2/+1
as part of the process of hiding the internals of SwPosition these are still the easy ones, i.e. no functional change intended Change-Id: Ibb2adf17de47bab5374730b508d9c020991a945e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-04add more SwPosition::AssignNoel Grandin1-2/+1
These are just the "obviously correct" places where we can use SwPosition::Assign, i.e. the places where we are already correctly setting both nNode and nContent in SwPosition. Change-Id: I27078c91e491c9162770ce729364197056d62cb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetContentIndexNoel Grandin1-1/+1
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nContent.GetIndex' | xargs perl -pi -e 's/\bnContent\.GetIndex/GetContentIndex/g' Change-Id: I12684071a6666c365dbadbab2a4b37cf51b274d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137695 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetNodeIndexNoel Grandin1-2/+2
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nNode.GetIndex' | xargs perl -pi -e 's/\bnNode\.GetIndex/GetNodeIndex/g' Change-Id: I3616cea4c47595afe74f1aa8e3be553279f25d44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137694 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02introduce SwPosition::GetNodeNoel Grandin1-5/+5
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nNode.GetNode' | xargs perl -pi -e 's/nNode\.GetNode/GetNode/g' Change-Id: Id1937df1bd5a54677c2c1bbfb2d693a4e22a7b98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137671 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-08tdf#133957 sw: don't delete flys on Backspace/Delete keysMichael Stahl1-2/+2
Also fixes: tdf#134007 tdf#138835 tdf#139514 When a character is deleted via the keyboard by Backspace or Delete key, an artificial selection is created in SwWrtShell::DelLeft()/DelRight(). Ideally this should not delete flys that may be anchored to the paragraphs, but unfortunately this may happen if there are only 2 empty paragraphs in the section, because then the artificial selection cannot be distinguished by the SwDoc implementation from a selection from Ctrl+A (Select All), which *should* delete the flys. So introduce a new flag that needs to be passed down multiple layers so that SwUndoDelete can use it to determine if flys should be deleted, and translating it to a flag that had been introduced to preserve flys in ReplaceRange() previously. There are a couple more callers that look like they want to "replace" some text, so guess a bit at where to set this new flag. (note: of course fly anchored *as char* must be deleted via keys.) (regression from commit e75dd1fc992f168f24d66595265a978071cdd277) Change-Id: Ib4467476b12a12aefbbcb74ab9802f9318cf9aa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135476 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-03-17tdf#147347 sw: hide deleted table at deletion in Hide ChangesLászló Németh1-17/+5
Last deleted row of a table frame was visible in Hide Changes mode, if it is deleted in Hide Changes mode. Fix also missing immediate update of the table layout during deleting only rows in the table. Follow-up to commit a74c51025fa4519caaf461492e4ed8e68bd34885 "tdf#146962 sw: hide deleted row at deletion in Hide Changes" Change-Id: Ic0bf09ac68dd336bd53e84e58f52ebe88ca56238 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131701 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-02-28tdf#146962 sw: hide deleted row at deletion in Hide ChangesLászló Németh1-15/+77
In Hide Changes mode, deleting table rows with change tracking wasn't applied on the table layout immediately, only using Show Changes and Hide Changes again. Now the deleted row removed from the table instead leaving an empty table row (except the last row of a wholly deleted table). See also commit 95213407dfcbf34056037d60243ff915340d1a2e "tdf#146622 sw crash fix: don't delete already deleted rows". Change-Id: I864957cafa38e631a65db0670c7b566cb689f4cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130701 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-02-16tdf#146622 sw crash fix: don't delete already deleted rowsLászló Németh1-7/+5
Delete tables and rows removed also tables and table rows with tracked row deletion/insertion. This resulted not only lost change tracking, but a crashing Undo. Crash regression from commit 99059a1ececa3621c2fe46fabdd79eed9d626c42 "tdf#143359 sw: track deletion of empty table rows". Non-tracked deletion of the tracked row changes was a temporary solution for the missing UI of tracked row changes, implemented in commit 05366b8e6683363688de8708a3d88cf144c7a2bf "tdf#60382 sw offapi: add change tracking of table/row deletion". Note: UI was added in commit f348440e17debacbcba9153e238e010e8c020bdc "tdf#146120 sw: show tracked table changes with different color", commit 95c003d75e0f8b255344715a35358072b5eba99d "tdf#146145 sw: 1-click Accept/Reject of table row changes", commit 84fbb3398f7486f00e7b7dea415e1ea2510a9535 "tdf#146144 sw: add tooltip to table rows with change tracking", commit eebe4747d2d13545004937bb0267ccfc8ab9d63f "tdf#144270 sw: manage tracked table (row) deletion/insertion", commit f481c2c8e74bded11fac754e493560391229dbcd "tdf#144057 sw track changes: hide deleted table rows" and commit 23846867ea32667ccf328c36142394dd6aaee8ba "tdf#147182 sw: accept/reject all changes of a table selection". Change-Id: I384b750b0d3626fa8b3f256c7eaf5b93f382e4e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129958 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2021-10-21introduce SwNodeOffset strong typedefNoel Grandin1-1/+1
for indexing into node children. Replaces various usage of sal_uLong, tools::Long, sal_uInt32 with an underlying type of sal_Int32. Also add a NODE_OFFSET_MAX constant to replace usage of ULONG_MAX Change-Id: I2f466922e1ebc19029bb2883d2b29aa4c0614170 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-24return SwCursor from IShellCursorSupplierNoel Grandin1-1/+1
rather than casting it Change-Id: Ia950f521c8f73d8a0da59344db9b5aacb727aca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122576 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák1-1/+1
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-09-08tdf#143359 sw: track deletion of empty table rowsLászló Németh1-3/+3
Empty table rows were deleted immediately during change tracking, or in the case of a deleted table also with non-empty rows, accepting table deletion kept empty rows. Note: as a workaround for tracking of the empty rows, i.e. rows without text content, add a redline with invisible text ZWJ in the first cell of the empty row. See also commit a483a44ca00f43a64ae51d62b8fbb4129a413f6d "tdf#143215 DOCX import: fix tracked empty row insertion/deletion", commit b50d386dfa70f7c1d4eb1a49091ec9dd782b767b "tdf#142701 track changes: fix layout regression of image deletion" and commit 05366b8e6683363688de8708a3d88cf144c7a2bf "tdf#60382 sw offapi: add change tracking of table/row deletion". Note: switch off unnecessary redlining of tdf#132744 unit test to keep the sake of that test (i.e. cut of the selected table with empty rows). Change-Id: Ief59008e8714fb88afdfce867598e3dda21bfba5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121784 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2021-08-24reduce cost of dynamic casting to SwFlyFrameNoel Grandin1-1/+1
which is often hot on doing document layout Change-Id: Ie78b6a6da4dba38b4ab682f4e1b9d86cc8171918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120938 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-11loplugin:unnecessaryreturn in sw/Noel Grandin1-4/+4
Change-Id: Iaca3f5385fd2c763cd1121ae50624aaa4a1f6165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117029 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-21sw: replace most static_cast<sal_uInt16>() calls with o3tl::narrowing()Miklos Vajna1-4/+4
o3tl::narrowing() is a better way to handle this, as that way the integer conversion is still implicit, which allows detecting integer truncation at runtime (with suitable compiler flags). Change-Id: I499abda3be6943e8c111c56df390e72939586221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115948 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-05-20tdf#60382 sw offapi: add change tracking of table/row deletionLászló Németh1-0/+30
This is a minimal extension of the text range based change tracking to record and apply table row and table deletions with full Undo/Redo support. Add property IsNotTracked to com::sun::star::text::TextTableRow. During recording of track changes, deletion of table rows wasn't recorded: the rows removed completely with their text content. Now the deletion deletes the cell content with change tracking, setting also IsNotTracked property of table rows to FALSE. If all tracked deletions were accepted in a row, and the result is an empty row, the row will be removed, if its IsNotTracked property is FALSE. Note: Deletion of empty lines isn't recorded (they are simply deleted). Hiding deleted rows hasn't been supported yet in the Hide Changes mode. OpenDocument supports only track changes of text ranges, but not changes of the table structure, e.g. deletion of table rows. For the native export it needs to extend ODF, and depending on this future extension, can be based also on SwExtraRedlineTable (which lacks of recording and Undo/Redo, but supports OOXML round-trip of tracked table changes). See also commit d688069023959ab97d14eb1dbfd5bf6ad3c1b160 "Add support for 'Table Row Redlines' in SW core" and its follow-up commits. Change-Id: I2e3807cf8ae8212bd51c210ef1c20c85878d0da8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115804 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
2021-04-09Recheck include/ with IWYUGabor Kelemen1-0/+1
See tdf#42949 for motivation Change-Id: Ifc253bf800bb1468b5774663a93f4fb30bec81d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113657 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-02-04sw: fix copying and deleting of table in section via APIMichael Stahl1-2/+1
This is a follow-up to 7ab349296dac79dad3fec09f60348efcbb9ea17e. The first problem was that tables that contain protected cells refused to be deleted, which caused an infinite loop in SwXTextRange::DeleteAndInsert(). This also affected SwXTextTable::dispose(), and DDE tables. Fix this by forcibly deleting even protected cells from UNO APIs; protection is an UI feature. The second problem was that pasting the table SwFEShell::Paste() would set up aCpyPam so that it selects from the start node of the table to the last text node in the table, excluding the table cell and table end nodes, which caused: DocumentContentOperationsManager.cxx:3548: An insufficient number of nodes were copied! Fix this by setting up aCpyPam over the entire body section of the clipboard document. Change-Id: I8c6caee5e75260dff79f106efc11f9669feddc0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110411 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2020-10-20use tools::Long in swNoel1-12/+12
Change-Id: I44be72b3a9b14823ec37a3c799cffb4fb4d6e1de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-13static_cast after dynamic_castNoel1-3/+2
Change-Id: I68c20dfbedb84660cf25df785e1e0b13a7592994 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-30SwNode::GetDoc can return a reference insteadCaolán McNamara1-1/+1
and remove discovered redundant null checks Change-Id: I6b8bc9593434f38947e399a48888a8fa0d4f7e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103640 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-06-16sw: remove useless SET_CURR_SHELL macroMiklos Vajna1-29/+29
Perhaps it did something useful in the past, but it's better to expand it in its current form. Change-Id: I404e8d274f15a178f519d42a1ecd993c1e530f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96384 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-06-10loplugin:buriedassign in swNoel Grandin1-1/+2
limited this only fixing assignments inside "if" statements, since other things are harder to change Change-Id: If3188a3e3d5fcd94123211c97fee097ece5e2797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95990 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-23pass SvxBrushItem around by unique_ptrNoel Grandin1-8/+8
we never create an object that is actually shared, so this is wasted Note1: in IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) there was a comparison if( aBrush != pRepr->GetBackground() || ... which I removed Note2: In bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill ) which had a condition else if( rToFill != xBack ) I changed to compare contents Change-Id: Idd769f44917c5ccc7e9f4bfbaddf12f9cd4151cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-02-04rename GetCursorOfst -> GetModelPositionForViewPointNoel Grandin1-1/+1
Change-Id: Ia7202e009f635032178e5467a1ac0ab43f82ccf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87953 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins