[Libreoffice-commits] core.git: framework/source include/framework solenv/clang-format
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Mar 1 09:14:49 UTC 2019
framework/source/services/dispatchhelper.cxx | 81 +++++++---------
include/framework/dispatchhelper.hxx | 134 +++++++++++++--------------
solenv/clang-format/blacklist | 2
3 files changed, 104 insertions(+), 113 deletions(-)
New commits:
commit 40431b12b86aa8ede3a6d065645781c8e7710570
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 1 08:42:24 2019 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Fri Mar 1 10:14:20 2019 +0100
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: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx
index 55d827668586..27455004831d 100644
--- a/framework/source/services/dispatchhelper.cxx
+++ b/framework/source/services/dispatchhelper.cxx
@@ -21,39 +21,36 @@
#include <macros/xserviceinfo.hxx>
#include <services.h>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
-#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <comphelper/profilezone.hxx>
#include <unotools/mediadescriptor.hxx>
#include <vcl/threadex.hxx>
-namespace framework{
-
+namespace framework
+{
// XInterface, XTypeProvider, XServiceInfo
-DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchHelper ,
- ::cppu::OWeakObject ,
- "com.sun.star.frame.DispatchHelper",
- IMPLEMENTATIONNAME_DISPATCHHELPER)
+DEFINE_XSERVICEINFO_MULTISERVICE_2(DispatchHelper, ::cppu::OWeakObject,
+ "com.sun.star.frame.DispatchHelper",
+ IMPLEMENTATIONNAME_DISPATCHHELPER)
-DEFINE_INIT_SERVICE( DispatchHelper, {} )
+DEFINE_INIT_SERVICE(DispatchHelper, {})
/** ctor.
@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 )
- : m_xContext (xContext)
+DispatchHelper::DispatchHelper(const css::uno::Reference<css::uno::XComponentContext>& xContext)
+ : m_xContext(xContext)
{
}
/** dtor.
*/
-DispatchHelper::~DispatchHelper()
-{
-}
+DispatchHelper::~DispatchHelper() {}
/** capsulate all steps of a dispatch request and provide so an easy way for dispatches.
@@ -75,18 +72,12 @@ DispatchHelper::~DispatchHelper()
@return An Any which capsulate a possible result of the internal wrapped dispatch.
*/
css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
- const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider ,
- const OUString& sURL ,
- const OUString& sTargetFrameName ,
- sal_Int32 nSearchFlags ,
- const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
+ const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
+ const OUString& sURL, const OUString& sTargetFrameName, sal_Int32 nSearchFlags,
+ const css::uno::Sequence<css::beans::PropertyValue>& lArguments)
{
// check for valid parameters
- if (
- (!xDispatchProvider.is()) ||
- (!m_xContext.is()) ||
- (sURL.isEmpty() )
- )
+ if ((!xDispatchProvider.is()) || (!m_xContext.is()) || (sURL.isEmpty()))
{
return css::uno::Any();
}
@@ -94,7 +85,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
// parse given URL
/* SAFE { */
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();
/* } SAFE */
@@ -103,7 +95,8 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
xParser->parseStrict(aURL);
// 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);
bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false);
@@ -116,34 +109,35 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch(
return executeDispatch(xDispatch, aURL, true, lArguments);
}
-
-css::uno::Any DispatchHelper::executeDispatch(
- const css::uno::Reference< css::frame::XDispatch >& xDispatch ,
- const css::util::URL& aURL ,
- bool SyncronFlag ,
- const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
+css::uno::Any
+DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
+ const css::util::URL& aURL, bool SyncronFlag,
+ const css::uno::Sequence<css::beans::PropertyValue>& lArguments)
{
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();
// 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)
- css::uno::Sequence< css::beans::PropertyValue > aArguments( lArguments );
+ css::uno::Sequence<css::beans::PropertyValue> aArguments(lArguments);
sal_Int32 nLength = lArguments.getLength();
- aArguments.realloc( nLength + 1 );
- aArguments[ nLength ].Name = "SynchronMode";
- aArguments[ nLength ].Value <<= SyncronFlag;
+ aArguments.realloc(nLength + 1);
+ aArguments[nLength].Name = "SynchronMode";
+ aArguments[nLength].Value <<= SyncronFlag;
if (xNotifyDispatch.is())
{
// dispatch it with guaranteed notification
// 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 { */
osl::ClearableMutexGuard aWriteLock(m_mutex);
m_xBroadcaster.set(xNotifyDispatch, css::uno::UNO_QUERY);
@@ -154,12 +148,12 @@ css::uno::Any DispatchHelper::executeDispatch(
// dispatch it and wait for a notification
// TODO/MBA: waiting in main thread?!
xNotifyDispatch->dispatchWithNotification(aURL, aArguments, xListener);
- m_aBlock.wait(); // wait for result
+ m_aBlock.wait(); // wait for result
}
else
{
// 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(
@param aResult
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);
m_aResult <<= aResult;
@@ -188,14 +182,13 @@ void SAL_CALL DispatchHelper::dispatchFinished( const css::frame::DispatchResult
@param aEvent
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);
m_aResult.clear();
m_aBlock.set();
m_xBroadcaster.clear();
}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/dispatchhelper.hxx b/include/framework/dispatchhelper.hxx
index b300c8be5167..cdec89ea3791 100644
--- a/include/framework/dispatchhelper.hxx
+++ b/include/framework/dispatchhelper.hxx
@@ -20,22 +20,30 @@
#ifndef 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/XDispatchResultListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-
+#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/implbase.hxx>
-#include <osl/conditn.hxx>
#include <framework/fwedllapi.h>
+#include <osl/conditn.hxx>
-namespace com::sun::star::lang { class XMultiServiceFactory; }
-namespace com::sun::star::lang { class XSingleServiceFactory; }
-namespace com::sun::star::uno { class XComponentContext; }
-
-namespace framework{
+namespace com::sun::star::lang
+{
+class XMultiServiceFactory;
+}
+namespace com::sun::star::lang
+{
+class XSingleServiceFactory;
+}
+namespace com::sun::star::uno
+{
+class XComponentContext;
+}
+namespace framework
+{
/**
@short implements an easy way for dispatches
@descr Dispatches are splitted into different parts:
@@ -44,77 +52,69 @@ namespace framework{
- dispatching of the URL
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
- 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. */
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference<css::uno::XComponentContext> m_xContext;
- /** used to wait for asynchronous listener callbacks. */
- ::osl::Condition m_aBlock;
+ /** used to wait for asynchronous listener callbacks. */
+ ::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
- public:
-
- // ctor/dtor
-
- DispatchHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext );
- virtual ~DispatchHelper( ) override;
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName ( ) override;
- virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) override;
-
- static css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames( );
- static OUString impl_getStaticImplementationName ( );
- // Helper for initialization of service by using own reference!
- void impl_initService ( );
-
- // Helper for registry
- /// @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::lang::XSingleServiceFactory > impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XDispatchHelper
- virtual css::uno::Any SAL_CALL executeDispatch(
- const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider ,
- const OUString& sURL ,
- const OUString& sTargetFrameName ,
- 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
- /// @throws css::uno::RuntimeException
- css::uno::Any executeDispatch(
- const css::uno::Reference< css::frame::XDispatch >& xDispatch ,
- const css::util::URL& aURL ,
- bool SyncronFlag ,
- const css::uno::Sequence< css::beans::PropertyValue >& lArguments );
-
-
- // XDispatchResultListener
- virtual void SAL_CALL dispatchFinished(
- const css::frame::DispatchResultEvent& aResult ) override;
-
- // XEventListener
- virtual void SAL_CALL disposing(
- const css::lang::EventObject& aEvent ) override;
+public:
+ // ctor/dtor
+
+ DispatchHelper(const css::uno::Reference<css::uno::XComponentContext>& xContext);
+ virtual ~DispatchHelper() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ static css::uno::Sequence<OUString> impl_getStaticSupportedServiceNames();
+ static OUString impl_getStaticImplementationName();
+ // Helper for initialization of service by using own reference!
+ void impl_initService();
+
+ // Helper for registry
+ /// @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::lang::XSingleServiceFactory>
+ impl_createFactory(const css::uno::Reference<css::lang::XMultiServiceFactory>& xServiceManager);
+
+ // XDispatchHelper
+ virtual css::uno::Any SAL_CALL
+ executeDispatch(const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider,
+ const OUString& sURL, const OUString& sTargetFrameName, 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
+ /// @throws css::uno::RuntimeException
+ css::uno::Any executeDispatch(const css::uno::Reference<css::frame::XDispatch>& xDispatch,
+ const css::util::URL& aURL, bool SyncronFlag,
+ const css::uno::Sequence<css::beans::PropertyValue>& lArguments);
+
+ // XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aResult) override;
+
+ // XEventListener
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
};
-
}
#endif
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 2b2d27ee4e11..91424754b2af 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -5380,7 +5380,6 @@ framework/source/register/registertemp.cxx
framework/source/services/ContextChangeEventMultiplexer.cxx
framework/source/services/autorecovery.cxx
framework/source/services/desktop.cxx
-framework/source/services/dispatchhelper.cxx
framework/source/services/frame.cxx
framework/source/services/mediatypedetectionhelper.cxx
framework/source/services/modulemanager.cxx
@@ -6448,7 +6447,6 @@ include/framework/actiontriggerhelper.hxx
include/framework/addonmenu.hxx
include/framework/addonsoptions.hxx
include/framework/configimporter.hxx
-include/framework/dispatchhelper.hxx
include/framework/documentundoguard.hxx
include/framework/framelistanalyzer.hxx
include/framework/fwedllapi.h
More information about the Libreoffice-commits
mailing list