summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-01-09 20:48:08 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-01-17 12:25:05 +0100
commit4c016d70043f8fc4709eacbcef496ab0d9b65c15 (patch)
treeff5d17750dcee3d34b5d75c0224f430de3bb3dad /framework
parent278880fbd1a9d74be486bf5a2248bfe64c7dc2fc (diff)
fwk: Use constructor feature for GlobalAcceleratorConfiguration.
Change-Id: Ic0268e9841c78e5de646074755e99706adac8d7d
Diffstat (limited to 'framework')
-rw-r--r--framework/source/accelerators/globalacceleratorconfiguration.cxx116
-rw-r--r--framework/source/inc/accelerators/globalacceleratorconfiguration.hxx95
-rw-r--r--framework/source/register/registerservices.cxx2
-rw-r--r--framework/util/fwk.component3
4 files changed, 77 insertions, 139 deletions
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index 737d1bc6c011..261aa178ba55 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -17,66 +17,89 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <accelerators/globalacceleratorconfiguration.hxx>
-
+#include <accelerators/acceleratorconfiguration.hxx>
+#include <accelerators/presethandler.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 <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/supportsservice.hxx>
+#include <rtl/ref.hxx>
#include <vcl/svapp.hxx>
#include <i18nlangtag/languagetag.hxx>
-namespace framework
-{
+using namespace framework;
-//-----------------------------------------------
-// XInterface, XTypeProvider, XServiceInfo
-
-DEFINE_XSERVICEINFO_MULTISERVICE_2(GlobalAcceleratorConfiguration ,
- ::cppu::OWeakObject ,
- "com.sun.star.ui.GlobalAcceleratorConfiguration" ,
- OUString("com.sun.star.comp.framework.GlobalAcceleratorConfiguration"))
-
-DEFINE_INIT_SERVICE(GlobalAcceleratorConfiguration,
- {
- /*Attention
- I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
- to create a new instance of this class by our own supported service factory.
- see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further information!
- */
- impl_ts_fillCache();
- }
- )
+namespace {
-//-----------------------------------------------
-GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : GlobalAcceleratorConfiguration_BASE(xContext)
+/**
+ 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:
-//-----------------------------------------------
-GlobalAcceleratorConfiguration::~GlobalAcceleratorConfiguration()
-{
-}
+ /** 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);
-void SAL_CALL GlobalAcceleratorConfiguration::initialize(const css::uno::Sequence< css::uno::Any >& /*lArguments*/)
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
+ /** TODO */
+ virtual ~GlobalAcceleratorConfiguration() {}
+
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ {
+ return OUString("com.sun.star.comp.framework.GlobalAcceleratorConfiguration");
+ }
+
+ 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 > aSeq(1);
+ aSeq[0] = OUString("com.sun.star.ui.GlobalAcceleratorConfiguration");
+ return aSeq;
+ }
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
+
+ void impl_ts_fillCache();
+
+private:
+
+ OUString m_sLocale;
+
+ /** helper to listen for configuration changes without ownership cycle problems */
+ css::uno::Reference< css::util::XChangesListener > m_xCfgListener;
+};
+
+GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext)
+ : GlobalAcceleratorConfiguration_BASE(xContext)
{
}
-//-----------------------------------------------
void GlobalAcceleratorConfiguration::impl_ts_fillCache()
{
+ /** read all data into the cache. */
+
#if 0
// get current office locale ... but dont cache it.
// Otherwise we must be listener on the configuration layer
@@ -120,6 +143,17 @@ 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,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ rtl::Reference<GlobalAcceleratorConfiguration> x(new GlobalAcceleratorConfiguration(context));
+ x->impl_ts_fillCache();
+ 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 7ecd19e2276c..e36f23adaaaa 100644
--- a/framework/source/register/registerservices.cxx
+++ b/framework/source/register/registerservices.cxx
@@ -43,7 +43,6 @@
#include <uiconfiguration/moduleuicfgsupplier.hxx>
#include <uiconfiguration/moduleuiconfigurationmanager.hxx>
#include <uifactory/menubarfactory.hxx>
-#include <accelerators/globalacceleratorconfiguration.hxx>
#include <accelerators/moduleacceleratorconfiguration.hxx>
#include <accelerators/documentacceleratorconfiguration.hxx>
#include <uifactory/toolboxfactory.hxx>
@@ -71,7 +70,6 @@ COMPONENTGETFACTORY ( fwk,
IFFACTORY( ::framework::ModuleUIConfigurationManagerSupplier ) else
IFFACTORY( ::framework::ModuleUIConfigurationManager ) else
IFFACTORY( ::framework::MenuBarFactory ) else
- IFFACTORY( ::framework::GlobalAcceleratorConfiguration ) else
IFFACTORY( ::framework::ModuleAcceleratorConfiguration ) else
IFFACTORY( ::framework::DocumentAcceleratorConfiguration ) else
IFFACTORY( ::framework::ToolBoxFactory ) else
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index aeb8f149568b..9eb753e36d20 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -44,7 +44,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"