diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-09-05 13:38:04 +0300 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-01 10:42:21 +0200 |
commit | 270604a11022ab4fb9a3ac299d9a42e1d8464c47 (patch) | |
tree | 087968a86aaeaecae135ec8e0c8256aab7b13918 | |
parent | 2f40b190b22213a80aa11021f69619f1b72838be (diff) |
tdf#136441 ms export: don't export comments in footnotes
Microsoft UI does not allow comments in footnotes,
or in headers/footers, or endnotes,
so just throw them away for all MS formats.
This avoids the biggest problem,
which was an error in LO reading the DOCX.
Prior to this bug fix, the status was:
DOCX:
Word 2016 opens it ok, but no comment in footnote.
Word 2003 hangs.
LO loads but has a SAX error the user must ignore,
and no comment seen in the footnote anyway.
DOC:
Word 2016 opens, but misses the main body text,
and of course no comment in footnote.
Word 2003 opens, sees the main body text just fine,
and no comment in footnote.
LO loads, but no comment seen in footnote anyway.
RTF:
Word 2016/2003 open, and no comment in footnote.
LO loads, but no comment seen in footnote anyway.
If the SAX error problem could be fixed, then perhaps
it would be worth allowing LO to export comments
to DOCX for its own benefit. In that case, allow
case SwFieldIds::Postit:
PostitField( pField );
This patch does not fix the problem where the body
text is missing in Word 2016 in DOC format.
Change-Id: I0b7389616a2207d41ae525dbc0b2eea536364d90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102074
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103630
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt | bin | 0 -> 11777 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt Binary files differnew file mode 100644 index 000000000000..61c9632b3972 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index ab204e9c5e67..1950b8349697 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -114,6 +114,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135973, "tdf135973.odt") } } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_commentInFootnote.odt") +{ + // failed to load without error if footnote contained a comment. + // (MS Word's UI doesn't allow adding comments to a footnote.) +} + DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index ec6f63cb222b..4f3b98089658 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2392,7 +2392,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // Append bookmarks in this range after flys, exclusive of final // position of this range AppendBookmarks( rNode, nCurrentPos, nNextAttr - nCurrentPos ); - AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); + //Sadly only possible for word in main document text + if ( m_nTextTyp == TXT_MAINTEXT ) + AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); // At the moment smarttags are only written for paragraphs, at the // beginning of the paragraph. |