summaryrefslogtreecommitdiff
path: root/sw/source/core/undo/undobj1.cxx
AgeCommit message (Collapse)AuthorFilesLines
2020-09-28SwUndoSetFlyFormat: SwClient::Modify no moreBjoern Michaelsen1-13/+10
Change-Id: I366745a410c8b3f1e6198392d899a16c9ac36b9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103034 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-08-20sw: remove misleading initialisation from SwUndoInsLayFormatMichael Stahl1-20/+4
Change-Id: I5577b388b565cdab6dcf60721f0f90d2987dac05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101005 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-19tdf#135412 tdf#135888 sw: fix copying of linked text-boxesMichael Stahl1-0/+1
The resetLink()/restoreLinks() were added in commit 00a007be5ad88bac9905b373bc5e02d02acab11a because testMissingPath missing-path.docx was crashing. But then 0bcc5b3daebeb2a7d2b5ba132af4745cc6c78cd0 refactored how linking works and introduced the isTextBox function, which is called in the middle of DocumentContentOperationsManager::CopyFlyInFlyImpl() after resetLink(), and this now always returns false, the same for another call inside CopyLayoutFormat() (when called from CopyFlyInFlyImpl()), which causes text-boxes to be copied to 2 separate flys (tdf#135888). The problem in tdf#135412 is that somehow when called from SwFEShell::Paste() the content-index from the clipboard document ends up in the SwDrawFrameFormat that is created in the target document, and this causes crash in Undo because the node index is out of bounds. 10 SwUndoInsLayFormat::UndoImpl (this=0x7c2a760, rContext=...) at sw/source/core/undo/undobj1.cxx:310 (rr) p rContent.GetContentIdx()->GetNode().GetDoc()->IsClipBoard() (rr) $29 = true It turns out that missing-path.docx doesn't crash any more without resetLink(), and removing it fixes the 2 bugs. Change-Id: I0c6c91a42e00b9f3b79b774c814e7323f2bb3e05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101004 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-08-18tdf#135016 DOCX export: fix unexpected error on save with undo/redoMiklos Vajna1-0/+13
Regression from commit d379d18666aa42031359ca8eb34b0021960347ae (oox: import WPS shape with text as shape with textbox, 2014-06-18), then problem was that when undo restored text deleted by cut, we ended up with an SwXShape that had no frame format. Fix the problem by deleting the cached old UNO wrapper after changing the association between a textbox's shape and text frame. An alternative would be to handle errors better when the TextBox UNO property is not of type bool, but that would still lead to silent data loss, so don't fix the problem that way. Change-Id: Id45ad292befc746e7c49a3b827c91efd069d29df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100876 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-31loplugin:flatten in sw/core/undoNoel Grandin1-78/+78
Change-Id: I34662fd439578fc6f446c5216c5c1b735b79718d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99860 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-23sw doc model xml dump: improve undo-redo coverage:Miklos Vajna1-0/+24
- show the undo manager's node array - show SwUndoDelete - show SwUndoSaveContent - show SwHistory - show SwHistoryHint - show SwHistoryTextFlyCnt - show SwUndoFlyBase - show SwHistorySetFormat - show SwUndoInserts When an action + undo pair goes wrong, it's easier to see the state of the undo stack after the action this way, then decide if the undo stack is already bad, or the problem is with the undo implementation. Change-Id: Ic509a233dce3c47db9697982eb7ea423f4706129 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96930 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2020-03-02speedup sw build a littleNoel Grandin1-0/+1
from 11m46 to 11m21 Used ClangBuildAnalyzer to find headers that took a long time to parse (in total, across all modules). (*) moved the boost stuff out of sw/inc/docary into a new header. (*) make sw/inc/ndtxt no longer include doc.hxx Change-Id: Ia1d4ebddb4ddd4ec4ffbc011f4a5e24a42b46d3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89808 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-06tdf#42949 Fix IWYU warnings in sw/source/core/[u-v]*/*cxxGabor Kelemen1-3/+0
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I86602514130061e47943c490005e6bbf3460b1b0 Reviewed-on: https://gerrit.libreoffice.org/84585 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-10-01Avoid redundant IsAtEnd: NextItem returns nullptr iif iterator is at endMike Kaganski1-11/+2
To keep the check efficient, split NextItem to inline and Impl parts Change-Id: Id5877a3c5bed73aac9c39c655b106a715cf888ea Reviewed-on: https://gerrit.libreoffice.org/79894 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-09-28loplugin:constmethod in swNoel Grandin1-1/+1
Change-Id: I73c3c6d2165287d2d581a04b23b1d3b48166a488 Reviewed-on: https://gerrit.libreoffice.org/79780 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-28sw: prefix members of SwUndoFlyBaseMiklos Vajna1-77/+77
See tdf#94879 for motivation. Change-Id: I266ba820629ec6f8505d091fb6090ed8626b4742 Reviewed-on: https://gerrit.libreoffice.org/78211 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-08-21sw: prefix members of SwUndoDelLayFormatMiklos Vajna1-2/+2
See tdf#94879 for motivation. Change-Id: I16fe75a5a7fd586e021cd5d49676031b97838165 Reviewed-on: https://gerrit.libreoffice.org/77867 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-08-01tdf#126168: sw undo/redo crash fixedVasily Melenchuk1-10/+11
After undo of style creation we have a dangling pointers to deleted style in SwUndoSetFlyFormat. So instead of keeping pointers to SwFrameFormat which can be invalidated, we could keep style name and find style by name. Change-Id: I9a60d6b3311278d7391d676010c31c862189fd08 Reviewed-on: https://gerrit.libreoffice.org/76351 Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> Tested-by: Jenkins
2019-05-14tdf#42949 Fix IWYU warnings in sw/source/core/inc/[t-w]*Gabor Kelemen1-0/+1
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I7cd9837360e244741bfa22b4693fd221241daf12 Reviewed-on: https://gerrit.libreoffice.org/71833 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-25sw: prefix members of SwUndoSetFlyFormatMiklos Vajna1-49/+49
Change-Id: I64701255f3c0d0eb05e9962819deaef9aa8127c3 Reviewed-on: https://gerrit.libreoffice.org/69644 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2018-12-08Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann1-2/+2
...after 7ffdd830d5fb52f2ca25aa80277d22ea6d89970b "HAVE_CPP_ATTRIBUTE_FALLTHROUGH is always true now" Change-Id: I54e5ff4e036a6bb3e5774d1c0524158aae18e937 Reviewed-on: https://gerrit.libreoffice.org/64800 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-16loplugin:buriedassign in swNoel Grandin1-2/+4
Change-Id: If2adf22a0ac3e030fca1b4ecd0173cac58f0f21e Reviewed-on: https://gerrit.libreoffice.org/63470 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-26use boost::optional in swNoel Grandin1-1/+1
instead of std::unique_ptr, where we end up needlessly putting small objects separately on the heap Change-Id: I107421e7530c9580869b7a0f088ea7b0514bcf36 Reviewed-on: https://gerrit.libreoffice.org/51863 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25introduce SwClient::EndListeningAll()Bjoern Michaelsen1-5/+0
- this is to reduce the use of GetRegisterdIn(), which should be an implementation detail - remove SwTOXMark::DeRegister() which did the same for a part of the class tree - remove SwUndoSetFlyFormat::DeRegisterFromFormat(), same - remove doubletracking FrameDeleteWatch::m_bDeleted, just check GetRegisteredIn() Change-Id: Id9364076759446ee5ff1898683c3ca700c1014c9 Reviewed-on: https://gerrit.libreoffice.org/48548 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2018-01-12More loplugin:cstylecast: swStephan Bergmann1-1/+1
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I0f49d21dfdf82742f11b27709f74294feb1e419e
2017-09-13Enable -Wunreachable-codeStephan Bergmann1-1/+1
...motivated by <https://gerrit.libreoffice.org/#/c/41565/2> adding dead code at the end of a switch statement, after the last case's "break". -Wunreachable-code appears to work well on Clang, while it appears to have no effect on GCC. Most of the affected places are apparently temporary/TODO/FIXME cases of disabling code via "if (false)", which can be written with an extra set of parentheses as "if ((false))" to silence -Wunreachable-code on Clang (which thus needed loplugin:unnecessaryparen to be adapted accordingly). In some cases, the controlling expression was more complex than just "false" and needed to be rewritten by taking it out of the if statement to silence Clang. One noteworthy case where the nature of the disabled code wasn't immediately apparent: Sep 12 16:59:58 <sberg> quikee, is that "if (false)" in ScExponentialSmoothingDialog::ApplyOutput (sc/source/ui/StatisticsDialogs/ExponentialSmoothingDialog.cxx) some work-in- progress or dead code? Sep 12 17:02:03 <quikee> sberg: WIP, but you can remove it Sep 12 17:04:47 <sberg> quikee, I'll wrap the false in an extra set of parentheses for now, to silence -Wunreachable-code (I wouldn't want to remove it, as I have no idea whether I should then also remove the "Initial value" comment preceding it) Sep 12 17:07:29 <quikee> sberg: both are different ways to calculate the "intital value"... so no Another case where the nature of the dead code, following while (true) loops without breaks, is unclear is sd/source/ui/remotecontrol/BluetoothServer.cxx, where I added TODO markers to the workarounds that silence the warnings for now. basic/source/sbx/sbxvalue.cxx had a variable of type double, of automatic storage duration, and without an initalizer at the top of a switch statement. Clang warning about it is arguably a false positive. Apart from that, this didn't find any cases of genuinely dead code in the existing code base. Change-Id: Ib00b822c8efec94278c048783d5997b8ba86a94c Reviewed-on: https://gerrit.libreoffice.org/42217 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-08-04loplugin:constparams in sw part5Noel Grandin1-1/+1
Change-Id: I6c33709aa407ccb3eee7026ab9b40dc4257de209 Reviewed-on: https://gerrit.libreoffice.org/40769 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-21tdf#108867 sw: fix dangling text box frame format pointers in UndoMichael Stahl1-0/+18
If the text box is removed, the SwFrameFormat of the drawing shape still retains a pointer to the frame SwFrameFormat, and the latter is owned by the SwUndoFlyBase. This is pretty bad, so try to clear & reset the connection between them in SwUndoFlyBase::InsFly() and DelFly(). Hopefully nothing will actually delete the drawing shape SwFrameFormat while the Undo object is alive. Note that when the SwUndoInsLayFormat is created when the text box is added, the GetOtherTextBoxFormat() returns null as it's set later, that's why the constructor can't do anything. Change-Id: Iae562b6f8f272e47b2b5cf8ee80778db15d29ce0
2017-07-02loplugin:casttovoid: swStephan Bergmann1-2/+1
Change-Id: I224e9995962901e8740bfaed06d57f7c0389236c
2017-05-12coverity#1406101 Dereference null return valueCaolán McNamara1-2/+3
and coverity#1406100 Dereference null return value coverity#1406099 Dereference null return value coverity#1406098 Dereference null return value coverity#1406097 Dereference null return value Change-Id: I26d5c0f2e69dc049a87a607ca28586dc575a8ca3
2017-05-10tdf#107512 sw: fix rollback of text attributes in SwUndoDeleteMichael Stahl1-1/+1
The problem is that in SwUndoDelete::UndoImpl(), first the formatting attributes are restored via TmpRollback(), and then all footnote/fly attributes are restored via Rollback(). This means that the SwHistory doesn't actually store the original positions of the formatting hints; ideally there wouldn't be 2 separate steps here, but that appears difficult to change now given the plethora of calls to DelContentIndex() ... So work around the problem by adding a new SetAttrMode::NOHINTEXPAND to prevent expanding the existing hints when the CH_TXTATR_BREAKWORD are inserted from SwUndoDelLayFormat. This fixes 2 problematic cases: at the start of the paragraph, and if the hint ends at the position before the CH_TXTATR_BREAKWORD. Let's hope this won't break anything anybody cares about. Change-Id: I557c4c9136f4225ca502019730fb9f0a9c03d23b
2017-05-03tdf#88555 sw: remove dynamic_cast from SwFrameFormats::ContainsMichael Stahl1-2/+2
This is a bad idea as the function is sometimes used to check if a SwFrameFormat has been deleted, which can happen in Undo, and for SwCallMouseEvent before commit 32403675bf9d2d0380956f9a82da71593edbb53c Replace with ContainsFormat() and IsAlive(), and don't require a non-const SwFrameFormat parameter. Change-Id: I87ede94dfbfe7f6985f13faab4c156015c3a5fc0
2017-04-10tdf#39468 Translate German comments in swJens Carl1-2/+2
Translate German comments and terms in sw/inc/ and sw/source Change-Id: I1330a358db2c6cdc0512009befeafa0582ac4877 Reviewed-on: https://gerrit.libreoffice.org/36288 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2017-03-22loplugin:redundantcast find redundant c-style enum castsNoel Grandin1-3/+3
Change-Id: I2dab376d87804521aed6b6bd41ad7762830fa349 Reviewed-on: https://gerrit.libreoffice.org/35467 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-20convert RndStdIds to scoped enumNoel Grandin1-43/+44
Change-Id: I029ad67dfcbc40f3953adf485957efcbd97f23d0 Reviewed-on: https://gerrit.libreoffice.org/35328 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-03-16convert SwUndoId to scoped enumNoel Grandin1-6/+6
Change-Id: I782fdd53641c0d7c629265b6179de70aa54382f9 Reviewed-on: https://gerrit.libreoffice.org/35246 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-23Revert "used std::map in SfxItemSet"Noel Grandin1-1/+2
This reverts commit 2757ee9fe610e253e4ccc37423fa420004d0f388. Besides causing a performance regression, I now notice that there is code in SW that relies on iterating over two different SfxItemSet's in parallel, and assumes that missing items are returned as nullptr, which is not the case for my std::map based change. Change-Id: I2b1110350fe4c4b74e5508558e9661ef1e1a103e
2017-01-18new loplugin: useuniqueptr: sw part 2Noel Grandin1-1/+0
Change-Id: Ifa901f75072d8474d8a97ca57c2b5b48d8c6b79d Reviewed-on: https://gerrit.libreoffice.org/33250 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-17used std::map in SfxItemSetNoel Grandin1-2/+1
instead of naked array SfxItemIter ended up needing to take copies of stuff because various code likes to iterate over the items and delete items inside the loop. The gdb pretty printer is no longer quite as pretty as it was before, but it still prints useful info. Change-Id: I59b07ea42f6b1c74798a15402970b9dbd8233dbe
2016-12-04use proper message passingBjoern Michaelsen1-8/+1
Change-Id: I1ee686ff96615f7b8aa69c0cd4caafaae07318b7 Reviewed-on: https://gerrit.libreoffice.org/31493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2016-12-04use proper message passingBjoern Michaelsen1-11/+1
Change-Id: I0c6610308f75a57e517b233db66c66b34eb25189 Reviewed-on: https://gerrit.libreoffice.org/31492 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2016-08-29Convert SwFrameFormats to boost::multi_indexJan-Marek Glogowski1-1/+1
This is almost the same situation as SwPageDescs. What makes this more complicated is the fact, that actually duplicated draw objects are allowed, in regard to the key values "type" and "name". And actually for some types, duplicate names are not allowed, e.g. SwDoc::FindFlyByName( const OUString& rName, sal_Int8 nNdTyp ) expects a single result! Change-Id: I6e0ea1099c1c1e6cfe90926170e27179722e88b8
2016-07-29sw undo: implement SfxUndoAction::GetViewShellId() interfaceMiklos Vajna1-2/+2
With this, it's possible to tell which view shell created which undo actions. It's visible only in the doc model xml dump only, though. Change-Id: Ia76d218a1d8b578aaad00ab733c772b10dda39f0 Reviewed-on: https://gerrit.libreoffice.org/27693 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-05-10Replace fallthrough comments with new SAL_FALLTHROUGH macroStephan Bergmann1-2/+2
...which (in LIBO_INTERNAL_ONLY) for Clang expands to [[clang::fallthrough]] in preparation of enabling -Wimplicit-fallthrough. (This is only relevant for C++11, as neither C nor old C++ has a way to annotate intended fallthroughs.) Could use BOOST_FALLTHROUGH instead of introducing our own SAL_FALLTHROUGH, but that would require adding back in dependencies on boost_headers to many libraries where we carefully removed any remaining Boost dependencies only recently. (At least make SAL_FALLTHROUGH strictly LIBO_INTERNAL_ONLY, so its future evolution will not have any impact on the stable URE interface.) C++17 will have a proper [[fallthroug]], eventually removing the need for a macro altogether. Change-Id: I342a7610a107db7d7a344ea9cbddfd9714d7e9ca
2016-04-18cppcheck: silence known condition warning in sw undobjJochen Nitschke1-1/+1
Change-Id: Iedbb6bbdcdccf4ea44a7ad4d2e11ce630431034f Reviewed-on: https://gerrit.libreoffice.org/24210 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2015-11-25bin/rename-sw-abbreviations.shlibreoffice-5-1-branch-pointRobinson Tryon1-13/+13
This commit renames the most annoying abbreviations in Writer (and partially in the shared code too). Change-Id: I77e5134f42f25e3786afa36b7a505c7e3237a9e8
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann1-6/+6
Change-Id: I01e11fa956a249974e77dce9deebe79311f098d0
2015-10-20loplugin:defaultparamsStephan Bergmann1-1/+1
Change-Id: I11ff551955c1ac291ab576f2f18c2dd410427eda
2015-10-01remove old standalone Sun bug numbersNoel Grandin1-1/+0
Sun bug numbers without any accompanying text are completely useless. Fixed with git grep -lP '//\s*#\d+#\s*$' | xargs perl -i -ne'/\/\/\s*#\d+#\s*$/d or print' And then hand-checking the result to restore places where it deleted code. And then some more grepping and hand-editing to kill the others. Change-Id: Ia96ce4466db8bb8da363ebf41f0ae7f45f28bf29 Reviewed-on: https://gerrit.libreoffice.org/19023 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-06-08loplugin:cstylecast: deal with remaining pointer castsStephan Bergmann1-1/+1
Change-Id: I8d27ae80d209159690182ab91e272cf00e9f863d
2015-05-20bin/rename-sw-abbreviations.shlibreoffice-5-0-branch-pointChristian Lohmaier1-159/+159
renames the most annoying abbreviations in Writer (and partially in the shared code too). Change-Id: I9a62759138126c1537cc5c985ba05cf54d6132d9
2015-05-11loplugin:cstylecast: nop between pointer types of exactly same spellingStephan Bergmann1-2/+2
Change-Id: I0e42e757a6f7b0c28758193aad8b3cb01607b8b1
2015-05-05loplugin:staticmethodsNoel Grandin1-2/+2
Change-Id: I90dd921077bbfc57200e398e7959306f26c65cfe
2015-05-03tdf#89783: Adjust to new GetPos retval (size_t vs. sal_uInt16)Katarina Behrens1-2/+2
Some of the usages of GetPos were just misusing it to find out whether a vector contains given element -- use Contains() in those cases This patch is partially based on work of Christoph Lutz Conflicts: sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtw8num.cxx Change-Id: I40bedba905e7577ba23f69acee178e0ea7cc1521
2015-03-26const_cast: convert some C-style casts and remove some redundant onesStephan Bergmann1-1/+1
Change-Id: Icb14a036ea9d7636359b6bc5e0af17568c0d54cb