summaryrefslogtreecommitdiff
path: root/sw/source/filter/html
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-10-20 23:35:52 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2022-11-07 08:32:05 +0100
commitc3549e7857d53af25857ae50ea881cd22737d907 (patch)
tree5fcaff1bd4f124cffab95c7c757106c9dd10d9bb /sw/source/filter/html
parentacf7a851e87ec993ae828ccbf1bfb25448e88423 (diff)
tdf#151605 Don't include hidden text by default in HTML filter
Exclude hidden text from HTML filter (and add an option to change the behavior). Change-Id: I232fda1a283090229b8716532c646bcc6824a7f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141606 Tested-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r--sw/source/filter/html/wrthtml.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 7134d787b8ca..a3b900b6a222 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -83,6 +83,7 @@
#include <unotools/tempfile.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Writer.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
@@ -881,6 +882,7 @@ static Writer& OutHTML_Section( Writer& rWrt, const SwSectionNode& rSectNd )
void SwHTMLWriter::Out_SwDoc( SwPaM* pPam )
{
bool bSaveWriteAll = m_bWriteAll; // save
+ bool bIncludeHidden = officecfg::Office::Writer::FilterFlags::HTML::IncludeHiddenText::get();
// search next text::Bookmark position from text::Bookmark table
m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
@@ -901,14 +903,17 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam )
OSL_ENSURE( !(rNd.IsGrfNode() || rNd.IsOLENode()),
"Unexpected Grf- or OLE-Node here" );
+
if( rNd.IsTextNode() )
{
SwTextNode* pTextNd = rNd.GetTextNode();
+ if (!pTextNd->IsHidden() || bIncludeHidden)
+ {
+ if (!m_bFirstLine)
+ m_pCurrentPam->GetPoint()->Assign(*pTextNd, 0);
- if( !m_bFirstLine )
- m_pCurrentPam->GetPoint()->Assign( *pTextNd, 0 );
-
- OutHTML_SwTextNode( *this, *pTextNd );
+ OutHTML_SwTextNode(*this, *pTextNd);
+ }
}
else if( rNd.IsTableNode() )
{
@@ -917,8 +922,12 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam )
}
else if( rNd.IsSectionNode() )
{
- OutHTML_Section( *this, *rNd.GetSectionNode() );
- m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
+ SwSectionNode* pSectionNode = rNd.GetSectionNode();
+ if (!pSectionNode->GetSection().IsHiddenFlag() || bIncludeHidden)
+ {
+ OutHTML_Section( *this, *pSectionNode );
+ m_nBkmkTabPos = m_bWriteAll ? FindPos_Bkmk( *m_pCurrentPam->GetPoint() ) : -1;
+ }
}
else if( &rNd == &m_pDoc->GetNodes().GetEndOfContent() )
break;