fwk: Use constructor feature for ObjectMenuController.
Change-Id: I93bec5fcb51987b7db433250f990685f15f0aa29
This commit is contained in:
parent
5d8a2f9f06
commit
af96a6635e
@ -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: */
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
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<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: */
|
||||
|
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user