diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-01 13:41:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-01 15:07:18 +0200 |
commit | e899a75fc6dd600ea9992c851a42734b334122b6 (patch) | |
tree | 1a54173803fc304f8af8802654ec147c6e6ad38d /sw | |
parent | 020d72fb85dac7a52eacb29731b8f2d536a2892d (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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/config/StoredChapterNumbering.cxx | 1 |
3 files changed, 14 insertions, 15 deletions
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> |