diff options
-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 | 78 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
4 files changed, 65 insertions, 87 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 c29de9195cec..e3dbd26a5899 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -40,7 +40,6 @@ #include <services/layoutmanager.hxx> #include <uifactory/uielementfactorymanager.hxx> #include <uifactory/uicontrollerfactory.hxx> -#include <uielement/objectmenucontroller.hxx> #include <uielement/controlmenucontroller.hxx> #include <uielement/uicommanddescription.hxx> #include <uiconfiguration/moduleuicfgsupplier.hxx> @@ -71,7 +70,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::LayoutManager ) else IFFACTORY( ::framework::UIElementFactoryManager ) else IFFACTORY( ::framework::PopupMenuControllerFactory ) else - IFFACTORY( ::framework::ObjectMenuController ) else IFFACTORY( ::framework::ControlMenuController ) else IFFACTORY( ::framework::UICommandDescription ) else IFFACTORY( ::framework::ModuleManager ) else diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index 68c71fd362eb..de84009e1f67 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -17,10 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <uielement/objectmenucontroller.hxx> - #include <threadhelp/resetableguard.hxx> -#include "services.h" +#include <stdtypes.h> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -28,33 +26,73 @@ #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/supportsservice.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 framework +namespace { + +class ObjectMenuController : public svt::PopupMenuControllerBase { + using svt::PopupMenuControllerBase::disposing; + +public: + ObjectMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ObjectMenuController(); -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ObjectMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_OBJECTMENUCONTROLLER - ) + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { + return OUString("com.sun.star.comp.framework.ObjectMenuController"); + } -DEFINE_INIT_SERVICE ( ObjectMenuController, {} ) + 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.frame.PopupMenuController"); + return aSeq; + } + + // 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; +}; ObjectMenuController::ObjectMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) : svt::PopupMenuControllerBase( xContext ) @@ -135,4 +173,14 @@ 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, + css::uno::Sequence<css::uno::Any> const &) +{ + rtl::Reference<ObjectMenuController> x(new ObjectMenuController(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 aff24e61eab6..377ef5e3762c 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -75,7 +75,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"> |