summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-05-29 20:24:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-01 11:59:06 +0200
commit5e68d6cfade45f40b1ad46025a81afe4cb8dd337 (patch)
treeaf7740f3636e6b303371c764bfe7ff083e847879 /include
parentf15a6e1b1b186bf42e1ade05630d17841add2c46 (diff)
Convert XFastParser into a normal C++ interface
There is no need for it to be an UNO interface anymore (ever since we started supporting dynamic_cast on UNO objects). Which means that XImportFilter2 also needs become a C++ interface. Change-Id: Ice2db0f098271bba32b199bd083b08cb8410ce93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152388 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/IwyuFilter_include.yaml2
-rw-r--r--include/sax/fastparser.hxx29
-rw-r--r--include/sax/xfastparser.hxx69
-rw-r--r--include/sax/ximportfilter2.hxx43
-rw-r--r--include/xmloff/xmlimp.hxx31
5 files changed, 142 insertions, 32 deletions
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index 7a225d3b9488..c6b3e170645c 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -285,7 +285,6 @@ excludelist:
# base class has to be a complete type
- com/sun/star/lang/XInitialization.hpp
- com/sun/star/lang/XServiceInfo.hpp
- - com/sun/star/xml/sax/XFastParser.hpp
include/svl/numuno.hxx:
# base class has to be a complete type
- com/sun/star/lang/XUnoTunnel.hpp
@@ -433,7 +432,6 @@ excludelist:
- com/sun/star/lang/XUnoTunnel.hpp
- com/sun/star/xml/sax/XExtendedDocumentHandler.hpp
- com/sun/star/xml/sax/XFastDocumentHandler.hpp
- - com/sun/star/xml/sax/XFastParser.hpp
include/svtools/asynclink.hxx:
# unique_ptr needs complete type
- osl/mutex.hxx
diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index fe388fce21cc..4e884e9c0993 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -20,11 +20,10 @@
#ifndef INCLUDED_SAX_FASTPARSER_HXX
#define INCLUDED_SAX_FASTPARSER_HXX
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/lang/XInitialization.hpp>
+#include <sax/xfastparser.hxx>
#include <sax/saxdllapi.h>
#include <memory>
@@ -40,10 +39,8 @@ class FastSaxParserImpl;
// This class implements the external Parser interface
class SAX_DLLPUBLIC FastSaxParser final
- : public ::cppu::WeakImplHelper<
- css::lang::XInitialization,
- css::xml::sax::XFastParser,
- css::lang::XServiceInfo >
+ : public ::cppu::WeakImplHelper<css::lang::XInitialization, css::lang::XServiceInfo>,
+ public XFastParser
{
std::unique_ptr<FastSaxParserImpl> mpImpl;
@@ -55,16 +52,16 @@ public:
virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const& rArguments) override;
// XFastParser
- virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
- virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
- virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
- virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
- virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override;
- virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
- 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< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
+ virtual void parseStream( const css::xml::sax::InputSource& aInputSource ) override;
+ virtual void setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
+ virtual void setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
+ virtual void registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
+ virtual OUString getNamespaceURL( std::u16string_view aPrefix ) override;
+ virtual void setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
+ virtual void setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
+ virtual void setLocale( const css::lang::Locale& rLocale ) override;
+ virtual void setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
+ virtual void 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/sax/xfastparser.hxx b/include/sax/xfastparser.hxx
new file mode 100644
index 000000000000..84282162db68
--- /dev/null
+++ b/include/sax/xfastparser.hxx
@@ -0,0 +1,69 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/Pair.hpp>
+#include <sax/saxdllapi.h>
+
+namespace com::sun::star::xml::sax
+{
+struct InputSource;
+class XErrorHandler;
+class XFastDocumentHandler;
+class XEntityResolver;
+class XFastTokenHandler;
+class XFastNamespaceHandler;
+}
+namespace com::sun::star::lang
+{
+struct Locale;
+}
+
+class SAX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") XFastParser
+{
+public:
+ virtual ~XFastParser();
+
+ // XFastParser
+ virtual void parseStream(const css::xml::sax::InputSource& aInputSource) = 0;
+ virtual void
+ setFastDocumentHandler(const css::uno::Reference<css::xml::sax::XFastDocumentHandler>& Handler)
+ = 0;
+ virtual void
+ setTokenHandler(const css::uno::Reference<css::xml::sax::XFastTokenHandler>& Handler)
+ = 0;
+ virtual void registerNamespace(const OUString& NamespaceURL, sal_Int32 NamespaceToken) = 0;
+ virtual OUString getNamespaceURL(std::u16string_view Prefix) = 0;
+ virtual void setErrorHandler(const css::uno::Reference<css::xml::sax::XErrorHandler>& Handler)
+ = 0;
+ virtual void
+ setEntityResolver(const css::uno::Reference<css::xml::sax::XEntityResolver>& Resolver)
+ = 0;
+ virtual void setLocale(const css::lang::Locale& rLocale) = 0;
+ virtual void
+ setNamespaceHandler(const css::uno::Reference<css::xml::sax::XFastNamespaceHandler>& Handler)
+ = 0;
+ virtual void setCustomEntityNames(
+ const ::css::uno::Sequence<::css::beans::Pair<::rtl::OUString, ::rtl::OUString>>&
+ replacements)
+ = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sax/ximportfilter2.hxx b/include/sax/ximportfilter2.hxx
new file mode 100644
index 000000000000..9428e46e101e
--- /dev/null
+++ b/include/sax/ximportfilter2.hxx
@@ -0,0 +1,43 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/Pair.hpp>
+#include <sax/saxdllapi.h>
+#include <rtl/ref.hxx>
+
+namespace com::sun::star::beans {
+ struct PropertyValue;
+}
+class XFastParser;
+
+class SAX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") XImportFilter2
+{
+public:
+ virtual ~XImportFilter2();
+
+ // XImportFilter2
+ virtual bool
+ importer(const css::uno::Sequence< css::beans::PropertyValue >& sourceData,
+ XFastParser& fastParser,
+ const css::uno::Sequence< OUString >& userData) = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 3287911f1112..52a60269122a 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -30,7 +30,7 @@
#include <xmloff/dllapi.h>
#include <sal/types.h>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <com/sun/star/xml/sax/XFastNamespaceHandler.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -42,6 +42,7 @@
#include <cppuhelper/implbase.hxx>
#include <xmloff/formlayerimport.hxx>
#include <sax/fastattribs.hxx>
+#include <sax/xfastparser.hxx>
#include <rtl/ustring.hxx>
#include <unordered_map>
@@ -56,6 +57,7 @@ namespace com::sun::star::document { class XEmbeddedObjectResolver; }
namespace com::sun::star::document { class XGraphicStorageHandler; }
namespace com::sun::star::embed { class XStorage; }
namespace com::sun::star::graphic { class XGraphic; }
+namespace com::sun::star::io { class XInputStream; }
namespace com::sun::star::task { class XStatusIndicator; }
namespace com::sun::star::uno { class XComponentContext; }
namespace com::sun::star::util { class XNumberFormatsSupplier; }
@@ -71,6 +73,8 @@ namespace com::sun::star {
namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
namespace comphelper { class AttributeList; }
+namespace sax_fastparser { class FastSaxParser; }
+
namespace xmloff {
class RDFaImportHelper;
}
@@ -180,8 +184,7 @@ class XMLOFF_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SvXMLImport : public c
css::lang::XServiceInfo,
css::lang::XInitialization,
css::document::XImporter,
- css::document::XFilter,
- css::xml::sax::XFastParser>
+ css::document::XFilter>, public XFastParser
{
friend class SvXMLImportContext;
friend class SvXMLLegacyToFastDocHandler;
@@ -228,7 +231,7 @@ class XMLOFF_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SvXMLImport : public c
SvXMLImportFlags mnImportFlags;
std::set< OUString > m_embeddedFontUrlsKnown;
- css::uno::Reference< css::xml::sax::XFastParser > mxParser;
+ rtl::Reference< sax_fastparser::FastSaxParser > mxParser;
rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
@@ -331,16 +334,16 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
// XFastParser
- virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override;
- virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
- virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
- virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
- virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override;
- virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
- 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< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override;
+ virtual void parseStream( const css::xml::sax::InputSource& aInputSource ) override;
+ virtual void setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override;
+ virtual void setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override;
+ virtual void registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override;
+ virtual OUString getNamespaceURL( std::u16string_view aPrefix ) override;
+ virtual void setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override;
+ virtual void setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override;
+ virtual void setLocale( const css::lang::Locale& rLocale ) override;
+ virtual void setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override;
+ virtual void 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;