summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sax/fastparser.hxx3
-rw-r--r--include/xmloff/xmlimp.hxx3
-rw-r--r--offapi/com/sun/star/xml/sax/XFastParser.idl4
-rw-r--r--sax/source/fastparser/fastparser.cxx23
-rw-r--r--starmath/source/mathmlimport.cxx6
-rw-r--r--starmath/source/xparsmlbase.cxx14
-rw-r--r--starmath/source/xparsmlbase.hxx11
-rw-r--r--xmloff/source/core/xmlimp.cxx5
8 files changed, 35 insertions, 34 deletions
diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index 5af3ac1d1f57..aebaa4056aa0 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -64,8 +64,7 @@ public:
virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override;
virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
- virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names,
- const ::css::uno::Sequence< ::rtl::OUString >& replacements ) override;
+ virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 9c402f199ffa..494de3cbcd26 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -335,8 +335,7 @@ public:
virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override;
virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
- virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names,
- const ::css::uno::Sequence< ::rtl::OUString >& replacements ) override;
+ virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
// XImporter
virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
diff --git a/offapi/com/sun/star/xml/sax/XFastParser.idl b/offapi/com/sun/star/xml/sax/XFastParser.idl
index 9beefe4aa4d6..9d4439144b27 100644
--- a/offapi/com/sun/star/xml/sax/XFastParser.idl
+++ b/offapi/com/sun/star/xml/sax/XFastParser.idl
@@ -41,6 +41,8 @@
#include <com/sum/star/xml/sax/XFastNamespaceHandler.idl>
+#include <com/sun/star/beans/Pair.idl>
+
module com { module sun { module star { module xml { module sax {
@@ -163,7 +165,7 @@ interface XFastParser: com::sun::star::uno::XInterface
* Will allow to use customized entity references like &infin; .
* @since LibreOffice 7.1
*/
- void setCustomEntityNames( [in] sequence<string> names, [in] sequence<string> replacements);
+ void setCustomEntityNames( [in] sequence< beans::Pair<string,string> > replacements);
};
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 85726599b41c..9d13d25ce385 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -250,7 +250,8 @@ public:
/// @throws css::uno::RuntimeException
void setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler);
// Fake DTD file
- void setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names, const ::css::uno::Sequence< ::rtl::OUString >& replacements );
+ void setCustomEntityNames(
+ const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString>>& replacements);
// called by the C callbacks of the expat parser
void callbackStartElement( const xmlChar *localName , const xmlChar* prefix, const xmlChar* URI,
@@ -952,16 +953,15 @@ void FastSaxParserImpl::setNamespaceHandler( const Reference< XFastNamespaceHand
}
void FastSaxParserImpl::setCustomEntityNames(
- const ::css::uno::Sequence<::rtl::OUString>& names,
- const ::css::uno::Sequence<::rtl::OUString>& replacements)
+ const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString>>& replacements)
{
- m_Replacements.resize(names.size());
- for (size_t i = 0; i < names.size(); ++i)
+ m_Replacements.resize(replacements.size());
+ for (size_t i = 0; i < replacements.size(); ++i)
{
- m_Replacements[i].name = names[i];
- m_Replacements[i].replacement = replacements[i];
+ m_Replacements[i].name = replacements[i].First;
+ m_Replacements[i].replacement = replacements[i].Second;
}
- if (names.size() > 1)
+ if (m_Replacements.size() > 1)
std::sort(m_Replacements.begin(), m_Replacements.end());
}
@@ -1521,11 +1521,10 @@ OUString FastSaxParser::getImplementationName()
return "com.sun.star.comp.extensions.xml.sax.FastParser";
}
-void FastSaxParser::setCustomEntityNames(const ::css::uno::Sequence<::rtl::OUString>& names,
- const ::css::uno::Sequence<::rtl::OUString>& replacements)
+void FastSaxParser::setCustomEntityNames(
+ const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString>>& replacements)
{
- assert(names.size() == replacements.size());
- mpImpl->setCustomEntityNames(names, replacements);
+ mpImpl->setCustomEntityNames(replacements);
}
sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 04c4bc6b8837..fd27d226a948 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -270,16 +270,14 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(const Reference<io::XInputStrea
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilter, UNO_QUERY);
if (xFastParser)
{
- xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntitiesNames,
- starmathdatabase::icustomMathmlHtmlEntitiesValues);
+ xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
xFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
Reference<css::xml::sax::XFastParser> xParser
= css::xml::sax::FastParser::create(rxContext);
- xParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntitiesNames,
- starmathdatabase::icustomMathmlHtmlEntitiesValues);
+ xParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
xParser->setFastDocumentHandler(xFastDocHandler);
xParser->parseStream(aParserInput);
}
diff --git a/starmath/source/xparsmlbase.cxx b/starmath/source/xparsmlbase.cxx
index b8bb6c7fc329..b699e7935fbe 100644
--- a/starmath/source/xparsmlbase.cxx
+++ b/starmath/source/xparsmlbase.cxx
@@ -18,6 +18,7 @@
*/
#include "xparsmlbase.hxx"
+/*
static OUString icustomMathmlHtmlEntitiesNamesData[2125] = {
// clang-format off
u"AElig",
@@ -4277,11 +4278,16 @@ static OUString icustomMathmlHtmlEntitiesValuesData[2125] = {
u"\u200C"
// clang-format on
};
+*/
-const ::css::uno::Sequence<::rtl::OUString>
- starmathdatabase::icustomMathmlHtmlEntitiesNames(icustomMathmlHtmlEntitiesNamesData, 2125);
+static ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> icustomMathmlHtmlEntitiesData[2] = {
+ // clang-format off
+ { u"infin", u"\u221E" },
+ { u"sigma", u"\u03C3" }
+ // clang-format on
+};
-const ::css::uno::Sequence<::rtl::OUString>
- starmathdatabase::icustomMathmlHtmlEntitiesValues(icustomMathmlHtmlEntitiesValuesData, 2125);
+const ::css::uno::Sequence<::css::beans::Pair<OUString, OUString>>
+ starmathdatabase::icustomMathmlHtmlEntities(icustomMathmlHtmlEntitiesData, 2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/xparsmlbase.hxx b/starmath/source/xparsmlbase.hxx
index f9b58de7ca89..6603d23293db 100644
--- a/starmath/source/xparsmlbase.hxx
+++ b/starmath/source/xparsmlbase.hxx
@@ -21,6 +21,7 @@
#define XPARSEMLBASE
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/Pair.hpp>
namespace starmathdatabase
{
/**
@@ -32,16 +33,14 @@ namespace starmathdatabase
* On export only mathml entities are allowed.
* Some documentation: https://www.w3.org/TR/MathML3/chapter7.html
*/
+
/**
* Entity names for mathml. Example: &infin;
+ * These ones are to be used on import.
* Must be in sync with customMathmlHtmlEntitiesNames.
*/
-const extern ::css::uno::Sequence<::rtl::OUString> icustomMathmlHtmlEntitiesNames;
-/**
- * Entity values for mathml. Example: &infin; -> "\u8734";
- * Must be in sync with customMathmlHtmlEntitiesNames.
- */
-const extern ::css::uno::Sequence<::rtl::OUString> icustomMathmlHtmlEntitiesValues;
+const extern ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString>>
+ icustomMathmlHtmlEntities;
};
#endif /*XPARSEMLBASE*/
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 5f1e7ec1b20a..9d3b1115f57e 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -544,10 +544,9 @@ void SAL_CALL SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::
mxParser->setNamespaceHandler( Handler );
}
-void SAL_CALL SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::rtl::OUString >& names,
- const ::css::uno::Sequence< ::rtl::OUString >& replacements )
+void SAL_CALL SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
{
- mxParser->setCustomEntityNames( names, replacements );
+ mxParser->setCustomEntityNames( replacements );
}
void SAL_CALL SvXMLImport::startDocument()