Kaydet (Commit) a8a35e54 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Convert frame::AppDispatchProvider to new style

The service already existed, it just needed an IDL file.

Change-Id: I9553c8e7c4922f2106bc13034e0cc35669b28b7e
üst 515701a1
......@@ -99,7 +99,6 @@ namespace framework{
#define IMPLEMENTATIONNAME_RECENTFILESMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.RecentFilesMenuController" )
#define IMPLEMENTATIONNAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarFactory" )
#define IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarControllerFactory" )
#define IMPLEMENTATIONNAME_APPDISPATCHPROVIDER DECLARE_ASCII("com.sun.star.comp.sfx2.AppDispatchProvider" )
#define IMPLEMENTATIONNAME_SESSIONLISTENER DECLARE_ASCII("com.sun.star.comp.frame.SessionListener" )
#define IMPLEMENTATIONNAME_HELPONSTARTUP DECLARE_ASCII("com.sun.star.comp.framework.HelpOnStartup" )
#define IMPLEMENTATIONNAME_SHELLJOB DECLARE_ASCII("com.sun.star.comp.framework.ShellJob" )
......
......@@ -25,6 +25,8 @@
#include <services.h>
#include <com/sun/star/frame/CommandGroup.hpp>
#include <com/sun/star/frame/AppDispatchProvider.hpp>
#include <comphelper/sequenceasvector.hxx>
......@@ -148,8 +150,7 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvide
css::uno::Reference< css::frame::XDispatchInformationProvider > xCloseDispatch(xCloser , css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher(
xContext->getServiceManager()->createInstanceWithContext(IMPLEMENTATIONNAME_APPDISPATCHPROVIDER, xContext), css::uno::UNO_QUERY);
css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(xContext);
css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > lProvider(3);
lProvider[0] = xController ;
lProvider[1] = xCloseDispatch;
......
......@@ -28,7 +28,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/frame/XAppDispatchProvider.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XSynchronousDispatch.hpp>
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
......@@ -40,6 +40,7 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
#include <tools/errcode.hxx>
......@@ -81,10 +82,9 @@ public:
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
};
class SfxAppDispatchProvider : public ::cppu::WeakImplHelper4< ::com::sun::star::frame::XDispatchProvider,
class SfxAppDispatchProvider : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XAppDispatchProvider,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XInitialization,
::com::sun::star::frame::XDispatchInformationProvider >
::com::sun::star::lang::XInitialization >
{
::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
public:
......
......@@ -186,6 +186,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/runti
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\
AutoRecovery \
AppDispatchProvider \
Bibliography \
Desktop \
DispatchHelper \
......@@ -2563,6 +2564,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\
UnknownModuleException \
UntitledNumbersConst \
WindowArrange \
XAppDispatchProvider \
XBorderResizeListener \
XBrowseHistoryRegistry \
XComponentLoader \
......
/* -*- 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 __com_sun_star_frame_AppDispatchProvider_idl__
#define __com_sun_star_frame_AppDispatchProvider_idl__
#include <com/sun/star/frame/XAppDispatchProvider.idl>
module com { module sun { module star { module frame {
/**
@since LibreOffice 4.2
*/
service AppDispatchProvider : XAppDispatchProvider;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 __com_sun_star_frame_XAppDispatchProvider_idl__
#define __com_sun_star_frame_XAppDispatchProvider_idl__
#include <com/sun/star/frame/XDispatchInformationProvider.idl>
#include <com/sun/star/frame/XDispatchProvider.idl>
module com { module sun { module star { module frame {
/**
@since LibreOffice 4.2
*/
interface XAppDispatchProvider
{
interface XDispatchInformationProvider;
interface XDispatchProvider;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1990,7 +1990,54 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, com::sun::star::uno::An
#endif
}
SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \
/* XServiceInfo */
OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::uno::RuntimeException )
{
return impl_getStaticImplementationName();
}
/* XServiceInfo */
sal_Bool SAL_CALL SfxAppDispatchProvider::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )
{
css::uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames();
const OUString* pArray = seqServiceNames.getConstArray();
for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
{
if ( pArray[nCounter] == sServiceName )
{
return sal_True;
}
}
return sal_False;
}
/* XServiceInfo */
css::uno::Sequence< OUString > SAL_CALL SfxAppDispatchProvider::getSupportedServiceNames() throw( css::uno::RuntimeException )
{
return impl_getStaticSupportedServiceNames();
}
/* Helper for XServiceInfo */
css::uno::Sequence< OUString > SfxAppDispatchProvider::impl_getStaticSupportedServiceNames()
{
css::uno::Sequence< OUString > seqServiceNames( 2 );
seqServiceNames.getArray()[0] = "com.sun.star.frame.DispatchProvider";
seqServiceNames.getArray()[1] = "com.sun.star.frame.AppDispatchProvider";
return seqServiceNames;
}
/* Helper for XServiceInfo */
OUString SfxAppDispatchProvider::impl_getStaticImplementationName()
{
return OUString::createFromAscii( "com.sun.star.comp.sfx2.AppDispatchProvider" );
}
/* Helper for registry */
css::uno::Reference< css::uno::XInterface > SAL_CALL SfxAppDispatchProvider::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception )
{
return css::uno::Reference< css::uno::XInterface >( *new SfxAppDispatchProvider( xServiceManager ) );
}
SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
void SAL_CALL SfxAppDispatchProvider::initialize( const uno::Sequence<uno::Any>& aArguments ) throw (uno::Exception, uno::RuntimeException)
......
......@@ -41,6 +41,7 @@
</implementation>
<implementation name="com.sun.star.comp.sfx2.AppDispatchProvider">
<service name="com.sun.star.frame.ProtocolHandler"/>
<service name="com.sun.star.frame.AppDispatchProvider"/>
</implementation>
<implementation name="com.sun.star.comp.sfx2.ApplicationDialogLibraryContainer">
<service name="com.sun.star.script.ApplicationDialogLibraryContainer"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment