desktop/source/deployment/registry/configuration/dp_configuration.cxx |   36 
------
 include/rtl/xmlencode.hxx                                             |   55 
++++++++++
 include/vcl/pdfwriter.hxx                                             |    2 
 sd/source/filter/html/htmlex.cxx                                      |    5 
 sw/source/filter/html/css1atr.cxx                                     |    3 
 sw/source/filter/html/htmlfldw.cxx                                    |    3 
 sw/source/ui/dialog/uiregionsw.cxx                                    |   13 ++
 vcl/source/gdi/pdfwriter_impl.cxx                                     |   39 
-------
 8 files changed, 81 insertions(+), 75 deletions(-)

New commits:
commit c7fffb9ff3a0d0636d86bf68086d5ae3fd3f8ae6
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Apr 7 19:03:55 2023 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue May 2 10:33:50 2023 +0200

    lok: Hide file linking in section
    
    this is followup for 6f56317
    
    Change-Id: I87227b3e665a6d15378ee294556bcd2f95801e6b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151231
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sw/source/ui/dialog/uiregionsw.cxx 
b/sw/source/ui/dialog/uiregionsw.cxx
index afe90adc6c21..37a7ab66fa9c 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -415,6 +415,19 @@ SwEditRegionDlg::SwEditRegionDlg(weld::Window* pParent, 
SwWrtShell& rWrtSh)
 
     m_xTree->show();
     m_bDontCheckPasswd = false;
+
+    if(comphelper::LibreOfficeKit::isActive())
+    {
+        m_xBuilder->weld_label("label8")->hide(); // Link
+        m_xFileCB->hide();
+        m_xDDECB->hide();
+        m_xDDECommandFT->hide();
+        m_xFileNameFT->hide();
+        m_xFileNameED->hide();
+        m_xFilePB->hide();
+        m_xSubRegionFT->hide();
+        m_xSubRegionED->hide();
+    }
 }
 
 bool SwEditRegionDlg::CheckPasswd(weld::Toggleable* pBox)
commit 69e5b9a7d95a481aae23e651729cceb618abd00c
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Apr 7 09:48:41 2023 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue May 2 10:33:38 2023 +0200

    Make encodeForXml accessible for other modules
    
    and share similar code
    
    Change-Id: I7729a46d40845893f577c273c1ab340f69ebb51b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151230
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git 
a/desktop/source/deployment/registry/configuration/dp_configuration.cxx 
b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 1f4ba053ec55..5baa4127ad26 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -31,6 +31,7 @@
 #include <rtl/string.hxx>
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <rtl/xmlencode.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <ucbhelper/content.hxx>
@@ -566,39 +567,6 @@ BackendImpl::PackageImpl::isRegistered_(
 }
 
 
-OUString encodeForXml( std::u16string_view text )
-{
-    // encode conforming xml:
-    size_t len = text.size();
-    OUStringBuffer buf;
-    for ( size_t pos = 0; pos < len; ++pos )
-    {
-        sal_Unicode c = text[ pos ];
-        switch (c) {
-        case '<':
-            buf.append( "&lt;" );
-            break;
-        case '>':
-            buf.append( "&gt;" );
-            break;
-        case '&':
-            buf.append( "&amp;" );
-            break;
-        case '\'':
-            buf.append( "&apos;" );
-            break;
-        case '\"':
-            buf.append( "&quot;" );
-            break;
-        default:
-            buf.append( c );
-            break;
-        }
-    }
-    return buf.makeStringAndClear();
-}
-
-
 OUString replaceOrigin(
     OUString const & url, std::u16string_view destFolder, Reference< 
XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & 
xContext, bool & out_replaced)
 {
@@ -651,7 +619,7 @@ OUString replaceOrigin(
             if (origin.isEmpty()) {
                 // encode only once
                 origin = OUStringToOString(
-                    encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ),
+                    rtl::encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) 
) ),
                     // xxx todo: encode always for UTF-8? => lookup doc-header?
                     RTL_TEXTENCODING_UTF8 );
             }
diff --git a/include/rtl/xmlencode.hxx b/include/rtl/xmlencode.hxx
new file mode 100644
index 000000000000..487c4ee94749
--- /dev/null
+++ b/include/rtl/xmlencode.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_RTL_XMLENCODE_HXX
+#define INCLUDED_RTL_XMLENCODE_HXX
+
+#include "rtl/ustring.hxx"
+
+namespace rtl
+{
+inline OUString encodeForXml(std::u16string_view rStr)
+{
+    // encode conforming xml:
+    sal_Int32 len = rStr.length();
+    OUStringBuffer buf;
+    for (sal_Int32 pos = 0; pos < len; ++pos)
+    {
+        sal_Unicode c = rStr[pos];
+        switch (c)
+        {
+            case '<':
+                buf.append("&lt;");
+                break;
+            case '>':
+                buf.append("&gt;");
+                break;
+            case '&':
+                buf.append("&amp;");
+                break;
+            case '\'':
+                buf.append("&apos;");
+                break;
+            case '\"':
+                buf.append("&quot;");
+                break;
+            default:
+                buf.append(c);
+                break;
+        }
+    }
+
+    return buf.makeStringAndClear();
+}
+
+} /* Namespace */
+
+#endif // INCLUDED_RTL_XMLENCODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 9ab22190df0b..dd5ab0b5e495 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -1230,8 +1230,6 @@ The following structure describes the permissions used in 
PDF security
     static OString GetDateTime();
 };
 
-VCL_DLLPUBLIC void escapeStringXML( const OUString& rStr, OUString &rValue);
-
 }
 
 #endif // INCLUDED_VCL_PDFWRITER_HXX
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index adeae7080e1b..fe80321e4259 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/ucb/SimpleFileAccess.hpp>
 
+#include <rtl/xmlencode.hxx>
 #include <sal/log.hxx>
 #include <rtl/tencinfo.h>
 #include <comphelper/processfactory.hxx>
@@ -289,10 +290,10 @@ OUString HtmlState::SetLink( const OUString& aLink, const 
OUString& aTarget )
 
     if (!aLink.isEmpty())
     {
-        aStr += "<a href=\"" + aLink;
+        aStr += "<a href=\"" + rtl::encodeForXml(aLink);
         if (!aTarget.isEmpty())
         {
-            aStr += "\" target=\"" + aTarget;
+            aStr += "\" target=\"" + rtl::encodeForXml(aTarget);
         }
         aStr += "\">";
         mbLink = true;
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 28c5cc5dea8f..dc0764a21835 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;
@@ -1076,7 +1077,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 9da104508b8f..64dd86a347dc 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 <o3tl/string_view.hxx>
 #include <fmtfld.hxx>
@@ -513,7 +514,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const 
SfxPoolItem& rHt )
             OString sOut =
                 "<" OOO_STRING_SVTOOLS_HTML_comment
                 " " +
-                OUStringToOString(sComment, RTL_TEXTENCODING_UTF8) +
+                OUStringToOString(rtl::encodeForXml(sComment), 
RTL_TEXTENCODING_UTF8) +
                 " -->";
             rWrt.Strm().WriteOString( sOut );
         }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 3ce03d88f734..bdceb72f6182 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -51,6 +51,7 @@
 #include <rtl/digest.h>
 #include <rtl/uri.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <rtl/xmlencode.hxx>
 #include <sal/log.hxx>
 #include <svl/urihelper.hxx>
 #include <tools/fract.hxx>
@@ -5717,43 +5718,11 @@ sal_Int32 PDFWriterImpl::emitOutputIntent()
     return nOIObject;
 }
 
-// formats the string for the XML stream
-void escapeStringXML(const OUString& rStr, OUString &rValue)
+static void lcl_assignMeta(std::u16string_view aValue, OString& aMeta)
 {
-    const sal_Unicode* pUni = rStr.getStr();
-    int nLen = rStr.getLength();
-    for( ; nLen; nLen--, pUni++ )
+    if (!aValue.empty())
     {
-        switch( *pUni )
-        {
-        case u'&':
-            rValue += "&amp;";
-        break;
-        case u'<':
-            rValue += "&lt;";
-        break;
-        case u'>':
-            rValue += "&gt;";
-        break;
-        case u'\'':
-            rValue += "&apos;";
-        break;
-        case u'"':
-            rValue += "&quot;";
-        break;
-        default:
-            rValue += OUStringChar( *pUni );
-            break;
-        }
-    }
-}
-
-static void lcl_assignMeta(const OUString& aValue, OString& aMeta)
-{
-    if (!aValue.isEmpty())
-    {
-        OUString aTempString;
-        escapeStringXML(aValue, aTempString);
+        OUString aTempString = rtl::encodeForXml(aValue);
         aMeta = OUStringToOString(aTempString, RTL_TEXTENCODING_UTF8);
     }
 }

Reply via email to