[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - xmloff/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Sun Dec 29 12:59:09 UTC 2019
xmloff/source/text/XMLTextMarkImportContext.cxx | 9 +++++++++
1 file changed, 9 insertions(+)
New commits:
commit 2a6bb61bde1e4f387ce5a6da2a1ae09d7c405c11
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Dec 20 18:25:42 2019 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Dec 29 13:58:36 2019 +0100
tdf#129520 xmloff: fix ODF import of multi-paragraph fieldmark
The problem is that inserting PARAGRAPH_BREAK also calls
AppendTextNode() internally, not SplitNode().
(regression from 6eb1c2304d257d16858b7b51cad63f1dc2bde88b)
Change-Id: I2d33819a973c956ea04925458c904ce36ccb55a3
Reviewed-on: https://gerrit.libreoffice.org/85627
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 027a7c8e02c6b023dcf9e26b68c0f339bd4c74c6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85749
Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 9d13c810b240..7a919eb99385 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -31,6 +31,7 @@
#include <xmloff/odffields.hxx>
#include <xmloff/xmlement.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -204,6 +205,12 @@ static auto InsertFieldmark(SvXMLImport & rImport,
// move cursor after setFieldType as that may delete/re-insert
rHelper.GetCursor()->gotoRange(xContent->getAnchor()->getEnd(), false);
rHelper.GetCursor()->goLeft(1, false); // move before CH_TXT_ATR_FIELDEND
+ // tdf#129520: AppendTextNode() ignores the content index!
+ // plan B: insert a spurious paragraph break now and join
+ // it in PopFieldmark()!
+ rHelper.GetText()->insertControlCharacter(rHelper.GetCursor(),
+ text::ControlCharacter::PARAGRAPH_BREAK, false);
+ rHelper.GetCursor()->goLeft(1, false); // back to previous paragraph
}
}
@@ -218,6 +225,8 @@ static auto PopFieldmark(XMLTextImportHelper & rHelper) -> void
{
try
{ // skip CH_TXT_ATR_FIELDEND
+ rHelper.GetCursor()->goRight(1, true);
+ rHelper.GetCursor()->setString(OUString()); // undo AppendTextNode from InsertFieldmark
rHelper.GetCursor()->gotoRange(xField->getAnchor()->getEnd(), false);
}
catch (uno::Exception const&)
More information about the Libreoffice-commits
mailing list