diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 20:48:08 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-10 16:29:27 +0100 |
commit | 32e897cec3fa5f00c333b4bf8b4095f9f4ebc2f9 (patch) | |
tree | aa3ef511c7f2b4e22e024d6742a0711257293c68 | |
parent | 24941c6cbe1e31de77cb69264ba193100c9cd451 (diff) |
fwk: Use constructor feature for GlobalAcceleratorConfiguration.
Change-Id: Ic0268e9841c78e5de646074755e99706adac8d7d
4 files changed, 60 insertions, 114 deletions
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx index 737d1bc6c011..8ac612660a8b 100644 --- a/framework/source/accelerators/globalacceleratorconfiguration.cxx +++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -17,29 +17,65 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <accelerators/globalacceleratorconfiguration.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" +#include <helper/mischelper.hxx> #include <acceleratorconst.h> #include <services.h> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> +#include <rtl/ref.hxx> #include <vcl/svapp.hxx> #include <i18nlangtag/languagetag.hxx> -namespace framework +using namespace framework; + +namespace { + +/** + implements a read/write access to the global + accelerator configuration. + */ +typedef ::cppu::ImplInheritanceHelper1< + XCUBasedAcceleratorConfiguration, + css::lang::XServiceInfo > GlobalAcceleratorConfiguration_BASE; +class GlobalAcceleratorConfiguration : public GlobalAcceleratorConfiguration_BASE { +public: -//----------------------------------------------- -// XInterface, XTypeProvider, XServiceInfo + /** initialize this instance and fill the internal cache. + + @param xSMGR + reference to an uno service manager, which is used internaly. + */ + GlobalAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); + + /** TODO */ + virtual ~GlobalAcceleratorConfiguration(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + +private: + + OUString m_sLocale; + + /** 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(GlobalAcceleratorConfiguration , ::cppu::OWeakObject , @@ -68,12 +104,6 @@ GlobalAcceleratorConfiguration::~GlobalAcceleratorConfiguration() { } -void SAL_CALL GlobalAcceleratorConfiguration::initialize(const css::uno::Sequence< css::uno::Any >& /*lArguments*/) - throw(css::uno::Exception , - css::uno::RuntimeException) -{ -} - //----------------------------------------------- void GlobalAcceleratorConfiguration::impl_ts_fillCache() { @@ -120,6 +150,18 @@ void SAL_CALL GlobalAcceleratorConfiguration::dispose() {} } -} // namespace framework +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + rtl::Reference<GlobalAcceleratorConfiguration> x( + new GlobalAcceleratorConfiguration(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx b/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx deleted file mode 100644 index b78c528f1e58..000000000000 --- a/framework/source/inc/accelerators/globalacceleratorconfiguration.hxx +++ /dev/null @@ -1,95 +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_GLOBALACCELERATORCONFIGURATION_HXX -#define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_GLOBALACCELERATORCONFIGURATION_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> - -// definition - -namespace framework -{ - -//__________________________________________ -/** - implements a read/write access to the global - accelerator configuration. - */ -typedef ::cppu::ImplInheritanceHelper2< - XCUBasedAcceleratorConfiguration, - css::lang::XServiceInfo, - css::lang::XInitialization > GlobalAcceleratorConfiguration_BASE; -class GlobalAcceleratorConfiguration : GlobalAcceleratorConfiguration_BASE -{ - //______________________________________ - // interface - - public: - - //---------------------------------- - /** initialize this instance and fill the internal cache. - - @param xSMGR - reference to an uno service manager, which is used internaly. - */ - GlobalAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); - - //---------------------------------- - /** TODO */ - virtual ~GlobalAcceleratorConfiguration(); - - // 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: - - OUString m_sLocale; - - /** 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_GLOBALACCELERATORCONFIGURATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 735942e55649..0366b8369315 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -36,7 +36,6 @@ #include <services/desktop.hxx> #include <services/frame.hxx> #include <uielement/controlmenucontroller.hxx> -#include <accelerators/globalacceleratorconfiguration.hxx> #include <accelerators/documentacceleratorconfiguration.hxx> #include <uielement/recentfilesmenucontroller.hxx> #include <services/sessionlistener.hxx> @@ -47,7 +46,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::Desktop ) else IFFACTORY( ::framework::Frame ) else IFFACTORY( ::framework::ControlMenuController ) else - IFFACTORY( ::framework::GlobalAcceleratorConfiguration ) 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 b55f2f691b7d..df010a57c96f 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -45,7 +45,8 @@ <implementation name="com.sun.star.comp.framework.Frame"> <service name="com.sun.star.frame.Frame"/> </implementation> - <implementation name="com.sun.star.comp.framework.GlobalAcceleratorConfiguration"> + <implementation name="com.sun.star.comp.framework.GlobalAcceleratorConfiguration" + constructor="com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation"> <service name="com.sun.star.ui.GlobalAcceleratorConfiguration"/> </implementation> <implementation name="com.sun.star.comp.framework.ImageManager" |