summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-11-10 01:58:20 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2016-11-11 11:11:11 +0200
commitecdb04638c70f4063d146cf9df6d8adb5c91f78f (patch)
treed754a8229b431058260d62943472c49e3368f256 /framework
parenta6d324f30bd5cfd09d54614d8df67b7857550429 (diff)
RecentFilesMenuController: Remove duplicate dispatch handling
Change-Id: I3f2729bfe82c059bbf934510cb4066a77867f3c8
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx55
1 files changed, 2 insertions, 53 deletions
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 2786f3c3ac88..e49082166c52 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -47,13 +47,6 @@ static const char CMD_CLEAR_LIST[] = ".uno:ClearRecentFileList";
static const char CMD_OPEN_AS_TEMPLATE[] = ".uno:OpenTemplate";
static const char CMD_OPEN_REMOTE[] = ".uno:OpenRemote";
-struct LoadRecentFile
-{
- util::URL aTargetURL;
- uno::Sequence< beans::PropertyValue > aArgSeq;
- uno::Reference< frame::XDispatch > xDispatch;
-};
-
class RecentFilesMenuController : public svt::PopupMenuControllerBase
{
using svt::PopupMenuControllerBase::disposing;
@@ -98,8 +91,6 @@ public:
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( uno::RuntimeException, std::exception ) override;
- DECL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, void*, void );
-
private:
virtual void impl_setPopupMenu() override;
struct RecentFile
@@ -263,25 +254,13 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
{
- Reference< XDispatch > xDispatch;
- Reference< XDispatchProvider > xDispatchProvider;
- css::util::URL aTargetURL;
- Sequence< PropertyValue > aArgsList;
-
- osl::ClearableMutexGuard aLock( m_aMutex );
- xDispatchProvider.set( m_xFrame, UNO_QUERY );
- aLock.clear();
-
if (( nIndex >= 0 ) &&
( nIndex < sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() )))
{
const RecentFile& rRecentFile = m_aRecentFilesItems[ nIndex ];
- aTargetURL.Complete = rRecentFile.aURL;
- m_xURLTransformer->parseStrict( aTargetURL );
-
sal_Int32 nSize = 2;
- aArgsList.realloc( nSize );
+ Sequence< PropertyValue > aArgsList(nSize);
aArgsList[0].Name = "Referer";
aArgsList[0].Value = makeAny( OUString( "private:user" ) );
@@ -297,20 +276,7 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
aArgsList[nSize-1].Value <<= m_aModuleName;
}
- xDispatch = xDispatchProvider->queryDispatch( aTargetURL, "_default", 0 );
- }
-
- if ( xDispatch.is() )
- {
- // Call dispatch asynchronously as we can be destroyed while dispatch is
- // executed. VCL is not able to survive this as it wants to call listeners
- // after select!!!
- LoadRecentFile* pLoadRecentFile = new LoadRecentFile;
- pLoadRecentFile->xDispatch = xDispatch;
- pLoadRecentFile->aTargetURL = aTargetURL;
- pLoadRecentFile->aArgSeq = aArgsList;
-
- Application::PostUserEvent( LINK(nullptr, RecentFilesMenuController, ExecuteHdl_Impl), pLoadRecentFile );
+ dispatchCommand( rRecentFile.aURL, aArgsList, "_default" );
}
}
@@ -437,23 +403,6 @@ throw( RuntimeException, std::exception )
}
}
-IMPL_STATIC_LINK( RecentFilesMenuController, ExecuteHdl_Impl, void*, p, void )
-{
- LoadRecentFile* pLoadRecentFile = static_cast<LoadRecentFile*>(p);
- try
- {
- // Asynchronous execution as this can lead to our own destruction!
- // Framework can recycle our current frame and the layout manager disposes all user interface
- // elements if a component gets detached from its frame!
- pLoadRecentFile->xDispatch->dispatch( pLoadRecentFile->aTargetURL, pLoadRecentFile->aArgSeq );
- }
- catch ( const Exception& )
- {
- }
-
- delete pLoadRecentFile;
-}
-
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL