summaryrefslogtreecommitdiff
path: root/svgio/source/svguno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-11-22 11:51:47 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-11-22 11:51:47 +0100
commit722fffd68854c57c5d8f82bd71d8799d9982f016 (patch)
treeb950573ad039054563be695d8628f16b08e10f04 /svgio/source/svguno
parent90ddb6cce222580fc7dc3450c033e39edc01aecc (diff)
Some svgio clean-up
Change-Id: I48adf3b0500f3e4e37fbe444f8a0773d273e09d2
Diffstat (limited to 'svgio/source/svguno')
-rw-r--r--svgio/source/svguno/svguno.cxx78
-rw-r--r--svgio/source/svguno/xsvgparser.cxx23
-rw-r--r--svgio/source/svguno/xsvgparser.hxx53
3 files changed, 84 insertions, 70 deletions
diff --git a/svgio/source/svguno/svguno.cxx b/svgio/source/svguno/svguno.cxx
index 41cc46168b82..0f241bcfe344 100644
--- a/svgio/source/svguno/svguno.cxx
+++ b/svgio/source/svguno/svguno.cxx
@@ -17,76 +17,30 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <svgio/svgiodllapi.h>
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <uno/environment.h>
-#include <cppuhelper/factory.hxx>
+#include "sal/config.h"
-//////////////////////////////////////////////////////////////////////////////
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "sal/types.h"
-using namespace ::com::sun::star;
+#include "xsvgparser.hxx"
-//////////////////////////////////////////////////////////////////////////////
-// predefines
+namespace {
-namespace svgio
-{
- namespace svgreader
- {
- extern uno::Sequence< rtl::OUString > SAL_CALL XSvgParser_getSupportedServiceNames();
- extern rtl::OUString SAL_CALL XSvgParser_getImplementationName();
- extern uno::Reference< uno::XInterface > SAL_CALL XSvgParser_createInstance( const uno::Reference< lang::XMultiServiceFactory > & );
- } // end of namespace svgreader
-} // end of namespace svgio
-
-//////////////////////////////////////////////////////////////////////////////
-// component_getImplementationEnvironment
+static cppu::ImplementationEntry const services[] = {
+ { &svgio::svgreader::XSvgParser_createInstance,
+ &svgio::svgreader::XSvgParser_getImplementationName,
+ &svgio::svgreader::XSvgParser_getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 } };
-extern "C"
-{
- SVGIO_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
- {
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
}
-//////////////////////////////////////////////////////////////////////////////
-// component_getFactory
-
-extern "C"
+extern "C" SAL_DLLPUBLIC void * SAL_CALL svgio_component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
{
- SVGIO_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
- {
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = 0;
-
- if(svgio::svgreader::XSvgParser_getImplementationName().equalsAscii(pImplName))
- {
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< lang::XMultiServiceFactory * >(pServiceManager),
- svgio::svgreader::XSvgParser_getImplementationName(),
- svgio::svgreader::XSvgParser_createInstance,
- svgio::svgreader::XSvgParser_getSupportedServiceNames());
- }
-
- if(xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
- }
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
}
-//////////////////////////////////////////////////////////////////////////////
-// eof
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx
index d08080f8fb13..26a81c0b5e75 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -17,15 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
+
#include <com/sun/star/graphic/XSvgParser.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase2.hxx>
#include <svgio/svgreader/svgdocumenthandler.hxx>
#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <comphelper/processfactory.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include "xsvgparser.hxx"
+
//////////////////////////////////////////////////////////////////////////////
using namespace ::com::sun::star;
@@ -42,9 +46,12 @@ namespace svgio
XSvgParser(const XSvgParser&);
XSvgParser& operator=(const XSvgParser&);
+ uno::Reference< uno::XComponentContext > context_;
+
protected:
public:
- XSvgParser();
+ XSvgParser(
+ uno::Reference< uno::XComponentContext > const & context);
virtual ~XSvgParser();
// XSvgParser
@@ -80,9 +87,9 @@ namespace svgio
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "svgio::svgreader::XSvgParser" ) );
}
- uno::Reference< uno::XInterface > SAL_CALL XSvgParser_createInstance(const uno::Reference< lang::XMultiServiceFactory >&)
+ uno::Reference< uno::XInterface > SAL_CALL XSvgParser_createInstance(const uno::Reference< uno::XComponentContext >& context)
{
- return static_cast< ::cppu::OWeakObject* >(new XSvgParser);
+ return static_cast< ::cppu::OWeakObject* >(new XSvgParser(context));
}
} // end of namespace svgreader
} // end of namespace svgio
@@ -93,7 +100,9 @@ namespace svgio
{
namespace svgreader
{
- XSvgParser::XSvgParser()
+ XSvgParser::XSvgParser(
+ uno::Reference< uno::XComponentContext > const & context):
+ context_(context)
{
}
@@ -121,9 +130,7 @@ namespace svgio
// get parser
uno::Reference< xml::sax::XParser > xParser(
- comphelper::getProcessServiceFactory()->createInstance(
- rtl::OUString::createFromAscii("com.sun.star.xml.sax.Parser") ),
- uno::UNO_QUERY_THROW );
+ xml::sax::Parser::create(context_));
// connect parser and filter
xParser->setDocumentHandler(xSvgDocHdl);
diff --git a/svgio/source/svguno/xsvgparser.hxx b/svgio/source/svguno/xsvgparser.hxx
new file mode 100644
index 000000000000..861f322a0f8b
--- /dev/null
+++ b/svgio/source/svguno/xsvgparser.hxx
@@ -0,0 +1,53 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SOURCE_SVGUNO_XSVGPARSER_HXX
+#define INCLUDED_SVGIO_SOURCE_SVGUNO_XSVGPARSER_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XComponentContext;
+ class XInterface;
+ }
+} } }
+namespace rtl { class OUString; }
+
+namespace svgio { namespace svgreader {
+
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+XSvgParser_createInstance(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const &);
+
+rtl::OUString SAL_CALL XSvgParser_getImplementationName();
+
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+XSvgParser_getSupportedServiceNames();
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */