summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/del-then-format.docxbin0 -> 14457 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport22.cxx14
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx32
3 files changed, 45 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/del-then-format.docx b/sw/qa/extras/ooxmlexport/data/del-then-format.docx
new file mode 100644
index 000000000000..866201f7fb18
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/del-then-format.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
index 2d77c7155ed5..01f0220cd676 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
@@ -199,6 +199,20 @@ CPPUNIT_TEST_FIXTURE(Test, testBadFormulaResult)
assertXPathContent(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[4]/w:tc/w:p/w:r[4]/w:t", u"6");
}
+CPPUNIT_TEST_FIXTURE(Test, testDelThenFormatDocxExport)
+{
+ // Given a document with <del>A<format>B</format>C</del> style redlines:
+ // When exporting that document:
+ loadAndSave("del-then-format.docx");
+
+ // Then make sure delete "under" format uses the <w:delText> markup:
+ // Without the accompanying fix in place, this test would have failed with:
+ // - In <>, XPath '/w:document/w:body/w:p/w:del[2]/w:r/w:delText' not found
+ // i.e. <w:t> was used, not <w:delText>.
+ xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:del[2]/w:r/w:delText", u"BBB");
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf139418, "tdf139418.docx")
{
uno::Reference<beans::XPropertySet> xPropertySet(
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3498494aac8a..702f2d7f8b26 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3852,6 +3852,36 @@ static bool impl_WriteRunText( FSHelperPtr const & pSerializer, sal_Int32 nTextT
return true;
}
+namespace
+{
+/// Decides if pRedlineData is a delete or is something on a delete.
+RedlineType GetRedlineTypeForTextToken(const SwRedlineData* pRedlineData)
+{
+ if (!pRedlineData)
+ {
+ return RedlineType::None;
+ }
+
+ if (pRedlineData->GetType() == RedlineType::Delete)
+ {
+ return RedlineType::Delete;
+ }
+
+ const SwRedlineData* pNext = pRedlineData->Next();
+ if (!pNext)
+ {
+ return RedlineType::None;
+ }
+
+ if (pNext->GetType() == RedlineType::Delete)
+ {
+ return RedlineType::Delete;
+ }
+
+ return RedlineType::None;
+}
+}
+
void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCharSet*/, const OUString& rSymbolFont )
{
if( m_closeHyperlinkInThisRun )
@@ -3888,7 +3918,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh
// tdf#150166 save tracked moving around TOC as w:ins, w:del
SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr;
- if ( m_pRedlineData && m_pRedlineData->GetType() == RedlineType::Delete && !bMoved )
+ if (GetRedlineTypeForTextToken(m_pRedlineData) == RedlineType::Delete && !bMoved)
{
nTextToken = XML_delText;
}