Fix the copy-paste

Use m_xUrlTransformer, and drop the now unneeded m_xContext.is()
check.

Here is the history of this:

- commit ef8f9cfb26 (CWS docking1) introduced this code in
  ToolboxController::execute.

- commit a2bbbc5130 (CWS docking3) copy-pasted this into
  GenericToolbarController::execute.

- commit 0fc90c8a06 (CWS insight02) changed the original
  code, but not the copy-pasted one.

- commit d7afd8e128 (CWS toolbars2) That CWS didn't have
  the above change yet, and copy-pasted the old code to yet
  another place (GenericToolboxController::execute).

Change-Id: I7f4e8dfb52b96ea5285ea7b2bb3083847dd84932
This commit is contained in:
Maxim Monastirsky
2017-04-26 03:09:41 +03:00
parent 58daac975b
commit 3268092322
3 changed files with 6 additions and 13 deletions

View File

@@ -123,7 +123,6 @@ void SAL_CALL GenericToolbarController::dispose()
void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
{
Reference< XDispatch > xDispatch;
Reference< XURLTransformer > xURLTransformer;
OUString aCommandURL;
{
@@ -136,8 +135,6 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
m_xFrame.is() &&
!m_aCommandURL.isEmpty() )
{
xURLTransformer = URLTransformer::create(m_xContext);
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )
@@ -145,7 +142,7 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
}
}
if ( xDispatch.is() && xURLTransformer.is() )
if ( xDispatch.is() )
{
css::util::URL aTargetURL;
Sequence<PropertyValue> aArgs( 1 );
@@ -155,7 +152,8 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
aArgs[0].Value <<= KeyModifier;
aTargetURL.Complete = aCommandURL;
xURLTransformer->parseStrict( aTargetURL );
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aTargetURL );
// Execute dispatch asynchronously
ExecuteInfo* pExecuteInfo = new ExecuteInfo;

View File

@@ -81,7 +81,6 @@ void SAL_CALL GenericToolboxController::dispose()
void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
{
Reference< XDispatch > xDispatch;
Reference< XURLTransformer > xURLTransformer;
OUString aCommandURL;
{
@@ -92,11 +91,8 @@ void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
if ( m_bInitialized &&
m_xFrame.is() &&
m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
xURLTransformer = URLTransformer::create( m_xContext );
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )
@@ -104,13 +100,14 @@ void SAL_CALL GenericToolboxController::execute( sal_Int16 /*KeyModifier*/ )
}
}
if ( xDispatch.is() && xURLTransformer.is() )
if ( xDispatch.is() )
{
css::util::URL aTargetURL;
Sequence<PropertyValue> aArgs;
aTargetURL.Complete = aCommandURL;
xURLTransformer->parseStrict( aTargetURL );
if ( m_xUrlTransformer.is() )
m_xUrlTransformer->parseStrict( aTargetURL );
// Execute dispatch asynchronously
ExecuteInfo* pExecuteInfo = new ExecuteInfo;

View File

@@ -324,10 +324,8 @@ void SAL_CALL ToolboxController::execute( sal_Int16 KeyModifier )
if ( m_bInitialized &&
m_xFrame.is() &&
m_xContext.is() &&
!m_aCommandURL.isEmpty() )
{
aCommandURL = m_aCommandURL;
URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL );
if ( pIter != m_aListenerMap.end() )