diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 19:45:44 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-10 16:29:15 +0100 |
commit | db74b4cd9e95112d524de2f4395a3ab7f9f1c0cf (patch) | |
tree | a66d249324487ebd456163cad15738cc166db7f8 | |
parent | 64bd3dd5faba44739778fc6947056fd143061c8e (diff) |
fwk: Use constructor feature for ObjectMenuController.
Change-Id: I93bec5fcb51987b7db433250f990685f15f0aa29
-rw-r--r-- | framework/inc/uielement/objectmenucontroller.hxx | 69 | ||||
-rw-r--r-- | framework/source/register/registerservices.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/objectmenucontroller.cxx | 62 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
4 files changed, 55 insertions, 81 deletions
diff --git a/framework/inc/uielement/objectmenucontroller.hxx b/framework/inc/uielement/objectmenucontroller.hxx deleted file mode 100644 index 3203f326ce8a..000000000000 --- a/framework/inc/uielement/objectmenucontroller.hxx +++ /dev/null @@ -1,69 +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_UIELEMENT_OBJECTMENUCONTROLLER_HXX -#define INCLUDED_FRAMEWORK_INC_UIELEMENT_OBJECTMENUCONTROLLER_HXX - -#include <macros/xserviceinfo.hxx> -#include <stdtypes.h> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XStatusListener.hpp> -#include <com/sun/star/frame/XPopupMenuController.hpp> -#include <com/sun/star/embed/VerbDescriptor.hpp> - -#include <svtools/popupmenucontrollerbase.hxx> -#include <toolkit/awt/vclxmenu.hxx> -#include <cppuhelper/weak.hxx> -#include <rtl/ustring.hxx> - -namespace framework -{ - class ObjectMenuController : public svt::PopupMenuControllerBase - { - using svt::PopupMenuControllerBase::disposing; - - public: - ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); - virtual ~ObjectMenuController(); - - // XServiceInfo - DECLARE_XSERVICEINFO - - // XStatusListener - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - // XEventListener - virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); - - private: - void fillPopupMenu( const com::sun::star::uno::Sequence< com::sun::star::embed::VerbDescriptor >& rVerbCommandSeq, com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); - virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); - - com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > m_xObjectUpdateDispatch; - }; -} - -#endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_OBJECTMENUCONTROLLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 4e82412c4ac0..328dc8ca616b 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -38,7 +38,6 @@ #include <services/modulemanager.hxx> #include <jobs/jobexecutor.hxx> #include <services/layoutmanager.hxx> -#include <uielement/objectmenucontroller.hxx> #include <uielement/controlmenucontroller.hxx> #include <uiconfiguration/moduleuicfgsupplier.hxx> #include <uiconfiguration/moduleuiconfigurationmanager.hxx> @@ -57,7 +56,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::Frame ) else IFFACTORY( ::framework::JobExecutor ) else IFFACTORY( ::framework::LayoutManager ) else - IFFACTORY( ::framework::ObjectMenuController ) else IFFACTORY( ::framework::ControlMenuController ) else IFFACTORY( ::framework::ModuleManager ) else IFFACTORY( ::framework::ModuleUIConfigurationManagerSupplier ) else diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index 68c71fd362eb..09afc971272c 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <uielement/objectmenucontroller.hxx> - #include <threadhelp/resetableguard.hxx> -#include "services.h" +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <services.h> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -28,25 +28,54 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/embed/VerbAttributes.hpp> - +#include <com/sun/star/embed/VerbDescriptor.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XPopupMenuController.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <svtools/popupmenucontrollerbase.hxx> +#include <toolkit/awt/vclxmenu.hxx> +#include <cppuhelper/weak.hxx> #include <vcl/menu.hxx> #include <vcl/svapp.hxx> #include <vcl/i18nhelp.hxx> +#include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <osl/mutex.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ - using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::frame; using namespace com::sun::star::beans; using namespace com::sun::star::util; +using namespace framework; + +namespace { -namespace framework +class ObjectMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + + public: + ObjectMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ObjectMenuController(); + + // XServiceInfo + DECLARE_XSERVICEINFO + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException ); + + private: + void fillPopupMenu( const css::uno::Sequence< css::embed::VerbDescriptor >& rVerbCommandSeq, css::uno::Reference< css::awt::XPopupMenu >& rPopupMenu ); + virtual void impl_select(const css::uno::Reference< css::frame::XDispatch >& _xDispatch,const css::util::URL& aURL); + + css::uno::Reference< css::frame::XDispatch > m_xObjectUpdateDispatch; +}; DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ObjectMenuController , OWeakObject , @@ -135,4 +164,19 @@ void ObjectMenuController::impl_select(const Reference< XDispatch >& _xDispatch, } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_ObjectMenuController_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0); + rtl::Reference<ObjectMenuController> x(new ObjectMenuController(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/util/fwk.component b/framework/util/fwk.component index 722d77d618c7..1dddf74bf1a5 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -76,7 +76,8 @@ <implementation name="com.sun.star.comp.framework.ModuleUIConfigurationManagerSupplier"> <service name="com.sun.star.ui.ModuleUIConfigurationManagerSupplier"/> </implementation> - <implementation name="com.sun.star.comp.framework.ObjectMenuController"> + <implementation name="com.sun.star.comp.framework.ObjectMenuController" + constructor="com_sun_star_comp_framework_ObjectMenuController_get_implementation"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> <implementation name="com.sun.star.comp.framework.PathSettings" |