diff -r 1ed7b2431f10 cui/source/dialogs/scriptdlg.cxx --- a/cui/source/dialogs/scriptdlg.cxx Mon Feb 14 12:37:17 2011 +0100 +++ b/cui/source/dialogs/scriptdlg.cxx Thu Feb 17 16:01:54 2011 +0100 @@ -65,6 +65,7 @@ #include #include +#include #include #include #include @@ -76,6 +77,36 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::document; +namespace{ + +class EditThread: public osl::Thread { +public: + explicit EditThread(Reference< script::XInvocation > const & inv): xInv(inv) + {} + +private: + virtual void run() { + Sequence< Any > args(0); + Sequence< Any > outArgs( 0 ); + Sequence< sal_Int16 > outIndex; + try + { + // ISSUE need code to run script here + xInv->invoke( ::rtl::OUString::createFromAscii( "Editable" ), args, outIndex, outArgs ); + } + catch( Exception& e ) + { + OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + } + } + + virtual void onTerminated() { delete this; } + + Reference< script::XInvocation > xInv; +}; + +} + void ShowErrorDialog( const Any& aException ) { SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException ); @@ -845,19 +876,8 @@ { StoreCurrentSelection(); EndDialog( 0 ); - Sequence< Any > args(0); - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - // ISSUE need code to run script here - xInv->invoke( ::rtl::OUString::createFromAscii( "Editable" ), args, outIndex, outArgs ); - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - } + osl::Thread * p = new EditThread(xInv); + p->create(); } } else if ( pButton == &aCreateButton )