sw321bf01: #i109363# Fix crash with quickstarter and OOo file dialogs

This commit is contained in:
Carsten Driesner 2010-03-23 14:51:17 +01:00
parent 89af58843b
commit 233f869315
3 changed files with 42 additions and 22 deletions

View file

@ -125,14 +125,14 @@ STDMETHODIMP VistaFilePickerEventHandler::OnFileOk(IFileDialog* /*pDialog*/)
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnFolderChanging(IFileDialog* pDialog,
IShellItem* pFolder)
STDMETHODIMP VistaFilePickerEventHandler::OnFolderChanging(IFileDialog* /*pDialog*/,
IShellItem* /*pFolder*/)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnFolderChange(IFileDialog* pDialog)
STDMETHODIMP VistaFilePickerEventHandler::OnFolderChange(IFileDialog* /*pDialog*/)
{
impl_sendEvent(E_DIRECTORY_CHANGED, 0);
return S_OK;
@ -250,7 +250,7 @@ void lcl_updateVersionListDirectly(IFileDialog* pDialog)
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnSelectionChange(IFileDialog* pDialog)
STDMETHODIMP VistaFilePickerEventHandler::OnSelectionChange(IFileDialog* /*pDialog*/)
{
impl_sendEvent(E_FILE_SELECTION_CHANGED, 0);
//lcl_updateVersionListDirectly(pDialog);
@ -258,16 +258,16 @@ STDMETHODIMP VistaFilePickerEventHandler::OnSelectionChange(IFileDialog* pDialog
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnShareViolation(IFileDialog* pDialog ,
IShellItem* pItem ,
FDE_SHAREVIOLATION_RESPONSE* pResponse)
STDMETHODIMP VistaFilePickerEventHandler::OnShareViolation(IFileDialog* /*pDialog*/ ,
IShellItem* /*pItem*/ ,
FDE_SHAREVIOLATION_RESPONSE* /*pResponse*/)
{
impl_sendEvent(E_CONTROL_STATE_CHANGED, css::ui::dialogs::CommonFilePickerElementIds::LISTBOX_FILTER);
return S_OK;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* pDialog)
STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* /*pDialog*/)
{
/*
IFileDialogCustomize *iCustomize;
@ -299,32 +299,32 @@ STDMETHODIMP VistaFilePickerEventHandler::OnTypeChange(IFileDialog* pDialog)
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnOverwrite(IFileDialog* pDialog ,
IShellItem* pItem ,
FDE_OVERWRITE_RESPONSE* pResponse)
STDMETHODIMP VistaFilePickerEventHandler::OnOverwrite(IFileDialog* /*pDialog*/ ,
IShellItem* /*pItem*/ ,
FDE_OVERWRITE_RESPONSE* /*pResponse*/)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnItemSelected(IFileDialogCustomize* pCustomize,
STDMETHODIMP VistaFilePickerEventHandler::OnItemSelected(IFileDialogCustomize* /*pCustomize*/,
DWORD nIDCtl ,
DWORD nIDItem )
DWORD /*nIDItem*/ )
{
impl_sendEvent(E_CONTROL_STATE_CHANGED, nIDCtl);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl ));
return S_OK;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnButtonClicked(IFileDialogCustomize* pCustomize,
STDMETHODIMP VistaFilePickerEventHandler::OnButtonClicked(IFileDialogCustomize* /*pCustomize*/,
DWORD nIDCtl )
{
impl_sendEvent(E_CONTROL_STATE_CHANGED, nIDCtl);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustomize* pCustomize,
STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustomize* /*pCustomize*/,
DWORD nIDCtl ,
BOOL bChecked )
{
@ -353,15 +353,15 @@ STDMETHODIMP VistaFilePickerEventHandler::OnCheckButtonToggled(IFileDialogCustom
if (nIDCtl == css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION)
m_pInternalNotify->onAutoExtensionChanged(bChecked);
impl_sendEvent(E_CONTROL_STATE_CHANGED, nIDCtl);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;
}
//-----------------------------------------------------------------------------------------
STDMETHODIMP VistaFilePickerEventHandler::OnControlActivating(IFileDialogCustomize* pCustomize,
STDMETHODIMP VistaFilePickerEventHandler::OnControlActivating(IFileDialogCustomize* /*pCustomize*/,
DWORD nIDCtl )
{
impl_sendEvent(E_CONTROL_STATE_CHANGED, nIDCtl);
impl_sendEvent(E_CONTROL_STATE_CHANGED, static_cast<sal_Int16>( nIDCtl));
return S_OK;
}

View file

@ -33,6 +33,7 @@
#include <sfx2/app.hxx>
#include <vos/mutex.hxx>
#include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx>
// #include <cmdlineargs.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/frame/XDispatchResultListener.hpp>
@ -235,6 +236,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) :
ShutdownIconServiceBase( m_aMutex ),
m_bVeto ( false ),
m_bListenForTermination ( false ),
m_bSystemDialogs( false ),
m_pResMgr( NULL ),
m_pFileDlg( NULL ),
m_xServiceManager( aSMgr ),
@ -243,6 +245,7 @@ ShutdownIcon::ShutdownIcon( Reference< XMultiServiceFactory > aSMgr ) :
m_pPlugin( 0 ),
m_bInitialized( false )
{
m_bSystemDialogs = SvtMiscOptions().UseSystemFileDialog();
}
ShutdownIcon::~ShutdownIcon()
@ -376,6 +379,16 @@ void ShutdownIcon::StartFileDialog()
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
bool bDirty = ( m_bSystemDialogs != static_cast<bool>(SvtMiscOptions().UseSystemFileDialog()) );
if ( m_pFileDlg && bDirty )
{
// Destroy instance as changing the system file dialog setting
// forces us to create a new FileDialogHelper instance!
delete m_pFileDlg;
m_pFileDlg = NULL;
}
if ( !m_pFileDlg )
m_pFileDlg = new FileDialogHelper( WB_OPEN | SFXWB_MULTISELECTION, String() );
m_pFileDlg->StartExecuteModal( STATIC_LINK( this, ShutdownIcon, DialogClosedHdl_Impl ) );
@ -512,8 +525,14 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR
#ifdef WNT
// #103346 Destroy dialog to prevent problems with custom controls
delete pThis->m_pFileDlg;
pThis->m_pFileDlg = NULL;
// This fix is dependent on the dialog settings. Destroying the dialog here will
// crash the non-native dialog implementation! Therefore make this dependent on
// the settings.
if ( SvtMiscOptions().UseSystemFileDialog() )
{
delete pThis->m_pFileDlg;
pThis->m_pFileDlg = NULL;
}
#endif
LeaveModalMode();

View file

@ -52,6 +52,7 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
::osl::Mutex m_aMutex;
bool m_bVeto;
bool m_bListenForTermination;
bool m_bSystemDialogs;
ResMgr* m_pResMgr;
sfx2::FileDialogHelper* m_pFileDlg;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;