[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 24 07:12:58 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf123460.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 14 +++++++-------
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 20 ++++++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 +++++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 +++-
5 files changed, 47 insertions(+), 8 deletions(-)
New commits:
commit 4f279b95efbc113d3c1907a232a4e647e2b4054f
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Fri Apr 26 17:24:38 2019 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri May 24 09:12:06 2019 +0200
tdf#123460 DOCX track changes: moveFrom completely
also with the paragraph mark, not leaving an empty
paragraph at the original place of the moved text.
Note: as desktop version of MSO does, but its
online version leaves empty paragraphs interestingly.
Change-Id: I03dda8997df3efbc82e936bd31a3813323e6b5ab
Reviewed-on: https://gerrit.libreoffice.org/71382
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit d32d9a2b3c5e3963f4a18f6c7bbf50fab2e9b2be)
Reviewed-on: https://gerrit.libreoffice.org/72718
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
Tested-by: Jenkins
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123460.docx b/sw/qa/extras/ooxmlexport/data/tdf123460.docx
new file mode 100644
index 000000000000..c3b723b4e5ad
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123460.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 23958351a91b..018aa8ccfcb8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -789,13 +789,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf104797, "tdf104797.docx")
CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(1), 2), "IsStart"));
CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence. Will this sentence be duplicated ADDED STUFF?" ),
getParagraph( 2 )->getString());
- CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence." ), getRun( getParagraph( 2 ), 1 )->getString());
- CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 2 )->getString());
- CPPUNIT_ASSERT_EQUAL( OUString( " Will this sentence be duplicated ADDED STUFF?" ), getRun( getParagraph( 2 ), 3 )->getString());
- CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 4 )->getString());
- CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 5), "RedlineType"));
- CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(2), 5), "RedlineType"));
- CPPUNIT_ASSERT_EQUAL(false,getProperty<bool>(getRun(getParagraph(2), 5), "IsStart"));
+ CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 1 )->getString());
+ CPPUNIT_ASSERT_EQUAL( OUString( "This is a filler sentence." ), getRun( getParagraph( 2 ), 2 )->getString());
+ CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 3 )->getString());
+ CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 3), "RedlineType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Insert"),getProperty<OUString>(getRun(getParagraph(2), 3), "RedlineType"));
+ CPPUNIT_ASSERT_EQUAL(true,getProperty<bool>(getRun(getParagraph(2), 3), "IsStart"));
+ CPPUNIT_ASSERT_EQUAL( OUString( " Will this sentence be duplicated ADDED STUFF?" ), getRun( getParagraph( 2 ), 4 )->getString());
}
DECLARE_OOXMLEXPORT_TEST(testTdf113608_runAwayNumbering, "tdf113608_runAwayNumbering.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index e610254b3b83..ca211e0e7eb9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -91,6 +91,26 @@ DECLARE_OOXMLEXPORT_TEST(testTextInput, "textinput.odt")
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:t", "SomeText");
}
+DECLARE_OOXMLIMPORT_TEST(testTdf123460, "tdf123460.docx")
+{
+ // check paragraph mark deletion at terminating moveFrom
+ CPPUNIT_ASSERT_EQUAL(true,getParagraph( 2 )->getString().startsWith("Nunc"));
+ CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 1 )->getString());
+ CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Delete"),getProperty<OUString>(getRun(getParagraph(2), 1), "RedlineType"));
+ CPPUNIT_ASSERT_EQUAL(true, getRun( getParagraph( 2 ), 2 )->getString().endsWith("tellus."));
+ CPPUNIT_ASSERT_EQUAL( OUString( "" ), getRun( getParagraph( 2 ), 3 )->getString());
+ bool bCaught = false;
+ try
+ {
+ getRun( getParagraph( 2 ), 4 );
+ }
+ catch (container::NoSuchElementException&)
+ {
+ bCaught = true;
+ }
+ CPPUNIT_ASSERT_EQUAL(true, bCaught);
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index dcacd18b55f7..4a700758a574 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1690,6 +1690,11 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
}
}
+ // reset moveFrom data of non-terminating runs of the paragraph
+ if ( m_pParaMarkerRedlineMoveFrom.get( ) )
+ {
+ m_pParaMarkerRedlineMoveFrom.clear();
+ }
CheckRedline( xTextRange );
m_bParaChanged = true;
@@ -2062,6 +2067,8 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR
sType = getPropertyName( PROP_INSERT );
break;
case XML_moveFrom:
+ m_pParaMarkerRedlineMoveFrom = pRedline.get();
+ SAL_FALLTHROUGH;
case XML_del:
sType = getPropertyName( PROP_DELETE );
break;
@@ -2100,6 +2107,16 @@ void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange
m_currentRedline.clear();
}
}
+ else if ( m_pParaMarkerRedlineMoveFrom.get( ) )
+ {
+ // terminating moveFrom redline removes also the paragraph mark
+ m_pParaMarkerRedlineMoveFrom->m_nToken = XML_del;
+ CreateRedline( xRange, m_pParaMarkerRedlineMoveFrom );
+ }
+ if ( m_pParaMarkerRedlineMoveFrom.get( ) )
+ {
+ m_pParaMarkerRedlineMoveFrom.clear();
+ }
}
void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > const& xRange )
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6006d2465f13..5d6f634bad10 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -505,6 +505,8 @@ private:
RedlineParamsPtr m_currentRedline;
RedlineParamsPtr m_pParaMarkerRedline;
bool m_bIsParaMarkerChange;
+ // redline data of the terminating run, if it's a moveFrom deletion
+ RedlineParamsPtr m_pParaMarkerRedlineMoveFrom;
/// If the current paragraph has any runs.
bool m_bParaChanged;
@@ -574,7 +576,7 @@ public:
}
void SetDocumentSettingsProperty( const OUString& rPropName, const css::uno::Any& rValue );
- static void CreateRedline(css::uno::Reference<css::text::XTextRange> const& xRange, const RedlineParamsPtr& pRedline);
+ void CreateRedline(css::uno::Reference<css::text::XTextRange> const& xRange, const RedlineParamsPtr& pRedline);
void CheckParaMarkerRedline(css::uno::Reference<css::text::XTextRange> const& xRange);
More information about the Libreoffice-commits
mailing list