sw/source/uibase/docvw/FloatingTableButton.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 9a115beac9a13ae320a9abf578be25bfbff1e02d Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jan 2 18:06:37 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Fri Jan 4 04:33:51 2019 +0100 Unfloat: Disable undoing of unfloat operation I tested to use undo events for unfloat operations: moving a table outside of the text frame and removing the text frame, but sometimes it just crashed. So now we handle unfloating similar to the reverse operation (table is moved into a text frame(MakeFlyAndMove). Change-Id: I4eaeda550ccc51252abd4abde6cee45c76a8483e Reviewed-on: https://gerrit.libreoffice.org/65822 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/uibase/docvw/FloatingTableButton.cxx b/sw/source/uibase/docvw/FloatingTableButton.cxx index eccdef644227..949934d5908d 100644 --- a/sw/source/uibase/docvw/FloatingTableButton.cxx +++ b/sw/source/uibase/docvw/FloatingTableButton.cxx @@ -20,6 +20,8 @@ #include <txtfrm.hxx> #include <ndindex.hxx> #include <swtable.hxx> +#include <IDocumentState.hxx> +#include <IDocumentUndoRedo.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/attribute/fontattribute.hxx> @@ -100,12 +102,23 @@ void FloatingTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/) if (pTableNode == nullptr) return; + SwDoc& rDoc = pTextFrame->GetDoc(); + + // Move the table outside of the text frame SwNodeRange aRange(*pTableNode, 0, *pTableNode->EndOfSectionNode(), 1); - pTableNode->getIDocumentContentOperations().MoveNodeRange(aRange, aInsertPos, - SwMoveFlags::DEFAULT); + rDoc.getIDocumentContentOperations().MoveNodeRange(aRange, aInsertPos, SwMoveFlags::DEFAULT); // Remove the floating table's frame SwFrame::DestroyFrame(pFlyFrame); + + rDoc.getIDocumentState().SetModified(); + + // Undoing MoveNodeRange() is not working correctly in case of tables, it crashes some times + // So don't allow to undo after unfloating (similar to MakeFlyAndMove() method) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) + { + rDoc.GetIDocumentUndoRedo().DelAllUndoObj(); + } } void FloatingTableButton::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits