diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2025-01-01 21:55:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2025-01-17 11:38:05 +0100 |
commit | c73958bf812d4c1f0b08354bcd86cec5802c6d4e (patch) | |
tree | ed993e4702656e154c83915bc0dd24fae39f7673 /sw | |
parent | 2761a14646da14cde30988c19cc22ee02a0281fd (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>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180377
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index dcbeefc2a14b..cd5572e44d6a 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> @@ -2278,6 +2279,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 @@ -2291,7 +2293,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() ) |