diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 17:18:57 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-10 16:29:09 +0100 |
commit | 1bae084f333912db8aacce47a9f94eab5bb0ef4f (patch) | |
tree | fcf272c49b0962e586c486bd9360f41c9285b764 | |
parent | bbfda58607e71ac61c9175fed9b75a477a138d6f (diff) |
fwk: Use constructor feature for UICategoryDescription.
Change-Id: I56c906c9eeafb625dee65eec9fe39ea3aee66251
-rw-r--r-- | framework/inc/uiconfiguration/uicategorydescription.hxx | 58 | ||||
-rw-r--r-- | framework/source/register/registerservices.cxx | 2 | ||||
-rw-r--r-- | framework/source/uiconfiguration/uicategorydescription.cxx | 48 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
4 files changed, 32 insertions, 79 deletions
diff --git a/framework/inc/uiconfiguration/uicategorydescription.hxx b/framework/inc/uiconfiguration/uicategorydescription.hxx deleted file mode 100644 index e3b9d6a8519a..000000000000 --- a/framework/inc/uiconfiguration/uicategorydescription.hxx +++ /dev/null @@ -1,58 +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_UICONFIGURATION_UICATEGORYDESCRIPTION_HXX -#define INCLUDED_FRAMEWORK_INC_UICONFIGURATION_UICATEGORYDESCRIPTION_HXX - -/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble - with solaris headers ... -*/ -#include <vector> -#include <list> -#include <boost/unordered_map.hpp> - -#include <threadhelp/threadhelpbase.hxx> -#include <macros/generic.hxx> -#include <macros/xserviceinfo.hxx> -#include <uielement/uicommanddescription.hxx> -#include <stdtypes.h> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> - -namespace framework -{ -class UICategoryDescription : public UICommandDescription -{ - public: - UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); - virtual ~UICategoryDescription(); - - DECLARE_XSERVICEINFO - private: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const OUString& _sName); -}; - -} // namespace framework - -#endif // __FRAMEWORK_SERVICES_UICOMMANDCATEGORY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 55cb853baf87..5d8cfd16f466 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -47,7 +47,6 @@ #include <accelerators/moduleacceleratorconfiguration.hxx> #include <accelerators/documentacceleratorconfiguration.hxx> #include <uielement/recentfilesmenucontroller.hxx> -#include <uiconfiguration/uicategorydescription.hxx> #include <services/sessionlistener.hxx> #include <services/taskcreatorsrv.hxx> @@ -71,7 +70,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::ModuleAcceleratorConfiguration ) else IFFACTORY( ::framework::DocumentAcceleratorConfiguration ) else IFFACTORY( ::framework::RecentFilesMenuController ) else - IFFACTORY( ::framework::UICategoryDescription ) else IFFACTORY( ::framework::SessionListener ) else IFFACTORY( ::framework::SessionListener ) else IFFACTORY( ::framework::TaskCreatorService ) else diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index d93cfe2c28b0..159f1da0c957 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -17,9 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "uiconfiguration/uicategorydescription.hxx" #include <threadhelp/resetableguard.hxx> +#include <threadhelp/threadhelpbase.hxx> #include "services.h" +#include <macros/xserviceinfo.hxx> +#include <uielement/uicommanddescription.hxx> #include "properties.h" @@ -31,7 +33,9 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <cppuhelper/implbase2.hxx> #include <unotools/configmgr.hxx> @@ -39,9 +43,7 @@ #include <vcl/mnemonic.hxx> #include <comphelper/sequence.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ +#include <boost/unordered_map.hpp> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -49,10 +51,9 @@ using namespace com::sun::star::beans; using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::frame; +using namespace framework; -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ +namespace { struct ModuleToCategory { @@ -65,13 +66,6 @@ static const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.O static const char CONFIGURATION_CATEGORY_ELEMENT_ACCESS[] = "/Commands/Categories"; static const char CONFIGURATION_PROPERTY_NAME[] = "Name"; -namespace framework -{ - -//***************************************************************************************************************** -// Configuration access class for PopupMenuControllerFactory implementation -//***************************************************************************************************************** - class ConfigurationAccess_UICategory : // Order is necessary for right initialization! private ThreadHelpBase , public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener> @@ -395,9 +389,16 @@ void SAL_CALL ConfigurationAccess_UICategory::disposing( const EventObject& aEve m_xConfigAccess.clear(); } -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** +class UICategoryDescription : public UICommandDescription +{ + public: + UICategoryDescription( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UICategoryDescription(); + + DECLARE_XSERVICEINFO + private: + virtual css::uno::Reference< css::container::XNameAccess > impl_createConfigAccess(const OUString& _sName); +}; DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICategoryDescription , ::cppu::OWeakObject , @@ -433,6 +434,17 @@ Reference< XNameAccess > UICategoryDescription::impl_createConfigAccess(const OU return new ConfigurationAccess_UICategory( _sName, m_xGenericUICommands, m_xContext ); } -} // namespace framework +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_UICategoryDescription_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + rtl::Reference<UICategoryDescription> x(new UICategoryDescription(context)); + 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 5902bc199344..bbab2c49f5fd 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -115,7 +115,8 @@ constructor="com_sun_star_comp_framework_ToolBarFactory_get_implementation"> <service name="com.sun.star.ui.ToolBarFactory"/> </implementation> - <implementation name="com.sun.star.comp.framework.UICategoryDescription"> + <implementation name="com.sun.star.comp.framework.UICategoryDescription" + constructor="com_sun_star_comp_framework_UICategoryDescription_get_implementation"> <service name="com.sun.star.ui.UICategoryDescription"/> </implementation> <implementation name="com.sun.star.comp.framework.UICommandDescription" |