offapi/UnoApi_offapi.mk                                 |    1 
 offapi/com/sun/star/xml/sax/FastParser.idl              |   23 ++++++
 offapi/com/sun/star/xml/sax/FastShapeContextHandler.idl |    4 -
 oox/source/core/fastparser.cxx                          |    6 +
 oox/source/crypto/DocumentDecryption.cxx                |    9 --
 sax/qa/cppunit/parser.cxx                               |    7 --
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx   |   53 ++++------------
 writerfilter/source/ooxml/factoryimpl.xsl               |   11 ---
 8 files changed, 53 insertions(+), 61 deletions(-)

New commits:
commit 71eb27376a92f61c91567f2bfc2a74dba7192aab
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Dec 19 13:35:28 2013 +0100

    css.xml.sax service ctor clean-up
    
    Change-Id: I556904861e93a145cfe65f61218926851e4e8eb0

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index ccee741..0ad0451 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 0000000..4f23822
--- /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 e85334f..0944827 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 70e12a8..af79760 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 0e90139..6dee4de 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 52f6677..5ee1613 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 a50f449..2d192ad 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 07571b0..f9c486e 100644
--- a/writerfilter/source/ooxml/factoryimpl.xsl
+++ b/writerfilter/source/ooxml/factoryimpl.xsl
@@ -321,13 +321,7 @@ uno::Reference &lt; xml::sax::XFastParser &gt; 
OOXMLStreamImpl::getFastParser()
 {
     if (! mxFastParser.is())
     {
-        uno::Reference &lt; lang::XMultiComponentFactory &gt; xFactory = 
-            uno::Reference &lt; lang::XMultiComponentFactory &gt;
-            (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 &lt; xml::sax::XFastParser &gt; 
OOXMLStreamImpl::getFastParser()
 </xsl:template>
 
   <xsl:template match="/">
-    <xsl:text>    
+    <xsl:text>
+#include &lt;com/sun/star/xml/sax/FastParser.hpp&gt;
 #include "ooxml/OOXMLFactory.hxx"
 #include "ooxml/OOXMLFastHelper.hxx"
 #include "ooxml/OOXMLStreamImpl.hxx"
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to