summaryrefslogtreecommitdiff
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
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>
-rw-r--r--chart2/Library_chartcore.mk1
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx8
-rw-r--r--chart2/source/model/inc/XMLFilter.hxx3
-rw-r--r--editeng/source/misc/svxacorr.cxx6
-rw-r--r--editeng/source/xml/xmltxtimp.cxx1
-rw-r--r--filter/Library_odfflatxml.mk1
-rw-r--r--filter/Library_xmlfa.mk1
-rw-r--r--filter/source/odfflatxml/OdfFlatXml.cxx25
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx17
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx31
-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
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/xml/XImportFilter2.idl61
-rw-r--r--offapi/com/sun/star/xml/sax/FastParser.idl16
-rw-r--r--offapi/com/sun/star/xml/sax/XFastParser.idl148
-rw-r--r--oox/source/core/fastparser.cxx1
-rw-r--r--oox/source/crypto/AgileEngine.cxx7
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx8
-rw-r--r--sax/qa/cppunit/parser.cxx1
-rw-r--r--sax/source/expatwrap/expwrap.component4
-rw-r--r--sax/source/fastparser/fastparser.cxx14
-rw-r--r--sax/source/fastparser/legacyfastparser.cxx13
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx7
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx9
-rw-r--r--sd/source/core/drawdoc4.cxx9
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx12
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx8
-rwxr-xr-xsolenv/bin/native-code.py1
-rw-r--r--solenv/clang-format/excludelist1
-rw-r--r--starmath/source/mathml/import.cxx15
-rw-r--r--starmath/source/mathml/mathmlimport.cxx14
-rw-r--r--svx/source/xml/xmlexport.cxx10
-rw-r--r--svx/source/xml/xmlxtimp.cxx1
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx18
-rw-r--r--sw/source/filter/xml/swxml.cxx10
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx1
-rw-r--r--writerfilter/inc/ooxml/OOXMLDocument.hxx5
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.cxx4
-rw-r--r--writerfilter/source/ooxml/OOXMLStreamImpl.hxx5
-rw-r--r--writerfilter/source/ooxml/factoryimpl.py9
-rw-r--r--xmloff/source/core/xmlimp.cxx33
45 files changed, 306 insertions, 410 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 54bc946766d8..05697c36eaff 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Library_use_libraries,chartcore,\
i18nlangtag \
sal \
salhelper \
+ sax \
sfx \
svl \
svt \
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 6eccb22be375..6362fc91beed 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -44,11 +44,11 @@
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/document/GraphicStorageHandler.hpp>
#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
+#include <sax/xfastparser.hxx>
using namespace ::com::sun::star;
@@ -463,9 +463,9 @@ ErrCode XMLFilter::impl_ImportStream(
aParserInput.aInputStream.set(xInputStream, uno::UNO_QUERY_THROW);
// the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- Reference< xml::sax::XFastParser > xFastParser(xFilter, uno::UNO_QUERY);
- if (xFastParser.is())
- xFastParser->parseStream(aParserInput);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ if (pFastParser)
+ pFastParser->parseStream(aParserInput);
else
{
Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(m_xContext);
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
index c26587c3ebad..e8a2890c0b24 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -36,9 +36,6 @@ namespace com::sun::star {
namespace embed {
class XStorage;
}
- namespace xml::sax {
- class XFastParser;
- }
namespace document {
class XGraphicStorageHandler;
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 318da6536df9..c32022e4e6dc 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -56,7 +56,6 @@
#include <editeng/unolingu.hxx>
#include <vcl/window.hxx>
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <unotools/streamwrap.hxx>
@@ -72,6 +71,7 @@
#include <xmloff/xmltoken.hxx>
#include <unordered_map>
#include <rtl/character.hxx>
+#include <sax/fastparser.hxx>
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::uno;
@@ -2278,7 +2278,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLExceptionListImport ( xContext, *rpLst );
// connect parser and filter
- uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
+ rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler = new SvXMLAutoCorrectTokenHandler;
xParser->setFastDocumentHandler( xFilter );
xParser->registerNamespace( "http://openoffice.org/2001/block-list", SvXMLAutoCorrectToken::NAMESPACE );
@@ -2385,7 +2385,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
aParserInput.aInputStream = xStrm->getInputStream();
// get parser
- uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
+ rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
SAL_INFO("editeng", "AutoCorrect Import" );
uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xContext, pAutocorr_List.get(), rAutoCorrect, xStg );
uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler = new SvXMLAutoCorrectTokenHandler;
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index d04e37a822bf..11c4be560342 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -18,6 +18,7 @@
*/
#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <comphelper/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <svl/itemprop.hxx>
diff --git a/filter/Library_odfflatxml.mk b/filter/Library_odfflatxml.mk
index 176530035ddd..dd37086ab210 100644
--- a/filter/Library_odfflatxml.mk
+++ b/filter/Library_odfflatxml.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,odfflatxml,\
cppuhelper \
cppu \
sal \
+ sax \
))
$(eval $(call gb_Library_add_exception_objects,odfflatxml,\
diff --git a/filter/Library_xmlfa.mk b/filter/Library_xmlfa.mk
index e1157cca3059..7310b18149d8 100644
--- a/filter/Library_xmlfa.mk
+++ b/filter/Library_xmlfa.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Library_use_libraries,xmlfa,\
cppuhelper \
cppu \
sal \
+ sax \
tl \
utl \
xo \
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index 4c838ab5f40e..0c76d193eb3b 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -23,19 +23,19 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XImportFilter2.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <comphelper/diagnose_ex.hxx>
+#include <sax/ximportfilter2.hxx>
+#include <sax/xfastparser.hxx>
using namespace ::cppu;
using namespace ::osl;
@@ -55,8 +55,9 @@ namespace filter::odfflatxml {
* OdfFlatXml export and imports ODF flat XML documents by plugging a pass-through
* filter implementation into XmlFilterAdaptor.
*/
- class OdfFlatXml : public WeakImplHelper<XImportFilter, XImportFilter2,
- XExportFilter, DocumentHandlerAdapter, css::lang::XServiceInfo>
+ class OdfFlatXml : public WeakImplHelper<XImportFilter,
+ XExportFilter, DocumentHandlerAdapter, css::lang::XServiceInfo>,
+ public XImportFilter2
{
private:
Reference< XComponentContext > m_xContext;
@@ -75,9 +76,9 @@ namespace filter::odfflatxml {
const Sequence< OUString >& userData) override;
// XImportFilter2
- virtual sal_Bool SAL_CALL
+ virtual bool
importer(const Sequence< PropertyValue >& sourceData,
- const Reference< XFastParser >& fastParser,
+ XFastParser& fastParser,
const Sequence< OUString >& userData) override;
// XExportFilter
@@ -142,9 +143,9 @@ OdfFlatXml::importer(
if ( xSeekable.is() )
xSeekable->seek( 0 );
- css::uno::Reference< css::xml::sax::XFastParser > xFastParser (docHandler, UNO_QUERY );
- if( xFastParser.is() )
- xFastParser->parseStream( inputSource );
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(docHandler.get());
+ if( pFastParser )
+ pFastParser->parseStream( inputSource );
else
{
Reference<XParser> saxParser = Parser::create(m_xContext);
@@ -165,10 +166,10 @@ OdfFlatXml::importer(
return true;
}
-sal_Bool
+bool
OdfFlatXml::importer(
const Sequence< PropertyValue >& sourceData,
- const Reference< XFastParser >& xFastParser,
+ XFastParser& rFastParser,
const Sequence< OUString >& /* userData */)
{
// Read InputStream to read from and a URL used for the system id
@@ -201,7 +202,7 @@ OdfFlatXml::importer(
if ( xSeekable.is() )
xSeekable->seek( 0 );
- xFastParser->parseStream( inputSource );
+ rFastParser.parseStream( inputSource );
}
catch (const Exception &)
{
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 525f567b67c0..0fa97b717104 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -25,7 +25,6 @@
#include "XmlFilterAdaptor.hxx"
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XImportFilter2.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
@@ -42,7 +41,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <unotools/pathoptions.hxx>
#include <xmloff/xmlimp.hxx>
-
+#include <sax/ximportfilter2.hxx>
#include <strings.hrc>
using namespace comphelper;
@@ -132,7 +131,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
xStatusIndicator->setValue(nSteps++);
Reference< XImportFilter > xConverter1( xConvBridge, UNO_QUERY );
- Reference< XImportFilter2 > xConverter2( xConvBridge, UNO_QUERY );
+ XImportFilter2* pConverter2 = dynamic_cast<XImportFilter2*>(xConvBridge.get());
// prevent unnecessary broadcasting when loading
Reference< XModel > xModel( mxDoc, UNO_QUERY );
@@ -170,12 +169,12 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
// Calling Filtering Component
try {
- Reference < XFastParser > xFastParser( xFilter, UNO_QUERY ); // SvXMLImport subclasses
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>( xFilter.get() ); // SvXMLImport subclasses
Reference < XDocumentHandler > xDocHandler( xFilter, UNO_QUERY ); // XMLTransformer subclasses
- assert(xFastParser || xDocHandler);
- if (xConverter2 && xFastParser)
+ assert(pFastParser || xDocHandler);
+ if (pConverter2 && pFastParser)
{
- if (!xConverter2->importer(aDescriptor,xFastParser,msUserData)) {
+ if (!pConverter2->importer(aDescriptor,*pFastParser,msUserData)) {
if (xStatusIndicator.is())
xStatusIndicator->end();
return false;
@@ -189,9 +188,9 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
return false;
}
}
- else if (xConverter1 && xFastParser)
+ else if (xConverter1 && pFastParser)
{
- auto pImport = static_cast<SvXMLImport*>(xFastParser.get());
+ auto pImport = static_cast<SvXMLImport*>(pFastParser);
Reference<XDocumentHandler> xLegacyDocHandler = new SvXMLLegacyToFastDocHandler(pImport);
if (!xConverter1->importer(aDescriptor,xLegacyDocHandler,msUserData)) {
if (xStatusIndicator.is())
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 44f9ce4d8172..3ceb2a002cc8 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -46,10 +46,8 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XImportFilter2.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
@@ -66,6 +64,8 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <com/sun/star/xml/xslt/XSLTTransformer.hpp>
+#include <sax/ximportfilter2.hxx>
+#include <sax/xfastparser.hxx>
#include <utility>
#define TRANSFORMATION_TIMEOUT_SEC 60
@@ -118,8 +118,8 @@ namespace XSLT
* supporting service from an extension for a specific filter; the
* service must support com.sun.star.xml.xslt.XSLT2Transformer.
*/
- class XSLTFilter : public WeakImplHelper<XImportFilter, XImportFilter2, XExportFilter,
- ExtendedDocumentHandlerAdapter, XServiceInfo>
+ class XSLTFilter : public WeakImplHelper<XImportFilter, XExportFilter,
+ ExtendedDocumentHandlerAdapter, XServiceInfo>, public XImportFilter2
{
friend class XSLTFilterStreamListener;
private:
@@ -162,9 +162,9 @@ namespace XSLT
const Sequence<OUString>& msUserData) override;
// XImportFilter2
- virtual sal_Bool SAL_CALL
- importer(const Sequence<PropertyValue>& aSourceData, const css::uno::Reference<
- XFastParser>& xFastParser,
+ virtual bool
+ importer(const Sequence<PropertyValue>& aSourceData,
+ XFastParser& xFastParser,
const Sequence<OUString>& msUserData) override;
// XExportFilter
@@ -362,8 +362,8 @@ namespace XSLT
aInput.sPublicId = aURL;
aInput.aInputStream = pipein;
- css::uno::Reference< css::xml::sax::XFastParser > xFastParser(
- xHandler, css::uno::UNO_QUERY );
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(
+ xHandler.get() );
// transform
m_tcontrol->start();
@@ -394,8 +394,8 @@ namespace XSLT
result = m_cTransformed.wait(&timeout);
};
if (!m_bError) {
- if( xFastParser.is() )
- xFastParser->parseStream( aInput );
+ if( pFastParser )
+ pFastParser->parseStream( aInput );
else
{
// create SAX parser that will read the document file
@@ -422,9 +422,9 @@ namespace XSLT
}
}
- sal_Bool
+ bool
XSLTFilter::importer(const Sequence<PropertyValue>& aSourceData,
- const css::uno::Reference<XFastParser>& xFastParser, const Sequence<
+ XFastParser& rFastParser, const Sequence<
OUString>& msUserData)
{
if (msUserData.getLength() < 5)
@@ -461,10 +461,9 @@ namespace XSLT
Any(NamedValue("SourceBaseURL", Any(INetURLObject(aURL).getBase()))) };
m_tcontrol = impl_createTransformer(msUserData[1], args);
- assert(xFastParser.is());
OSL_ASSERT(xInputStream.is());
OSL_ASSERT(m_tcontrol.is());
- if (xFastParser.is() && xInputStream.is() && m_tcontrol.is())
+ if (xInputStream.is() && m_tcontrol.is())
{
try
{
@@ -521,7 +520,7 @@ namespace XSLT
result = m_cTransformed.wait(&timeout);
};
if (!m_bError)
- xFastParser->parseStream( aInput );
+ rFastParser.parseStream( aInput );
m_tcontrol->terminate();
return !m_bError;
}
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;
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 7ee71bb984c1..f266da0e83e7 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -473,7 +473,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/dom,\
SAXDocumentBuilder \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/sax,\
- FastParser \
FastTokenHandler \
Parser \
Writer \
@@ -4268,7 +4267,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/xml,\
FastAttribute \
XExportFilter \
XImportFilter \
- XImportFilter2 \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/xml/crypto,\
CipherID \
@@ -4386,7 +4384,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/xml/sax,\
XFastAttributeList \
XFastContextHandler \
XFastDocumentHandler \
- XFastParser \
XFastSAXSerializable \
XFastTokenHandler \
XLocator \
diff --git a/offapi/com/sun/star/xml/XImportFilter2.idl b/offapi/com/sun/star/xml/XImportFilter2.idl
deleted file mode 100644
index 3d1ae5bcdae2..000000000000
--- a/offapi/com/sun/star/xml/XImportFilter2.idl
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- 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 .
- */
-
-
-module com { module sun { module star { module xml {
-
-
-
-/** interface to implement for an XML-based import filter.
- Enhanced vs XImportFilter to take a XFastDocumentHandler.
-
- @since LibreOffice 7.1
- */
-interface XImportFilter2: com::sun::star::uno::XInterface
-{
- /** performs the import.
-
- <p>The source data (location indicated by <var>aSourceData</var>),
- and the XML representation of the document must be generated by calls
- to xocHandler (???) methods.
-
- @param aSourceData
- com::sun::star::document::MediaDescriptor
- which defines the data source
-
- @param msUserData
- Sequence of strings which contains the user data defined in the
- TypeDetection.xml
-
- @param xFastParser
- the fast parser for the XML document, i.e. an SvXMLImport subclass
-
- @returns
- `TRUE` if import process is successful
- */
- boolean importer(
- [in] sequence< com::sun::star::beans::PropertyValue > aSourceData,
- [in] com::sun::star::xml::sax::XFastParser xFastParser,
- [in] sequence< string > msUserData )
- raises( com::sun::star::lang::IllegalArgumentException );
-};
-
-}; }; }; };
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xml/sax/FastParser.idl b/offapi/com/sun/star/xml/sax/FastParser.idl
deleted file mode 100644
index 5eaa3482a22c..000000000000
--- a/offapi/com/sun/star/xml/sax/FastParser.idl
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- 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/.
- */
-
-module com { module sun { module star { module xml { module sax {
-
-service FastParser: XFastParser;
-
-}; }; }; }; };
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xml/sax/XFastParser.idl b/offapi/com/sun/star/xml/sax/XFastParser.idl
deleted file mode 100644
index 8f17b3ddaf87..000000000000
--- a/offapi/com/sun/star/xml/sax/XFastParser.idl
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- 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 .
- */
-
-
-module com { module sun { module star { module xml { module sax {
-
-
-/** specifies a SAX parser that uses integer values for known XML names
- (elements, attributes and attribute values). The parser also handles
- namespaces and allows to have individual contexts for each XML element.
-
- <p>Before parsing is possible you have to set your
- XFastDocumentHandler using setFastDocumentHandler().
-
- <p>Parsing starts with calling parseStream(). If the parser
- finds a valid XML file with the given InputSource, it calls
- XFastDocumentHandler::startDocument() first.
-
- <p>This parser generates either "fast" events that use integer token
- values for namespaces, elements and attributes or "unknown" events for
- elements that are unknown.
-
- <p>A namespace is unknown if the namespace URL was not registered with
- registerNamespace().
-
- <p>An element is unknown if no XFastTokenHandler is set
- or if the XFastTokenHandler does not return a valid
- identifier for the elements local name. An element is also unknown if
- the elements local name is known but it uses a namespace that is unknown.
-
- <p>Setting a XFastTokenHandler with setTokenHandler()
- is optional, but without a XFastTokenHandler you will only
- get unknown sax events. This can be useful if you are only interested
- in the namespace handling and/or the context feature.
-
- <p>For each element the parser sends a create child element event to the
- elements parent context by calling
- XFastContextHandler::createFastChildContext() for known
- elements or XFastContextHandler::createUnknownChildContext()
- for unknown elements.
- <br>The parent context for the root element is the XFastDocumentHandler
- itself.
-
- <p>If the parent context returns an empty reference, no further events for
- the element and all of its children are created.
-
- <p>If a valid context is returned this context gets a start event by a call to
- XFastContextHandler::startFastElement() for known elements or
- XFastContextHandler::startUnknownElement() for unknown elements.
-
- <p>After processing all its child elements the context gets an end event by a call to
- XFastContextHandler::endFastElement() for known elements or
- XFastContextHandler::endUnknownElement() for unknown elements.
-
- <p>It is valid to return one instance of XFastContextHandler more
- than once. It is even possible to only use the XFastDocumentHandler
- by always returning a reference to itself for each create child context event.
-
- <p>After the last element is processed the parser generates an end document
- event at the XFastDocumentHandler by calling
- XFastDocumentHandler::endDocument().
-
- @see http://wiki.openoffice.org/wiki/FastParser
-*/
-interface XFastParser: com::sun::star::uno::XInterface
-{
- /** parses an XML document from a stream.
-
- <p>Set the desired handlers before calling this method.</p>
- */
- void parseStream( [in] InputSource aInputSource )
- raises( SAXException, com::sun::star::io::IOException );
-
-
- /** Application must register a document event handler to get
- sax events for the parsed stream.
- */
- void setFastDocumentHandler( [in] XFastDocumentHandler Handler );
-
-
- /** must be registered to translate known XML names to integer tokens.
- */
- void setTokenHandler( [in] XFastTokenHandler Handler );
-
-
- /** registers a known namespace url with the given integer token.<br>
- @param NamespaceURL the namespace URL.
- @param NamespaceToken
- an integer token that must be greater than FastToken::NAMESPACE.
- */
- void registerNamespace( [in] string NamespaceURL, [in] long NamespaceToken )
- raises( com::sun::star::lang::IllegalArgumentException );
-
- /** allows an application to register an error event handler.
-
- <p>Note that the error handler can throw an exception when an error or
- warning occurs. Note that an exception is thrown by the parser when
- an unrecoverable (fatal) error occurs.</p>
- */
- void setErrorHandler( [in] XErrorHandler Handler );
-
- /** allows an application to register a DTD-Handler.
- */
- void setEntityResolver( [in] XEntityResolver Resolver );
-
- /** sets a locale specified for localization of warnings and error messages.
-
- <p>Set the language of the error messages. Useful when the parsing
- errors will be presented to the user.</p>
- */
- void setLocale( [in] com::sun::star::lang::Locale locale );
-
- /** Gets the namespace url string.
- */
- string getNamespaceURL( [in] string prefix )
- raises( com::sun::star::lang::IllegalArgumentException );
-
- /** @since LibreOffice 5.3 */
- void setNamespaceHandler( [in] XFastNamespaceHandler Handler);
-
- /**
- * Simulate a DTD file.
- * Will allow to use customized entity references like &infin; .
- * @since LibreOffice 7.1
- */
- void setCustomEntityNames( [in] sequence< beans::Pair<string,string> > replacements);
-};
-
-
-}; }; }; }; };
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 53e5eb78a849..22ba37c7d671 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <oox/core/fastparser.hxx>
#include <oox/core/fasttokenhandler.hxx>
diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx
index f7518498171d..7a667943d8e2 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -26,11 +26,12 @@
#include <tools/stream.hxx>
#include <tools/XmlWriter.hxx>
#include <sax/fastattribs.hxx>
+#include <sax/fastparser.hxx>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
using namespace css;
using namespace css::beans;
@@ -521,7 +522,7 @@ bool AgileEngine::readEncryptionInfo(uno::Reference<io::XInputStream> & rxInputS
Reference<XFastDocumentHandler> xFastDocumentHandler(new AgileDocumentHandler(mInfo));
Reference<XFastTokenHandler> xFastTokenHandler(new AgileTokenHandler);
- Reference<XFastParser> xParser(css::xml::sax::FastParser::create(comphelper::getProcessComponentContext()));
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser = new sax_fastparser::FastSaxParser;
xParser->setFastDocumentHandler(xFastDocumentHandler);
xParser->setTokenHandler(xFastTokenHandler);
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index caf2c7b9907c..1ad8d01bffbd 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -226,15 +226,15 @@ static ErrCode ReadThroughComponent(
aFilterCompArgsRange[ nArgs++ ] <<= _xProp;
// the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- Reference< XFastParser > xFastParser(
- rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext),
- uno::UNO_QUERY_THROW );
+ Reference< XInterface > xInstance =
+ rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xInstance.get());
uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
// read from the stream
return ReadThroughComponent( xInputStream
,xModelComponent
,rxContext
- ,xFastParser );
+ ,pFastParser );
}
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 261091fe8769..88e0ebd90cf9 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -12,6 +12,7 @@
#include <com/sun/star/io/Pipe.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <sax/fastparser.hxx>
#include <sax/fastattribs.hxx>
diff --git a/sax/source/expatwrap/expwrap.component b/sax/source/expatwrap/expwrap.component
index 1f72eccf3145..dbc9822c566d 100644
--- a/sax/source/expatwrap/expwrap.component
+++ b/sax/source/expatwrap/expwrap.component
@@ -27,10 +27,6 @@
constructor="com_sun_star_extensions_xml_sax_Writer_get_implementation">
<service name="com.sun.star.xml.sax.Writer"/>
</implementation>
- <implementation name="com.sun.star.comp.extensions.xml.sax.FastParser"
- constructor="com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation">
- <service name="com.sun.star.xml.sax.FastParser"/>
- </implementation>
<implementation name="com.sun.star.comp.extensions.xml.sax.LegacyFastParser"
constructor="com_sun_star_comp_extensions_xml_sax_LegacyFastParser_get_implementation">
<service name="com.sun.star.xml.sax.LegacyFastParser"/>
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 344dda9cd63e..d92d0de0321d 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -19,6 +19,7 @@
#include <sax/fastparser.hxx>
#include <sax/fastattribs.hxx>
+#include <sax/ximportfilter2.hxx>
#include <utility>
#include <xml2utf.hxx>
@@ -27,8 +28,13 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastNamespaceHandler.hpp>
+#include <com/sun/star/xml/sax/XLocator.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -1484,9 +1490,9 @@ void FastSaxParser::registerNamespace( const OUString& NamespaceURL, sal_Int32 N
mpImpl->registerNamespace(NamespaceURL, NamespaceToken);
}
-OUString FastSaxParser::getNamespaceURL( const OUString& rPrefix )
+OUString FastSaxParser::getNamespaceURL( std::u16string_view aPrefix )
{
- return mpImpl->getNamespaceURL(rPrefix);
+ return mpImpl->getNamespaceURL(aPrefix);
}
void FastSaxParser::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
@@ -1675,5 +1681,9 @@ static bool NormalizeOasisURN( OUString& rName )
return true;
}
+XFastParser::~XFastParser() {}
+
+XImportFilter2::~XImportFilter2() {}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx
index 62e7b8a57a88..8dd5e5379aa0 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -19,13 +19,16 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
+#include <com/sun/star/xml/sax/XFastNamespaceHandler.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/Pair.hpp>
#include <comphelper/attributelist.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/ref.hxx>
+#include <sax/fastparser.hxx>
#include <memory>
#include <utility>
#include <vector>
@@ -115,7 +118,7 @@ public:
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
private:
- Reference< XFastParser > m_xParser;
+ rtl::Reference< sax_fastparser::FastSaxParser > m_xParser;
Reference< XDocumentHandler > m_xDocumentHandler;
Reference< XFastTokenHandler > m_xTokenHandler;
@@ -281,7 +284,7 @@ void SAL_CALL CallbackDocumentHandler::characters( const OUString& aChars )
}
SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new NamespaceHandler ),
- m_xParser(FastParser::create(::comphelper::getProcessComponentContext() ))
+ m_xParser(new sax_fastparser::FastSaxParser)
{
m_xParser->setNamespaceHandler( m_aNamespaceHandler );
}
@@ -308,9 +311,7 @@ void SAL_CALL SaxLegacyFastParser::initialize(Sequence< Any > const& rArguments
}
else
{
- uno::Reference<lang::XInitialization> const xInit(m_xParser,
- uno::UNO_QUERY_THROW);
- xInit->initialize( rArguments );
+ m_xParser->initialize( rArguments );
}
}
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 3546bfe5f043..d403bc4cff26 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -40,7 +40,6 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -180,9 +179,9 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo
// xImportInterface is either ScXMLImport or an XMLTransformer subclass.
// ScXMLImport implements XFastParser, but XMLTransformer only implements XExtendedDocumentHandler
- uno::Reference< xml::sax::XFastParser > xFastParser(xImportInterface, uno::UNO_QUERY);
- if (xFastParser)
- xFastParser->parseStream( aParserInput );
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xImportInterface.get());
+ if (pFastParser)
+ pFastParser->parseStream( aParserInput );
else
{
uno::Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(xContext);
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 242af4bd3a00..65aa70b8fe96 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/presentation/EffectPresetClass.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <unotools/streamwrap.hxx>
@@ -34,6 +33,7 @@
#include <comphelper/random.hxx>
#include <comphelper/lok.hxx>
#include <unotools/syslocaleoptions.hxx>
+#include <sax/xfastparser.hxx>
#include <tools/stream.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <o3tl/string_view.hxx>
@@ -225,11 +225,12 @@ Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFac
aParserInput.aInputStream = xInputStream;
// get filter
- Reference< xml::sax::XFastParser > xFilter( xServiceFactory->createInstance("com.sun.star.comp.Xmloff.AnimationsImport" ), UNO_QUERY_THROW );
+ Reference< XInterface > xInterface( xServiceFactory->createInstance("com.sun.star.comp.Xmloff.AnimationsImport" ) );
+ XFastParser* pFilter = dynamic_cast<XFastParser*>(xInterface.get());
- xFilter->parseStream( aParserInput );
+ pFilter->parseStream( aParserInput );
- Reference< XAnimationNodeSupplier > xAnimationNodeSupplier( xFilter, UNO_QUERY_THROW );
+ Reference< XAnimationNodeSupplier > xAnimationNodeSupplier( xInterface, UNO_QUERY_THROW );
xRootNode = xAnimationNodeSupplier->getAnimationNode();
}
catch (const Exception&)
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 91c4dc600703..db64ba8e88b6 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <sfx2/dispatch.hxx>
@@ -40,6 +40,7 @@
#include <rtl/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/streamwrap.hxx>
+#include <sax/xfastparser.hxx>
#include <tools/stream.hxx>
#include <tools/UnitConversion.hxx>
@@ -646,9 +647,9 @@ void SdDrawDocument::CreateDefaultCellStyles()
css::xml::sax::InputSource aParserInput;
aParserInput.sPublicId = aURL;
aParserInput.aInputStream = xInputStream;
- Reference<css::xml::sax::XFastParser> xFastParser(xImporter, UNO_QUERY);
- if (xFastParser)
- xFastParser->parseStream(aParserInput);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xImporter.get());
+ if (pFastParser)
+ pFastParser->parseStream(aParserInput);
// Set default fonts, if they were not defined in the xml.
vcl::Font aLatinFont, aCJKFont, aCTLFont;
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 43c3d0d7766d..ad36030f5e1c 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -28,6 +28,7 @@
#include <comphelper/propertysequence.hxx>
#include <o3tl/string_view.hxx>
#include <editeng/outlobj.hxx>
+#include <sax/xfastparser.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/sfxsids.hrc>
@@ -45,7 +46,6 @@
#include <svx/xmleohlp.hxx>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XExporter.hpp>
@@ -198,11 +198,11 @@ ErrCode ReadThroughComponent(
SAL_WARN_IF(!xFilter.is(), "sd.filter", "Can't instantiate filter component: " << aFilterName);
if( !xFilter.is() )
return SD_XML_READERROR;
- Reference< xml::sax::XFastParser > xFastParser(xFilter, UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
Reference< xml::sax::XDocumentHandler > xDocumentHandler;
- if (!xFastParser)
+ if (!pFastParser)
xDocumentHandler.set(xFilter, UNO_QUERY);
- if (!xFastParser && !xDocumentHandler)
+ if (!pFastParser && !xDocumentHandler)
{
SAL_WARN("sd", "service does not implement XFastParser or XDocumentHandler");
assert(false);
@@ -218,8 +218,8 @@ ErrCode ReadThroughComponent(
SAL_INFO( "sd.filter", "parsing stream" );
try
{
- if (xFastParser)
- xFastParser->parseStream( aParserInput );
+ if (pFastParser)
+ pFastParser->parseStream( aParserInput );
else
{
Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(rxContext);
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 7d1f16c01fd9..431e2455668a 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -48,7 +48,6 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/dom/DOMException.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xml/dom/XElement.hpp>
@@ -74,6 +73,7 @@
#include <sot/storage.hxx>
#include <sfx2/docfile.hxx>
#include <sax/tools/converter.hxx>
+#include <sax/xfastparser.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <optional>
@@ -1826,12 +1826,12 @@ SfxDocumentMetaData::loadFromStorage(
xMsf->createInstanceWithArgumentsAndContext(
OUString::createFromAscii(pServiceName), args, m_xContext);
assert(xFilter);
- css::uno::Reference<css::xml::sax::XFastParser> xFastParser(xFilter, css::uno::UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
css::uno::Reference<css::document::XImporter> xImp(xFilter, css::uno::UNO_QUERY_THROW);
xImp->setTargetDocument(css::uno::Reference<css::lang::XComponent>(this));
try {
- if (xFastParser)
- xFastParser->parseStream(input);
+ if (pFastParser)
+ pFastParser->parseStream(input);
else
{
css::uno::Reference<css::xml::sax::XDocumentHandler> xDocHandler(xFilter, css::uno::UNO_QUERY_THROW);
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 6dc5def61b1a..3469926f95b1 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -321,7 +321,6 @@ core_constructor_list = [
"package_ManifestReader_get_implementation",
"package_ManifestWriter_get_implementation",
# sax/source/expatwrap/expwrap.component
- "com_sun_star_comp_extensions_xml_sax_FastParser_get_implementation",
"com_sun_star_comp_extensions_xml_sax_ParserExpat_get_implementation",
"com_sun_star_extensions_xml_sax_Writer_get_implementation",
# scripting/util/scriptframe.component
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 55666de2c6e3..be8d80e7aeae 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -5522,6 +5522,7 @@ include/sax/fastparser.hxx
include/sax/fshelper.hxx
include/sax/tools/converter.hxx
include/sax/tools/documenthandleradapter.hxx
+include/sax/ximportfilter2.hxx
include/sfx2/DocumentMetadataAccess.hxx
include/sfx2/Metadatable.hxx
include/sfx2/StyleManager.hxx
diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx
index 8a0463283286..f653705b1391 100644
--- a/starmath/source/mathml/import.cxx
+++ b/starmath/source/mathml/import.cxx
@@ -17,7 +17,6 @@
#include <com/sun/star/packages/WrongPasswordException.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
@@ -29,6 +28,8 @@
#include <comphelper/propertysetinfo.hxx>
#include <comphelper/servicehelper.hxx>
#include <rtl/character.hxx>
+#include <sax/xfastparser.hxx>
+#include <sax/fastparser.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/frame.hxx>
#include <sfx2/sfxsids.hrc>
@@ -393,17 +394,17 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
// Finally, parser the stream
try
{
- Reference<css::xml::sax::XFastParser> xFastParser(xFilter, UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilter, UNO_QUERY);
- if (xFastParser)
+ if (pFastParser)
{
- xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
- xFastParser->parseStream(aParserInput);
+ pFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
+ pFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- Reference<css::xml::sax::XFastParser> xParser
- = css::xml::sax::FastParser::create(rxContext);
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser
+ = new sax_fastparser::FastSaxParser;
xParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
xParser->setFastDocumentHandler(xFastDocHandler);
xParser->parseStream(aParserInput);
diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx
index a33a4015846f..4fcd1e4dc76c 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -22,7 +22,6 @@ into one string, xml parser hands them to us line by line rather than all in
one go*/
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -40,6 +39,7 @@ one go*/
#include <comphelper/propertysetinfo.hxx>
#include <rtl/character.hxx>
#include <sal/log.hxx>
+#include <sax/fastparser.hxx>
#include <sfx2/frame.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/sfxsids.hrc>
@@ -266,18 +266,18 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(const Reference<io::XInputStrea
// finally, parser the stream
try
{
- Reference<css::xml::sax::XFastParser> xFastParser(xFilter, UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilter, UNO_QUERY);
- if (xFastParser)
+ if (pFastParser)
{
if (bUseHTMLMLEntities)
- xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
- xFastParser->parseStream(aParserInput);
+ pFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
+ pFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- Reference<css::xml::sax::XFastParser> xParser
- = css::xml::sax::FastParser::create(rxContext);
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser
+ = new sax_fastparser::FastSaxParser;
if (bUseHTMLMLEntities)
xParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
xParser->setFastDocumentHandler(xFastDocHandler);
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index d6bc3870ce08..79e65373a496 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -22,12 +22,12 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <comphelper/processfactory.hxx>
+#include <sax/xfastparser.hxx>
#include <svx/svdmodel.hxx>
#include <svx/xmleohlp.hxx>
#include <svx/xmlgrhlp.hxx>
@@ -193,18 +193,18 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
// get filter
Reference< XInterface > xFilter = xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext);
SAL_WARN_IF( !xFilter, "svx", "Can't instantiate filter component " << pImportService);
- uno::Reference< xml::sax::XFastParser > xFastParser( xFilter, UNO_QUERY );
- assert(xFastParser);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>( xFilter.get() );
+ assert(pFastParser);
bRet = false;
- if( xFastParser.is() )
+ if( pFastParser )
{
// connect model and filter
uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
xImporter->setTargetDocument( xTargetDocument );
// finally, parser the stream
- xFastParser->parseStream( aParserInput );
+ pFastParser->parseStream( aParserInput );
bRet = true;
}
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index 19c2a66ce1bb..e653f5695872 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/document/XGraphicStorageHandler.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index e8a2b088e67c..ffe4872dc28f 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <osl/diagnose.h>
+#include <sax/fastparser.hxx>
#include <svl/macitem.hxx>
#include <svtools/unoevent.hxx>
#include <sfx2/docfile.hxx>
@@ -29,7 +30,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/IOException.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
@@ -114,7 +114,7 @@ ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx )
uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLTextBlockTokenHandler();
// connect parser and filter
- uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
+ rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
xParser->setFastDocumentHandler( xFilter );
xParser->setTokenHandler( xTokenHandler );
@@ -214,16 +214,16 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
// parse the stream
try
{
- Reference<css::xml::sax::XFastParser> xFastParser(xFilterInt, UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilterInt.get());
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilterInt, UNO_QUERY);
- if (xFastParser)
+ if (pFastParser)
{
- xFastParser->parseStream(aParserInput);
+ pFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- Reference<css::xml::sax::XFastParser> xParser
- = css::xml::sax::FastParser::create(xContext);
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser
+ = new sax_fastparser::FastSaxParser;
xParser->setFastDocumentHandler(xFastDocHandler);
xParser->parseStream(aParserInput);
}
@@ -297,7 +297,7 @@ ErrCode SwXMLTextBlocks::GetBlockText( std::u16string_view rShort, OUString& rTe
uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLTextBlockTokenHandler();
// connect parser and filter
- uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
+ rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
xParser->setFastDocumentHandler( xFilter );
xParser->setTokenHandler( xTokenHandler );
@@ -421,7 +421,7 @@ void SwXMLTextBlocks::ReadInfo()
uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = new SwXMLBlockListTokenHandler();
// connect parser and filter
- uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
+ rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
xParser->setFastDocumentHandler( xFilter );
xParser->registerNamespace( "http://openoffice.org/2001/block-list", FastToken::NAMESPACE | XML_NAMESPACE_BLOCKLIST );
xParser->setTokenHandler( xTokenHandler );
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index b679f111a3b6..31ee26289830 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -159,11 +159,11 @@ ErrCode ReadThroughComponent(
if( !xFilter.is() )
return ERR_SWG_READ_ERROR;
// the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
- uno::Reference< xml::sax::XFastParser > xFastParser(xFilter, UNO_QUERY);
+ XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
uno::Reference< xml::sax::XDocumentHandler > xDocumentHandler;
- if (!xFastParser)
+ if (!pFastParser)
xDocumentHandler.set(xFilter, UNO_QUERY);
- if (!xDocumentHandler && !xFastParser)
+ if (!xDocumentHandler && !pFastParser)
{
SAL_WARN("sd", "service does not implement XFastParser or XDocumentHandler");
assert(false);
@@ -177,8 +177,8 @@ ErrCode ReadThroughComponent(
// finally, parse the stream
try
{
- if (xFastParser)
- xFastParser->parseStream( aParserInput );
+ if (pFastParser)
+ pFastParser->parseStream( aParserInput );
else
{
uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(rxContext);
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index fd3cb6e4a39c..eab7ad13022c 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -15,6 +15,7 @@
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <comphelper/processfactory.hxx>
diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx
index 6b47ab752177..7fd5462d2e60 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -25,7 +25,6 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <dmapper/resourcemodel.hxx>
#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -67,6 +66,8 @@
core API to insert the according elements to the core.
*/
+namespace sax_fastparser { class FastSaxParser; }
+
namespace writerfilter::ooxml
{
@@ -80,7 +81,7 @@ public:
/**
Returns fast parser for this stream.
*/
- virtual css::uno::Reference<css::xml::sax::XFastParser> getFastParser() = 0;
+ virtual rtl::Reference<sax_fastparser::FastSaxParser> getFastParser() = 0;
virtual css::uno::Reference<css::io::XInputStream> getDocumentStream() = 0;
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 3a7359df22e4..35f70c01e01b 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -91,7 +91,7 @@ void OOXMLDocumentImpl::resolveFastSubStream(Stream & rStreamHandler,
OOXMLStream::Pointer_t savedStream = mpStream;
mpStream = pStream;
- uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser(mpStream->getFastParser());
if (xParser.is())
{
@@ -445,7 +445,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
return;
}
- uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
+ rtl::Reference<sax_fastparser::FastSaxParser> xParser(mpStream->getFastParser());
if (mxModel.is())
{
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
index ec65290c6214..eb5a9c36376f 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
@@ -22,6 +22,7 @@
#include <ooxml/OOXMLDocument.hxx>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
+#include <sax/fastparser.hxx>
extern OUString customTarget;
extern OUString embeddingsTarget;
@@ -38,7 +39,7 @@ class OOXMLStreamImpl : public OOXMLStream
css::uno::Reference<css::embed::XStorage> mxStorage;
css::uno::Reference<css::embed::XRelationshipAccess> mxRelationshipAccess;
css::uno::Reference<css::io::XStream> mxDocumentStream;
- css::uno::Reference<css::xml::sax::XFastParser> mxFastParser;
+ rtl::Reference<sax_fastparser::FastSaxParser> mxFastParser;
css::uno::Reference<css::xml::sax::XFastTokenHandler> mxFastTokenHandler;
StreamType_t mnStreamType;
@@ -67,7 +68,7 @@ public:
virtual ~OOXMLStreamImpl() override;
- virtual css::uno::Reference<css::xml::sax::XFastParser> getFastParser() override;
+ virtual rtl::Reference<sax_fastparser::FastSaxParser> getFastParser() override;
virtual css::uno::Reference<css::io::XInputStream> getDocumentStream() override;
virtual css::uno::Reference<css::uno::XComponentContext> getContext() override;
virtual OUString getTargetForId(const OUString & rId) override;
diff --git a/writerfilter/source/ooxml/factoryimpl.py b/writerfilter/source/ooxml/factoryimpl.py
index c68d5ba06160..302ecf47eca4 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -147,15 +147,14 @@ std::string fastTokenToId(sal_uInt32 nToken)
def getFastParser():
- print("""uno::Reference <xml::sax::XFastParser> OOXMLStreamImpl::getFastParser()
+ print("""rtl::Reference<sax_fastparser::FastSaxParser> OOXMLStreamImpl::getFastParser()
{
if (!mxFastParser.is())
{
- mxFastParser = css::xml::sax::FastParser::create(mxContext);
+ mxFastParser = new sax_fastparser::FastSaxParser;
// the threaded parser is about 20% slower loading writer documents
- css::uno::Reference< css::lang::XInitialization > xInit( mxFastParser, css::uno::UNO_QUERY_THROW );
css::uno::Sequence< css::uno::Any > args{ css::uno::Any(OUString("DisableThreadedParser")) };
- xInit->initialize(args);
+ mxFastParser->initialize(args);
""")
for url in sorted(ooxUrlAliases.keys()):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (url, ooxUrlAliases[url]))
@@ -170,7 +169,7 @@ def getFastParser():
def createImpl(model):
print("""
-#include <com/sun/star/xml/sax/FastParser.hpp>
+#include <sax/fastparser.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include "ooxml/OOXMLFactory.hxx"
#include "ooxml/OOXMLFastHelper.hxx"
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a3c5e6fb31d6..979a7233c970 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -57,7 +57,6 @@
#include <com/sun/star/document/XGraphicStorageHandler.hpp>
#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
#include <com/sun/star/xml/sax/XLocator.hpp>
-#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -76,6 +75,7 @@
#include <fasttokenhandler.hxx>
#include <vcl/GraphicExternalLink.hxx>
#include <o3tl/string_view.hxx>
+#include <sax/fastparser.hxx>
#include <com/sun/star/rdf/XMetadatable.hpp>
#include <com/sun/star/rdf/XRepositorySupplier.hpp>
@@ -430,7 +430,7 @@ SvXMLImport::SvXMLImport(
{
SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
InitCtor_();
- mxParser = xml::sax::FastParser::create( xContext );
+ mxParser = new sax_fastparser::FastSaxParser;
setNamespaceHandler( maNamespaceHandler );
setTokenHandler( xTokenHandler );
if ( !bIsNSMapsInitialized )
@@ -479,9 +479,9 @@ namespace
class setFastDocumentHandlerGuard
{
private:
- css::uno::Reference<css::xml::sax::XFastParser> mxParser;
+ rtl::Reference<sax_fastparser::FastSaxParser> mxParser;
public:
- setFastDocumentHandlerGuard(css::uno::Reference<css::xml::sax::XFastParser> Parser,
+ setFastDocumentHandlerGuard(rtl::Reference<sax_fastparser::FastSaxParser> Parser,
const css::uno::Reference<css::xml::sax::XFastDocumentHandler>& Handler)
: mxParser(std::move(Parser))
{
@@ -496,53 +496,53 @@ namespace
}
// XFastParser
-void SAL_CALL SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource )
+void SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource )
{
setFastDocumentHandlerGuard aDocumentHandlerGuard(mxParser, mxFastDocumentHandler.is() ? mxFastDocumentHandler : this);
mxParser->parseStream(aInputSource);
}
-void SAL_CALL SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler )
+void SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler )
{
mxFastDocumentHandler = Handler;
}
-void SAL_CALL SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler )
+void SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler )
{
mxParser->setTokenHandler( Handler );
}
-void SAL_CALL SvXMLImport::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
+void SvXMLImport::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
{
mxParser->registerNamespace( NamespaceURL, NamespaceToken );
}
-OUString SAL_CALL SvXMLImport::getNamespaceURL( const OUString& rPrefix )
+OUString SvXMLImport::getNamespaceURL( std::u16string_view aPrefix )
{
- return mxParser->getNamespaceURL( rPrefix );
+ return mxParser->getNamespaceURL( aPrefix );
}
-void SAL_CALL SvXMLImport::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
+void SvXMLImport::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
{
mxParser->setErrorHandler( Handler );
}
-void SAL_CALL SvXMLImport::setEntityResolver( const uno::Reference< xml::sax::XEntityResolver >& Resolver )
+void SvXMLImport::setEntityResolver( const uno::Reference< xml::sax::XEntityResolver >& Resolver )
{
mxParser->setEntityResolver( Resolver );
}
-void SAL_CALL SvXMLImport::setLocale( const lang::Locale& rLocale )
+void SvXMLImport::setLocale( const lang::Locale& rLocale )
{
mxParser->setLocale( rLocale );
}
-void SAL_CALL SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::XFastNamespaceHandler >& Handler)
+void SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::XFastNamespaceHandler >& Handler)
{
mxParser->setNamespaceHandler( Handler );
}
-void SAL_CALL SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
+void SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
{
mxParser->setCustomEntityNames( replacements );
}
@@ -1039,8 +1039,7 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
}
}
- uno::Reference<lang::XInitialization> const xInit(mxParser, uno::UNO_QUERY_THROW);
- xInit->initialize( { Any(OUString("IgnoreMissingNSDecl")) });
+ mxParser->initialize( { Any(OUString("IgnoreMissingNSDecl")) });
}
// XServiceInfo