diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 13:35:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 13:35:39 +0100 |
commit | 71eb27376a92f61c91567f2bfc2a74dba7192aab (patch) | |
tree | 5016e1ffb68d32f377226d8b2508076e946a09b6 | |
parent | 3b9b2e2d98ee3eb10dfdcbc27c5ead40f0335cb7 (diff) |
css.xml.sax service ctor clean-up
Change-Id: I556904861e93a145cfe65f61218926851e4e8eb0
-rwxr-xr-x | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/xml/sax/FastParser.idl | 23 | ||||
-rw-r--r-- | offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl | 4 | ||||
-rw-r--r-- | oox/source/core/fastparser.cxx | 6 | ||||
-rw-r--r-- | oox/source/crypto/DocumentDecryption.cxx | 9 | ||||
-rw-r--r-- | sax/qa/cppunit/parser.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 53 | ||||
-rw-r--r-- | writerfilter/source/ooxml/factoryimpl.xsl | 11 |
8 files changed, 53 insertions, 61 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index ccee74136520..0ad045111ad7 100755 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -457,6 +457,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 \ FastShapeContextHandler \ FastTokenHandler \ Parser \ 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..4f2382217f27 --- /dev/null +++ b/offapi/com/sun/star/xml/sax/FastParser.idl @@ -0,0 +1,23 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_COM_SUN_STAR_XML_SAX_FASTPARSER_IDL +#define INCLUDED_COM_SUN_STAR_XML_SAX_FASTPARSER_IDL + +#include <com/sun/star/xml/sax/XFastParser.idl> + +module com { module sun { module star { module xml { module sax { + +service FastParser: XFastParser; + +}; }; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl b/offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl index e85334faa728..094482793219 100644 --- a/offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl +++ b/offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl @@ -24,9 +24,7 @@ module com { module sun { module star { module xml { module sax { -service FastShapeContextHandler : XFastShapeContextHandler -{ -}; +service FastShapeContextHandler : XFastShapeContextHandler; }; }; }; }; }; diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx index 70e12a896098..af79760e0bfe 100644 --- a/oox/source/core/fastparser.cxx +++ b/oox/source/core/fastparser.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <com/sun/star/xml/sax/FastParser.hpp> #include "oox/core/fastparser.hxx" #include "oox/core/fasttokenhandler.hxx" @@ -72,8 +75,7 @@ FastParser::FastParser( const Reference< XComponentContext >& rxContext ) throw( mpParser(NULL) { // create a fast parser instance - Reference< XMultiComponentFactory > xFactory( rxContext->getServiceManager(), UNO_SET_THROW ); - mxParser.set( xFactory->createInstanceWithContext( "com.sun.star.xml.sax.FastParser", rxContext ), UNO_QUERY_THROW ); + mxParser = css::xml::sax::FastParser::create(rxContext); mpParser = dynamic_cast<sax_fastparser::FastSaxParser*>(mxParser.get()); // create the fast tokenhandler diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx index 0e9013997d6e..6dee4de0adf2 100644 --- a/oox/source/crypto/DocumentDecryption.cxx +++ b/oox/source/crypto/DocumentDecryption.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/xml/sax/XFastParser.hpp> #include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <com/sun/star/xml/sax/FastParser.hpp> #include <com/sun/star/xml/sax/FastToken.hpp> namespace oox { @@ -221,15 +222,11 @@ bool DocumentDecryption::readAgileEncryptionInfo(Reference< XInputStream >& xInp mEngine.reset(engine); AgileEncryptionInfo& info = engine->getInfo(); - Reference<XMultiComponentFactory> xFactory( mxContext->getServiceManager(), UNO_SET_THROW ); Reference<XFastDocumentHandler> xFastDocumentHandler( new AgileDocumentHandler(info) ); Reference<XFastTokenHandler> xFastTokenHandler ( new AgileTokenHandler ); - Reference<XFastParser> xParser; - xParser.set( xFactory->createInstanceWithContext( "com.sun.star.xml.sax.FastParser", mxContext ), UNO_QUERY_THROW ); - - if (!xParser.is()) - return false; + Reference<XFastParser> xParser( + css::xml::sax::FastParser::create(mxContext)); xParser->setFastDocumentHandler( xFastDocumentHandler ); xParser->setTokenHandler( xFastTokenHandler ); diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx index 52f66774c14a..5ee1613f2674 100644 --- a/sax/qa/cppunit/parser.cxx +++ b/sax/qa/cppunit/parser.cxx @@ -10,6 +10,7 @@ #include <sal/config.h> #include <com/sun/star/io/Pipe.hpp> +#include <com/sun/star/xml/sax/FastParser.hpp> #include <com/sun/star/xml/sax/FastTokenHandler.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <com/sun/star/xml/sax/XFastParser.hpp> @@ -44,11 +45,7 @@ private: void ParserTest::setUp() { test::BootstrapFixture::setUp(); - mxParser.set( - m_xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.xml.sax.FastParser", m_xContext), - uno::UNO_QUERY ); - CPPUNIT_ASSERT_MESSAGE("No FastParser!", mxParser.is()); + mxParser = css::xml::sax::FastParser::create(m_xContext); mxParser->setTokenHandler( css::xml::sax::FastTokenHandler::create(m_xContext)); } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index a50f449bd83c..2d192ad2441a 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -22,6 +22,7 @@ #include <set> #include <comphelper/servicehelper.hxx> #include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/xml/sax/FastShapeContextHandler.hpp> #include <resourcemodel/QNameToString.hxx> #include <resourcemodel/XPathLogger.hxx> #include <resourcemodel/util.hxx> @@ -56,7 +57,6 @@ static const sal_uInt8 cFieldEnd = 0x15; namespace writerfilter { namespace ooxml { -using ::com::sun::star::lang::XMultiComponentFactory; using namespace ::com::sun::star; using namespace ::std; @@ -2033,47 +2033,26 @@ OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape : OOXMLFastContextHandlerProperties(pContext), m_bShapeSent( false ), m_bShapeStarted(false) { - uno::Reference<uno::XComponentContext> xContext(getComponentContext()); - if (xContext.is()) + mrShapeContext.set( getDocument( )->getShapeContext( ) ); + if ( !mrShapeContext.is( ) ) { - uno::Reference<XMultiComponentFactory> rServiceManager - (xContext->getServiceManager()); - - mrShapeContext.set( getDocument( )->getShapeContext( ) ); - if ( !mrShapeContext.is( ) ) - { - // Define the shape context for the whole document - mrShapeContext.set - (rServiceManager-> - createInstanceWithContext - ("com.sun.star.xml.sax.FastShapeContextHandler", xContext), - uno::UNO_QUERY); - getDocument()->setShapeContext( mrShapeContext ); - } + // Define the shape context for the whole document + mrShapeContext = css::xml::sax::FastShapeContextHandler::create( + getComponentContext()); + getDocument()->setShapeContext( mrShapeContext ); + } - if (mrShapeContext.is()) - { - mrShapeContext->setModel(getDocument()->getModel()); - mrShapeContext->setDrawPage(getDocument()->getDrawPage()); - mrShapeContext->setInputStream(getDocument()->getStorageStream()); + mrShapeContext->setModel(getDocument()->getModel()); + mrShapeContext->setDrawPage(getDocument()->getDrawPage()); + mrShapeContext->setInputStream(getDocument()->getStorageStream()); #ifdef DEBUG_ELEMENT - debug_logger->startElement("setRelationFragmentPath"); - debug_logger->attribute("path", mpParserState->getTarget()); - debug_logger->endElement(); -#endif - mrShapeContext->setRelationFragmentPath - (mpParserState->getTarget()); - } -#ifdef DEBUG_CONTEXT_STACK - else - { - debug_logger->startElement("error"); - debug_logger->chars(std::string("failed to get shape handler")); - debug_logger->endElement(); - } + debug_logger->startElement("setRelationFragmentPath"); + debug_logger->attribute("path", mpParserState->getTarget()); + debug_logger->endElement(); #endif - } + mrShapeContext->setRelationFragmentPath + (mpParserState->getTarget()); } OOXMLFastContextHandlerShape::~OOXMLFastContextHandlerShape() diff --git a/writerfilter/source/ooxml/factoryimpl.xsl b/writerfilter/source/ooxml/factoryimpl.xsl index 07571b0d03cc..f9c486e6f853 100644 --- a/writerfilter/source/ooxml/factoryimpl.xsl +++ b/writerfilter/source/ooxml/factoryimpl.xsl @@ -321,13 +321,7 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser() { if (! mxFastParser.is()) { - uno::Reference < lang::XMultiComponentFactory > xFactory = - uno::Reference < lang::XMultiComponentFactory > - (mxContext->getServiceManager()); - - mxFastParser.set(xFactory->createInstanceWithContext - ( "com.sun.star.xml.sax.FastParser", - mxContext ), uno::UNO_QUERY_THROW); + mxFastParser = css::xml::sax::FastParser::create(mxContext); </xsl:text> <xsl:for-each select="//namespace-alias"> <xsl:text> @@ -346,7 +340,8 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser() </xsl:template> <xsl:template match="/"> - <xsl:text> + <xsl:text> +#include <com/sun/star/xml/sax/FastParser.hpp> #include "ooxml/OOXMLFactory.hxx" #include "ooxml/OOXMLFastHelper.hxx" #include "ooxml/OOXMLStreamImpl.hxx" |