diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 17:05:25 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-17 12:24:53 +0100 |
commit | 86b12c3448a24eb1f3ef51c0fcbaef75b771d211 (patch) | |
tree | 3a95ab482b9f71e00c661ecdbc4afaa84cba7e9f /framework | |
parent | d51b1059042ca741d7601c56a631ea0c57c0645d (diff) |
fwk: Use constructor feature for URLTransformer.
Change-Id: I6559cb4c97e7c20930fffba3ce3d565840c89033
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/services/urltransformer.hxx | 192 | ||||
-rw-r--r-- | framework/source/register/registerservices.cxx | 2 | ||||
-rw-r--r-- | framework/source/services/urltransformer.cxx | 95 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
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 0103c902edf3..d96555393cb5 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> @@ -67,7 +66,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..a5346392833c 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -17,53 +17,66 @@ * 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 <cppuhelper/supportsservice.hxx> #include <tools/urlobj.hxx> +#include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> -#include <vcl/svapp.hxx> -namespace framework{ +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.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< css::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 cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException) + { + css::uno::Sequence< OUString > aRet(1); + aRet[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 +338,16 @@ 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( + css::uno::XComponentContext *, + css::uno::Sequence<css::uno::Any> const &) +{ + 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 98c9eb577378..8d3dee374ed0 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -121,7 +121,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"> |