diff options
-rw-r--r-- | include/oox/core/fastparser.hxx | 17 | ||||
-rw-r--r-- | include/oox/core/xmlfilterbase.hxx | 2 | ||||
-rw-r--r-- | oox/source/core/fastparser.cxx | 8 | ||||
-rw-r--r-- | oox/source/core/filterdetect.cxx | 2 | ||||
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 7 | ||||
-rw-r--r-- | oox/source/docprop/ooxmldocpropimport.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/revisionfragment.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookfragment.cxx | 4 |
8 files changed, 20 insertions, 24 deletions
diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx index 69cc111c4b49..d28e724e84b0 100644 --- a/include/oox/core/fastparser.hxx +++ b/include/oox/core/fastparser.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/xml/sax/SAXException.hpp> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <sal/types.h> namespace com { namespace sun { namespace star { @@ -57,10 +58,12 @@ class FastParser { public: /// @throws css::uno::RuntimeException - explicit FastParser( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ) + explicit FastParser() throw( css::uno::RuntimeException ); + FastParser(const FastParser&) = delete; + FastParser& operator=(const FastParser&) = delete; + virtual ~FastParser(); /** Registers an OOXML namespace at the parser. @@ -110,13 +113,9 @@ public: getTokenHandler() const { return mxTokenHandler; } private: - css::uno::Reference< css::xml::sax::XFastParser > - mxParser; - css::uno::Reference< css::xml::sax::XFastTokenHandler > - mxTokenHandler; - const NamespaceMap& mrNamespaceMap; - - sax_fastparser::FastSaxParser* mpParser; + css::uno::Reference<css::xml::sax::XFastTokenHandler> mxTokenHandler; + const NamespaceMap& mrNamespaceMap; + rtl::Reference<sax_fastparser::FastSaxParser> mxParser; }; diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx index c9769d7fadb8..51497836a885 100644 --- a/include/oox/core/xmlfilterbase.hxx +++ b/include/oox/core/xmlfilterbase.hxx @@ -230,7 +230,7 @@ public: void importDocumentProperties(); - FastParser* createParser() const; + static FastParser* createParser(); bool isMSO2007Document() const; diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx index 54b07b18102c..ce0a6c0a89f9 100644 --- a/oox/source/core/fastparser.cxx +++ b/oox/source/core/fastparser.cxx @@ -63,13 +63,11 @@ InputStreamCloseGuard::~InputStreamCloseGuard() } // namespace -FastParser::FastParser( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) : - mrNamespaceMap( StaticNamespaceMap::get() ), - mpParser(nullptr) +FastParser::FastParser() throw( RuntimeException ) : + mrNamespaceMap( StaticNamespaceMap::get() ) { // create a fast parser instance - mxParser = css::xml::sax::FastParser::create(rxContext); - mpParser = dynamic_cast<sax_fastparser::FastSaxParser*>(mxParser.get()); + mxParser = new sax_fastparser::FastSaxParser; // create the fast tokenhandler mxTokenHandler.set( new FastTokenHandler ); diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index f7a8f8125df5..c333db3fb25a 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -403,7 +403,7 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq if( aZipStorage.isStorage() ) { // create the fast parser, register the XML namespaces, set document handler - FastParser aParser( mxContext ); + FastParser aParser; aParser.registerNamespace( NMSP_packageRel ); aParser.registerNamespace( NMSP_officeRel ); aParser.registerNamespace( NMSP_packageContentTypes ); diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 48da8c7cbe71..21f0b505e986 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -188,7 +188,6 @@ struct XmlFilterBaseImpl XmlFilterBaseImpl::XmlFilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) : mxContext(rxContext), - maFastParser( rxContext ), maBinSuffix( ".bin" ), mrNamespaceMap(StaticNamespaceMap::get()) { @@ -268,9 +267,9 @@ void XmlFilterBase::importDocumentProperties() checkDocumentProperties(xDocProps); } -FastParser* XmlFilterBase::createParser() const +FastParser* XmlFilterBase::createParser() { - FastParser* pParser = new FastParser(getComponentContext()); + FastParser* pParser = new FastParser; registerNamespaces(*pParser); return pParser; } @@ -305,7 +304,7 @@ OUString XmlFilterBase::getFragmentPathFromFirstTypeFromOfficeDoc( const OUStrin bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHandler ) { - FastParser aParser(mxImpl->mxContext); + FastParser aParser; registerNamespaces(aParser); return importFragment(rxHandler, aParser); } diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx index 1aa4c4a09ce8..2d78d30517e3 100644 --- a/oox/source/docprop/ooxmldocpropimport.cxx +++ b/oox/source/docprop/ooxmldocpropimport.cxx @@ -159,7 +159,7 @@ void SAL_CALL DocumentPropertiesImport::importProperties( if( aCoreStreams.getLength() > 1 ) throw IOException( "Unexpected core properties stream!" ); - ::oox::core::FastParser aParser( mxContext ); + ::oox::core::FastParser aParser; aParser.registerNamespace( NMSP_packageMetaCorePr ); aParser.registerNamespace( NMSP_dc ); aParser.registerNamespace( NMSP_dcTerms ); diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index 928d71ec857f..6708b4e3f8b5 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -265,7 +265,7 @@ void RevisionHeadersFragment::finalizeImport() const RevisionMetadata& rData = it->second; pCT->SetUser(rData.maUserName); pCT->SetFixDateTimeLocal(rData.maDateTime); - std::unique_ptr<oox::core::FastParser> xParser(getOoxFilter().createParser()); + std::unique_ptr<oox::core::FastParser> xParser(oox::core::XmlFilterBase::createParser()); rtl::Reference<oox::core::FragmentHandler> xFragment(new RevisionLogFragment(*this, aPath, *pCT)); importOoxFragment(xFragment, *xParser); } diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index add959cdec18..bf19e87c71d9 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -244,7 +244,7 @@ public: SAL_INFO( "sc.filter", "got solar\n" ); std::unique_ptr<oox::core::FastParser> xParser( - mrWorkbookHandler.getOoxFilter().createParser() ); + oox::core::XmlFilterBase::createParser() ); SAL_INFO( "sc.filter", "start import\n" ); mrWorkbookHandler.importOoxFragment( mxHandler, *xParser ); @@ -504,7 +504,7 @@ void WorkbookFragment::finalizeImport() OUString aRevHeadersPath = getFragmentPathFromFirstType(CREATE_OFFICEDOC_RELATION_TYPE("revisionHeaders")); if (!aRevHeadersPath.isEmpty()) { - std::unique_ptr<oox::core::FastParser> xParser(getOoxFilter().createParser()); + std::unique_ptr<oox::core::FastParser> xParser(oox::core::XmlFilterBase::createParser()); rtl::Reference<oox::core::FragmentHandler> xFragment(new RevisionHeadersFragment(*this, aRevHeadersPath)); importOoxFragment(xFragment, *xParser); } |