summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2025-01-01 21:55:00 +0000
committerMiklos Vajna <vmiklos@collabora.com>2025-01-03 08:22:32 +0100
commitee1b0982834976638697e47a35b4999e6df9a028 (patch)
tree442d14641222d976427d3bea7f4e05748724f8be /sw/source/uibase
parentc0c0433d469021ca55d832fb9e85407f3f6705a5 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx5
1 files changed, 5 insertions, 0 deletions
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 <tools/bigint.hxx>
#include <svtools/insdlg.hxx>
#include <sfx2/ipclient.hxx>
+#include <editeng/editeng.hxx>
#include <editeng/editobj.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/svxacorr.hxx>
@@ -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() )