From ee1b0982834976638697e47a35b4999e6df9a028 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 Jan 2025 21:55:00 +0000 Subject: undo/redo of comment insertion assumes Par2 content matches TextObject contents (as much as conversion to plain text makes possible) To make things easier, add an EditTextObject::GetText() like EditEngine::GetText() that serializes multiple paragraphs in an equivalent way so there isn't a need to create an editengine just to do this conversion. Modify and extend DesktopLOKTest::testCommentsCallbacksWriter to use a html payload and add a undo/redo to it. Change-Id: I4d895138e919bab54ebbbcb966f9b9faef574086 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179594 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna --- sw/source/uibase/wrtsh/wrtsh1.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sw/source/uibase') diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 7b1d9236c099..4e3dd61bbd5b 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -2267,6 +2268,7 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq) Outliner aOutliner(&pDocSh->GetPool(), OutlinerMode::TextObject); SwPostItHelper::ImportHTML(aOutliner, pHtmlItem->GetValue()); oTextPara = aOutliner.CreateParaObject(); + sText = aOutliner.GetEditEngine().GetText(); } // If we have a text already registered for answer, use that @@ -2280,7 +2282,10 @@ void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq) } const EditTextObject& rTextObject = pAnswer->GetTextObject(); if (rTextObject.GetParagraphCount() != 1 || !rTextObject.GetText(0).isEmpty()) + { oTextPara = *pAnswer; + sText = rTextObject.GetText(); + } } if ( HasSelection() && !IsTableMode() ) -- cgit