Index: sfx2/source/dialog/mailmodel.cxx =================================================================== RCS file: /cvs/framework/sfx2/source/dialog/mailmodel.cxx,v retrieving revision 1.42 diff -u -p -u -r1.42 mailmodel.cxx --- sfx2/source/dialog/mailmodel.cxx 17 Sep 2006 16:33:06 -0000 1.42 +++ sfx2/source/dialog/mailmodel.cxx 21 Oct 2006 16:42:09 -0000 @@ -232,6 +232,7 @@ SfxMailModel::SaveResult SfxMailModel::S rtl::OUString& rFileNamePath ) { SaveResult eRet( SAVE_ERROR ); + bool bSendAsPDF = (rType.compareTo(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf_Portable_Document_Format" ))) == 0); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); if (!xSMGR.is()) @@ -484,28 +485,31 @@ SfxMailModel::SaveResult SfxMailModel::S css::util::URL aURL; css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs; - if ( xURLTransformer.is() ) + if( !bSendAsPDF ) { - aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrepareMailExport" )); - xURLTransformer->parseStrict( aURL ); - } + if ( xURLTransformer.is() ) + { + aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrepareMailExport" )); + xURLTransformer->parseStrict( aURL ); + } - if ( xDispatchProvider.is() ) - { - xDispatch = css::uno::Reference< css::frame::XDispatch >( - xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); - if ( xDispatch.is() ) + if ( xDispatchProvider.is() && !bSendAsPDF ) { - try - { - xDispatch->dispatch( aURL, aDispatchArgs ); - } - catch ( css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) + xDispatch = css::uno::Reference< css::frame::XDispatch >( + xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); + if ( xDispatch.is() ) { + try + { + xDispatch->dispatch( aURL, aDispatchArgs ); + } + catch ( css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) + { + } } } } @@ -514,33 +518,35 @@ SfxMailModel::SaveResult SfxMailModel::S rFileNamePath = aFileURL; eRet = SAVE_SUCCESSFULL; - // #i30432# notify that export is finished - the Writer may want to restore removed content - if ( xURLTransformer.is() ) + if( !bSendAsPDF ) { - aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MailExportFinished" )); - xURLTransformer->parseStrict( aURL ); - } + // #i30432# notify that export is finished - the Writer may want to restore removed content + if ( xURLTransformer.is() ) + { + aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MailExportFinished" )); + xURLTransformer->parseStrict( aURL ); + } - if ( xDispatchProvider.is() ) - { - xDispatch = css::uno::Reference< css::frame::XDispatch >( - xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); - if ( xDispatch.is() ) + if ( xDispatchProvider.is() ) { - try - { - xDispatch->dispatch( aURL, aDispatchArgs ); - } - catch ( css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) + xDispatch = css::uno::Reference< css::frame::XDispatch >( + xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); + if ( xDispatch.is() ) { + try + { + xDispatch->dispatch( aURL, aDispatchArgs ); + } + catch ( css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) + { + } } } - } - + } // If the model is not modified, it could be modified by the dispatch calls. // Therefore set back to modified = false. This should not hurt if we call // on a non-modified model.