summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-11-05 10:16:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-05 10:41:03 +0100
commit9ffbbd9dba5f12be2914ebbf01ebdd303b695e46 (patch)
tree99471e78d70c0cc218fca16231e5b226ad932100
parent03b476c0da596545bd9b99cc744a5fb56bfb797a (diff)
flatten PopupMenuDispatcher::queryDispatch
Change-Id: I8dce031913a4ed40faa8d7994b1da8990d684091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124732 Tested-by: Jenkins Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx92
1 files changed, 46 insertions, 46 deletions
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index a79ffe35e6b8..0333c0698fe6 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -98,57 +98,57 @@ SAL_CALL PopupMenuDispatcher::queryDispatch(
const OUString& sTarget ,
sal_Int32 nFlags )
{
- css::uno::Reference< css::frame::XDispatch > xDispatch;
+ if ( !rURL.Complete.startsWith( "vnd.sun.star.popup:" ) )
+ return {};
- if ( rURL.Complete.startsWith( "vnd.sun.star.popup:" ) )
- {
- // --- SAFE ---
- SolarMutexClearableGuard aGuard;
- impl_RetrievePopupControllerQuery();
- if ( !m_xUriRefFactory.is() )
- m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext );
+ // --- SAFE ---
+ SolarMutexClearableGuard aGuard;
+ impl_RetrievePopupControllerQuery();
+ if ( !m_xUriRefFactory.is() )
+ m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext );
+
+ css::uno::Reference< css::container::XNameAccess > xPopupCtrlQuery( m_xPopupCtrlQuery );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( !xPopupCtrlQuery.is() )
+ return {};
- css::uno::Reference< css::container::XNameAccess > xPopupCtrlQuery( m_xPopupCtrlQuery );
- aGuard.clear();
- // --- SAFE ---
+ css::uno::Reference< css::frame::XDispatch > xDispatch;
- if ( xPopupCtrlQuery.is() )
+ try
+ {
+ // Just use the main part of the URL for popup menu controllers
+ sal_Int32 nSchemePart( 0 );
+ OUString aBaseURL( "vnd.sun.star.popup:" );
+ OUString aURL( rURL.Complete );
+
+ nSchemePart = aURL.indexOf( ':' );
+ if (( nSchemePart > 0 ) &&
+ ( aURL.getLength() > ( nSchemePart+1 )))
{
- try
- {
- // Just use the main part of the URL for popup menu controllers
- sal_Int32 nSchemePart( 0 );
- OUString aBaseURL( "vnd.sun.star.popup:" );
- OUString aURL( rURL.Complete );
-
- nSchemePart = aURL.indexOf( ':' );
- if (( nSchemePart > 0 ) &&
- ( aURL.getLength() > ( nSchemePart+1 )))
- {
- sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
- if ( nQueryPart > 0 )
- aBaseURL += aURL.subView( nSchemePart+1, nQueryPart-(nSchemePart+1) );
- else if ( nQueryPart == -1 )
- aBaseURL += aURL.subView( nSchemePart+1 );
- }
-
- css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
-
- // Find popup menu controller using the base URL
- xPopupCtrlQuery->getByName( aBaseURL ) >>= xDispatchProvider;
-
- // Ask popup menu dispatch provider for dispatch object
- if ( xDispatchProvider.is() )
- xDispatch = xDispatchProvider->queryDispatch( rURL, sTarget, nFlags );
- }
- catch ( const RuntimeException& )
- {
- throw;
- }
- catch ( const Exception& )
- {
- }
+ sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart );
+ if ( nQueryPart > 0 )
+ aBaseURL += aURL.subView( nSchemePart+1, nQueryPart-(nSchemePart+1) );
+ else if ( nQueryPart == -1 )
+ aBaseURL += aURL.subView( nSchemePart+1 );
}
+
+ css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
+
+ // Find popup menu controller using the base URL
+ xPopupCtrlQuery->getByName( aBaseURL ) >>= xDispatchProvider;
+
+ // Ask popup menu dispatch provider for dispatch object
+ if ( xDispatchProvider.is() )
+ xDispatch = xDispatchProvider->queryDispatch( rURL, sTarget, nFlags );
+ }
+ catch ( const RuntimeException& )
+ {
+ throw;
+ }
+ catch ( const Exception& )
+ {
}
return xDispatch;
}