Kaydet (Commit) 40431b12 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

clang-format DispatchHelper

To reduce excessive whitespace in function definitons

Change-Id: I8dbf58e5ba53ddcf6c5a8e212636c1306584aa2e
Reviewed-on: https://gerrit.libreoffice.org/68533
Tested-by: Jenkins
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 81e9703c
...@@ -21,39 +21,36 @@ ...@@ -21,39 +21,36 @@
#include <macros/xserviceinfo.hxx> #include <macros/xserviceinfo.hxx>
#include <services.h> #include <services.h>
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <comphelper/profilezone.hxx> #include <comphelper/profilezone.hxx>
#include <unotools/mediadescriptor.hxx> #include <unotools/mediadescriptor.hxx>
#include <vcl/threadex.hxx> #include <vcl/threadex.hxx>
namespace framework{ namespace framework
{
// XInterface, XTypeProvider, XServiceInfo // XInterface, XTypeProvider, XServiceInfo
DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchHelper , DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchHelper, ::cppu::OWeakObject,
::cppu::OWeakObject ,
"com.sun.star.frame.DispatchHelper", "com.sun.star.frame.DispatchHelper",
IMPLEMENTATIONNAME_DISPATCHHELPER) IMPLEMENTATIONNAME_DISPATCHHELPER)
DEFINE_INIT_SERVICE( DispatchHelper, {} ) DEFINE_INIT_SERVICE(DispatchHelper, {})
/** ctor. /** ctor.
@param xSMGR the global uno service manager, which can be used to create own needed services. @param xSMGR the global uno service manager, which can be used to create own needed services.
*/ */
DispatchHelper::DispatchHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext ) DispatchHelper::DispatchHelper(const css::uno::Reference<css::uno::XComponentContext>& xContext)
: m_xContext (xContext) : m_xContext(xContext)
{ {
} }
/** dtor. /** dtor.
*/ */
DispatchHelper::~DispatchHelper() DispatchHelper::~DispatchHelper() {}
{
}
/** capsulate all steps of a dispatch request and provide so an easy way for dispatches. /** capsulate all steps of a dispatch request and provide so an easy way for dispatches.
...@@ -75,18 +72,12 @@ DispatchHelper::~DispatchHelper() ...@@ -75,18 +72,12 @@ DispatchHelper::~DispatchHelper()
@return An Any which capsulate a possible result of the internal wrapped dispatch. @return An Any which capsulate a possible result of the internal wrapped dispatch.
*/ */
css::uno::Any SAL_CALL DispatchHelper::executeDispatch( css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider , const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
const OUString& sURL , const OUString& sURL, const OUString& sTargetFrameName, sal_Int32 nSearchFlags,
const OUString& sTargetFrameName , const css::uno::Sequence<css::beans::PropertyValue>& lArguments)
sal_Int32 nSearchFlags ,
const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
{ {
// check for valid parameters // check for valid parameters
if ( if ((!xDispatchProvider.is()) || (!m_xContext.is()) || (sURL.isEmpty()))
(!xDispatchProvider.is()) ||
(!m_xContext.is()) ||
(sURL.isEmpty() )
)
{ {
return css::uno::Any(); return css::uno::Any();
} }
...@@ -94,7 +85,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( ...@@ -94,7 +85,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
// parse given URL // parse given URL
/* SAFE { */ /* SAFE { */
osl::ClearableMutexGuard aReadLock(m_mutex); osl::ClearableMutexGuard aReadLock(m_mutex);
css::uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(m_xContext); css::uno::Reference<css::util::XURLTransformer> xParser
= css::util::URLTransformer::create(m_xContext);
aReadLock.clear(); aReadLock.clear();
/* } SAFE */ /* } SAFE */
...@@ -103,7 +95,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( ...@@ -103,7 +95,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
xParser->parseStrict(aURL); xParser->parseStrict(aURL);
// search dispatcher // search dispatcher
css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, sTargetFrameName, nSearchFlags); css::uno::Reference<css::frame::XDispatch> xDispatch
= xDispatchProvider->queryDispatch(aURL, sTargetFrameName, nSearchFlags);
utl::MediaDescriptor aDescriptor(lArguments); utl::MediaDescriptor aDescriptor(lArguments);
bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false);
...@@ -116,34 +109,35 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( ...@@ -116,34 +109,35 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
return executeDispatch(xDispatch, aURL, true, lArguments); return executeDispatch(xDispatch, aURL, true, lArguments);
} }
css::uno::Any
css::uno::Any DispatchHelper::executeDispatch( DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
const css::uno::Reference< css::frame::XDispatch >& xDispatch , const css::util::URL& aURL, bool SyncronFlag,
const css::util::URL& aURL , const css::uno::Sequence<css::beans::PropertyValue>& lArguments)
bool SyncronFlag ,
const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
{ {
comphelper::ProfileZone aZone("executeDispatch"); comphelper::ProfileZone aZone("executeDispatch");
css::uno::Reference< css::uno::XInterface > xTHIS(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); css::uno::Reference<css::uno::XInterface> xTHIS(static_cast<::cppu::OWeakObject*>(this),
css::uno::UNO_QUERY);
m_aResult.clear(); m_aResult.clear();
// check for valid parameters // check for valid parameters
if (xDispatch.is() ) if (xDispatch.is())
{ {
css::uno::Reference< css::frame::XNotifyingDispatch > xNotifyDispatch (xDispatch, css::uno::UNO_QUERY); css::uno::Reference<css::frame::XNotifyingDispatch> xNotifyDispatch(xDispatch,
css::uno::UNO_QUERY);
// make sure that synchronous execution is used (if possible) // make sure that synchronous execution is used (if possible)
css::uno::Sequence< css::beans::PropertyValue > aArguments( lArguments ); css::uno::Sequence<css::beans::PropertyValue> aArguments(lArguments);
sal_Int32 nLength = lArguments.getLength(); sal_Int32 nLength = lArguments.getLength();
aArguments.realloc( nLength + 1 ); aArguments.realloc(nLength + 1);
aArguments[ nLength ].Name = "SynchronMode"; aArguments[nLength].Name = "SynchronMode";
aArguments[ nLength ].Value <<= SyncronFlag; aArguments[nLength].Value <<= SyncronFlag;
if (xNotifyDispatch.is()) if (xNotifyDispatch.is())
{ {
// dispatch it with guaranteed notification // dispatch it with guaranteed notification
// Here we can hope for a result ... instead of the normal dispatch. // Here we can hope for a result ... instead of the normal dispatch.
css::uno::Reference< css::frame::XDispatchResultListener > xListener(xTHIS, css::uno::UNO_QUERY); css::uno::Reference<css::frame::XDispatchResultListener> xListener(xTHIS,
css::uno::UNO_QUERY);
/* SAFE { */ /* SAFE { */
osl::ClearableMutexGuard aWriteLock(m_mutex); osl::ClearableMutexGuard aWriteLock(m_mutex);
m_xBroadcaster.set(xNotifyDispatch, css::uno::UNO_QUERY); m_xBroadcaster.set(xNotifyDispatch, css::uno::UNO_QUERY);
...@@ -159,7 +153,7 @@ css::uno::Any DispatchHelper::executeDispatch( ...@@ -159,7 +153,7 @@ css::uno::Any DispatchHelper::executeDispatch(
else else
{ {
// dispatch it without any chance to get a result // dispatch it without any chance to get a result
xDispatch->dispatch( aURL, aArguments ); xDispatch->dispatch(aURL, aArguments);
} }
} }
...@@ -175,7 +169,7 @@ css::uno::Any DispatchHelper::executeDispatch( ...@@ -175,7 +169,7 @@ css::uno::Any DispatchHelper::executeDispatch(
@param aResult @param aResult
describes the result of the dispatch operation describes the result of the dispatch operation
*/ */
void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResultEvent& aResult ) void SAL_CALL DispatchHelper::dispatchFinished(const css::frame::DispatchResultEvent& aResult)
{ {
osl::MutexGuard g(m_mutex); osl::MutexGuard g(m_mutex);
m_aResult <<= aResult; m_aResult <<= aResult;
...@@ -188,14 +182,13 @@ void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResult ...@@ -188,14 +182,13 @@ void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResult
@param aEvent @param aEvent
describe the source of this event and MUST be our save broadcaster! describe the source of this event and MUST be our save broadcaster!
*/ */
void SAL_CALL DispatchHelper::disposing( const css::lang::EventObject& ) void SAL_CALL DispatchHelper::disposing(const css::lang::EventObject&)
{ {
osl::MutexGuard g(m_mutex); osl::MutexGuard g(m_mutex);
m_aResult.clear(); m_aResult.clear();
m_aBlock.set(); m_aBlock.set();
m_xBroadcaster.clear(); m_xBroadcaster.clear();
} }
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,22 +20,30 @@ ...@@ -20,22 +20,30 @@
#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX #ifndef INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
#define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX #define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/frame/XDispatchHelper.hpp> #include <com/sun/star/frame/XDispatchHelper.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <osl/conditn.hxx>
#include <framework/fwedllapi.h> #include <framework/fwedllapi.h>
#include <osl/conditn.hxx>
namespace com::sun::star::lang { class XMultiServiceFactory; } namespace com::sun::star::lang
namespace com::sun::star::lang { class XSingleServiceFactory; } {
namespace com::sun::star::uno { class XComponentContext; } class XMultiServiceFactory;
}
namespace framework{ namespace com::sun::star::lang
{
class XSingleServiceFactory;
}
namespace com::sun::star::uno
{
class XComponentContext;
}
namespace framework
{
/** /**
@short implements an easy way for dispatches @short implements an easy way for dispatches
@descr Dispatches are splitted into different parts: @descr Dispatches are splitted into different parts:
...@@ -44,77 +52,69 @@ namespace framework{ ...@@ -44,77 +52,69 @@ namespace framework{
- dispatching of the URL - dispatching of the URL
All these steps are done inside one method call here. All these steps are done inside one method call here.
*/ */
class FWE_DLLPUBLIC DispatchHelper : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,css::frame::XDispatchHelper,css::frame::XDispatchResultListener > class FWE_DLLPUBLIC DispatchHelper
: public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::frame::XDispatchHelper,
css::frame::XDispatchResultListener>
{ {
// member // member
private: private:
osl::Mutex m_mutex; osl::Mutex m_mutex;
/** global uno service manager. /** global uno service manager.
Can be used to create own needed services. */ Can be used to create own needed services. */
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference<css::uno::XComponentContext> m_xContext;
/** used to wait for asynchronous listener callbacks. */ /** used to wait for asynchronous listener callbacks. */
::osl::Condition m_aBlock; ::osl::Condition m_aBlock;
css::uno::Any m_aResult; css::uno::Any m_aResult;
css::uno::Reference< css::uno::XInterface > m_xBroadcaster; css::uno::Reference<css::uno::XInterface> m_xBroadcaster;
// interface // interface
public: public:
// ctor/dtor // ctor/dtor
DispatchHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext ); DispatchHelper(const css::uno::Reference<css::uno::XComponentContext>& xContext);
virtual ~DispatchHelper( ) override; virtual ~DispatchHelper() override;
// XServiceInfo // XServiceInfo
virtual OUString SAL_CALL getImplementationName ( ) override; virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) override; virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) override; virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames( ); static css::uno::Sequence<OUString> impl_getStaticSupportedServiceNames();
static OUString impl_getStaticImplementationName ( ); static OUString impl_getStaticImplementationName();
// Helper for initialization of service by using own reference! // Helper for initialization of service by using own reference!
void impl_initService ( ); void impl_initService();
// Helper for registry // Helper for registry
/// @throws css::uno::Exception /// @throws css::uno::Exception
static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); static css::uno::Reference<css::uno::XInterface> SAL_CALL impl_createInstance(
static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ); const css::uno::Reference<css::lang::XMultiServiceFactory>& xServiceManager);
static css::uno::Reference<css::lang::XSingleServiceFactory>
impl_createFactory(const css::uno::Reference<css::lang::XMultiServiceFactory>& xServiceManager);
// XDispatchHelper // XDispatchHelper
virtual css::uno::Any SAL_CALL executeDispatch( virtual css::uno::Any SAL_CALL
const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider , executeDispatch(const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
const OUString& sURL , const OUString& sURL, const OUString& sTargetFrameName, sal_Int32 nSearchFlags,
const OUString& sTargetFrameName , const css::uno::Sequence<css::beans::PropertyValue>& lArguments) override;
sal_Int32 nSearchFlags ,
const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
// not a public XDispatchHelper-method, need in sfx2/source/control/statcach.cxx for extensions // not a public XDispatchHelper-method, need in sfx2/source/control/statcach.cxx for extensions
/// @throws css::uno::RuntimeException /// @throws css::uno::RuntimeException
css::uno::Any executeDispatch( css::uno::Any executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
const css::uno::Reference< css::frame::XDispatch >& xDispatch , const css::util::URL& aURL, bool SyncronFlag,
const css::util::URL& aURL , const css::uno::Sequence<css::beans::PropertyValue>& lArguments);
bool SyncronFlag ,
const css::uno::Sequence< css::beans::PropertyValue >& lArguments );
// XDispatchResultListener // XDispatchResultListener
virtual void SAL_CALL dispatchFinished( virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aResult) override;
const css::frame::DispatchResultEvent& aResult ) override;
// XEventListener // XEventListener
virtual void SAL_CALL disposing( virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
const css::lang::EventObject& aEvent ) override;
}; };
} }
#endif #endif
......
...@@ -5380,7 +5380,6 @@ framework/source/register/registertemp.cxx ...@@ -5380,7 +5380,6 @@ framework/source/register/registertemp.cxx
framework/source/services/ContextChangeEventMultiplexer.cxx framework/source/services/ContextChangeEventMultiplexer.cxx
framework/source/services/autorecovery.cxx framework/source/services/autorecovery.cxx
framework/source/services/desktop.cxx framework/source/services/desktop.cxx
framework/source/services/dispatchhelper.cxx
framework/source/services/frame.cxx framework/source/services/frame.cxx
framework/source/services/mediatypedetectionhelper.cxx framework/source/services/mediatypedetectionhelper.cxx
framework/source/services/modulemanager.cxx framework/source/services/modulemanager.cxx
...@@ -6448,7 +6447,6 @@ include/framework/actiontriggerhelper.hxx ...@@ -6448,7 +6447,6 @@ include/framework/actiontriggerhelper.hxx
include/framework/addonmenu.hxx include/framework/addonmenu.hxx
include/framework/addonsoptions.hxx include/framework/addonsoptions.hxx
include/framework/configimporter.hxx include/framework/configimporter.hxx
include/framework/dispatchhelper.hxx
include/framework/documentundoguard.hxx include/framework/documentundoguard.hxx
include/framework/framelistanalyzer.hxx include/framework/framelistanalyzer.hxx
include/framework/fwedllapi.h include/framework/fwedllapi.h
......
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