diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 20:58:27 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-10 16:29:29 +0100 |
commit | 59f2d473cca2a6c85ae3d3ee4c5a742609c23f18 (patch) | |
tree | 82c6a47b4e15c243213b0690c99f5a34c889646c | |
parent | 984146a10f9e91a4eb24acf81fd2a27cf8023f41 (diff) |
fwk: Use constructor feature for DocumentAcceleratorConfiguration.
feature/components
Change-Id: I14daf6409bf0d651d7b23246ba3855f647b3d1ef
4 files changed, 84 insertions, 130 deletions
diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index d9e8689a7d42..6ded8bb7c251 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -17,40 +17,90 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <accelerators/documentacceleratorconfiguration.hxx> +#include <accelerators/acceleratorconfiguration.hxx> +#include <accelerators/istoragelistener.hxx> +#include <accelerators/presethandler.hxx> #include <xml/acceleratorconfigurationreader.hxx> - #include <xml/acceleratorconfigurationwriter.hxx> - #include <xml/saxnamespacefilter.hxx> #include <threadhelp/readguard.hxx> #include <threadhelp/writeguard.hxx> - +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> #include <acceleratorconst.h> #include <services.h> -#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> -#include <com/sun/star/io/XSeekable.hpp> - -#include <com/sun/star/io/XTruncate.hpp> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <rtl/ref.hxx> -#include <com/sun/star/embed/ElementModes.hpp> +using namespace framework; -#include <com/sun/star/xml/sax/InputSource.hpp> +namespace { -#include <com/sun/star/xml/sax/XParser.hpp> +/** + implements a read/write access to a document + based accelerator configuration. + */ -#include <comphelper/sequenceashashmap.hxx> -#include <i18nlangtag/languagetag.hxx> +typedef ::cppu::ImplInheritanceHelper2< + XMLBasedAcceleratorConfiguration, + css::lang::XServiceInfo, + css::lang::XInitialization > DocumentAcceleratorConfiguration_BASE; -namespace framework +class DocumentAcceleratorConfiguration : public DocumentAcceleratorConfiguration_BASE { +private: -//----------------------------------------------- -// XInterface, XTypeProvider, XServiceInfo + //---------------------------------- + /** points to the root storage of the outside document, + where we can read/save our configuration data. */ + css::uno::Reference< css::embed::XStorage > m_xDocumentRoot; + +//______________________________________ +// interface + +public: + + /** initialize this instance and fill the internal cache. + + @param xSMGR + reference to an uno service manager, which is used internaly. + */ + DocumentAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); + virtual ~DocumentAcceleratorConfiguration(); + + // 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); + + // XUIConfigurationStorage + virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage) + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasStorage() + throw(css::uno::RuntimeException); + +private: + + /** read all data into the cache. */ + void impl_ts_fillCache(); + + /** forget all currently cached data AND(!) + forget all currently used storages. */ + void impl_ts_clearCache(); +}; DEFINE_XSERVICEINFO_MULTISERVICE_2(DocumentAcceleratorConfiguration , ::cppu::OWeakObject , @@ -185,4 +235,20 @@ void DocumentAcceleratorConfiguration::impl_ts_clearCache() } // namespace framework +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0); + rtl::Reference<DocumentAcceleratorConfiguration> x( + new DocumentAcceleratorConfiguration(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/documentacceleratorconfiguration.hxx b/framework/source/inc/accelerators/documentacceleratorconfiguration.hxx deleted file mode 100644 index fdf40459f585..000000000000 --- a/framework/source/inc/accelerators/documentacceleratorconfiguration.hxx +++ /dev/null @@ -1,111 +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_DOCUMENTACCELERATORCONFIGURATION_HXX -#define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX - -#include <accelerators/acceleratorconfiguration.hxx> -#include <accelerators/istoragelistener.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 <com/sun/star/ui/XUIConfigurationStorage.hpp> - -#include <cppuhelper/implbase2.hxx> -// definition - -namespace framework -{ - -//__________________________________________ -/** - implements a read/write access to a document - based accelerator configuration. - */ - -typedef ::cppu::ImplInheritanceHelper2< - XMLBasedAcceleratorConfiguration, - css::lang::XServiceInfo, - css::lang::XInitialization > DocumentAcceleratorConfiguration_BASE; - -class DocumentAcceleratorConfiguration : public DocumentAcceleratorConfiguration_BASE -{ - //______________________________________ - // member - - private: - - //---------------------------------- - /** points to the root storage of the outside document, - where we can read/save our configuration data. */ - css::uno::Reference< css::embed::XStorage > m_xDocumentRoot; - - //______________________________________ - // interface - - public: - - //---------------------------------- - /** initialize this instance and fill the internal cache. - - @param xSMGR - reference to an uno service manager, which is used internaly. - */ - DocumentAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext >& xContext); - virtual ~DocumentAcceleratorConfiguration(); - - // 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); - - // XUIConfigurationStorage - virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage >& xStorage) - throw(css::uno::RuntimeException); - - virtual sal_Bool SAL_CALL hasStorage() - throw(css::uno::RuntimeException); - - //______________________________________ - // helper - - private: - - //---------------------------------- - /** read all data into the cache. */ - void impl_ts_fillCache(); - - //---------------------------------- - /** forget all currently cached data AND(!) - forget all currently used storages. */ - void impl_ts_clearCache(); -}; - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_DOCUMENTACCELERATORCONFIGURATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index c056ad1bf4c6..e1c2c9c13924 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -35,7 +35,6 @@ =================================================================================================================*/ #include <services/desktop.hxx> #include <uielement/controlmenucontroller.hxx> -#include <accelerators/documentacceleratorconfiguration.hxx> #include <uielement/recentfilesmenucontroller.hxx> #include <services/sessionlistener.hxx> @@ -44,7 +43,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::Desktop ) else IFFACTORY( ::framework::ControlMenuController ) else - IFFACTORY( ::framework::DocumentAcceleratorConfiguration ) else IFFACTORY( ::framework::RecentFilesMenuController ) else IFFACTORY( ::framework::SessionListener ) else IFFACTORY( ::framework::SessionListener ) else diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 26807179758b..a7c33c095009 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -36,7 +36,8 @@ <implementation name="com.sun.star.comp.framework.Desktop"> <service name="com.sun.star.frame.Desktop"/> </implementation> - <implementation name="com.sun.star.comp.framework.DocumentAcceleratorConfiguration"> + <implementation name="com.sun.star.comp.framework.DocumentAcceleratorConfiguration" + constructor="com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation"> <service name="com.sun.star.ui.DocumentAcceleratorConfiguration"/> </implementation> <implementation name="org.apache.openoffice.comp.framework.ContextChangeEventMultiplexer"> |