From b5e07b1339f73841664b28c65639f1638bd7edf4 Mon Sep 17 00:00:00 2001 From: Oleg Shchelykalnov Date: Wed, 26 May 2021 22:11:49 +0300 Subject: tdf#137469 Implement and test excluding hidden text in text filter Uses filter options to manage whether hidden text output to file. Fixes filter options usage in test. Change-Id: I12a234438730795df6dd11bd6707dfa1fbfa4740 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105631 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/qa/extras/txtencexport/txtencexport.cxx | 2 +- sw/source/filter/ascii/wrtasc.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/qa/extras/txtencexport/txtencexport.cxx b/sw/qa/extras/txtencexport/txtencexport.cxx index ec9fa697e9d1..bce9b81b4564 100644 --- a/sw/qa/extras/txtencexport/txtencexport.cxx +++ b/sw/qa/extras/txtencexport/txtencexport.cxx @@ -86,7 +86,7 @@ DECLARE_TXTENCEXPORT_TEST(testBulletsHidden, "bullets.odt", "UTF8,,,,,false", Tx " 2. Second" SAL_NEWLINE_STRING " 1. Second-first" SAL_NEWLINE_STRING " Third, but deleted" SAL_NEWLINE_STRING " 3. Actual third" SAL_NEWLINE_STRING "" SAL_NEWLINE_STRING "Paragraph after numbering" SAL_NEWLINE_STRING - "Next paragraph" SAL_NEWLINE_STRING "Hidden paragraph" SAL_NEWLINE_STRING + "Next paragraph" SAL_NEWLINE_STRING "Final paragraph" SAL_NEWLINE_STRING, RTL_TEXTENCODING_UTF8); diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index f122e51f6d5c..1bba438e87e8 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -87,6 +87,7 @@ SwASCWriter::~SwASCWriter() {} ErrCode SwASCWriter::WriteStream() { bool bIncludeBOM = GetAsciiOptions().GetIncludeBOM(); + bool bIncludeHidden = GetAsciiOptions().GetIncludeHidden(); if( m_bASCII_ParaAsCR ) // If predefined m_sLineEnd = "\015"; @@ -149,7 +150,7 @@ ErrCode SwASCWriter::WriteStream() continue; // reset while loop! } } - else + else if (!pNd->IsHidden() || bIncludeHidden) { if (bWriteSttTag) { -- cgit