summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-01 13:41:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-01 15:07:18 +0200
commite899a75fc6dd600ea9992c851a42734b334122b6 (patch)
tree1a54173803fc304f8af8802654ec147c6e6ad38d
parent020d72fb85dac7a52eacb29731b8f2d536a2892d (diff)
Revert "Convert XFastParser into a normal C++ interface"
This reverts commit 5e68d6cfade45f40b1ad46025a81afe4cb8dd337. Reason for revert: Seems like outside users have been using this API Change-Id: I8814cf1eb4f000eeb4cbbb5db9c282d001465993 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152441 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, 410 insertions, 306 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 05697c36eaff..54bc946766d8 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -48,7 +48,6 @@ $(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 6362fc91beed..6eccb22be375 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
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
- if (pFastParser)
- pFastParser->parseStream(aParserInput);
+ Reference< xml::sax::XFastParser > xFastParser(xFilter, uno::UNO_QUERY);
+ if (xFastParser.is())
+ xFastParser->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 e8a2890c0b24..c26587c3ebad 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -36,6 +36,9 @@ 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 c32022e4e6dc..318da6536df9 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -56,6 +56,7 @@
#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>
@@ -71,7 +72,6 @@
#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
- rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
+ uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
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
- rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
+ uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
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 11c4be560342..d04e37a822bf 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -18,7 +18,6 @@
*/
#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 dd37086ab210..176530035ddd 100644
--- a/filter/Library_odfflatxml.mk
+++ b/filter/Library_odfflatxml.mk
@@ -27,7 +27,6 @@ $(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 7310b18149d8..e1157cca3059 100644
--- a/filter/Library_xmlfa.mk
+++ b/filter/Library_xmlfa.mk
@@ -35,7 +35,6 @@ $(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 0c76d193eb3b..4c838ab5f40e 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,9 +55,8 @@ 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,
- XExportFilter, DocumentHandlerAdapter, css::lang::XServiceInfo>,
- public XImportFilter2
+ class OdfFlatXml : public WeakImplHelper<XImportFilter, XImportFilter2,
+ XExportFilter, DocumentHandlerAdapter, css::lang::XServiceInfo>
{
private:
Reference< XComponentContext > m_xContext;
@@ -76,9 +75,9 @@ namespace filter::odfflatxml {
const Sequence< OUString >& userData) override;
// XImportFilter2
- virtual bool
+ virtual sal_Bool SAL_CALL
importer(const Sequence< PropertyValue >& sourceData,
- XFastParser& fastParser,
+ const Reference< XFastParser >& fastParser,
const Sequence< OUString >& userData) override;
// XExportFilter
@@ -143,9 +142,9 @@ OdfFlatXml::importer(
if ( xSeekable.is() )
xSeekable->seek( 0 );
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(docHandler.get());
- if( pFastParser )
- pFastParser->parseStream( inputSource );
+ css::uno::Reference< css::xml::sax::XFastParser > xFastParser (docHandler, UNO_QUERY );
+ if( xFastParser.is() )
+ xFastParser->parseStream( inputSource );
else
{
Reference<XParser> saxParser = Parser::create(m_xContext);
@@ -166,10 +165,10 @@ OdfFlatXml::importer(
return true;
}
-bool
+sal_Bool
OdfFlatXml::importer(
const Sequence< PropertyValue >& sourceData,
- XFastParser& rFastParser,
+ const Reference< XFastParser >& xFastParser,
const Sequence< OUString >& /* userData */)
{
// Read InputStream to read from and a URL used for the system id
@@ -202,7 +201,7 @@ OdfFlatXml::importer(
if ( xSeekable.is() )
xSeekable->seek( 0 );
- rFastParser.parseStream( inputSource );
+ xFastParser->parseStream( inputSource );
}
catch (const Exception &)
{
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 0fa97b717104..525f567b67c0 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -25,6 +25,7 @@
#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>
@@ -41,7 +42,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <unotools/pathoptions.hxx>
#include <xmloff/xmlimp.hxx>
-#include <sax/ximportfilter2.hxx>
+
#include <strings.hrc>
using namespace comphelper;
@@ -131,7 +132,7 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
xStatusIndicator->setValue(nSteps++);
Reference< XImportFilter > xConverter1( xConvBridge, UNO_QUERY );
- XImportFilter2* pConverter2 = dynamic_cast<XImportFilter2*>(xConvBridge.get());
+ Reference< XImportFilter2 > xConverter2( xConvBridge, UNO_QUERY );
// prevent unnecessary broadcasting when loading
Reference< XModel > xModel( mxDoc, UNO_QUERY );
@@ -169,12 +170,12 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
// Calling Filtering Component
try {
- XFastParser* pFastParser = dynamic_cast<XFastParser*>( xFilter.get() ); // SvXMLImport subclasses
+ Reference < XFastParser > xFastParser( xFilter, UNO_QUERY ); // SvXMLImport subclasses
Reference < XDocumentHandler > xDocHandler( xFilter, UNO_QUERY ); // XMLTransformer subclasses
- assert(pFastParser || xDocHandler);
- if (pConverter2 && pFastParser)
+ assert(xFastParser || xDocHandler);
+ if (xConverter2 && xFastParser)
{
- if (!pConverter2->importer(aDescriptor,*pFastParser,msUserData)) {
+ if (!xConverter2->importer(aDescriptor,xFastParser,msUserData)) {
if (xStatusIndicator.is())
xStatusIndicator->end();
return false;
@@ -188,9 +189,9 @@ bool XmlFilterAdaptor::importImpl( const Sequence< css::beans::PropertyValue >&
return false;
}
}
- else if (xConverter1 && pFastParser)
+ else if (xConverter1 && xFastParser)
{
- auto pImport = static_cast<SvXMLImport*>(pFastParser);
+ auto pImport = static_cast<SvXMLImport*>(xFastParser.get());
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 3ceb2a002cc8..44f9ce4d8172 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -46,8 +46,10 @@
#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>
@@ -64,8 +66,6 @@
#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, XExportFilter,
- ExtendedDocumentHandlerAdapter, XServiceInfo>, public XImportFilter2
+ class XSLTFilter : public WeakImplHelper<XImportFilter, XImportFilter2, XExportFilter,
+ ExtendedDocumentHandlerAdapter, XServiceInfo>
{
friend class XSLTFilterStreamListener;
private:
@@ -162,9 +162,9 @@ namespace XSLT
const Sequence<OUString>& msUserData) override;
// XImportFilter2
- virtual bool
- importer(const Sequence<PropertyValue>& aSourceData,
- XFastParser& xFastParser,
+ virtual sal_Bool SAL_CALL
+ importer(const Sequence<PropertyValue>& aSourceData, const css::uno::Reference<
+ XFastParser>& xFastParser,
const Sequence<OUString>& msUserData) override;
// XExportFilter
@@ -362,8 +362,8 @@ namespace XSLT
aInput.sPublicId = aURL;
aInput.aInputStream = pipein;
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(
- xHandler.get() );
+ css::uno::Reference< css::xml::sax::XFastParser > xFastParser(
+ xHandler, css::uno::UNO_QUERY );
// transform
m_tcontrol->start();
@@ -394,8 +394,8 @@ namespace XSLT
result = m_cTransformed.wait(&timeout);
};
if (!m_bError) {
- if( pFastParser )
- pFastParser->parseStream( aInput );
+ if( xFastParser.is() )
+ xFastParser->parseStream( aInput );
else
{
// create SAX parser that will read the document file
@@ -422,9 +422,9 @@ namespace XSLT
}
}
- bool
+ sal_Bool
XSLTFilter::importer(const Sequence<PropertyValue>& aSourceData,
- XFastParser& rFastParser, const Sequence<
+ const css::uno::Reference<XFastParser>& xFastParser, const Sequence<
OUString>& msUserData)
{
if (msUserData.getLength() < 5)
@@ -461,9 +461,10 @@ 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 (xInputStream.is() && m_tcontrol.is())
+ if (xFastParser.is() && xInputStream.is() && m_tcontrol.is())
{
try
{
@@ -520,7 +521,7 @@ namespace XSLT
result = m_cTransformed.wait(&timeout);
};
if (!m_bError)
- rFastParser.parseStream( aInput );
+ xFastParser->parseStream( aInput );
m_tcontrol->terminate();
return !m_bError;
}
diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml
index c6b3e170645c..7a225d3b9488 100644
--- a/include/IwyuFilter_include.yaml
+++ b/include/IwyuFilter_include.yaml
@@ -285,6 +285,7 @@ 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
@@ -432,6 +433,7 @@ 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 4e884e9c0993..fe388fce21cc 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -20,10 +20,11 @@
#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>
@@ -39,8 +40,10 @@ class FastSaxParserImpl;
// This class implements the external Parser interface
class SAX_DLLPUBLIC FastSaxParser final
- : public ::cppu::WeakImplHelper<css::lang::XInitialization, css::lang::XServiceInfo>,
- public XFastParser
+ : public ::cppu::WeakImplHelper<
+ css::lang::XInitialization,
+ css::xml::sax::XFastParser,
+ css::lang::XServiceInfo >
{
std::unique_ptr<FastSaxParserImpl> mpImpl;
@@ -52,16 +55,16 @@ public:
virtual void SAL_CALL initialize(css::uno::Sequence<css::uno::Any> const& rArguments) override;
// XFastParser
- 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;
+ 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;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
diff --git a/include/sax/xfastparser.hxx b/include/sax/xfastparser.hxx
deleted file mode 100644
index 84282162db68..000000000000
--- a/include/sax/xfastparser.hxx
+++ /dev/null
@@ -1,69 +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 .
- */
-#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
deleted file mode 100644
index 9428e46e101e..000000000000
--- a/include/sax/ximportfilter2.hxx
+++ /dev/null
@@ -1,43 +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 .
- */
-#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 52a60269122a..3287911f1112 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/XFastNamespaceHandler.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -42,7 +42,6 @@
#include <cppuhelper/implbase.hxx>
#include <xmloff/formlayerimport.hxx>
#include <sax/fastattribs.hxx>
-#include <sax/xfastparser.hxx>
#include <rtl/ustring.hxx>
#include <unordered_map>
@@ -57,7 +56,6 @@ 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; }
@@ -73,8 +71,6 @@ namespace com::sun::star {
namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
namespace comphelper { class AttributeList; }
-namespace sax_fastparser { class FastSaxParser; }
-
namespace xmloff {
class RDFaImportHelper;
}
@@ -184,7 +180,8 @@ class XMLOFF_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SvXMLImport : public c
css::lang::XServiceInfo,
css::lang::XInitialization,
css::document::XImporter,
- css::document::XFilter>, public XFastParser
+ css::document::XFilter,
+ css::xml::sax::XFastParser>
{
friend class SvXMLImportContext;
friend class SvXMLLegacyToFastDocHandler;
@@ -231,7 +228,7 @@ class XMLOFF_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") SvXMLImport : public c
SvXMLImportFlags mnImportFlags;
std::set< OUString > m_embeddedFontUrlsKnown;
- rtl::Reference< sax_fastparser::FastSaxParser > mxParser;
+ css::uno::Reference< css::xml::sax::XFastParser > mxParser;
rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler;
rtl::Reference < comphelper::AttributeList > maNamespaceAttrList;
css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler;
@@ -334,16 +331,16 @@ public:
const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override;
// XFastParser
- 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;
+ 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;
// 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 f266da0e83e7..7ee71bb984c1 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -473,6 +473,7 @@ $(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 \
@@ -4267,6 +4268,7 @@ $(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 \
@@ -4384,6 +4386,7 @@ $(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
new file mode 100644
index 000000000000..3d1ae5bcdae2
--- /dev/null
+++ b/offapi/com/sun/star/xml/XImportFilter2.idl
@@ -0,0 +1,61 @@
+/* -*- 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
new file mode 100644
index 000000000000..5eaa3482a22c
--- /dev/null
+++ b/offapi/com/sun/star/xml/sax/FastParser.idl
@@ -0,0 +1,16 @@
+/* -*- 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
new file mode 100644
index 000000000000..8f17b3ddaf87
--- /dev/null
+++ b/offapi/com/sun/star/xml/sax/XFastParser.idl
@@ -0,0 +1,148 @@
+/* -*- 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 22ba37c7d671..53e5eb78a849 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -20,7 +20,6 @@
#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 7a667943d8e2..f7518498171d 100644
--- a/oox/source/crypto/AgileEngine.cxx
+++ b/oox/source/crypto/AgileEngine.cxx
@@ -26,12 +26,11 @@
#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/XFastDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
using namespace css;
using namespace css::beans;
@@ -522,7 +521,7 @@ bool AgileEngine::readEncryptionInfo(uno::Reference<io::XInputStream> & rxInputS
Reference<XFastDocumentHandler> xFastDocumentHandler(new AgileDocumentHandler(mInfo));
Reference<XFastTokenHandler> xFastTokenHandler(new AgileTokenHandler);
- rtl::Reference<sax_fastparser::FastSaxParser> xParser = new sax_fastparser::FastSaxParser;
+ Reference<XFastParser> xParser(css::xml::sax::FastParser::create(comphelper::getProcessComponentContext()));
xParser->setFastDocumentHandler(xFastDocumentHandler);
xParser->setTokenHandler(xFastTokenHandler);
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 1ad8d01bffbd..caf2c7b9907c 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< XInterface > xInstance =
- rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext);
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xInstance.get());
+ Reference< XFastParser > xFastParser(
+ rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext),
+ uno::UNO_QUERY_THROW );
uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
// read from the stream
return ReadThroughComponent( xInputStream
,xModelComponent
,rxContext
- ,pFastParser );
+ ,xFastParser );
}
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 88e0ebd90cf9..261091fe8769 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -12,7 +12,6 @@
#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 dbc9822c566d..1f72eccf3145 100644
--- a/sax/source/expatwrap/expwrap.component
+++ b/sax/source/expatwrap/expwrap.component
@@ -27,6 +27,10 @@
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 d92d0de0321d..344dda9cd63e 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -19,7 +19,6 @@
#include <sax/fastparser.hxx>
#include <sax/fastattribs.hxx>
-#include <sax/ximportfilter2.hxx>
#include <utility>
#include <xml2utf.hxx>
@@ -28,13 +27,8 @@
#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>
@@ -1490,9 +1484,9 @@ void FastSaxParser::registerNamespace( const OUString& NamespaceURL, sal_Int32 N
mpImpl->registerNamespace(NamespaceURL, NamespaceToken);
}
-OUString FastSaxParser::getNamespaceURL( std::u16string_view aPrefix )
+OUString FastSaxParser::getNamespaceURL( const OUString& rPrefix )
{
- return mpImpl->getNamespaceURL(aPrefix);
+ return mpImpl->getNamespaceURL(rPrefix);
}
void FastSaxParser::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
@@ -1681,9 +1675,5 @@ 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 8dd5e5379aa0..62e7b8a57a88 100644
--- a/sax/source/fastparser/legacyfastparser.cxx
+++ b/sax/source/fastparser/legacyfastparser.cxx
@@ -19,16 +19,13 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/sax/XParser.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/xml/sax/FastParser.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>
@@ -118,7 +115,7 @@ public:
sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
private:
- rtl::Reference< sax_fastparser::FastSaxParser > m_xParser;
+ Reference< XFastParser > m_xParser;
Reference< XDocumentHandler > m_xDocumentHandler;
Reference< XFastTokenHandler > m_xTokenHandler;
@@ -284,7 +281,7 @@ void SAL_CALL CallbackDocumentHandler::characters( const OUString& aChars )
}
SaxLegacyFastParser::SaxLegacyFastParser( ) : m_aNamespaceHandler( new NamespaceHandler ),
- m_xParser(new sax_fastparser::FastSaxParser)
+ m_xParser(FastParser::create(::comphelper::getProcessComponentContext() ))
{
m_xParser->setNamespaceHandler( m_aNamespaceHandler );
}
@@ -311,7 +308,9 @@ void SAL_CALL SaxLegacyFastParser::initialize(Sequence< Any > const& rArguments
}
else
{
- m_xParser->initialize( rArguments );
+ uno::Reference<lang::XInitialization> const xInit(m_xParser,
+ uno::UNO_QUERY_THROW);
+ xInit->initialize( rArguments );
}
}
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index d403bc4cff26..3546bfe5f043 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -40,6 +40,7 @@
#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>
@@ -179,9 +180,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
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xImportInterface.get());
- if (pFastParser)
- pFastParser->parseStream( aParserInput );
+ uno::Reference< xml::sax::XFastParser > xFastParser(xImportInterface, uno::UNO_QUERY);
+ if (xFastParser)
+ xFastParser->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 65aa70b8fe96..242af4bd3a00 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -24,6 +24,7 @@
#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>
@@ -33,7 +34,6 @@
#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,12 +225,11 @@ Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFac
aParserInput.aInputStream = xInputStream;
// get filter
- Reference< XInterface > xInterface( xServiceFactory->createInstance("com.sun.star.comp.Xmloff.AnimationsImport" ) );
- XFastParser* pFilter = dynamic_cast<XFastParser*>(xInterface.get());
+ Reference< xml::sax::XFastParser > xFilter( xServiceFactory->createInstance("com.sun.star.comp.Xmloff.AnimationsImport" ), UNO_QUERY_THROW );
- pFilter->parseStream( aParserInput );
+ xFilter->parseStream( aParserInput );
- Reference< XAnimationNodeSupplier > xAnimationNodeSupplier( xInterface, UNO_QUERY_THROW );
+ Reference< XAnimationNodeSupplier > xAnimationNodeSupplier( xFilter, UNO_QUERY_THROW );
xRootNode = xAnimationNodeSupplier->getAnimationNode();
}
catch (const Exception&)
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index db64ba8e88b6..91c4dc600703 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/InputSource.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <sfx2/dispatch.hxx>
@@ -40,7 +40,6 @@
#include <rtl/bootstrap.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/streamwrap.hxx>
-#include <sax/xfastparser.hxx>
#include <tools/stream.hxx>
#include <tools/UnitConversion.hxx>
@@ -647,9 +646,9 @@ void SdDrawDocument::CreateDefaultCellStyles()
css::xml::sax::InputSource aParserInput;
aParserInput.sPublicId = aURL;
aParserInput.aInputStream = xInputStream;
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xImporter.get());
- if (pFastParser)
- pFastParser->parseStream(aParserInput);
+ Reference<css::xml::sax::XFastParser> xFastParser(xImporter, UNO_QUERY);
+ if (xFastParser)
+ xFastParser->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 ad36030f5e1c..43c3d0d7766d 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -28,7 +28,6 @@
#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>
@@ -46,6 +45,7 @@
#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;
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ Reference< xml::sax::XFastParser > xFastParser(xFilter, UNO_QUERY);
Reference< xml::sax::XDocumentHandler > xDocumentHandler;
- if (!pFastParser)
+ if (!xFastParser)
xDocumentHandler.set(xFilter, UNO_QUERY);
- if (!pFastParser && !xDocumentHandler)
+ if (!xFastParser && !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 (pFastParser)
- pFastParser->parseStream( aParserInput );
+ if (xFastParser)
+ xFastParser->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 431e2455668a..7d1f16c01fd9 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -48,6 +48,7 @@
#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>
@@ -73,7 +74,6 @@
#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);
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ css::uno::Reference<css::xml::sax::XFastParser> xFastParser(xFilter, css::uno::UNO_QUERY);
css::uno::Reference<css::document::XImporter> xImp(xFilter, css::uno::UNO_QUERY_THROW);
xImp->setTargetDocument(css::uno::Reference<css::lang::XComponent>(this));
try {
- if (pFastParser)
- pFastParser->parseStream(input);
+ if (xFastParser)
+ xFastParser->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 3469926f95b1..6dc5def61b1a 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -321,6 +321,7 @@ 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 be8d80e7aeae..55666de2c6e3 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -5522,7 +5522,6 @@ 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 f653705b1391..8a0463283286 100644
--- a/starmath/source/mathml/import.cxx
+++ b/starmath/source/mathml/import.cxx
@@ -17,6 +17,7 @@
#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>
@@ -28,8 +29,6 @@
#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>
@@ -394,17 +393,17 @@ ErrCode SmMLImportWrapper::ReadThroughComponentIS(
// Finally, parser the stream
try
{
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ Reference<css::xml::sax::XFastParser> xFastParser(xFilter, UNO_QUERY);
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilter, UNO_QUERY);
- if (pFastParser)
+ if (xFastParser)
{
- pFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
- pFastParser->parseStream(aParserInput);
+ xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
+ xFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- rtl::Reference<sax_fastparser::FastSaxParser> xParser
- = new sax_fastparser::FastSaxParser;
+ Reference<css::xml::sax::XFastParser> xParser
+ = css::xml::sax::FastParser::create(rxContext);
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 4fcd1e4dc76c..a33a4015846f 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -22,6 +22,7 @@ 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>
@@ -39,7 +40,6 @@ 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
{
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ Reference<css::xml::sax::XFastParser> xFastParser(xFilter, UNO_QUERY);
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilter, UNO_QUERY);
- if (pFastParser)
+ if (xFastParser)
{
if (bUseHTMLMLEntities)
- pFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
- pFastParser->parseStream(aParserInput);
+ xFastParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
+ xFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- rtl::Reference<sax_fastparser::FastSaxParser> xParser
- = new sax_fastparser::FastSaxParser;
+ Reference<css::xml::sax::XFastParser> xParser
+ = css::xml::sax::FastParser::create(rxContext);
if (bUseHTMLMLEntities)
xParser->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntities);
xParser->setFastDocumentHandler(xFastDocHandler);
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 79e65373a496..d6bc3870ce08 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);
- XFastParser* pFastParser = dynamic_cast<XFastParser*>( xFilter.get() );
- assert(pFastParser);
+ uno::Reference< xml::sax::XFastParser > xFastParser( xFilter, UNO_QUERY );
+ assert(xFastParser);
bRet = false;
- if( pFastParser )
+ if( xFastParser.is() )
{
// connect model and filter
uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
xImporter->setTargetDocument( xTargetDocument );
// finally, parser the stream
- pFastParser->parseStream( aParserInput );
+ xFastParser->parseStream( aParserInput );
bRet = true;
}
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index e653f5695872..19c2a66ce1bb 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -21,7 +21,6 @@
#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 ffe4872dc28f..e8a2b088e67c 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -20,7 +20,6 @@
#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>
@@ -30,6 +29,7 @@
#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
- rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
+ uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
xParser->setFastDocumentHandler( xFilter );
xParser->setTokenHandler( xTokenHandler );
@@ -214,16 +214,16 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
// parse the stream
try
{
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilterInt.get());
+ Reference<css::xml::sax::XFastParser> xFastParser(xFilterInt, UNO_QUERY);
Reference<css::xml::sax::XFastDocumentHandler> xFastDocHandler(xFilterInt, UNO_QUERY);
- if (pFastParser)
+ if (xFastParser)
{
- pFastParser->parseStream(aParserInput);
+ xFastParser->parseStream(aParserInput);
}
else if (xFastDocHandler)
{
- rtl::Reference<sax_fastparser::FastSaxParser> xParser
- = new sax_fastparser::FastSaxParser;
+ Reference<css::xml::sax::XFastParser> xParser
+ = css::xml::sax::FastParser::create(xContext);
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
- rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
+ uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
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
- rtl::Reference< sax_fastparser::FastSaxParser > xParser = new sax_fastparser::FastSaxParser;
+ uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
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 31ee26289830..b679f111a3b6 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
- XFastParser* pFastParser = dynamic_cast<XFastParser*>(xFilter.get());
+ uno::Reference< xml::sax::XFastParser > xFastParser(xFilter, UNO_QUERY);
uno::Reference< xml::sax::XDocumentHandler > xDocumentHandler;
- if (!pFastParser)
+ if (!xFastParser)
xDocumentHandler.set(xFilter, UNO_QUERY);
- if (!xDocumentHandler && !pFastParser)
+ if (!xDocumentHandler && !xFastParser)
{
SAL_WARN("sd", "service does not implement XFastParser or XDocumentHandler");
assert(false);
@@ -177,8 +177,8 @@ ErrCode ReadThroughComponent(
// finally, parse the stream
try
{
- if (pFastParser)
- pFastParser->parseStream( aParserInput );
+ if (xFastParser)
+ xFastParser->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 eab7ad13022c..fd3cb6e4a39c 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -15,7 +15,6 @@
#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 7fd5462d2e60..6b47ab752177 100644
--- a/writerfilter/inc/ooxml/OOXMLDocument.hxx
+++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx
@@ -25,6 +25,7 @@
#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>
@@ -66,8 +67,6 @@
core API to insert the according elements to the core.
*/
-namespace sax_fastparser { class FastSaxParser; }
-
namespace writerfilter::ooxml
{
@@ -81,7 +80,7 @@ public:
/**
Returns fast parser for this stream.
*/
- virtual rtl::Reference<sax_fastparser::FastSaxParser> getFastParser() = 0;
+ virtual css::uno::Reference<css::xml::sax::XFastParser> 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 35f70c01e01b..3a7359df22e4 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;
- rtl::Reference<sax_fastparser::FastSaxParser> xParser(mpStream->getFastParser());
+ uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
if (xParser.is())
{
@@ -445,7 +445,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
return;
}
- rtl::Reference<sax_fastparser::FastSaxParser> xParser(mpStream->getFastParser());
+ uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
if (mxModel.is())
{
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
index eb5a9c36376f..ec65290c6214 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.hxx
@@ -22,7 +22,6 @@
#include <ooxml/OOXMLDocument.hxx>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
-#include <sax/fastparser.hxx>
extern OUString customTarget;
extern OUString embeddingsTarget;
@@ -39,7 +38,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;
- rtl::Reference<sax_fastparser::FastSaxParser> mxFastParser;
+ css::uno::Reference<css::xml::sax::XFastParser> mxFastParser;
css::uno::Reference<css::xml::sax::XFastTokenHandler> mxFastTokenHandler;
StreamType_t mnStreamType;
@@ -68,7 +67,7 @@ public:
virtual ~OOXMLStreamImpl() override;
- virtual rtl::Reference<sax_fastparser::FastSaxParser> getFastParser() override;
+ virtual css::uno::Reference<css::xml::sax::XFastParser> 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 302ecf47eca4..c68d5ba06160 100644
--- a/writerfilter/source/ooxml/factoryimpl.py
+++ b/writerfilter/source/ooxml/factoryimpl.py
@@ -147,14 +147,15 @@ std::string fastTokenToId(sal_uInt32 nToken)
def getFastParser():
- print("""rtl::Reference<sax_fastparser::FastSaxParser> OOXMLStreamImpl::getFastParser()
+ print("""uno::Reference <xml::sax::XFastParser> OOXMLStreamImpl::getFastParser()
{
if (!mxFastParser.is())
{
- mxFastParser = new sax_fastparser::FastSaxParser;
+ mxFastParser = css::xml::sax::FastParser::create(mxContext);
// 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")) };
- mxFastParser->initialize(args);
+ xInit->initialize(args);
""")
for url in sorted(ooxUrlAliases.keys()):
print(""" mxFastParser->registerNamespace("%s", oox::NMSP_%s);""" % (url, ooxUrlAliases[url]))
@@ -169,7 +170,7 @@ def getFastParser():
def createImpl(model):
print("""
-#include <sax/fastparser.hxx>
+#include <com/sun/star/xml/sax/FastParser.hpp>
#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 979a7233c970..a3c5e6fb31d6 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -57,6 +57,7 @@
#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>
@@ -75,7 +76,6 @@
#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 = new sax_fastparser::FastSaxParser;
+ mxParser = xml::sax::FastParser::create( xContext );
setNamespaceHandler( maNamespaceHandler );
setTokenHandler( xTokenHandler );
if ( !bIsNSMapsInitialized )
@@ -479,9 +479,9 @@ namespace
class setFastDocumentHandlerGuard
{
private:
- rtl::Reference<sax_fastparser::FastSaxParser> mxParser;
+ css::uno::Reference<css::xml::sax::XFastParser> mxParser;
public:
- setFastDocumentHandlerGuard(rtl::Reference<sax_fastparser::FastSaxParser> Parser,
+ setFastDocumentHandlerGuard(css::uno::Reference<css::xml::sax::XFastParser> Parser,
const css::uno::Reference<css::xml::sax::XFastDocumentHandler>& Handler)
: mxParser(std::move(Parser))
{
@@ -496,53 +496,53 @@ namespace
}
// XFastParser
-void SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource )
+void SAL_CALL SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource )
{
setFastDocumentHandlerGuard aDocumentHandlerGuard(mxParser, mxFastDocumentHandler.is() ? mxFastDocumentHandler : this);
mxParser->parseStream(aInputSource);
}
-void SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler )
+void SAL_CALL SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler )
{
mxFastDocumentHandler = Handler;
}
-void SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler )
+void SAL_CALL SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler )
{
mxParser->setTokenHandler( Handler );
}
-void SvXMLImport::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
+void SAL_CALL SvXMLImport::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
{
mxParser->registerNamespace( NamespaceURL, NamespaceToken );
}
-OUString SvXMLImport::getNamespaceURL( std::u16string_view aPrefix )
+OUString SAL_CALL SvXMLImport::getNamespaceURL( const OUString& rPrefix )
{
- return mxParser->getNamespaceURL( aPrefix );
+ return mxParser->getNamespaceURL( rPrefix );
}
-void SvXMLImport::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
+void SAL_CALL SvXMLImport::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
{
mxParser->setErrorHandler( Handler );
}
-void SvXMLImport::setEntityResolver( const uno::Reference< xml::sax::XEntityResolver >& Resolver )
+void SAL_CALL SvXMLImport::setEntityResolver( const uno::Reference< xml::sax::XEntityResolver >& Resolver )
{
mxParser->setEntityResolver( Resolver );
}
-void SvXMLImport::setLocale( const lang::Locale& rLocale )
+void SAL_CALL SvXMLImport::setLocale( const lang::Locale& rLocale )
{
mxParser->setLocale( rLocale );
}
-void SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::XFastNamespaceHandler >& Handler)
+void SAL_CALL SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::XFastNamespaceHandler >& Handler)
{
mxParser->setNamespaceHandler( Handler );
}
-void SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
+void SAL_CALL SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
{
mxParser->setCustomEntityNames( replacements );
}
@@ -1039,7 +1039,8 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
}
}
- mxParser->initialize( { Any(OUString("IgnoreMissingNSDecl")) });
+ uno::Reference<lang::XInitialization> const xInit(mxParser, uno::UNO_QUERY_THROW);
+ xInit->initialize( { Any(OUString("IgnoreMissingNSDecl")) });
}
// XServiceInfo