From af96a6635e47273e107dc9546c48cda68eaa7759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= Date: Thu, 9 Jan 2014 19:45:44 +0100 Subject: [PATCH] fwk: Use constructor feature for ObjectMenuController. Change-Id: I93bec5fcb51987b7db433250f990685f15f0aa29 --- .../inc/uielement/objectmenucontroller.hxx | 69 ----------------- .../source/register/registerservices.cxx | 2 - .../source/uielement/objectmenucontroller.cxx | 76 +++++++++++++++---- framework/util/fwk.component | 3 +- 4 files changed, 64 insertions(+), 86 deletions(-) delete mode 100644 framework/inc/uielement/objectmenucontroller.hxx 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 -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -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 #include #include -#include #include #include #include @@ -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 - #include -#include "services.h" +#include #include #include @@ -28,33 +26,73 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include #include #include -//_________________________________________________________________________________________________________________ -// 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; -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ObjectMenuController , - OWeakObject , - SERVICENAME_POPUPMENUCONTROLLER , - IMPLEMENTATIONNAME_OBJECTMENUCONTROLLER - ) +public: + ObjectMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~ObjectMenuController(); -DEFINE_INIT_SERVICE ( ObjectMenuController, {} ) + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { + return OUString("com.sun.star.comp.framework.ObjectMenuController"); + } + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException) + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence 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 const &) +{ + rtl::Reference x(new ObjectMenuController(context)); + x->acquire(); + return static_cast(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 @@ - +