diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 20:33:11 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-10 16:29:20 +0100 |
commit | 7077fb9c76f9da19d71bb5c8067945f4b7f251d1 (patch) | |
tree | 880df0eda02e0e69602fab4988499a758a000ee2 | |
parent | 714a4d106a968ce270ea5cfe0e8c11c6cf31c59b (diff) |
fwk: Use constructor feature for ModuleAcceleratorConfiguration.
Change-Id: If4a7987778e2880502bdc7ef2c30792de9377364
4 files changed, 74 insertions, 115 deletions
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index 4138155cbb4b..c8edba9de8fd 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <accelerators/moduleacceleratorconfiguration.hxx> - +#include <accelerators/acceleratorconfiguration.hxx> +#include <accelerators/presethandler.hxx> +#include <macros/xserviceinfo.hxx> #include <threadhelp/readguard.hxx> #include <threadhelp/writeguard.hxx> #include "helper/mischelper.hxx" @@ -34,15 +35,63 @@ #include <vcl/svapp.hxx> #include <com/sun/star/util/XChangesNotifier.hpp> +#include <com/sun/star/lang/XInitialization.hpp> - +#include <cppuhelper/implbase2.hxx> +#include <rtl/ref.hxx> #include <rtl/logfile.h> -namespace framework +using namespace framework; + +namespace { + +/** + implements a read/write access to a module + dependend accelerator configuration. + */ +typedef ::cppu::ImplInheritanceHelper2< + XCUBasedAcceleratorConfiguration, + css::lang::XServiceInfo, + css::lang::XInitialization > ModuleAcceleratorConfiguration_BASE; + +class ModuleAcceleratorConfiguration : public ModuleAcceleratorConfiguration_BASE { +private: + /** identify the application module, where this accelerator + configuration cache should work on. */ + OUString m_sModule; + OUString m_sLocale; -//----------------------------------------------- -// XInterface, XTypeProvider, XServiceInfo +public: + + /** initialize this instance and fill the internal cache. + + @param xSMGR + reference to an uno service manager, which is used internaly. + */ + ModuleAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); + + /** TODO */ + virtual ~ModuleAcceleratorConfiguration(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw (css::uno::RuntimeException); + +private: + /** helper to listen for configuration changes without ownership cycle problems */ + css::uno::Reference< css::util::XChangesListener > m_xCfgListener; + + /** read all data into the cache. */ + void impl_ts_fillCache(); +}; DEFINE_XSERVICEINFO_MULTISERVICE_2(ModuleAcceleratorConfiguration , ::cppu::OWeakObject , @@ -153,6 +202,22 @@ void SAL_CALL ModuleAcceleratorConfiguration::dispose() {} } -} // namespace framework +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0); + rtl::Reference<ModuleAcceleratorConfiguration> x( + new ModuleAcceleratorConfiguration(context)); + css::uno::Sequence<css::uno::Any> aArgs( + reinterpret_cast<css::uno::Any *>(arguments->elements), + arguments->nElements); + x->initialize(aArgs); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx b/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx deleted file mode 100644 index c85d8268e096..000000000000 --- a/framework/source/inc/accelerators/moduleacceleratorconfiguration.hxx +++ /dev/null @@ -1,105 +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_SOURCE_INC_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX -#define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX - -#include <accelerators/acceleratorconfiguration.hxx> -#include <accelerators/presethandler.hxx> - -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <macros/xserviceinfo.hxx> - -#include <com/sun/star/lang/XInitialization.hpp> -#include <cppuhelper/implbase2.hxx> - -// definition - -namespace framework -{ - -//__________________________________________ -/** - implements a read/write access to a module - dependend accelerator configuration. - */ -typedef ::cppu::ImplInheritanceHelper2< - XCUBasedAcceleratorConfiguration, - css::lang::XServiceInfo, - css::lang::XInitialization > ModuleAcceleratorConfiguration_BASE; - -class ModuleAcceleratorConfiguration : ModuleAcceleratorConfiguration_BASE -{ - //______________________________________ - // member - - private: - - //---------------------------------- - /** identify the application module, where this accelerator - configuration cache should work on. */ - OUString m_sModule; - OUString m_sLocale; - - //______________________________________ - // interface - - public: - - //---------------------------------- - /** initialize this instance and fill the internal cache. - - @param xSMGR - reference to an uno service manager, which is used internaly. - */ - ModuleAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); - - //---------------------------------- - /** TODO */ - virtual ~ModuleAcceleratorConfiguration(); - - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO - - // XInitialization - virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) - throw(css::uno::Exception , - css::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - - //______________________________________ - // helper - - private: - /** helper to listen for configuration changes without ownership cycle problems */ - css::uno::Reference< css::util::XChangesListener > m_xCfgListener; - - //---------------------------------- - /** read all data into the cache. */ - void impl_ts_fillCache(); -}; - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_MODULEACCELERATORCONFIGURATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 258f8626ba10..5554c4e7b7dc 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -40,7 +40,6 @@ #include <uielement/controlmenucontroller.hxx> #include <uifactory/menubarfactory.hxx> #include <accelerators/globalacceleratorconfiguration.hxx> -#include <accelerators/moduleacceleratorconfiguration.hxx> #include <accelerators/documentacceleratorconfiguration.hxx> #include <uielement/recentfilesmenucontroller.hxx> #include <services/sessionlistener.hxx> @@ -56,7 +55,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::ControlMenuController ) else IFFACTORY( ::framework::MenuBarFactory ) else IFFACTORY( ::framework::GlobalAcceleratorConfiguration ) else - IFFACTORY( ::framework::ModuleAcceleratorConfiguration ) else IFFACTORY( ::framework::DocumentAcceleratorConfiguration ) else IFFACTORY( ::framework::RecentFilesMenuController ) else IFFACTORY( ::framework::SessionListener ) else diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 4e15465d3764..79dacc4689a2 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -64,7 +64,8 @@ <implementation name="com.sun.star.comp.framework.MenuBarFactory"> <service name="com.sun.star.ui.UIElementFactory"/> </implementation> - <implementation name="com.sun.star.comp.framework.ModuleAcceleratorConfiguration"> + <implementation name="com.sun.star.comp.framework.ModuleAcceleratorConfiguration" + constructor="com_sun_star_comp_framework_ModuleAcceleratorConfiguration_get_implementation"> <service name="com.sun.star.ui.ModuleAcceleratorConfiguration"/> </implementation> <implementation name="com.sun.star.comp.framework.ModuleManager" |