summaryrefslogtreecommitdiff
path: root/sw/source
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 /sw/source
parentf15a6e1b1b186bf42e1ade05630d17841add2c46 (diff)
Convert XFastParser into a normal C++ interface
There is no need for it to be an UNO interface anymore (ever since we started supporting dynamic_cast on UNO objects). Which means that XImportFilter2 also needs become a C++ interface. Change-Id: Ice2db0f098271bba32b199bd083b08cb8410ce93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152388 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-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
3 files changed, 15 insertions, 14 deletions
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>