summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-04-07 09:48:41 +0200
committerAndras Timar <andras.timar@collabora.com>2023-04-23 16:29:23 +0200
commit4cb0100ae7ad6850276b96ca9d6a4f6074db1d2f (patch)
tree7b9d09b9eae4fc25086aa928ee26b4f6cced810b /sw
parent011cbde454e653f9207058b972691a9b43d61127 (diff)
Make encodeForXml accessible for other modules
and share similar code Change-Id: I7729a46d40845893f577c273c1ab340f69ebb51b
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/css1atr.cxx3
-rw-r--r--sw/source/filter/html/htmlfldw.cxx3
2 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index f3d9a22c5140..44833c00e6a7 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -94,6 +94,7 @@
#include <o3tl/unit_conversion.hxx>
#include <rtl/strbuf.hxx>
+#include <rtl/xmlencode.hxx>
#include <osl/diagnose.h>
using namespace css;
@@ -1075,7 +1076,7 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
while( nStrPos != -1 )
{
OUString aName = rName.getToken( 0, ';', nStrPos );
- aName = comphelper::string::strip(aName, ' ');
+ aName = rtl::encodeForXml(comphelper::string::strip(aName, ' '));
if( aName.isEmpty() )
continue;
diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx
index dbe4fe8d9092..fa069112a13d 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -21,6 +21,7 @@
#include <comphelper/string.hxx>
#include <svtools/htmlkywd.hxx>
#include <svtools/htmlout.hxx>
+#include <rtl/xmlencode.hxx>
#include <osl/diagnose.h>
#include <fmtfld.hxx>
#include <doc.hxx>
@@ -510,7 +511,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt )
OString sOut =
"<" OOO_STRING_SVTOOLS_HTML_comment
" " +
- OUStringToOString(sComment, static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) +
+ OUStringToOString(rtl::encodeForXml(sComment), static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) +
" -->";
rWrt.Strm().WriteOString( sOut );
}