diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-10-05 12:07:38 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-10-05 12:07:38 +0000 |
commit | 42e583863110dcb7cc23fdd62c030c0ea3d22d49 (patch) | |
tree | 553b0db8f49fcd14661fc478734c66a1a810dc65 /dbaccess/source/ui/misc/asyncmodaldialog.cxx | |
parent | 5df0e1c5084bdca7e841a7f9d365d160fde29ac0 (diff) |
INTEGRATION: CWS hsqlcsvstage1 (1.1.4); FILE ADDED
2006/09/20 11:45:33 fs 1.1.4.1: #i69696#, being stage 1 of issue #i69526#: merging changes from CWS hsqlcsv herein
Diffstat (limited to 'dbaccess/source/ui/misc/asyncmodaldialog.cxx')
-rw-r--r-- | dbaccess/source/ui/misc/asyncmodaldialog.cxx | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx new file mode 100644 index 000000000000..ed3f33d28ee0 --- /dev/null +++ b/dbaccess/source/ui/misc/asyncmodaldialog.cxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: asyncmodaldialog.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2006-10-05 13:07:26 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef DBACCESS_ASYNCMODALDIALOG_HXX +#include "asyncmodaldialog.hxx" +#endif + +/** === begin UNO includes === **/ +#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_ +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#endif +/** === end UNO includes === **/ + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef TOOLS_DIAGNOSE_EX_H +#include <tools/diagnose_ex.h> +#endif + +//........................................................................ +namespace dbaui +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::ui::dialogs::XExecutableDialog; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::uno::Exception; + /** === end UNO using === **/ + + //==================================================================== + //= AsyncDialogExecutor + //==================================================================== + class DialogExecutor_Impl + { + Reference< XExecutableDialog > m_xDialog; + + public: + DialogExecutor_Impl( const Reference< XExecutableDialog >& _rxDialog ) + :m_xDialog( _rxDialog ) + { + } + + void execute() + { + Application::PostUserEvent( LINK( this, DialogExecutor_Impl, onExecute ) ); + } + + protected: + ~DialogExecutor_Impl() + { + } + + private: + DECL_LINK( onExecute, void* ); + }; + + //-------------------------------------------------------------------- + IMPL_LINK( DialogExecutor_Impl, onExecute, void*, /* _notInterestedIn */ ) + { + try + { + m_xDialog->execute(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + delete this; + return 0L; + } + + //==================================================================== + //= AsyncDialogExecutor + //==================================================================== + //-------------------------------------------------------------------- + void AsyncDialogExecutor::executeModalDialogAsync( const Reference< XExecutableDialog >& _rxDialog ) + { + if ( !_rxDialog.is() ) + throw IllegalArgumentException(); + + + DialogExecutor_Impl* pExecutor = new DialogExecutor_Impl( _rxDialog ); + pExecutor->execute(); + // will delete itself + } + +//........................................................................ +} // namespace dbaui +//........................................................................ + |