diff options
author | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-12-21 20:40:13 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@Sun.COM> | 2009-12-21 20:40:13 +0100 |
commit | a7d255a48528c749c7e7444881afdfb265b735a0 (patch) | |
tree | e40b2a8ab62a9d8ca6673d8a2e3b835ff4c8f810 /sfx2/source/dialog/mailmodel.cxx | |
parent | 6054dc9cd4d1c667c2a2689e2affa56c4cd464c7 (diff) | |
parent | 680e0f04cd5ffb447d9525200e7a3fadb2a760d6 (diff) |
aw078: resync to DEV300m68for integration
Diffstat (limited to 'sfx2/source/dialog/mailmodel.cxx')
-rw-r--r-- | sfx2/source/dialog/mailmodel.cxx | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 5d812751e8..d2f47233e5 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -78,7 +78,7 @@ #include <unotools/configitem.hxx> #include <ucbhelper/content.hxx> #include <tools/urlobj.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <comphelper/storagehelper.hxx> @@ -176,7 +176,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( try { uno::Sequence < beans::PropertyValue > aProps; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG = + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xFilterCFG = uno::Reference< container::XNameAccess >( xSMGR->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY ); @@ -184,7 +184,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( if ( !xFilterCFG.is() ) return eRet; - + uno::Any aAny = xFilterCFG->getByName( rFilterName ); if ( aAny >>= aProps ) @@ -207,26 +207,26 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( { uno::Sequence< beans::PropertyValue > aPropsForDialog(1); uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY ); - + if ( rType.equalsAsciiL( PDF_DOCUMENT_TYPE, PDF_DOCUMENT_TYPE_LEN )) { //add an internal property, used to tell the dialog we want to set a different //string for the ok button //used in filter/source/pdf/impdialog.cxx String aOkSendText( SfxResId( STR_PDF_EXPORT_SEND )); - + uno::Sequence< beans::PropertyValue > aFilterDataValue(1); aFilterDataValue[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_OkButtonString" )); aFilterDataValue[0].Value = css::uno::makeAny( ::rtl::OUString( aOkSendText )); - + //add to the filterdata property, the only one the PDF export filter dialog will care for aPropsForDialog[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterData" )); aPropsForDialog[0].Value = css::uno::makeAny( aFilterDataValue ); - + //when executing the dialog will merge the persistent FilterData properties xFilterProperties->setPropertyValues( aPropsForDialog ); } - + if( xExporter.is() ) xExporter->setSourceDocument( uno::Reference< lang::XComponent >( xModel, uno::UNO_QUERY ) ); @@ -235,7 +235,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( { //get the filter data uno::Sequence< beans::PropertyValue > aPropsFromDialog = xFilterProperties->getPropertyValues(); - + //add them to the args for ( sal_Int32 nInd = 0; nInd < aPropsFromDialog.getLength(); nInd++ ) { @@ -251,7 +251,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( eRet = SAVE_SUCCESSFULL; } else - { + { // cancel from dialog, then do not send // 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 @@ -280,26 +280,26 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog( throw; } catch( uno::Exception& ) - { + { } return eRet; } sal_Int32 SfxMailModel::GetCount() const -{ +{ return maAttachedDocuments.size(); } sal_Bool SfxMailModel::IsEmpty() const -{ +{ return maAttachedDocuments.empty(); } -SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( +SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( const rtl::OUString& aSaveFileName, - const css::uno::Reference< css::uno::XInterface >& xFrameOrModel, - const rtl::OUString& rType, + const css::uno::Reference< css::uno::XInterface >& xFrameOrModel, + const rtl::OUString& rType, rtl::OUString& rFileNamePath ) { SaveResult eRet( SAVE_ERROR ); @@ -335,7 +335,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if ( xController.is() ) xModel = xController->getModel(); } - + // We need at least a valid module name and model reference if (( aModule.getLength() > 0 ) && xModel.is() ) { @@ -345,7 +345,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( css::uno::Reference< css::util::XModifiable > xModifiable( xModel, css::uno::UNO_QUERY ); css::uno::Reference< css::frame::XStorable > xStorable( xModel, css::uno::UNO_QUERY ); - + if ( xModifiable.is() ) bModified = xModifiable->isModified(); if ( xStorable.is() ) @@ -367,12 +367,12 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( rtl::OUString aTypeName( rType ); rtl::OUString aFileName; rtl::OUString aExtension; - + css::uno::Reference< css::container::XContainerQuery > xContainerQuery( - xSMGR->createInstance( rtl::OUString( + xSMGR->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ))), css::uno::UNO_QUERY ); - + if ( bStoreTo ) { // Retrieve filter from type @@ -391,10 +391,10 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( aQuery[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Flags" )); aQuery[2].Value = css::uno::makeAny( sal_Int32(0x80042) ); // EXPORT ALIEN 3RDPARTY } - - css::uno::Reference< css::container::XEnumeration > xEnumeration = + + css::uno::Reference< css::container::XEnumeration > xEnumeration = xContainerQuery->createSubSetEnumerationByProperties( aQuery ); - + if ( xEnumeration->hasMoreElements() ) { ::comphelper::SequenceAsHashMap aFilterPropsHM( xEnumeration->nextElement() ); @@ -402,7 +402,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( ::rtl::OUString::createFromAscii( "Name" ), ::rtl::OUString() ); } - + if ( bHasLocation ) { // Retrieve filter from media descriptor @@ -415,7 +415,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( // We should save the document in the original format. Therefore this // is not a storeTo operation. To support signing in this case, reset // bStoreTo flag. - bStoreTo = false; + bStoreTo = false; } } } @@ -440,7 +440,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii( "ooSetupFactoryDefaultFilter" ), ::rtl::OUString() ); - css::uno::Reference< css::container::XNameAccess > xNameAccess2( + css::uno::Reference< css::container::XNameAccess > xNameAccess2( xContainerQuery, css::uno::UNO_QUERY ); if ( xNameAccess2.is() ) { @@ -461,7 +461,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( // No filter found => error // No type and no location => error - if (( aFilterName.getLength() == 0 ) || + if (( aFilterName.getLength() == 0 ) || (( aTypeName.getLength() == 0 ) && !bHasLocation )) return eRet; @@ -474,10 +474,10 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( else { css::uno::Reference< container::XNameAccess > xTypeDetection( - xSMGR->createInstance( ::rtl::OUString( + xSMGR->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ))), css::uno::UNO_QUERY ); - + if ( xTypeDetection.is() ) { @@ -495,7 +495,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( } } } - + // Use provided save file name. If empty determine file name aFileName = aSaveFileName; if ( aFileName.getLength() == 0 ) @@ -513,14 +513,14 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( aFileName = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::NO_DECODE ); } } - + // No file name => error if ( aFileName.getLength() == 0 ) return eRet; - + OSL_ASSERT( aFilterName.getLength() > 0 ); OSL_ASSERT( aFileName.getLength() > 0 ); - + // Creates a temporary directory to store a predefined file into it. // This makes it possible to store the file for "send document as e-mail" // with the original file name. We cannot use the original file as @@ -532,7 +532,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( aFilePathObj.setExtension( aExtension ); rtl::OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::NO_DECODE ); - + sal_Int32 nNumArgs(0); const rtl::OUString aPasswordPropName( RTL_CONSTASCII_USTRINGPARAM( "Password" )); css::uno::Sequence< css::beans::PropertyValue > aArgs( ++nNumArgs ); @@ -561,7 +561,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xFrame, css::uno::UNO_QUERY ); css::uno::Reference< css::frame::XDispatch > xDispatch; - + css::util::URL aURL; css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs; @@ -575,7 +575,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if ( xDispatchProvider.is() ) { - xDispatch = css::uno::Reference< css::frame::XDispatch >( + xDispatch = css::uno::Reference< css::frame::XDispatch >( xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); if ( xDispatch.is() ) { @@ -597,14 +597,14 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( //check if this is the pdf otput filter (i#64555) if( bSendAsPDF ) { - SaveResult eShowPDFFilterDialog = ShowFilterOptionsDialog( + SaveResult eShowPDFFilterDialog = ShowFilterOptionsDialog( xSMGR, xModel, aFilterName, rType, bModified, nNumArgs, aArgs ); - + // don't continue on dialog cancel or error if ( eShowPDFFilterDialog != SAVE_SUCCESSFULL ) return eShowPDFFilterDialog; } - + xStorable->storeToURL( aFileURL, aArgs ); rFileNamePath = aFileURL; eRet = SAVE_SUCCESSFULL; @@ -617,10 +617,10 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:MailExportFinished" )); xURLTransformer->parseStrict( aURL ); } - + if ( xDispatchProvider.is() ) { - xDispatch = css::uno::Reference< css::frame::XDispatch >( + xDispatch = css::uno::Reference< css::frame::XDispatch >( xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 )); if ( xDispatch.is() ) { @@ -637,7 +637,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( } } } - } + } // 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. @@ -741,9 +741,9 @@ void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) } } -SfxMailModel::SendMailResult SfxMailModel::AttachDocument( - const ::rtl::OUString& sDocumentType, - const css::uno::Reference< css::uno::XInterface >& xFrameOrModel, +SfxMailModel::SendMailResult SfxMailModel::AttachDocument( + const ::rtl::OUString& sDocumentType, + const css::uno::Reference< css::uno::XInterface >& xFrameOrModel, const ::rtl::OUString& sAttachmentTitle ) { rtl::OUString sFileName; @@ -752,7 +752,7 @@ SfxMailModel::SendMailResult SfxMailModel::AttachDocument( if ( eSaveResult == SAVE_SUCCESSFULL && ( sFileName.getLength() > 0 ) ) maAttachedDocuments.push_back(sFileName); return eSaveResult == SAVE_SUCCESSFULL ? SEND_MAIL_OK : SEND_MAIL_ERROR; -} +} SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css::frame::XFrame >& xFrame ) { @@ -850,7 +850,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: } Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size()); - + xSimpleMailMessage->setSubject( maSubject ); xSimpleMailMessage->setAttachement( aAttachmentSeq ); @@ -873,7 +873,7 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: ::vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); - + ErrorBox aBox( pParentWindow, SfxResId( RID_ERRBOX_MAIL_CONFIG )); aBox.Execute(); eResult = SEND_MAIL_CANCELLED; @@ -946,7 +946,7 @@ BOOL CreateFromAddress_Impl( String& rFrom ) rFrom.EraseAllChars( '@' ); } String aEmailName = aUserCFG.GetEmail(); - + // unerlaubte Zeichen entfernen aEmailName.EraseAllChars( '<' ); aEmailName.EraseAllChars( '>' ); |