summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 17:05:25 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-10 16:29:04 +0100
commitc94c86419d7b9785182c390d071fcb3c9b9fd2e2 (patch)
tree75ad361d3c28cabac033a6e5d1f37fa4c0cb3fe0
parentda68b2d30c3b25d633936d08c5f476e99de0e5d5 (diff)
fwk: Use constructor feature for URLTransformer.
Change-Id: I6559cb4c97e7c20930fffba3ce3d565840c89033
-rw-r--r--framework/inc/services/urltransformer.hxx192
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/source/services/urltransformer.cxx95
-rw-r--r--framework/util/fwk.component3
4 files changed, 61 insertions, 231 deletions
diff --git a/framework/inc/services/urltransformer.hxx b/framework/inc/services/urltransformer.hxx
deleted file mode 100644
index f39275f7f427..000000000000
--- a/framework/inc/services/urltransformer.hxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- 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_FRAMEWORK_INC_SERVICES_URLTRANSFORMER_HXX
-#define INCLUDED_FRAMEWORK_INC_SERVICES_URLTRANSFORMER_HXX
-
-#include <threadhelp/threadhelpbase.hxx>
-#include <macros/generic.hxx>
-#include <macros/xinterface.hxx>
-#include <macros/xtypeprovider.hxx>
-#include <macros/xserviceinfo.hxx>
-#include <general.h>
-
-#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/util/URL.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-
-namespace framework{
-
-/*-************************************************************************************************************//**
- @short
-
- @descr -
-
- @implements XInterface
- XTypeProvider
- XServiceInfo
- XURLTransformer
-
- @base ThreadHelpBase
- OWeakObject
-*//*-*************************************************************************************************************/
-
-class URLTransformer : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XURLTransformer, css::lang::XServiceInfo>
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- URLTransformer( const css::uno::Reference< css::lang::XMultiServiceFactory >& sFactory );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual ~URLTransformer();
-
- //---------------------------------------------------------------------------------------------------------
- // XInterface, XTypeProvider, XServiceInfo
- //---------------------------------------------------------------------------------------------------------
-
- DECLARE_XSERVICEINFO
-
- //---------------------------------------------------------------------------------------------------------
- // XURLTransformer
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual sal_Bool SAL_CALL parseStrict( css::util::URL& aURL ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual sal_Bool SAL_CALL parseSmart( css::util::URL& aURL ,
- const OUString& sSmartProtocol ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual sal_Bool SAL_CALL assemble( css::util::URL& aURL ) throw( css::uno::RuntimeException );
-
- /*-****************************************************************************************************//**
- @short -
- @descr -
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual OUString SAL_CALL getPresentation( const css::util::URL& aURL ,
- sal_Bool bWithPassword ) throw( css::uno::RuntimeException );
-
- //-------------------------------------------------------------------------------------------------------------
- // protected methods
- //-------------------------------------------------------------------------------------------------------------
-
- protected:
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- //-------------------------------------------------------------------------------------------------------------
- // debug methods
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
-
-
- //-------------------------------------------------------------------------------------------------------------
- // variables
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has created this instance
-
-}; // class URLTransformer
-
-} // namespace framework
-
-#endif // INCLUDED_FRAMEWORK_INC_SERVICES_URLTRANSFORMER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx
index 7e3fb68e948d..e16d0fdc5ad9 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -33,7 +33,6 @@
IFFACTORIE( Service2 )
)
=================================================================================================================*/
-#include <services/urltransformer.hxx>
#include <services/desktop.hxx>
#include <services/frame.hxx>
#include <services/modulemanager.hxx>
@@ -61,7 +60,6 @@
#include <services/ContextChangeEventMultiplexer.hxx>
COMPONENTGETFACTORY ( fwk,
- IFFACTORY( ::framework::URLTransformer ) else
IFFACTORY( ::framework::Desktop ) else
IFFACTORY( ::framework::Frame ) else
IFFACTORY( ::framework::JobExecutor ) else
diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx
index 971f8c60883e..eccd25898c51 100644
--- a/framework/source/services/urltransformer.cxx
+++ b/framework/source/services/urltransformer.cxx
@@ -17,53 +17,65 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <services/urltransformer.hxx>
-#include <threadhelp/resetableguard.hxx>
#include <services.h>
+#include <cppuhelper/implbase2.hxx>
#include <tools/urlobj.hxx>
+#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
-#include <vcl/svapp.hxx>
+#include <macros/xserviceinfo.hxx>
-namespace framework{
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/util/URL.hpp>
-using namespace ::osl ;
-using namespace ::cppu ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::lang ;
-using namespace ::com::sun::star::util ;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-URLTransformer::URLTransformer( const Reference< XMultiServiceFactory >& /*xFactory*/ )
-{
- // Safe impossible cases.
- // Method not defined for all incoming parameter.
- //SAL_WARN_IF( !xFactory.is(), "fwk", "URLTransformer::URLTransformer(): Invalid parameter detected!" );
-}
+namespace {
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-URLTransformer::~URLTransformer()
+class URLTransformer : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XURLTransformer, css::lang::XServiceInfo>
{
-}
+public:
+ URLTransformer() {}
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
+ virtual ~URLTransformer() {}
-DEFINE_XSERVICEINFO_MULTISERVICE ( URLTransformer ,
- OWeakObject ,
- "com.sun.star.util.URLTransformer" ,
- IMPLEMENTATIONNAME_URLTRANSFORMER
- )
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ {
+ return OUString("com.sun.star.comp.framework.URLTransformer");
+ }
-DEFINE_INIT_SERVICE ( URLTransformer,
- {
- }
- )
+ virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ {
+ return ServiceName == "com.sun.star.util.URLTransformer";
+ }
+
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+ {
+ css::uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = "com.sun.star.util.URLTransformer";
+ return aRet;
+ }
+
+ virtual sal_Bool SAL_CALL parseStrict( css::util::URL& aURL )
+ throw( css::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL parseSmart( css::util::URL& aURL, const OUString& sSmartProtocol )
+ throw( css::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL assemble( css::util::URL& aURL )
+ throw( css::uno::RuntimeException );
+
+ virtual OUString SAL_CALL getPresentation( const css::util::URL& aURL, sal_Bool bWithPassword )
+ throw( css::uno::RuntimeException );
+};
namespace
{
@@ -325,6 +337,17 @@ OUString SAL_CALL URLTransformer::getPresentation( const URL& aURL
return OUString();
}
-} // namespace framework
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_URLTransformer_get_implementation(
+ SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+ uno_Sequence * arguments)
+{
+ assert(arguments != 0 && arguments->nElements == 0); (void) arguments;
+ rtl::Reference<URLTransformer> x(new URLTransformer());
+ x->acquire();
+ return static_cast<cppu::OWeakObject *>(x.get());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 544c8f32e719..27f5534629e3 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -127,7 +127,8 @@
<implementation name="com.sun.star.comp.framework.UIElementFactoryManager">
<service name="com.sun.star.ui.UIElementFactoryManager"/>
</implementation>
- <implementation name="com.sun.star.comp.framework.URLTransformer">
+ <implementation name="com.sun.star.comp.framework.URLTransformer"
+ constructor="com_sun_star_comp_framework_URLTransformer_get_implementation">
<service name="com.sun.star.util.URLTransformer"/>
</implementation>
<implementation name="com.sun.star.comp.framework.WindowContentFactoryManager"