Kaydet (Commit) 9a115bea authored tarafından Tamás Zolnai's avatar Tamás Zolnai

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/65822Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Jenkins
üst dcf70bb4
......@@ -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&)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment